:root {
  color-scheme: dark;
  --outer: #090d12;
  --bg: #0f151c;
  --panel: #161e27;
  --panel-2: #1d2732;
  --panel-hover: #24313e;
  --text: #eef3f6;
  --muted: #8d9aa7;
  --line: #2b3743;
  --line-strong: #40515f;
  --accent: #49c8bb;
  --accent-strong: #6bd8cd;
  --accent-soft: #12302f;
  --accent-ink: #071514;
  --good: #55d29a;
  --bad: #ff6b78;
  --blue: #7aa7e8;
  --shadow: 0 12px 32px rgba(0, 0, 0, .22);
}

body[data-theme="light"] {
  color-scheme: light;
  --outer: #e7ecef;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-2: #edf2f4;
  --panel-hover: #e6edef;
  --text: #172126;
  --muted: #667580;
  --line: #d7e0e4;
  --line-strong: #b9c8ce;
  --accent: #087f78;
  --accent-strong: #066c67;
  --accent-soft: #dff3f0;
  --accent-ink: #f6fffd;
  --good: #16865b;
  --bad: #cc4050;
  --blue: #356fae;
  --shadow: 0 12px 32px rgba(23, 33, 38, .09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--outer);
  color: var(--text);
  font-family: Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overscroll-behavior-y: none;
}

button, select, textarea, input { font: inherit; }
button { cursor: pointer; }
button, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled {
  cursor: not-allowed;
  opacity: .42;
}
button:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 40%, transparent);
  outline-offset: 2px;
}

.app {
  position: relative;
  width: min(430px, 100vw);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 16px max(20px, env(safe-area-inset-bottom));
  background: var(--bg);
  overflow-x: hidden;
}

@media (min-width: 700px) {
  body {
    display: grid;
    place-items: start center;
  }

  .app {
    min-height: min(100dvh, 932px);
    border-inline: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
}

.hidden { display: none !important; }

.product-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(56px + env(safe-area-inset-top));
  margin-inline: -16px;
  padding: env(safe-area-inset-top) 16px 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
}

.product-brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.product-name {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.product-name strong { font-size: 15px; }
.product-name small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.hero {
  padding: 28px 2px 22px;
}

.hero h1 {
  max-width: 370px;
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 850;
}

.hero p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
}

.section-title {
  margin: 0 0 9px 2px;
  font-size: 13px;
  font-weight: 800;
}

.mode-title { margin-top: 20px; }

.setup, .controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 3%, transparent);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.curriculum-field { grid-column: 1 / -1; }

select:disabled {
  cursor: not-allowed;
  opacity: .55;
}

select, button, .import-label {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0 12px;
  font-weight: 750;
  transition: border-color .14s ease, background .14s ease, color .14s ease, transform .14s ease;
}

button:hover, .import-label:hover {
  border-color: var(--line-strong);
  background: var(--panel-hover);
}
button:active { transform: scale(.98); }

.quick-controls {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.icon-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  width: 32px;
  min-width: 32px;
  border-radius: 6px;
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
  font-size: 11px;
}

#sfxLabel, #themeLabel { display: none; }

.icon-toggle[aria-pressed="false"] {
  color: var(--muted);
  opacity: .72;
}

.toggle-icon {
  width: 15px;
  font-size: 15px;
  line-height: 1;
  text-align: center;
}

.effect-layer {
  position: fixed;
  z-index: 50;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.score-pop {
  position: absolute;
  left: 50%;
  top: 128px;
  color: var(--good);
  font-size: 24px;
  font-weight: 950;
  text-shadow: 0 2px 10px var(--bg), 0 0 18px color-mix(in srgb, var(--good) 45%, transparent);
  transform: translateX(-50%);
  animation: scorePop .72s cubic-bezier(.2,.85,.25,1) both;
}

.score-pop.bad {
  color: var(--bad);
  text-shadow: 0 2px 10px var(--bg), 0 0 18px rgba(255, 93, 104, .4);
}

.score-pop.combo-pop { color: var(--accent); }

@keyframes scorePop {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(.72); }
  24% { opacity: 1; transform: translate(-50%, -3px) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -38px) scale(.94); }
}

.start-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 0;
  border-block: 1px solid var(--line);
}

.start-card {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: inherit;
  text-decoration: none;
  padding: 13px 4px;
  border: 0;
  border-radius: 0;
  text-align: left;
  background: transparent;
}

.start-card + .start-card { border-top: 1px solid var(--line); }
.start-card:hover {
  padding-inline: 8px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
}

