/* ==========================================================
   언어교환 / 言語交換
   - 글자 색은 언어가 아니라 자리에 붙어요: 방의 첫 번째 언어(A) = 파랑, 두 번째 언어(B) = 빨강
   - 장식 그림(모티프)은 언어마다 달라요. common.js 가 --motif-a/b(그림), --accent-a/b(보조 색) 변수로 내려주고
     <html data-motifs="pair|single"> 로 표시합니다. 여기서는 어떤 언어인지 모르고 변수만 씁니다.
   - 좌우 여백·위치는 논리 속성(inline-start/end)으로 써서 아랍어(dir="rtl")에서도 그대로 뒤집혀요
   - 두 원이 겹치는 모양(벤 다이어그램)이 앱의 상징: 두 언어가 만나는 곳
   ========================================================== */

:root {
    --ink: #1b2340;
    --muted: #646d8a;
    --paper: #f3f5fc;
    --surface: #ffffff;
    --line: #dde2ef;

    --lang-a: #2c5bc4;
    --lang-a-soft: #e5ecfb;
    --lang-a-circle: #c9d9fa;
    --lang-b: #c2354f;
    --lang-b-soft: #fbe5ea;
    --lang-b-circle: #f8cdd6;

    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --radius-sm: 12px;

    --shadow-card: 0 1px 2px rgba(27, 35, 64, 0.06), 0 22px 40px -22px rgba(27, 35, 64, 0.38);
    --shadow-soft: 0 1px 2px rgba(27, 35, 64, 0.05), 0 10px 22px -16px rgba(27, 35, 64, 0.28);

    --font-ko: "Gowun Dodum", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    --font-ja: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
    --font-zh: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-system: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-ko);
    font-size: 1rem;
    line-height: 1.6;
    font-synthesis: none;
}

body:has(dialog[open]) {
    overflow: hidden;
}

/* 한국어는 단어 단위로, 일본어는 문장 덩어리 단위로 줄바꿈 */
[lang="ko"] {
    font-family: var(--font-ko);
    word-break: keep-all;
    overflow-wrap: break-word;
}

[lang="ja"] {
    font-family: var(--font-ja);
    font-weight: 400;
    line-break: strict;
    word-break: auto-phrase;
}

/* 화면 언어(<html lang>)에 맞는 기본 글꼴. 한국어·일본어·중국어 말고는 기기 기본 글꼴을 씁니다. */
html:lang(ja) body {
    font-family: var(--font-ja);
}

html:lang(zh) body {
    font-family: var(--font-zh);
}

html:not(:lang(ko), :lang(ja), :lang(zh)) body {
    font-family: var(--font-system);
}

