/* 설정 화면. 폼이 아니라 "말로 바꾸는 법" 목록이다.
   줄마다 왼쪽에 설정 이름과 그걸 바꾸는 한마디(마이크 표시 + 따옴표), 오른쪽에 손으로 바꾸는 큰 조작(서 있을 때).
   달리는 중(body[data-moving])에는 손 조작을 흐리게 잠그고 한마디를 크고 밝게 앞세운다.
   색은 토큰만 쓴다. 낮밤 모두 같은 규칙으로 보인다. */

/* 여는 단추: 칸 오른쪽 위. 손가락이 닿는 크기(56px)지만 눈에 띄지 않게 */
.settings-open { position: absolute; z-index: 7; right: 34px; top: 8px; height: 56px; padding: 0 14px; display: flex; align-items: center; gap: 8px;
  border: 0; background: none; color: var(--ink-muted); font: 500 18px/1 var(--font-sans); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.settings-open svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.settings-open:hover { color: var(--ink); }
.settings-open:focus-visible { outline: 3px solid var(--focus); outline-offset: -6px; }
.col.has-band:not([data-mode]) .settings-open { top: 52px; }

/* 판: 칸 전체를 덮는다. 바탕은 지금 화면(낮밤) 그대로 보이고 위에 한 겹 */
.sheet { position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; overflow: hidden;
  background: color-mix(in srgb, var(--ground) 94%, transparent);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  animation: sheet-in 320ms var(--ease-out) both; }
.sheet[hidden] { display: none; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* 머리: 작은 유키오 얼굴(바이저 원) + 유키오가 하는 말 + 닫기 */
.sheet-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 16px 24px 14px 12px; }
.sheet-face { width: 150px; }
.sheet-face .yk-stage-corner { display: none; }
.sheet-face .yk-stage-img { filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.4)); }
.sheet-face .yk-p-dial, .sheet-face .yk-p-dial-major { opacity: 0.5; }
.sheet-face .yk-p-top { fill: url(#ykPedestalTop); stroke: rgba(207, 230, 245, 0.55); }
.sheet-face .yk-p-side { fill: url(#ykPedestalSide); }
.sheet:focus { outline: none; }
.sheet-title h2 { margin: 0; font-size: 32px; line-height: 40px; font-weight: 600; letter-spacing: -0.01em; }
.sheet-say { margin: 2px 0 0; font-size: 20px; line-height: 28px; color: var(--ink-muted); text-wrap: pretty; }
.sheet-close { height: 56px; padding: 0 22px; border: 0; border-radius: var(--radius-1); background: color-mix(in srgb, var(--ink) 6%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--line-strong); color: var(--ink); font: 600 22px/1 var(--font-sans); cursor: pointer; }
.sheet-close:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.sheet-close:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 달리는 중 안내 띠 */
.sheet-moving { display: none; margin: 0 24px 6px 28px; padding: 12px 16px; font-size: 20px; line-height: 28px; font-weight: 500; color: var(--ink);
  background: color-mix(in srgb, var(--ring) 16%, transparent); box-shadow: inset 3px 0 0 var(--ring); }
body[data-moving] .sheet-moving { display: block; }

/* 목록 */
.sheet-body { flex: 1; overflow: auto; padding: 0 24px 20px 28px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.sheet-body::-webkit-scrollbar, .voice-list::-webkit-scrollbar { width: 4px; }
.sheet-body::-webkit-scrollbar-thumb, .voice-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
.voice-list { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; min-height: 84px; padding: 11px 0; border-top: 1px solid var(--line); }
.set-row:first-child { border-top: 0; }
body[data-device="car"] .phone-only { display: none; }
.set-text { display: grid; gap: 4px; min-width: 0; }
.set-name { font-size: 24px; line-height: 32px; font-weight: 600; color: var(--ink); }
.set-name em { font-style: normal; font-size: 15px; font-weight: 600; vertical-align: 3px; margin-left: 6px; padding: 2px 7px; color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line-strong); border-radius: 4px; }
/* 바꾸는 한마디: 핸들 버튼으로 이렇게 말하면 바뀐다 */
.set-say { display: inline-flex; align-items: center; gap: 6px; font-size: 19px; line-height: 26px; color: var(--ink-muted); transition: color 240ms, font-size 240ms; }
.set-say svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ring); stroke-width: 2; stroke-linecap: round; }
.set-hint { font-size: 18px; line-height: 25px; color: var(--ink-muted); }
.set-note { font-size: 18px; color: var(--ink-muted); }

/* 고르기 단추(세 칸). 고른 칸은 글자색으로 꽉 채운다 */
.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 88px; border-radius: var(--radius-1); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.seg button { height: 56px; border: 0; border-radius: 0; background: none; color: var(--ink-muted); font: 600 20px/1 var(--font-sans); cursor: pointer; transition: background 200ms var(--ease-out), color 200ms;
  box-shadow: inset 1px 0 0 var(--line); }
.seg button:first-child { box-shadow: none; }
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--ground); }
.seg button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 켜고 끄기: 스위치 대신 "끔 | 켬" 두 칸. 스위치는 어느 쪽이 켜진 건지 흘끗 봐서 헷갈린다 */
.switch { position: relative; display: inline-block; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch i { display: inline-grid; grid-template-columns: 76px 76px; border-radius: var(--radius-1); box-shadow: inset 0 0 0 1.5px var(--line-strong); font-style: normal; }
.switch b { display: grid; place-items: center; height: 56px; font: 600 20px/1 var(--font-sans); color: var(--ink-muted); transition: background 200ms var(--ease-out), color 200ms; }
.switch b + b { box-shadow: inset 1px 0 0 var(--line); }
.switch input:not(:checked) + i b:first-child, .switch input:checked + i b:last-child { background: var(--ink); color: var(--ground); box-shadow: none; }
.switch input:focus-visible + i { outline: 3px solid var(--focus); outline-offset: 3px; }

/* 목소리: 지금 목소리 이름 + 꺾쇠 */
.set-pick { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; height: 56px; min-width: 152px; padding: 0 12px 0 20px; border: 0; border-radius: var(--radius-1); cursor: pointer;
  background: none; box-shadow: inset 0 0 0 1.5px var(--line-strong); color: var(--ink); font: 600 20px/1 var(--font-sans); max-width: 264px; }
.set-pick b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-pick svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.set-pick:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 달리는 중: 손 조작은 흐리게 잠그고, 한마디를 크고 밝게 */
body[data-moving] .sheet .seg, body[data-moving] .sheet .switch, body[data-moving] .sheet .set-pick { opacity: 0.32; pointer-events: none; }
body[data-moving] .set-say { font-size: 23px; color: var(--ink); }
body[data-moving] .set-row:not(:has(.set-say)) { display: none; }

/* 연결 상태(개발용): 맨 아래 작은 글씨 */
.sheet-dev { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 16px; }
.sheet-dev summary { cursor: pointer; list-style: none; padding: 8px 0; }
.sheet-dev summary::-webkit-details-marker { display: none; }
.sheet-dev p { margin: 4px 0; }
body[data-moving] .sheet-dev { display: none; }

/* 목소리 고르기: 판 위에 한 겹 더. 카드를 누르면 그 목소리로 한마디 들려준다 */
.voice-pick { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--ground); animation: sheet-in 280ms var(--ease-out) both; }
.voice-pick[hidden] { display: none; }
.voice-pick-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 24px 12px 28px; }
.voice-pick-head h3 { margin: 0; font-size: 30px; line-height: 38px; font-weight: 600; }
.voice-list { flex: 1; overflow: auto; display: grid; align-content: start; gap: 12px; padding: 6px 24px 24px 28px; }
.voice-more { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 24px 24px 28px; min-height: 64px; padding: 0 20px;
  color: var(--ink); text-decoration: none; font-size: 22px; font-weight: 600; box-shadow: inset 0 0 0 1.5px var(--line-strong); border-radius: var(--radius-1); }
