:root {
  --bg: #0f1115;
  --bg-soft: #171a21;
  --line: #262b35;
  --text: #e8eaf0;
  --muted: #8b93a5;
  --accent: #7cc4ff;
  --accent-strong: #3d9bf0;
  --user: #24303f;
  --bot: #1c2029;
  --danger: #ff8a80;
  --radius: 18px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fa;
    --bg-soft: #ffffff;
    --line: #e2e5ec;
    --text: #16181d;
    --muted: #6b7280;
    --accent: #1f7ae0;
    --accent-strong: #1668c4;
    --user: #dce9fb;
    --bot: #ffffff;
    --danger: #c62828;
  }
}

* {
  box-sizing: border-box;
}

/*
 * hidden 속성은 "화면에 없다"는 뜻인데, display:flex/grid 를 준 클래스가 이걸 덮어써서
 * 숨겼다고 생각한 요소가 계속 보이는 버그가 반복됐다(설정 패널, 플래시카드 판정 버튼).
 * 클래스마다 [hidden] 예외를 덧대는 대신 여기서 한 번에 막는다.
 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard',
    'Noto Sans KR', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ---------- 상단 ---------- */
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 12px 14px calc(12px) 14px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
  flex: none;
}

/*
 * 주제 선택 드롭다운. 브랜드 바로 옆(헤더 왼쪽)에 고정한다 —
 * 예전 가로 스크롤 칩 줄은 폰에서 아이콘들에 밀려 화면 밖으로 나가 터치가 안 됐다.
 * flex 로 남는 공간을 차지하되 min-width 로 최소 가독폭을 지키고, 좁으면 아이콘들이
 * 아랫줄로 내려간다(.topbar 의 flex-wrap).
 */
.topic-select {
  flex: 1 1 150px;
  min-width: 120px;
  max-width: 260px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #08121c;
  font-weight: 600;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-overflow: ellipsis;
  /* appearance:none 으로 기본 화살표가 사라져 "누를 수 있는 것"으로 안 보였다.
     캐럿을 직접 그려 넣는다(어두운 글자색과 같은 색). */
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%2308121c' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 10px 7px;
  padding-right: 28px;
}
.topic-select:focus {
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}

.chip {
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover {
  color: var(--text);
}
.chip[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: #08121c;
  font-weight: 600;
}

/* 사용설명서 */
.help-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
}
.help-section h3 {
  margin: 0 0 4px;
  font-size: 15px;
}
.help-section p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}

.ghost {
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
}
.ghost:hover {
  color: var(--text);
}

/* ---------- 설정 패널 ---------- */
.settings {
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 14px 16px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  /* 설정이 길어져도 대화 화면을 다 가리지 않게, 패널 안에서 위아래 스크롤 */
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 상대·목소리 설정을 첫 자리에 두고 살짝 강조한다 */
.setting-featured {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--bg);
}

.voice-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.voice-row select {
  flex: 1;
  min-width: 0;
}
.voice-row .act {
  white-space: nowrap;
}
.settings[hidden] {
  display: none;
}

.setting {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 190px;
}
.setting[hidden] {
  display: none;
}

.setting-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.setting select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 15px;
  font-family: inherit;
}
.setting select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.setting-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.setting-toggles {
  gap: 9px;
  justify-content: flex-start;
  flex: 1 1 260px;
}

.setting-account {
  width: 100%;
  flex-basis: 100%;
}
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}
.user-avatar[hidden] {
  display: none;
}
.user-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.user-info span:first-child {
  font-size: 14px;
  font-weight: 600;
}

.setting-memory {
  flex: 1 1 240px;
  max-width: 340px;
}
.memory-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  max-height: 120px;
  overflow-y: auto;
}
.memory-list .memory-empty {
  list-style: none;
  margin-left: -18px;
  color: var(--muted);
}
.setting-memory .act {
  align-self: flex-start;
}
.setting-memory .act[hidden] {
  display: none;
}