button {
    font: inherit;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

a {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 3px solid var(--lang-a);
    outline-offset: 3px;
}

/* ---------- 넓은 화면의 빈 공간을 채우는 장식 (겹치는 두 원) ---------- */

@media (min-width: 1000px) {
    body::before,
    body::after {
        content: "";
        position: fixed;
        z-index: -1;
        width: 560px;
        height: 560px;
        border-radius: 50%;
        mix-blend-mode: multiply;
        opacity: 0.7;
        pointer-events: none;
    }

    body::before {
        inset-inline-end: 160px;
        bottom: -300px;
        background: var(--lang-a-circle);
    }

    body::after {
        inset-inline-end: -130px;
        bottom: -230px;
        background: var(--lang-b-circle);
    }

    /* 모티프가 정해지면 배경의 두 원도 그 언어들의 보조 색을 옅게 풀어서 씁니다 */
    :root[data-motifs] body::before {
        background: color-mix(in srgb, var(--accent-a) 42%, #ffffff);
    }

    :root[data-motifs] body::after {
        background: color-mix(in srgb, var(--accent-b) 42%, #ffffff);
    }
}

/* ---------- 언어별 모티프 (장식) ---------- */

.motif {
    display: block;
    flex: none;
    width: 84px;
    height: 84px;
    background: center / contain no-repeat;
    mix-blend-mode: multiply;
}

.motif--a {
    background-image: var(--motif-a);
}

.motif--b {
    background-image: var(--motif-b);
}

/* 방의 두 모티프를 살짝 겹쳐 나란히 (빈 상태 화면) */
.motif-pair {
    display: flex;
    margin-top: 8px;
}

.motif-pair .motif--b {
    margin-inline-start: -18px;
}

/* ---------- 레이아웃 ---------- */

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 clamp(20px, 4vw, 48px) calc(80px + env(safe-area-inset-bottom, 0px));
}

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    padding: calc(24px + env(safe-area-inset-top, 0px)) 0 clamp(24px, 4vw, 44px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.logo {
    display: inline-flex;
    align-items: center;
}

.logo-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    mix-blend-mode: multiply;
}

.logo-circle--a {
    background: #7d9ee6;
}

.logo-circle--b {
    margin-inline-start: -10px;
    background: #ee8fa0;
}

/* 모티프가 정해지면 헤더 마크의 두 원이 그 언어들의 그림으로 바뀝니다 (정해지기 전에는 원 그대로) */
:root[data-motifs] .logo-circle {
    width: 34px;
    height: 34px;
    border-radius: 0;
    background: center / contain no-repeat;
}

:root[data-motifs] .logo-circle--a {
    background-image: var(--motif-a);
}

:root[data-motifs] .logo-circle--b {
    background-image: var(--motif-b);
}

/* 방에 들어가기 전에는 화면 언어의 그림 하나만 */
:root[data-motifs="single"] .logo-circle--b {
    display: none;
}

.wordmark {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 10px;
    font-size: 1.3rem;
    line-height: 1.3;
}

/* ---------- 메뉴 ---------- */

.site-nav {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: #e8ecf7;
}

.site-nav a,
.site-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 4px 20px;
    border-radius: 999px;
    color: var(--ink);
    font-size: 0.97rem;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.site-nav button {
    border: 0;
    background: transparent;
    cursor: pointer;
}

/* 화면 언어 선택 (common.js 가 헤더에 넣어요) */
.lang-select {
    min-height: 44px;
    margin-inline-start: auto;
    padding: 8px 12px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.92rem;
    cursor: pointer;
}

.site-nav a:hover,
.site-nav button:hover {
    background: rgba(255, 255, 255, 0.75);
}

.site-nav a[aria-current="page"] {
    background: var(--ink);
    color: #ffffff;
}

@media (max-width: 700px) {
    .site-nav {
        width: 100%;
    }

    .site-nav a,
    .site-nav button {
        flex: 1;
        padding: 4px 6px;
    }
}

/* ---------- 진행바: 목표 횟수까지의 여정 (common.js 가 헤더 맨 아래에 넣어요) ---------- */

.journey {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 12px;
    flex-basis: 100%;
    font-size: 0.92rem;
    line-height: 1.3;
}

.journey-title {
    grid-column: 1 / -1;
}

/* 진행바 오른쪽의 퍼센트 */
.journey-percent {
    color: var(--muted);
}

.journey-bar {
    width: 100%;
    height: 10px;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    appearance: none;
    background: var(--line); /* Firefox 의 빈 칸 */
}

.journey-bar::-webkit-progress-bar {
    background: var(--line);
}

.journey-bar::-webkit-progress-value {
    border-radius: 999px;
    background: var(--accent-a, var(--lang-a));
}

.journey-bar::-moz-progress-bar {
    border-radius: 999px;
    background: var(--accent-a, var(--lang-a));
}

/* 방 만들기: 목표 횟수 라디오 */
.goal-options {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
}

.goal-options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    cursor: pointer;
}

.goal-options input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--accent-a, var(--lang-a));
}

@media (min-width: 760px) {
    .goal-options {
        grid-column: 2 / -1;
    }

    .form-row--goal {
        align-items: center;
    }

    .form-row--goal .form-row-name {
        padding-top: 0;
    }
}

/* ---------- 메인: 히어로 ---------- */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
    "copy"
    "card"
    "actions";
    gap: 28px;
}

.hero-copy {
    grid-area: copy;
}

.card-stage {
    grid-area: card;
    perspective: 1000px;
}

.hero-actions {
    grid-area: actions;
}

.hero-title {
    margin: 0;
    color: var(--lang-a);
    font-size: clamp(2rem, 5.4vw, 3.3rem);
    font-weight: 400;
    line-height: 1.25;
    text-wrap: balance;
}

.hero-desc {
    max-width: 32em;
    margin: 22px 0 0;
    color: var(--muted);
}

@media (min-width: 900px) {
    .hero {
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
        grid-template-areas:
      "copy card"
      "actions card";
        column-gap: clamp(40px, 6vw, 88px);
        row-gap: 0;
        align-items: center;
    }

    .hero-copy {
        align-self: end;
        padding-bottom: 32px;
    }

    .hero-actions {
        align-self: start;
        max-width: 440px;
    }
}

/* ---------- 주제 카드 ---------- */

.weekly-card {
    --d: 150px;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 300px;
    padding: 26px 24px 28px;
    border: 0;
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    text-align: start;
    cursor: pointer;
    transition: transform 0.22s ease;
}