.start-card-copy {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.start-card strong {
  font-size: 16px;
  line-height: 1.15;
}

.start-card-copy > span, .home-summary small, .hud small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.start-arrow {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
}

.home-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.home-ranking-card { margin-top: 8px; }

.home-summary div {
  min-width: 0;
  padding: 14px 8px 4px;
  text-align: center;
}

.home-summary div + div {
  border-left: 0;
}

.home-summary span {
  display: block;
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.home-summary small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-notice {
  margin: 8px 2px 0;
  color: var(--bad);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.data-tools {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.data-tools summary {
  padding: 14px 2px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  list-style-position: inside;
}

.data-tools[open] summary { color: var(--text); }
.data-tools .utility-panel { padding-bottom: 12px; }
.danger-action { color: var(--bad); }

.topbar {
  position: relative;
  min-height: 178px;
  margin-bottom: 8px;
  padding-top: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 225px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.08;
}

.ghost {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  background: var(--panel);
  font-size: 20px;
}

.hud {
  position: absolute;
  inset: 72px 0 auto 0;
  height: 100px;
  pointer-events: none;
}

.score-display {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  min-width: 132px;
  text-align: center;
}

.score-display strong {
  display: block;
  color: var(--accent);
  font-size: 58px;
  line-height: .9;
  font-weight: 900;
  text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 18%, transparent);
}

.score-display.score-hit strong {
  animation: scoreHit .3s cubic-bezier(.2,.9,.3,1);
}

@keyframes scoreHit {
  0% { transform: scale(1); }
  45% { transform: scale(1.18); filter: brightness(1.35); }
  100% { transform: scale(1); }
}

.score-display span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  padding: 4px 10px;
  border: 1px solid color-mix(in srgb, var(--good) 48%, transparent);
  border-radius: 999px;
  color: var(--good);
  background: color-mix(in srgb, var(--good) 8%, transparent);
  font-size: 13px;
  font-weight: 850;
}

.score-display.combo-hit span {
  animation: comboHit .4s cubic-bezier(.2,.9,.2,1);
}

@keyframes comboHit {
  0% { transform: scale(.82); }
  55% { transform: scale(1.16); box-shadow: 0 0 18px color-mix(in srgb, var(--good) 45%, transparent); }
  100% { transform: scale(1); }
}

.timer-display {
  position: absolute;
  top: 8px;
  right: 0;
  min-width: 126px;
  text-align: right;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--blue) 42%, transparent);
  border-radius: 6px;
  background: var(--panel);
}

.timer-display strong {
  display: block;
  color: var(--blue);
  font-size: 25px;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.timer-display.danger {
  border-color: rgba(255, 93, 104, .65);
  background: rgba(255, 93, 104, .1);
}

.timer-display.danger strong {
  color: #ff7b83;
}

.timer-display.urgent {
  animation: urgencyPulse .45s infinite alternate;
}

.timer-display.time-gain {
  animation: timeGain .44s cubic-bezier(.2,.9,.2,1);
}

@keyframes timeGain {
  0% { transform: scale(1); }
  45% { transform: scale(1.08); border-color: var(--good); box-shadow: 0 0 20px color-mix(in srgb, var(--good) 32%, transparent); }
  100% { transform: scale(1); }
}

@keyframes urgencyPulse {
  from { transform: scale(1); box-shadow: 0 0 0 rgba(255, 93, 104, 0); }
  to { transform: scale(1.04); box-shadow: 0 0 24px rgba(255, 93, 104, .38); }
}

.statusline {
  display: grid;
  gap: 4px;
  min-height: 45px;
  margin: 0 0 10px;
  padding: 3px 2px 8px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.statusline strong {
  color: var(--text);
  font-size: 13px;
}

.board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
}

.result-view {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 16px;
  min-height: 480px;
  padding-top: 8px;
  text-align: center;
}

.result-view h2 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(54px, 14vw, 72px);
  line-height: .9;
}