/* ---------- 대화 ---------- */
.stage {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 복습할 단어가 있을 때만 뜨는 얇은 배너. 본문을 누르면 바로 플래시카드, ✕ 로 닫는다. */
.review-banner {
  flex: none;
  display: flex;
  align-items: stretch;
  width: 100%;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.review-banner-go {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  padding: 10px 16px;
  cursor: pointer;
}
.review-banner-go:hover,
.review-banner-go:active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.review-banner-go::after {
  content: ' →';
  opacity: 0.6;
}

.review-banner-x {
  flex: none;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  /* 손가락으로 누를 수 있는 크기 확보 */
  padding: 0 16px;
  cursor: pointer;
}
.review-banner-x:hover,
.review-banner-x:active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.log {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  max-width: 340px;
  padding: 24px 0;
}
.empty-emoji {
  font-size: 44px;
  margin-bottom: 12px;
}
.empty-title {
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
}
.empty-sub {
  font-size: 14px;
  line-height: 1.65;
  margin: 0;
}

.bubble {
  max-width: min(560px, 84%);
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1.6;
  word-break: break-word;
  animation: rise 0.18s ease-out;
}

.bubble-text {
  white-space: pre-wrap;
}

.bubble-actions {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  flex-wrap: wrap;
}

.act {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 3px 9px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.5;
}
.act:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.bubble-panel {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}
.bubble-panel[hidden] {
  display: none;
}

.panel-row {
  display: block;
  margin-bottom: 6px;
}
.panel-row:last-child {
  margin-bottom: 0;
}
.panel-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin-bottom: 1px;
}
.panel-value {
  display: block;
  color: var(--text);
}
.panel-ok {
  margin: 0;
  color: var(--text);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.bubble.me {
  align-self: flex-end;
  background: var(--user);
  border-bottom-right-radius: 6px;
}

.bubble.you {
  align-self: flex-start;
  background: var(--bot);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.bubble.interim {
  align-self: flex-end;
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.bubble.error {
  align-self: center;
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 14px;
}

.typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 1.6em;
}
.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) {
  animation-delay: 0.2s;
}
.typing i:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes blink {
  0%,
  60%,
  100% {
    opacity: 0.25;
  }
  30% {
    opacity: 1;
  }
}

/* ---------- 하단 컨트롤 ---------- */
.controls {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.status {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
  text-align: center;
}

.mic-row {
  display: flex;
  justify-content: center;
}

.mic {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #08121c;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.mic:hover {
  background: var(--accent-strong);
}
.mic:active {
  transform: scale(0.94);
}
.mic:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.mic-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

.pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0;
}

.mic.listening {
  background: #ff6b6b;
  color: #fff;
}
.mic.listening .pulse {
  opacity: 1;
  animation: ring 1.4s ease-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.55);
}
@keyframes ring {
  to {
    box-shadow: 0 0 0 22px rgba(255, 107, 107, 0);
  }
}

.mic.speaking {
  background: #ffd166;
  color: #3a2a00;
}

.typebar {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 560px;
}
.typebar input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  min-width: 0;
}
.typebar input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.typebar button {
  flex: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 12px;
  padding: 0 16px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.typebar button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.toggle input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

/* ---------- 단어 탭 / 단어장 ---------- */
.word {
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s;
}
.word:hover,
.word:active {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}

.word-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
}
.word-base {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
/* 한국어 화면 = 쓰는 사람이 한국어 원어민. 학습자용 보조는 같은 말의 되풀이가 되므로 감춘다.
   JS 로 안 만드는 대신 여기서 감추는 이유: 화면 언어를 바꿔도 이미 그려진 말풍선의 버튼은
   다시 만들어지지 않아서, JS 로 걸러버리면 ko→en 으로 바꾼 사람에게 번역이 안 돌아온다.
   (lang 속성은 renderChrome 이 settings.uiLang 으로 계속 갱신한다) */
html[lang='ko'] .act[data-act='translate'],
html[lang='ko'] .hint-meaning,
html[lang='ko'] .word-rom {
  display: none;
}

.word-rom {
  font-size: 12px;
  color: var(--muted);
}
.word-buttons {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.wordbook-btn {
  position: relative;
}
.badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff6b6b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}
.badge[hidden] {
  display: none;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 20px;
}
.overlay[hidden] {
  display: none;
}

.overlay-box {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 18px;
  width: min(480px, 100%);
  max-height: min(640px, 90vh);
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 12px;
}

.overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.overlay-head h2 {
  margin: 0;
  font-size: 18px;
}
.overlay-head .ghost {
  width: auto;
  padding: 0 12px;
  font-size: 13px;
}

.overlay-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- 테스터 피드백 ---------- */
#feedbackText {
  width: 100%;
  resize: vertical;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
}
#feedbackText:focus {
  outline: none;
  border-color: var(--accent);
}

.feedback-attach {
  font-size: 13px;
  color: var(--muted);
}

/* 무엇이 함께 전송되는지 그대로 보여준다 */
.feedback-preview {
  margin: 0;
  max-height: 130px;
  overflow-y: auto;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.feedback-preview[hidden] {
  display: none;
}

.feedback-status {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--accent);
}
.feedback-status[hidden] {
  display: none;
}

