/* sori 청취 화면 — 고팡(gopang.app) 화면 규칙을 따른다 (바당 창, 2026-11-22)
   현무암 바탕, 강조색은 유채 노랑 하나: 누르는 것(주 단추)에만. 글자·선택 표시는 현무암 색. */
:root {
  --stone: #eceeea;      /* 바탕 */
  --stone-2: #dfe2dc;    /* 한 단계 짙은 바탕 (놓기 칸·눌린 칸) */
  --bench: #f9faf7;      /* 카드: 바탕보다 밝게 떠 있는 판 */
  --basalt: #22292b;     /* 글자 */
  --basalt-2: #5a6366;   /* 보조 글자 */
  --pore: #c9cdc6;       /* 현무암 구멍 무늬 */
  --yuchae: #e6b422;     /* 유채 노랑: 누르는 것에만 */
  --yuchae-soft: rgba(230, 180, 34, 0.22);
  --moss: #4a6545;       /* 완료·좋음 */
  --error: #a3332b;
  --line: #c4c8c1;
  --chart: #2e5f8f;      /* 그래프의 2f 선 (고팡 문서 묶음 색) */
  --font: "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", "Noto Sans KR", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --stone: #1e2324;
    --stone-2: #272d2e;
    --bench: #2c3335;
    --basalt: #e6e9e4;
    --basalt-2: #a3aaa6;
    --pore: #343b3c;
    --yuchae-soft: rgba(230, 180, 34, 0.18);
    --moss: #8fb187;
    --error: #e58a7f;
    --line: #3c4344;
    --chart: #8ab4de;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--stone);
  color: var(--basalt);
  font: 400 1rem/1.65 var(--font);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: inherit; text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--yuchae); outline-offset: 2px; }
[hidden] { display: none !important; }

header, main, footer { max-width: 54rem; margin: 0 auto; padding: 0 1rem; }

/* ── 머리: 바당 · 화면 고르기 / 제목 / 한 줄 설명 ── */
.masthead {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem 1rem; padding: 1.25rem 0 1.75rem;
}
.home { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.04em; text-decoration: none; }
.home small { margin-left: 0.5rem; font-size: 0.95rem; font-weight: 400; letter-spacing: 0; color: var(--basalt-2); }
.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; font-size: 0.95rem; }
.tabs a {
  padding: 0.35rem 0.95rem; border: 1.5px solid var(--line); border-radius: 999px;
  text-decoration: none; font-weight: 600; color: var(--basalt-2);
}
.tabs a:hover { color: var(--basalt); border-color: var(--basalt-2); }
.tabs a[aria-current="page"] { background: var(--basalt); border-color: var(--basalt); color: var(--stone); }
h1 {
  font-size: clamp(1.75rem, 4.6vw, 2.4rem); line-height: 1.2; letter-spacing: -0.03em;
  font-weight: 800; margin: 0 0 0.6rem;
}
.sub { font-size: 1.07rem; color: var(--basalt-2); margin: 0; max-width: 40rem; }
.who { font-size: 0.9rem; color: var(--basalt-2); margin: 0.5rem 0 1.5rem; }

/* ── 카드: 걸음마다 판 하나 ── */
.card {
  background: var(--bench);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.35rem;
  margin: 0 0 1.25rem;
}
h2 { font-size: 1.2rem; letter-spacing: -0.02em; font-weight: 800; margin: 0 0 1rem; }
h2 .step {
  display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; margin-right: 0.5rem;
  border-radius: 50%; background: var(--basalt); color: var(--stone); font-size: 0.95rem; vertical-align: 0.08em;
}
h3 { font-size: 1.05rem; margin: 0 0 0.6rem; }
.note, footer { color: var(--basalt-2); }
.note { font-size: 0.93rem; margin: 0.6rem 0; }
footer { font-size: 0.88rem; padding-bottom: 2.5rem; }
footer p { margin: 1.5rem 0 0; }