@media (min-width: 900px) {
    .weekly-card {
        --d: clamp(170px, 17vw, 240px);
        min-height: clamp(360px, 34vw, 460px);
        padding: 36px 36px 40px;
    }
}

.weekly-card:disabled {
    cursor: default;
}

.weekly-card.is-flipping {
    transform: rotateY(90deg);
}

/* 겹치는 두 원: 뽑기 전에는 떨어져 있다가 주제가 나오면 겹쳐요 */
.venn {
    position: absolute;
    top: 24px;
    inset-inline-end: 20px;
    width: calc(var(--d) * 1.7);
    height: var(--d);
    pointer-events: none;
}

@media (min-width: 900px) {
    .venn {
        top: 34px;
        inset-inline-end: 34px;
    }
}

/* 카드 안의 두 송이 꽃: 파랑(A)과 빨강(B). 둘 다 꽃잎이 5장이에요.
   두 꽃이 서로를 향해 움직이는 그림이라 이 안의 left/right 와 translateX 는 글 방향과 상관없이 그대로 둡니다.
   뽑기 전에는 떨어져 있다가, 주제가 나오면 돌면서 서로 겹쳐요. (그림 파일 없이 CSS 안에서 그려요) */
.venn-circle {
    position: absolute;
    top: 0;
    width: var(--d);
    height: var(--d);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    mix-blend-mode: multiply;
    transition: transform 0.9s cubic-bezier(0.3, 1.25, 0.4, 1);
}

.venn-circle--a {
    left: 0;
    background-image: var(--motif-a);
    transform: translateX(calc(var(--d) * 0.15)) rotate(-12deg);
}

.venn-circle--b {
    right: 0;
    background-image: var(--motif-b);
    transform: translateX(calc(var(--d) * -0.15)) rotate(14deg);
}

.weekly-card.is-empty .venn-circle--a {
    transform: translateX(calc(var(--d) * -0.12)) rotate(-50deg);
}

.weekly-card.is-empty .venn-circle--b {
    transform: translateX(calc(var(--d) * 0.12)) rotate(52deg);
}