.result-metrics {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.result-metrics div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.result-metrics span {
  display: block;
  font-size: 42px;
  font-weight: 900;
}

.leaderboard {
  width: 100%;
  max-width: none;
  text-align: left;
}

.ranking-page {
  min-height: calc(100dvh - 57px);
  padding: 22px 0 max(24px, env(safe-area-inset-bottom));
}

.ranking-page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.ranking-page-head .eyebrow { margin-bottom: 4px; }

.ranking-page-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.ranking-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 24px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.ranking-tab {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.ranking-tab.active {
  color: var(--text);
  background: var(--panel-hover);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.ranking-page-board { margin-top: 24px; }

.ranking-page-board h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.ranking-page-board .leaderboard-list { max-height: none; }

.leaderboard h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.leaderboard-list {
  max-height: 286px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  min-height: 45px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.leaderboard-item:last-child { border-bottom: 0; }
.leaderboard-item strong { color: var(--text); }
.leaderboard-item span:nth-child(2) { text-align: right; color: var(--text); font-weight: 800; }
.leaderboard-item span:last-child { text-align: right; }

.leaderboard-item.current {
  background: var(--accent-soft);
  color: var(--accent);
}

#retryBtn {
  width: 100%;
  min-height: 50px;
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 16px;
  font-weight: 900;
}

#retryBtn:hover { background: var(--accent-strong); }

.leaderboard-item.current strong,
.leaderboard-item.current span:nth-child(2) { color: var(--accent); }

.leaderboard-separator,
.leaderboard-empty {
  padding: 10px;
  color: var(--muted);
  text-align: center;
}

.card {
  --enter-delay: 0ms;
  min-height: clamp(84px, 13.2dvh, 112px);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px 10px;
  line-height: 1.22;
  font-size: clamp(18px, 5.8vw, 25px);
  font-weight: 820;
  word-break: keep-all;
  overflow-wrap: anywhere;
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  transition: transform .12s ease, border-color .12s ease, background .12s ease, opacity .2s ease;
  animation: cardEnter .24s cubic-bezier(.2,.8,.25,1) both;
  animation-delay: var(--enter-delay);
}

@keyframes cardEnter {
  from { opacity: 0; transform: scale(.9) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--panel-hover);
}

.card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent), 0 8px 22px color-mix(in srgb, var(--accent) 12%, transparent);
  transform: scale(.97);
}

.card.good {
  border-color: var(--good);
  background: color-mix(in srgb, var(--good) 14%, transparent);
  animation: correctImpact .25s cubic-bezier(.15,.85,.3,1) both;
}

.card.bad {
  border-color: var(--bad);
  background: rgba(255, 93, 104, .12);
  animation: wrongImpact .34s ease both;
}

@keyframes correctImpact {
  0% { transform: scale(.97); }
  45% { transform: scale(1.075); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent), 0 0 28px color-mix(in srgb, var(--good) 28%, transparent); }
  100% { transform: scale(.93); opacity: .25; }
}

@keyframes wrongImpact {
  0%, 100% { transform: translateX(0); }
  22% { transform: translateX(-8px) rotate(-1deg); }
  45% { transform: translateX(7px) rotate(1deg); }
  68% { transform: translateX(-4px); }
  84% { transform: translateX(3px); opacity: .75; }
  100% { transform: scale(.93); opacity: .22; }
}

.app.impact-correct { animation: appImpactCorrect .24s ease; }
.app.impact-wrong { animation: appImpactWrong .3s ease; }

@keyframes appImpactCorrect {
  0%, 100% { box-shadow: inherit; }
  45% { box-shadow: inset 0 0 42px color-mix(in srgb, var(--good) 16%, transparent); }
}

@keyframes appImpactWrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

.study-area {
  display: grid;
  gap: 12px;
}

.study-card {
  min-height: 410px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
  border-color: var(--line-strong);
  background: var(--panel);
  box-shadow: none;
}

.study-card strong {
  font-size: clamp(34px, 12vw, 60px);
  line-height: 1.1;
}

.study-card span, .study-card small {
  color: var(--muted);
}

.study-card small {
  max-width: 340px;
  padding-inline: 12px;
  line-height: 1.55;
}

.study-actions, .utility-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.study-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.study-actions button { min-height: 48px; }
#knowBtn {
  border-color: color-mix(in srgb, var(--good) 60%, var(--line));
  color: var(--good);
}
#weakBtn {
  border-color: color-mix(in srgb, var(--bad) 50%, var(--line));
  color: var(--bad);
}
#nextStudyBtn {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent);
}

.order-area {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
}

.order-round-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}

.order-round-head > div {
  display: grid;
  gap: 3px;
}

.order-round-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.order-round-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.order-shuffle {
  width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 20px;
}

.order-list {
  display: grid;
  gap: 7px;
}