/* ── 그림: 카드 맨 위, 무엇이 일어나는지 한눈에 ── */
.tool-art { margin: 0 0 1rem; display: flex; justify-content: center; }
.tool-art svg { width: 100%; max-width: 21rem; height: auto; display: block; overflow: visible; }
.art-doc { fill: var(--bench); stroke: var(--basalt); stroke-width: 2.2; stroke-linejoin: round; }
.art-line { fill: none; stroke: var(--basalt-2); stroke-width: 2.4; stroke-linecap: round; }
.art-line.strong { stroke: var(--basalt); stroke-width: 3; }
.art-wave { fill: none; stroke: var(--basalt); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.art-tag { fill: var(--basalt); }
.art-tag.hot { fill: var(--yuchae); }
.art-tag-t { fill: var(--stone); font: 800 11px/1 var(--font); }
.art-tag.hot + .art-tag-t { fill: #22292b; }
.art-arrow { fill: none; stroke: var(--yuchae); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 7 6; }
.art-head { fill: var(--yuchae); }
.art-bar { fill: var(--basalt-2); }
.art-bar.hot { fill: var(--yuchae); }
@media (max-width: 30rem) { .tool-art svg { max-width: 16rem; } }

/* ── 놓기 칸: 현무암 판 (고팡 .drop 과 같은 모양) ── */
.drop {
  position: relative;
  display: grid; place-items: center; align-content: center; gap: 0;
  min-height: 13.5rem;
  padding: 1.75rem 1.25rem;
  border-radius: 6px;
  background-color: var(--stone-2);
  background-image:
    radial-gradient(circle at 20% 30%, var(--pore) 0 3px, transparent 4px),
    radial-gradient(circle at 70% 65%, var(--pore) 0 2px, transparent 3px),
    radial-gradient(circle at 45% 80%, var(--pore) 0 4px, transparent 5px),
    radial-gradient(circle at 85% 20%, var(--pore) 0 2.5px, transparent 3.5px);
  background-size: 37px 41px, 53px 47px, 71px 67px, 43px 59px;
  border: 2px solid var(--line);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.drop:hover, .drop.is-over, .drop:focus-within { border-color: var(--basalt); }
.drop:focus-within { outline: 3px solid var(--yuchae); outline-offset: 2px; }
.drop.is-over { background-color: var(--stone); border-style: dashed; }
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-title { display: block; font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.drop-hint { display: block; color: var(--basalt-2); font-size: 0.95rem; margin: 0.3rem 0 1.15rem; max-width: 34rem; }
.drop-file {
  display: block; margin-top: 0.9rem; max-width: 100%;
  font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drop-file::before { content: "✓ "; color: var(--moss); }
.drop.has-file .drop-title { font-size: 1.1rem; }

/* 약속 한 줄 (고팡 .promise) */
.privacy { margin: 0.85rem 0 0; font-size: 0.93rem; color: var(--basalt-2); }
.privacy strong { color: var(--basalt); }

/* ── 단추 ── */
input, select, button, textarea { font: inherit; color: inherit; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.55rem 1.3rem;
  border: 0; border-radius: 4px;
  background: var(--yuchae); color: #22292b;
  font-weight: 700; line-height: 1.4;
  cursor: pointer;
}
button:hover { filter: brightness(1.06); }
button:disabled { opacity: 0.45; cursor: default; filter: none; }
button.ghost {
  background: transparent; color: var(--basalt);
  border: 1.5px solid var(--line); padding: 0.45rem 1rem;
}
button.ghost:hover { background: var(--stone-2); filter: none; }
button.link { background: none; color: var(--basalt-2); padding: 0; font-weight: 400; text-decoration: underline; }
.drop .button {
  display: inline-block; padding: 0.6rem 1.4rem; border-radius: 4px;
  background: var(--yuchae); color: #22292b; font-weight: 700; line-height: 1.4;
}
.drop:hover .button { filter: brightness(1.06); }

/* ── 고르기 칸: 선택지는 알약 모양, 고른 것은 진하게 ── */
.row { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin: 0.9rem 0; }
label { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; max-width: 100%; }
fieldset { border: 0; padding: 0; margin: 1.1rem 0 0; min-width: 0; }
fieldset:disabled { opacity: 0.5; }
legend { padding: 0; margin-bottom: 0.45rem; font-weight: 700; font-size: 0.97rem; }
.choice { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.choice legend { width: 100%; }
.choice label {
  gap: 0.4rem; padding: 0.3rem 0.85rem 0.3rem 0.65rem;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--bench);
  cursor: pointer; font-variant-numeric: tabular-nums; line-height: 1.5;
}
.choice label:hover { border-color: var(--basalt-2); }
.choice label:has(input:checked) { border-color: var(--basalt); background: var(--stone-2); font-weight: 700; }
.choice label:has(input:disabled) { opacity: 0.45; cursor: default; }
.choice input[type="radio"], .choice input[type="checkbox"], label.check input, .answer input {
  width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--basalt); flex: none;
}
#kbpsList { display: contents; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0.45rem 1rem; margin-left: 0.4rem; }
.seg label, label.check { cursor: pointer; }
/* 구간 칸(시작·길이)은 선택지가 아니라 입력 칸: 알약 모양을 쓰지 않는다 */
.choice .seg label { padding: 0; border: 0; background: none; font-weight: 400; cursor: default; }
.unit { color: var(--basalt-2); font-size: 0.93rem; margin-left: 0.15rem; }
select, input[type="number"] {
  background: var(--bench); border: 1.5px solid var(--line); border-radius: 4px; padding: 0.3rem 0.5rem;
}
input[type="number"] { width: 5.5em; font-variant-numeric: tabular-nums; }
select:focus, input[type="number"]:focus { outline: 2px solid var(--yuchae); outline-offset: 1px; }

/* ── 진행 줄 ── */
.jobs { margin-top: 1rem; display: grid; gap: 0.15rem; border-top: 1px solid var(--line); }
.job {
  display: grid; grid-template-columns: 9.5em minmax(0, 1fr) 15em; gap: 0.75rem; align-items: center;
  padding: 0.55rem 0; border-bottom: 1px solid var(--line); font-size: 0.93rem;
}
.job .who { margin: 0; font-weight: 600; color: var(--basalt); font-size: inherit; }
.job progress { width: 100%; height: 0.45rem; accent-color: var(--moss); }
.state { color: var(--basalt-2); }
.error { color: var(--error); font-weight: 600; }
.warn { color: var(--error); }
.ok { color: var(--moss); font-weight: 600; }
#loadError { margin: 0.9rem 0 0; }

/* ── 표 ── */
table.info { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
table.info th, table.info td { border-bottom: 1px solid var(--line); padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
table.info thead th { border-bottom: 2px solid var(--basalt); font-weight: 700; }
table.info tbody th:first-child { color: var(--basalt-2); font-weight: 400; width: 34%; }
table.info tr:last-child td, table.info tr:last-child th { border-bottom: 0; }
.song { margin: 0 0 0.9rem; }
.song b { font-size: 1.05rem; }
.song span { color: var(--basalt-2); font-size: 0.93rem; }
.downloads a { font-weight: 700; }
.tiny { color: var(--basalt-2); font-size: 0.78rem; margin: 0.6rem 0 0; }

/* ── 듣기 ── */
.question { font-weight: 800; font-size: 1.1rem; margin: 0 0 0.2rem; }
.pads { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0 0.8rem; }
.pad {
  min-width: 4.6em; padding: 0.75rem 1.1rem;
  background: var(--bench); color: var(--basalt);
  border: 2px solid var(--line); border-radius: 6px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.pad:hover { border-color: var(--basalt-2); filter: none; }
.pad.on { border-color: var(--basalt); background: var(--yuchae-soft); }
.now { color: var(--basalt-2); margin: 0 0 0 0.25rem; }
.bar {
  position: relative; height: 2rem; margin-top: 0.4rem;
  border: 1.5px solid var(--line); border-radius: 6px; background: var(--stone);
  cursor: pointer; touch-action: none; overflow: hidden;
}
.bar:focus-visible { outline: 3px solid var(--yuchae); outline-offset: 2px; }
.bar-region { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--yuchae-soft); }
.bar-head { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; margin-left: -1px; background: var(--basalt); }
.time { margin: 0.35rem 0 0; font-variant-numeric: tabular-nums; color: var(--basalt-2); font-size: 0.9rem; }
.region .label { font-weight: 700; }
button.play { min-width: 7.5em; padding: 0.65rem 1.4rem; }
.keys { font-size: 0.85rem; margin: 0; }
.answer { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 1.2rem; }
.answer label { gap: 0.5rem; padding: 0.3rem 0; cursor: pointer; }
.sum { font-size: 1.05rem; }
table.reveal { border-collapse: collapse; font-size: 0.9rem; margin-top: 0.6rem; width: 100%; }
table.reveal td, table.reveal th { border-bottom: 1px solid var(--line); padding: 0.35rem 0.5rem; text-align: left; }
table.reveal thead th { border-bottom: 2px solid var(--basalt); }

/* ── 비트레이트별 음질: 그래프·표 ── */
.chart { margin: 0 0 0.6rem; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--basalt-2); font-size: 13px; font-family: var(--font); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .band-hi { fill: var(--moss); opacity: 0.12; }
.chart .band-mid { fill: var(--yuchae); opacity: 0.14; }
.chart .band-lo { fill: var(--error); opacity: 0.10; }
.chart .l-twof { stroke: var(--chart); stroke-width: 2.5; fill: none; }
.chart .l-visqol { stroke: var(--basalt); stroke-width: 2; stroke-dasharray: 6 4; fill: none; }
.chart .p-twof { fill: var(--chart); }
.chart .p-visqol { fill: var(--bench); stroke: var(--basalt); stroke-width: 2; }
.legend { color: var(--basalt-2); font-size: 0.86rem; display: flex; flex-wrap: wrap; gap: 0.25rem 0.7rem; align-items: center; }
.key { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--chart); }
.key.visqol { border-top: 2px dashed var(--basalt); }
.scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.ladder tbody th:first-child { width: auto; color: var(--basalt); font-weight: 700; }
table.ladder td, table.ladder th { white-space: nowrap; }
table.ladder td.num { font-variant-numeric: tabular-nums; text-align: right; }
table.ladder .band-hi { color: var(--moss); }
table.ladder .band-lo { color: var(--error); }
.pads.many .pad { min-width: 3.7em; padding: 0.65rem 0.6rem; flex: 0 0 auto; }

/* ── 좁은 화면 ── */
@media (max-width: 36rem) {
  .masthead { padding: 1rem 0 1.25rem; }
  .card { padding: 1rem; margin-left: -0.25rem; margin-right: -0.25rem; }
  .drop { min-height: 11.5rem; padding: 1.4rem 1rem; }
  .job { grid-template-columns: 1fr; gap: 0.2rem; }
  .pad { flex: 1 1 0; min-width: 0; padding: 0.75rem 0.4rem; }
  .now { flex-basis: 100%; margin-left: 0; }
  .seg { margin-left: 0; }
  table.reveal { font-size: 0.82rem; }
  table.reveal td, table.reveal th { padding: 0.3rem 0.25rem; }
  .pads.many .pad { flex: 1 1 18%; min-width: 3.2em; padding: 0.65rem 0.2rem; }
  .chart text { font-size: 22px; }
  table.ladder { font-size: 0.82rem; }
  table.ladder td, table.ladder th { padding: 0.3rem 0.35rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