.card-text {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.card-name {
    display: block;
    line-height: 1.25;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.card-name--a {
    color: var(--lang-a);
    font-size: clamp(2.1rem, 9vw, 3.5rem);
}

.card-name--b {
    color: var(--lang-b);
    font-size: clamp(1.6rem, 6.4vw, 2.4rem);
}

.weekly-card.is-empty .card-name--a {
    font-size: clamp(1.3rem, 5vw, 1.7rem);
}

.weekly-card.is-empty .card-name--b {
    font-size: clamp(1.05rem, 3.6vw, 1.2rem);
}

.hint {
    margin: 0 4px 14px;
    color: var(--muted);
    font-size: 0.92rem;
}

.hero-actions .message {
    margin: 0 0 14px;
}

/* ---------- 메인: 바로가기 ---------- */

.shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 16px;
    margin-top: clamp(44px, 7vw, 80px);
}

.shortcut {
    position: relative;
    display: block;
    padding: 24px 26px;
    padding-inline-end: 60px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.18s ease;
}

.shortcut:hover {
    border-color: var(--ink);
}

.shortcut::after {
    content: "";
    position: absolute;
    top: 50%;
    inset-inline-end: 26px;
    width: 10px;
    height: 10px;
    border-top: 2px solid var(--muted);
    border-inline-end: 2px solid var(--muted);
    transform: translateY(-50%) rotate(45deg);
}

/* 오른쪽에서 왼쪽으로 쓰는 언어에서는 화살표도 반대쪽을 가리킵니다 */
[dir="rtl"] .shortcut::after,
[dir="rtl"] .topic-row::after {
    transform: translateY(-50%) rotate(-45deg);
}

.shortcut-title {
    display: block;
    color: var(--lang-a);
    font-size: 1.35rem;
    line-height: 1.4;
}

.shortcut-desc {
    display: block;
    margin-top: 14px;
    color: var(--muted);
    font-size: 0.93rem;
}

/* ---------- 버튼 ---------- */

.primary {
    display: block;
    width: 100%;
    min-height: 62px;
    margin-top: 18px;
    padding: 12px 20px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--ink);
    box-shadow: 0 14px 26px -14px rgba(27, 35, 64, 0.7);
    color: #ffffff;
    text-align: center;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.hero-actions .primary {
    margin-top: 0;
}

.primary:active {
    transform: scale(0.985);
}

.primary:disabled {
    opacity: 0.6;
    cursor: progress;
}

.btn-line {
    display: block;
    font-size: 1.08rem;
    line-height: 1.4;
}

.secondary {
    display: block;
    width: 100%;
    min-height: 52px;
    margin-top: 18px;
    padding: 10px 16px;
    border: 1.5px solid var(--ink);
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
}

.secondary:disabled {
    opacity: 0.55;
    cursor: progress;
}

.load-more {
    max-width: 360px;
    margin: 32px auto 0;
}

.icon-button {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: -6px 0 0;
    margin-inline-end: -8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

/* ---------- 메시지 ---------- */

.message {
    max-width: 640px;
    margin: 16px 0 0;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    background: var(--lang-b-soft);
    color: #8a1f36;
    font-size: 0.95rem;
}

.message--info {
    background: #e9ecf5;
    color: var(--muted);
}

/* ---------- 목록 페이지 공통 ---------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px 40px;
    margin-bottom: clamp(24px, 3.5vw, 36px);
}

/* 제목 옆에 모티프를 두는 화면 (들어가기) */
.page-heading {
    display: flex;
    align-items: center;
    gap: 14px;
}

.page-heading .motif {
    width: 72px;
    height: 72px;
}

.page-title {
    margin: 0;
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 400;
    line-height: 1.3;
}

.page-note {
    max-width: 440px;
    margin: 0;
    color: var(--muted);
    font-size: 0.93rem;
}

.topic-list,
.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.topic-list > li,
.history-list > li {
    display: flex;
}

/* ---------- 전체 주제 ---------- */

.group-heading {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 12px;
    margin-top: 18px;
    font-size: 1.15rem;
}

.group-heading:first-child {
    margin-top: 0;
}

.topic-row {
    position: relative;
    display: block;
    flex: 1;
    width: 100%;
    padding: 18px 20px;
    padding-inline-end: 48px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    text-align: start;
    cursor: pointer;
}

/* 아직 안 쓴 주제는 도드라지게, 쓴 주제는 차분하게 */
.topic-row.is-new {
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.topic-row.is-used {
    border-color: var(--line);
    background: transparent;
}

.topic-row::after {
    content: "";
    position: absolute;
    top: 50%;
    inset-inline-end: 20px;
    width: 9px;
    height: 9px;
    border-top: 2px solid var(--muted);
    border-inline-end: 2px solid var(--muted);
    transform: translateY(-50%) rotate(45deg);
}

.topic-row:hover {
    border-color: var(--ink);
}

.topic-name {
    display: block;
    line-height: 1.45;
}

.topic-name--a {
    color: var(--lang-a);
    font-size: 1.15rem;
}

.topic-name--b {
    margin-top: 1px;
    color: var(--lang-b);
    font-size: 1rem;
}

.topic-row.is-used .topic-name {
    opacity: 0.78;
}

.pill {
    display: inline-block;
    margin-top: 10px;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    line-height: 1.5;
}

.pill--new,
.pill--now {
    background: var(--ink);
    color: #ffffff;
}

.pill--used {
    background: #e7eaf3;
    color: var(--muted);
}

/* ---------- 학습 기록 ---------- */

.history-card {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    padding: 20px 22px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    text-align: start;
    cursor: pointer;
    transition: border-color 0.18s ease;
}

.history-card:hover,
.history-card.is-current {
    border-color: var(--ink);
}

.history-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.history-top .pill {
    margin-top: 0;
}

.round {
    display: flex;
    align-items: center;
    gap: 12px;
}

.round-no {
    display: grid;
    place-items: center;
    min-width: 3.1rem;
    height: 3.1rem;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: var(--ink);
    color: #ffffff;
    font-family: var(--font-ja);
    font-size: 1.4rem;
    line-height: 1;
}

.round-label {
    color: var(--lang-a);
    font-size: 0.9rem;
    line-height: 1.25;
}

.history-names {
    display: block;
}

.history-date {
    display: block;
    margin-top: auto;
    color: var(--muted);
    font-size: 0.88rem;
}

/* ---------- 주제 등록 ---------- */

.mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: min(100%, 420px);
    margin: 0 0 24px;
    padding: 4px;
    border-radius: 999px;
    background: #e8ecf7;
}

.mode-toggle button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: 0.97rem;
    line-height: 1.25;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.mode-toggle button[aria-pressed="true"] {
    background: var(--ink);
    color: #ffffff;
}

.topic-forms {
    display: grid;
    gap: 18px;
}

.topic-form {
    padding: clamp(18px, 3vw, 28px);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.topic-form-head {
    display: none;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.register-form.is-bulk .topic-form-head {
    display: flex;
}

.topic-form-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 400;
}

.text-button {
    padding: 6px 4px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.9rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.text-button:hover {
    color: var(--lang-b);
}

.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px 20px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
}

.topic-form-head + .form-row,
.topic-form > .form-row:first-child {
    border-top: 0;
}

.form-note {
    margin-bottom: 16px;
}

/* 입력 줄 아래 한 줄 설명 (줄 전체 폭) */
.form-row-hint {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

@media (min-width: 760px) {
    .form-row {
        grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
    }

    .form-row-name {
        padding-top: 1.7rem;
    }
}

.form-row-name {
    line-height: 1.35;
}

.field {
    display: block;
}

.field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.82rem;
    line-height: 1.3;
}

.field-label--a {
    color: var(--lang-a);
}

.field-label--b {
    color: var(--lang-b);
}

.field-input {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    background: #ffffff;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

textarea.field-input {
    min-height: 84px;
    resize: vertical;
}

.field-input::placeholder {
    color: #9aa1b8;
}

.field-input:focus {
    outline: none;
}

.field-input--a:focus {
    border-color: var(--lang-a);
    box-shadow: 0 0 0 3px var(--lang-a-soft);
}

.field-input--b:focus {
    border-color: var(--lang-b);
    box-shadow: 0 0 0 3px var(--lang-b-soft);
}

.field-input[aria-invalid="true"] {
    border-color: #d9730d;
    background: #fff9ef;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 22px;
}

.form-actions .primary {
    flex: 0 1 auto;
    width: auto;
    min-width: min(100%, 300px);
    margin-top: 0;
}

.form-actions .add-topic {
    width: auto;
    margin-top: 0;
}

@media (max-width: 600px) {
    .form-actions .primary,
    .form-actions .add-topic {
        width: 100%;
    }
}

.message--success {
    background: #e2f3e8;
    color: #1d6b3f;
}

.inline-link {
    display: block;
    width: fit-content;
    margin-top: 8px;
    color: inherit;
    font-weight: 500;
    text-underline-offset: 3px;
}

/* ---------- 질문 시트 ---------- */

.sheet-dialog {
    width: min(600px, 100%);
    max-width: 100%;
    padding: 0;
    border: 0;
    border-radius: var(--radius-xl);
    background: var(--surface);
    color: var(--ink);
    overflow: hidden;
}

.sheet-dialog::backdrop {
    background: rgba(27, 35, 64, 0.52);
}

.sheet-dialog[open] {
    animation: sheet-in 0.26s ease-out;
}

@keyframes sheet-in {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    .sheet-dialog {
        margin: auto 0 0;
        border-bottom-right-radius: 0;
        border-bottom-left-radius: 0;
    }
}

.sheet {
    max-height: 88vh;
    max-height: 88dvh;
    padding: 14px 22px calc(26px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
}

.sheet::before {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    margin: 0 auto 18px;
    border-radius: 2px;
    background: var(--line);
}

@media (min-width: 601px) {
    .sheet {
        padding: 26px 32px 32px;
    }

    .sheet::before {
        display: none;
    }
}

.sheet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.sheet-title {
    margin: 0;
    line-height: 1.35;
}

.sheet-title--a {
    color: var(--lang-a);
    font-size: 1.55rem;
}

.sheet-title--b {
    margin-top: 2px;
    color: var(--lang-b);
    font-size: 1.2rem;
}

.lang-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin: 20px 0 6px;
    padding: 4px;
    border-radius: 999px;
    background: #edf0f7;
}

.lang-toggle button {
    min-height: 46px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: 1.02rem;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.lang-toggle button[data-slot="a"][aria-pressed="true"] {
    background: var(--lang-a);
    color: #ffffff;
}

.lang-toggle button[data-slot="b"][aria-pressed="true"] {
    background: var(--lang-b);
    color: #ffffff;
}

.question-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.question-item {
    display: grid;
    grid-template-columns: 2.2rem 1fr;
    gap: 14px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
    font-size: 1.22rem;
    line-height: 1.7;
}

.question-item:last-child {
    border-bottom: 0;
}

.question-no {
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    margin-top: 0.15rem;
    border-radius: 50%;
    font-family: var(--font-ja);
    font-size: 1rem;
    line-height: 1;
}

.question-list[data-slot="a"] .question-no {
    background: var(--lang-a-soft);
    color: var(--lang-a);
}

.question-list[data-slot="b"] .question-no {
    background: var(--lang-b-soft);
    color: var(--lang-b);
}

.question-text {
    word-break: keep-all;
}

.question-text {
    overflow-wrap: anywhere;
    text-wrap: pretty;
}

.question-status {
    margin: 22px 0 4px;
    color: var(--muted);
}

/* ---------- 움직임 줄이기 ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}