.order-list.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.order-item {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.order-drag-handle {
  display: grid;
  grid-template-columns: 18px 1fr;
  place-items: center;
  width: 42px;
  min-height: 48px;
  padding: 0 5px;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.order-drag-handle:active { cursor: grabbing; }

.order-grip {
  color: var(--line-strong);
  font-size: 15px;
  line-height: 1;
}

.order-number {
  display: grid;
  place-items: center;
  width: 18px;
  height: 28px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.order-item.dragging {
  z-index: 2;
  opacity: .56;
}

.order-item.drag-target-before::before,
.order-item.drag-target-after::after {
  position: absolute;
  z-index: 3;
  right: 0;
  left: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  content: "";
  pointer-events: none;
}

.order-item.drag-target-before::before { top: -5px; }
.order-item.drag-target-after::after { bottom: -5px; }

.order-card {
  min-width: 0;
  min-height: 55px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  line-height: 1.3;
  font-size: 14px;
  font-weight: 800;
  background: var(--panel);
}

.order-item.selected .order-card {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 14%, transparent);
}

.order-item.correct-position .order-card {
  border-color: color-mix(in srgb, var(--good) 65%, var(--line));
  color: var(--good);
}

.order-item.wrong-position .order-card {
  border-color: color-mix(in srgb, var(--bad) 60%, var(--line));
  color: var(--bad);
}

.order-move-controls {
  display: grid;
  grid-template-columns: repeat(2, 34px);
  gap: 4px;
}

.order-move-controls button {
  width: 34px;
  min-height: 42px;
  padding: 0;
  color: var(--muted);
  font-size: 16px;
}

.order-answer {
  display: grid;
  gap: 6px;
  margin: 2px 0 0;
  padding: 12px 2px;
  border-block: 1px solid var(--line);
}

.order-answer strong {
  color: var(--accent);
  font-size: 12px;
}

.order-answer span {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.order-answer small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.order-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.order-actions button {
  min-height: 48px;
}

#orderCheckBtn,
#orderNextBtn {
  grid-column: 1 / -1;
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent);
}

#orderRetryBtn:not(.hidden) + #orderNextBtn:not(.hidden) {
  grid-column: auto;
}

.classification-area {
  display: grid;
  gap: 12px;
  padding-bottom: 14px;
}

.classification-head {
  display: grid;
  gap: 3px;
  min-height: 46px;
  align-content: center;
}

.classification-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.classification-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.classification-card {
  min-height: 190px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 13px;
  padding: 18px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  text-align: center;
}

.classification-card small,
.classification-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.classification-card strong {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(30px, 10vw, 46px);
  line-height: 1.15;
}

.classification-card.correct {
  border-color: color-mix(in srgb, var(--good) 70%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--good) 12%, transparent);
}

.classification-card.wrong {
  border-color: color-mix(in srgb, var(--bad) 70%, var(--line));
}

.classification-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.classification-targets button {
  min-height: 62px;
  padding: 8px;
  overflow-wrap: anywhere;
  line-height: 1.25;
  font-size: 13px;
  font-weight: 800;
}

.classification-targets button:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.classification-targets .correct-target {
  border-color: var(--good);
  color: var(--good);
  background: color-mix(in srgb, var(--good) 9%, var(--panel));
  opacity: 1;
}

.classification-targets .wrong-target {
  border-color: var(--bad);
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 9%, var(--panel));
  opacity: 1;
}

.classification-note {
  display: grid;
  gap: 4px;
  min-height: 48px;
  margin: 0;
  padding: 9px 2px;
  border-top: 1px solid var(--line);
}

.classification-note strong {
  color: var(--accent);
  font-size: 12px;
}

.classification-note span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.utility-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.utility-panel > button,
.utility-panel > .import-label {
  min-height: 40px;
  font-size: 12px;
}

.utility-panel .danger-action { grid-column: 1 / -1; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.import-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 14px;
}

.import-label input { display: none; }

#jsonBox {
  width: 100%;
  min-height: 92px;
  margin-top: 10px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  padding: 10px;
}

.app-notice {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: var(--panel-2);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .16s ease, transform .16s ease;
}

.app-notice.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-notice.error {
  border-color: color-mix(in srgb, var(--bad) 65%, var(--line));
  color: var(--bad);
}

@media (max-width: 380px) {
  .app { padding-inline: 12px; }
  .product-bar {
    margin-inline: -12px;
    padding-inline: 12px;
  }
  .icon-toggle {
    width: 34px;
    min-height: 34px;
    padding: 0;
  }
  #sfxLabel, #themeLabel { display: none; }
  .product-name small { display: none; }
  .order-item { grid-template-columns: 38px minmax(0, 1fr) 64px; gap: 5px; }
  .order-drag-handle { width: 38px; padding-inline: 3px; }
  .order-move-controls { grid-template-columns: repeat(2, 30px); }
  .order-move-controls button { width: 30px; }
  .hero { padding-top: 30px; }
  .hero h1 { font-size: 26px; }
  .setup {
    grid-template-columns: 1fr;
  }
  .home-summary small { font-size: 10px; }
  .topbar { min-height: 174px; }
  .score-display { left: 45%; }
  .score-display strong { font-size: 52px; }
  .timer-display { min-width: 118px; padding-inline: 8px; }
  .timer-display strong { font-size: 22px; }
  .card {
    min-height: 80px;
    font-size: clamp(17px, 5.7vw, 22px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