.voice-more svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.voice-more:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.voice-card { display: grid; gap: 4px; text-align: left; padding: 18px 20px; border: 0; border-radius: var(--radius-1); cursor: pointer; color: var(--ink);
  background: color-mix(in srgb, var(--ink) 5%, transparent); box-shadow: inset 0 0 0 1.5px var(--line); font-family: var(--font-sans); transition: box-shadow 200ms, background 200ms; }
.voice-card b { font-size: 26px; line-height: 32px; font-weight: 600; }
.voice-where { font-size: 17px; color: var(--ink-muted); }
.voice-sample { font-size: 19px; line-height: 27px; color: var(--ink-muted); margin-top: 4px; }
.voice-card[aria-selected="true"] { box-shadow: inset 0 0 0 2.5px var(--ring); background: color-mix(in srgb, var(--ring) 12%, transparent); }
.voice-card[aria-selected="true"] b::after { content: "지금 목소리"; margin-left: 10px; vertical-align: 4px; padding: 2px 8px; font-size: 16px; font-weight: 600; color: var(--ground); background: var(--ring); }
.voice-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { .sheet, .voice-pick { animation: none; } }

/* 마이크 시험 ------------------------------------------------------------------ */
.mt { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; background: var(--ground); animation: sheet-in 300ms var(--ease-out) both; }
.mt[hidden] { display: none; }
.mt-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 24px 12px 28px; }
.mt-head h2 { margin: 0; font-size: 32px; line-height: 40px; font-weight: 600; }
.mt-step { margin: 2px 0 0; font-size: 19px; color: var(--ink-muted); }
.mt-body { flex: 1; overflow: auto; padding: 8px 28px 24px; display: flex; flex-direction: column; gap: 10px; }
.mt-lead { margin: 0 0 6px; font-size: 24px; line-height: 36px; color: var(--ink); text-wrap: pretty; }
.mt-target { margin: 0; font-size: 36px; line-height: 48px; font-weight: 600; letter-spacing: -0.01em; text-wrap: pretty; }
.mt-note { margin: 0; font-size: 20px; line-height: 28px; color: var(--ink-muted); }
.mt-status { margin-top: auto; display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.mt-hint { margin: 0; font-size: 22px; color: var(--ink-muted); }
.mt-heard { margin: 0; font-size: 28px; line-height: 38px; font-weight: 500; }
.mt-meter { height: 10px; background: color-mix(in srgb, var(--ink) 10%, transparent); overflow: hidden; }
.mt-meter i { display: block; height: 100%; width: calc(4% + var(--lv, 0) * 96%); background: var(--ring); transition: width 80ms linear; }
.mt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-chip { font-size: 19px; font-weight: 600; padding: 6px 12px; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.mt-chip[data-ok="1"] { color: var(--ground); background: var(--ring); box-shadow: none; }
.mt-chip[data-ok="0"] { color: var(--on-alert); background: var(--alert-fill); box-shadow: none; }
.mt-chip-info { font-weight: 500; color: var(--ink-muted); }
.mt-actions { display: flex; gap: 12px; }
.mt-go { height: 64px; padding: 0 28px; border: 0; border-radius: var(--radius-1); cursor: pointer; background: var(--ink); color: var(--ground); font: 600 24px/1 var(--font-sans); align-self: flex-start; }
.mt-go-ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.mt-go:disabled { opacity: 0.5; cursor: default; }
.mt-go:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mt-actions .mt-go { flex: 1; }
.mt-sum { display: flex; gap: 28px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.mt-fact { display: grid; gap: 2px; }
.mt-fact .yk-label { font-family: var(--font-sans); font-size: 18px; letter-spacing: 0; }
.mt-fact b { font-size: 34px; line-height: 42px; font-weight: 600; }
.mt-list { margin: 0; padding-left: 26px; display: grid; gap: 8px; font-size: 19px; line-height: 26px; }
.mt-list li { display: grid; }
.mt-list li[data-bad="1"]::marker { color: var(--alert); }
.mt-li-heard { color: var(--ink-muted); }
.mt-list li[data-bad="1"] .mt-li-heard { color: var(--alert); }
/* 마이크 시험: 받아쓰기 견주기(크롬과 다른 회사 4곳) */
.mt-cloud { display: grid; gap: 4px; }
.mt-cloud .yk-label { font-family: var(--font-sans); font-size: 18px; letter-spacing: 0; margin-bottom: 2px; }
.mt-cloud-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 64px; gap: 12px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); font-size: 20px; line-height: 28px; }
.mt-cloud-row b { font-weight: 600; color: var(--ink-muted); }
.mt-cloud-row[data-mine="1"] b { color: var(--ink); }
.mt-cloud-row span { color: var(--ink); text-wrap: pretty; }
.mt-cloud-row em { font-style: normal; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.mt-cloud-row[data-ok="1"] em { color: var(--ring); }
.mt-cloud-row[data-ok="0"] em { color: var(--alert); }
/* 나를 알려 주기(interview.js): 마이크 시험과 같은 판 위에 누구를 고르는 단추, 되읽은 사실 조각, 아는 것 목록 */
.iv-who { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 4px; }
.iv-who-btn { display: grid; gap: 6px; text-align: left; padding: 20px 22px; border: 0; border-radius: var(--radius-1); cursor: pointer;
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); font-family: var(--font-sans); }
.iv-who-btn b { font-size: 34px; line-height: 40px; font-weight: 600; }
.iv-who-btn span { font-size: 19px; line-height: 26px; color: var(--ink-muted); }
.iv-who-btn:hover { box-shadow: inset 0 0 0 2px var(--ring); }
.iv-who-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.iv-ask { font-size: 30px; line-height: 42px; }
.iv-readback { font-size: 28px; line-height: 40px; }
.iv-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.iv-fact { font-size: 19px; line-height: 26px; padding: 6px 12px; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.iv-fact b { font-weight: 600; color: var(--ink-muted); margin-right: 2px; }
.iv-group { margin-top: 10px; font-family: var(--font-sans); font-size: 20px; letter-spacing: 0; }
.iv-list { list-style: none; margin: 0; padding: 0; display: grid; }
.iv-list li { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 21px; line-height: 28px; }
.iv-list li b { font-weight: 600; color: var(--ink-muted); }
.iv-del { height: 44px; padding: 0 14px; border: 0; background: none; color: var(--ink-muted); font: 600 18px/1 var(--font-sans); cursor: pointer; box-shadow: inset 0 0 0 1.5px var(--line); border-radius: var(--radius-1); }
.iv-del:hover { color: var(--alert); box-shadow: inset 0 0 0 1.5px var(--alert); }
.iv-del:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.iv .mt-status > .mt-go { align-self: stretch; }
/* 유키오 일지 */
.iv-entry { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.iv-entry-text { margin: 0; font-size: 22px; line-height: 34px; color: var(--ink); text-wrap: pretty; }
.iv-sub { font-family: var(--font-sans); font-size: 17px; letter-spacing: 0; margin-top: 4px; }
.iv-asks li, .iv-plain li { display: block; grid-template-columns: none; font-size: 21px; line-height: 30px; }
.iv-plain { margin: 0; padding-left: 22px; font-size: 20px; line-height: 28px; color: var(--ink); }
/* 유키오가 바꾸고 싶은 것(스스로 배운 규칙) */
.iv-rule { display: grid; gap: 8px; padding: 14px 16px; background: var(--surface); box-shadow: inset 3px 0 0 var(--line-strong); }
.iv-rule[data-status="ready"] { box-shadow: inset 3px 0 0 var(--ring); }
.iv-rule[data-status="active"] { box-shadow: inset 3px 0 0 var(--ink); }
.iv-rule[data-status="failed"] { opacity: 0.75; }
.iv-rule-head { display: flex; gap: 12px; align-items: baseline; }
.iv-rule-tag { font-size: 17px; font-weight: 600; color: var(--ink-muted); }
.iv-rule[data-status="ready"] .iv-rule-tag { color: var(--ring); }
.iv-rule-count { font-size: 17px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.iv-rule-text { margin: 0; font-size: 22px; line-height: 32px; font-weight: 600; text-wrap: pretty; }
.iv-rule-why { margin: 0; font-size: 18px; line-height: 26px; color: var(--ink-muted); }
.iv-rule-detail summary { cursor: pointer; font-size: 18px; color: var(--ink-muted); min-height: 44px; display: flex; align-items: center; }
.iv-turn { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 18px; line-height: 26px; }
.iv-turn p { margin: 0; }
.iv-turn-say { color: var(--ink); font-weight: 600; }
.iv-turn-v { color: var(--ink-muted); font-weight: 600; }
.iv-rule .mt-actions .mt-go { height: 52px; font-size: 20px; }