.primary {
  border: none;
  background: var(--accent);
  color: #08121c;
  font-weight: 600;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
}
.primary:hover {
  background: var(--accent-strong);
}
.primary:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.word-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.word-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
}
.word-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.word-row-meaning {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 반복 학습 카드 ---------- */
.review-box {
  align-items: stretch;
  text-align: center;
}
.review-word {
  font-size: 40px;
  font-weight: 700;
  margin: 28px 0;
}
.review-meaning {
  font-size: 17px;
  margin: 0 0 10px;
}
.review-example {
  font-size: 14px;
  color: var(--muted);
  white-space: pre-line;
  line-height: 1.6;
  margin: 0 0 16px;
}
.review-judge {
  display: flex;
  gap: 10px;
}
.review-judge button {
  flex: 1;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.judge-again {
  background: color-mix(in srgb, #ff6b6b 22%, transparent);
  color: #ff6b6b;
}
.judge-gotit {
  background: color-mix(in srgb, #34c759 22%, transparent);
  color: #34c759;
}

/* ---------- 단어 탭 안내 (처음 한 번만) ---------- */
.tap-hint {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

/* ---------- 저장한 단어 강조 ---------- */
.word.known {
  text-decoration: underline dotted var(--accent) 2px;
  text-underline-offset: 3px;
}

/* ---------- 답변 힌트 ---------- */
.hint-btn {
  flex: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.hint-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hint-panel {
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--bg);
}
.hint-panel[hidden] {
  display: none;
}
.hint-title {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
#hintList {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hint-chip {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 8px 11px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hint-chip:hover {
  border-color: var(--accent);
}
.hint-ko {
  font-size: 15px;
  color: var(--text);
}
.hint-meaning {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 학습 기록 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-tile {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 12px;
  text-align: center;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

/* ---------- 단어장 검색·정렬 ---------- */
.word-tools {
  display: flex;
  gap: 8px;
}
.word-tools[hidden] {
  display: none;
}
.word-tools input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  min-width: 0;
}
.word-tools select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 8px;
  font-size: 13px;
  font-family: inherit;
}

/* ---------- 온보딩 ---------- */
/* 2차 사전 테스트 안내 (2026-09-18~10-18). 기간이 끝나면 이 규칙도 함께 지운다. */
.notice-box {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent-strong) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-strong) 34%, transparent);
  font-size: 14px;
  line-height: 1.65;
}
.notice-box p {
  margin: 0 0 8px;
}
.notice-box p:last-child {
  margin-bottom: 0;
}
.notice-box .notice-period {
  font-weight: 700;
  color: var(--accent-strong);
}

.onboard-title {
  margin: 4px 0 2px;
  font-size: 20px;
  text-align: center;
}

.onboard-box {
  overflow-y: auto;
}

/* 🔴 시작 버튼은 내용이 아무리 길어져도 항상 보여야 한다.
   안내 블록(216px)이 들어가면서 375x667 화면에서 버튼이 화면 밖 236px 로 밀려,
   첫 방문자가 스크롤할 생각을 못 하면 **시작 자체를 못 했다**(적대 검증 실증, 2026-09-05).
   박스는 원래 스크롤되지만 그걸 알 방법이 없었다. 버튼을 아래에 붙여 둔다.
   안내를 지운 뒤에도 이 규칙은 남길 것 — 온보딩은 이미 375x667 에서 10px 여유뿐이라,
   무엇이든 한 줄만 늘어도 같은 사고가 난다. */
#onboardStart {
  position: sticky;
  bottom: -18px; /* .overlay-box 의 padding 만큼 당겨 바닥에 붙인다 */
  margin-bottom: 0;
  flex-shrink: 0;
  box-shadow: 0 -14px 18px -6px var(--bg-soft);
}

/* 고정된 버튼이 마지막 선택지(하나 — 차분한 선생님 같은 친구)를 덮지 않게 여백을 준다 */
.onboard-box .onboard-steps:last-of-type,
.onboard-box .onboard-pick:last-of-type {
  margin-bottom: 6px;
}

/* 안내 오버레이(재방문자용). 가로 화면(568x320)에서 본문이 길어지면 「알겠습니다」가
   박스 밖 30px 로 밀려 누를 수 없었다(적대 검증 실측). 본문만 스크롤시키고 버튼은 남긴다.
   기간이 끝나면 .notice-box 규칙과 함께 지운다. */
#noticeOverlay .notice-box {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}
#noticeClose {
  flex-shrink: 0;
}

.onboard-pick {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.onboard-steps {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 15px;
  line-height: 1.55;
}
.onboard-steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

/* ---------- 배너 ---------- */
.banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  /* 헤더 실제 높이 기준(JS 가 --header-h 를 심는다). 예전엔 한 줄 헤더 높이 58px 를
     박아뒀는데, 헤더가 두 줄이 되는 폰에서 배너가 헤더를 덮어 아이콘을 가렸다. */
  top: calc(var(--header-h, 58px) + 12px);
  max-width: min(520px, calc(100vw - 32px));
  background: var(--danger);
  color: #fff;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  /* .overlay(20) 보다 위여야 한다. 아래에 깔리면 단어장·복습·온보딩이 열려 있는 동안
     배너가 반투명 스크림에 가려 보이지도, 눌리지도 않는다(적대 검증 지적, 2026-08-31).
     배너는 잠깐 떴다 사라지고 탭하면 닫히므로 오버레이를 오래 가리지 않는다. */
  z-index: 30;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
/* 안내용 배너 — 오류가 아니라 팁·공지일 때. 빨간 배경이면 큰일 난 것처럼 보인다는
   대표 피드백(2026-08-23)으로 추가. 양쪽 테마에서 흰 글씨가 잘 읽히는 파랑 계열. */
.banner.info {
  background: var(--accent-strong);
}
.banner-action {
  display: block;
  margin-top: 10px;
  width: 100%;
  padding: 9px 14px;
  border: 0;
  border-radius: 9px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
/* 오류(빨강) 배너에 붙는 버튼은 글자색을 빨강 계열로 — 파란 글자가 뜨면 어색하다 */
.banner:not(.info) .banner-action {
  color: var(--danger);
}
.banner[hidden] {
  display: none;
}
