/* Quiz of Legend — 768px 기준 모바일 / 데스크톱(태블릿 포함), 공통 밝은 테마 */
/* 공통 글꼴을 직접 제공해 운영체제별 기본 글꼴 차이를 줄인다. */
@font-face {
  font-family: "QOL Pretendard";
  src: url("/static/fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --text: #1b2130;
  --muted: #5e6880;
  --line: #d9deea;
  --primary: #4f6df5;
  --primary-ink: #ffffff;
  --primary-soft: #e4e9ff;
  --accent: #ff8f3c;
  --ok: #22a06b;
  --ok-soft: #dcf5ea;
  --bad: #e5484d;
  --bad-soft: #fde2e3;
  --shadow: 0 6px 20px rgba(28, 38, 70, 0.08);
  --radius: 16px;
  --tap: 44px;
  --sidebar: 184px;
  color-scheme: light;
  /* 티어 색 */
  --tier-stone: #8d949e;
  --tier-bronze: #b4762d;
  --tier-silver: #7f8fa6;
  --tier-gold: #e0a921;
  --tier-platinum: #2fb8a6;
  --tier-diamond: #4ea3ff;
  --tier-master: #9b5cf6;
  --tier-grandmaster: #ef4f7a;
  --tier-legend: #ff7a00;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "QOL Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
button, input, select { -webkit-appearance: none; appearance: none; }
button, a { -webkit-tap-highlight-color: transparent; }
img, svg { flex-shrink: 0; }
.card, .row > *, .question-layout > *, .contestant { min-width: 0; }
p, strong, td, th, .choice, .who { overflow-wrap: anywhere; }
button { cursor: pointer; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---- 헤더 / 내비 ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { min-height: var(--tap); display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.01em; text-decoration: none; color: var(--text); }
.brand .logo { width: 30px; height: 30px; }
.brand small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.08em; }
.who { max-width: 40%; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.who strong { color: var(--text); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav > a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; font-size: 12px; text-decoration: none; color: var(--muted); font-weight: 600;
}
.nav > a .ico { width: 22px; height: 22px; }
.nav > a .ico svg { display: block; width: 100%; height: 100%; }
.nav > a.active { color: var(--primary); }

main { width: 100%; max-width: 1120px; margin: 0 auto; padding: 16px; }
/* 너비만으로 분류하므로 기기 이름이나 포인터 종류에 영향을 받지 않는다. */
@media (min-width: 768px) {
  body { padding-left: var(--sidebar); padding-bottom: 24px; }
  .nav {
    top: 0; bottom: 0; right: auto; width: var(--sidebar);
    display: flex; flex-direction: column; gap: 8px; padding: 24px 12px;
    border-top: 0; border-right: 1px solid var(--line); overflow-y: auto;
  }
  .nav > a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 52px; padding: 12px; border-radius: 12px; font-size: 15px; }
  .nav > a.active { background: var(--primary-soft); }
  main { padding: 24px; }
}

/* ---- 공통 컴포넌트 ---- */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 20px; }
.card h3 { margin: 16px 0 8px; font-size: 15px; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); font-weight: 700; transition: transform .06s ease, background .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.accent { background: var(--accent); color: #1b1200; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 17px; }

.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.input {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2);
}

select.input { padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%235e6880' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: var(--tap); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); font-weight: 700;
}
.chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.chip:disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }

.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s ease; }
.progress.opp > span { background: var(--accent); }

.alert { padding: 12px 14px; border-radius: 12px; background: var(--primary-soft); font-weight: 600; }
.alert.bad { background: var(--bad-soft); }
.alert.ok { background: var(--ok-soft); }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px;
  font-weight: 700; box-shadow: var(--shadow); z-index: 20; max-width: 90vw;
}

@media (min-width: 768px) {
  .toast { left: calc(50% + var(--sidebar) / 2); bottom: 24px; max-width: calc(100vw - var(--sidebar) - 48px); }
}

/* ---- 홈 ---- */
.hero { text-align: center; padding: 26px 18px; background: linear-gradient(135deg, var(--primary) 0%, #7c5cff 100%); color: #fff; }
.hero h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
.hero p { margin: 0; opacity: .9; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-grid .btn { flex-direction: column; min-height: 96px; font-size: 18px; }
.mode-grid .btn span.ico { font-size: 30px; }
.mode-grid .btn small { font-weight: 500; font-size: 12px; opacity: .85; }

/* ---- 문제 ---- */
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; color: var(--muted); font-weight: 700; }
.q-text { font-size: 19px; font-weight: 700; line-height: 1.55; margin: 8px 0 16px; white-space: pre-line; }
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  min-height: 54px; padding: 12px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface-2); font-size: 16px; font-weight: 600;
}
.choice .num {
  flex: 0 0 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 800;
}
.choice:not(:disabled):hover { border-color: var(--primary); }
.choice.selected { border-color: var(--primary); }
.choice.correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice.opp::after { content: "상대"; margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; }
.choice:disabled { cursor: default; }

.feedback { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.feedback .verdict { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.feedback.ok .verdict { color: var(--ok); }
.feedback.bad .verdict { color: var(--bad); }
.feedback .explain { white-space: pre-line; }
.review-note { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.review-note textarea { width: 100%; min-height: 110px; resize: vertical; }
.review-text { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 400px; }
.admin-table { width: 100%; overflow-wrap: anywhere; }
.admin-page [role="tablist"] { margin-bottom: 16px; }

.rate { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.rate button { min-height: var(--tap); padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; }
.rate button[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); }

/* 실제 헤더·탭 높이는 layout.js에서 측정한다. dvh 미지원 브라우저도 회전을 반영한다. */
:root { --visible-height: var(--viewport-height, 100vh); }
@supports (height: 100dvh) { :root { --visible-height: min(var(--viewport-height, 100dvh), 100dvh); } }
body.quiz-screen { height: var(--visible-height); min-height: 0; padding-bottom: 0; overflow: hidden; }
.quiz-screen > .sr-only { top: 0; left: 0; }
.quiz-screen .topbar { flex-wrap: nowrap; }
.quiz-screen .topbar .who { flex: 0 1 auto; width: auto; }
.quiz-screen .topbar .account-actions, .quiz-screen .topbar .account-session { display: none; }
.quiz-screen #app {
  height: calc(var(--visible-height) - var(--header-height) - var(--tabs-height));
  display: flex; flex-direction: column; gap: 8px; padding: 10px;
  container-type: size; container-name: quiz;
}
.quiz-screen #qcard { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px; margin: 0; }
.quiz-screen .battle-review { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.quiz-screen .q-head { flex: none; margin: 0; flex-wrap: nowrap; font-size: 12px; }
.quiz-screen .q-head > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quiz-screen .q-head > :last-child { flex-shrink: 0; }
.quiz-screen #qcard > .progress { flex: 0 0 5px; }
.quiz-screen .question-layout { display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 0; gap: 8px; }
.quiz-screen .question-prompt { display: contents; }
.quiz-screen .q-text { order: 1; }
.quiz-screen .choices { order: 2; flex: none; }
.quiz-screen .feedback { order: 3; }
.quiz-screen .q-text { min-height: 1.55em; flex: 1; margin: 0; overflow-y: auto; font-size: clamp(14px, 2.7cqh, 20px); }
.scroll-hint {
  /* 스크롤 끝에 다다르면 그림자가 사라져 남은 내용을 알 수 있다. */
  background: linear-gradient(var(--surface), var(--surface)) center top / 100% 12px no-repeat local,
    linear-gradient(var(--surface), var(--surface)) center bottom / 100% 12px no-repeat local,
    linear-gradient(rgba(28,38,70,.16), transparent) center top / 100% 8px no-repeat scroll,
    linear-gradient(transparent, rgba(28,38,70,.16)) center bottom / 100% 8px no-repeat scroll;
}
.quiz-screen .keyboard-hint { display: none; flex: none; margin: 0; font-size: 11px; }
.quiz-screen .choices { gap: 6px; }
.quiz-screen .choice { min-height: 54px; padding: 8px 10px; gap: 8px; font-size: clamp(13px, 2.3cqh, 16px); }
.quiz-screen .choice .num { flex-basis: 24px; height: 24px; font-size: 12px; }
.quiz-screen .feedback { flex: 0 1 auto; min-height: 76px; max-height: 60%; margin: 0; padding: 6px 8px; display: flex; flex-direction: column; }
.feedback-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; flex-shrink: 0; }
.quiz-screen .feedback .verdict { margin: 0; font-size: 14px; }
.explain-toggle { min-height: 44px; flex-shrink: 0; padding: 4px 8px; font-size: 12px; }
.quiz-screen .explain { min-height: 1.5em; max-height: 4.5em; overflow-y: auto; font-size: 13px; }
.quiz-screen .feedback.expanded { flex: 2; max-height: 80%; }
.quiz-screen .question-prompt.explanation-open > .q-text { flex: 0 1 24px; }
.quiz-screen .feedback.expanded .explain { max-height: none; }
.quiz-screen .after { flex: none; display: flex; flex-direction: column; gap: 6px; }
.rating-tools { display: flex; align-items: center; gap: 6px; position: relative; }
.rate { flex-wrap: nowrap; margin: 0; min-width: 0; }
.rate button { min-width: 44px; }
.quiz-screen .rate-label { display: none; }
.question-actions { display: flex; align-items: center; gap: 6px; }
.question-actions .btn { flex: 1; min-height: 44px; padding: 6px 10px; }
.question-actions a { font-size: 12px; white-space: nowrap; }
.lp-note { font-size: 11px; }
.review-note { position: relative; margin: 0; padding: 0; border: 0; }
.review-note summary { cursor: pointer; list-style: none; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 12px; }
.review-note summary::-webkit-details-marker { display: none; }
.review-note form { padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-top: 6px; }
.quiz-screen .review-note { position: static; }
.quiz-screen .review-note form { position: absolute; bottom: calc(100% + 6px); right: 0; z-index: 5; width: min(400px, 100%); max-height: calc(var(--visible-height) - var(--header-height) - var(--tabs-height) - 120px); overflow-y: auto; box-shadow: var(--shadow); }
.quiz-screen .battle-status { flex: none; padding: 8px 12px; margin: 0; }
.quiz-screen .battle-status h2 { font-size: 15px; }
.quiz-screen .battle-progress { margin-top: 4px; gap: 6px; }
.quiz-screen .contestant { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 6px; padding: 4px 8px; }
.quiz-screen .contestant > .small { grid-column: 1; grid-row: 1; }
.quiz-screen .contestant strong { grid-column: 2; grid-row: 1; }
.quiz-screen .contestant .row { display: contents; margin: 0; }
.quiz-screen .contestant .row > :first-child { display: none; }
.quiz-screen .contestant .row > :last-child { grid-column: 3; grid-row: 1; }
.quiz-screen .contestant .tier, .quiz-screen .contestant .progress { grid-column: 1 / -1; }
.quiz-screen .contestant .progress { height: 5px; }
.quiz-screen .contestant strong { font-size: 12px; }
@media (min-width: 768px) {
  .quiz-screen .question-layout { display: grid; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  .quiz-screen .question-prompt { min-height: 0; display: flex; flex-direction: column; gap: 6px; }
  .quiz-screen .keyboard-hint { display: block; }
  .quiz-screen .question-prompt.explanation-open > .q-text { flex: 1 1 24px; }
  .quiz-screen .choices { align-self: start; }
}
@media (min-width: 1100px) {
  .quiz-screen #app[data-quiz-size="large"] .rate-label { display: inline; }
}
/* JS 단계는 컨테이너 쿼리를 지원하지 않는 브라우저에도 같은 축소를 적용한다. */
.quiz-screen #app:not([data-quiz-size="large"]) .choice { min-height: 44px; padding: 4px 8px; }
.quiz-screen #app:not([data-quiz-size="large"]) .q-text { font-size: 16px; }
.quiz-screen #app:not([data-quiz-size="large"]) .choice { font-size: 13px; }
.quiz-screen #app[data-quiz-size="medium"] #qcard { gap: 6px; padding: 10px; }
.quiz-screen #app[data-quiz-size="small"] .choice { font-size: 12px; line-height: 1.3; }
.quiz-screen #app:not([data-quiz-size="large"]) .lp-note { display: none; }
.quiz-screen #app:not([data-quiz-size="large"]) .battle-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quiz-screen #app:not([data-quiz-size="large"]) .question-actions > span { display: none; }
.quiz-screen .contestant strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quiz-screen #app[data-quiz-size="small"] #qcard,
.quiz-screen #app[data-quiz-size="tiny"] #qcard { gap: 2px; padding: 4px; }
.quiz-screen #app[data-quiz-size="small"] .keyboard-hint,
.quiz-screen #app[data-quiz-size="tiny"] .keyboard-hint { display: none; }
.quiz-screen #app[data-quiz-size="small"] .explain,
.quiz-screen #app[data-quiz-size="tiny"] .explain { max-height: 3em; }
.quiz-screen #app .feedback.expanded .explain { max-height: none; }
.quiz-screen #app[data-quiz-size="tiny"] { padding: 4px 8px; gap: 4px; }
.quiz-screen #app[data-quiz-size="tiny"] .question-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; }
.quiz-screen #app[data-quiz-size="tiny"] .question-prompt { min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.quiz-screen #app[data-quiz-size="tiny"] .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; align-self: start; }
.quiz-screen #app[data-quiz-size="tiny"] .choice { font-size: 12px; }
.quiz-screen #app[data-quiz-size="tiny"] .choice { line-height: 1.3; }
.quiz-screen #app[data-quiz-size="tiny"] .q-text { font-size: 14px; }
.quiz-screen #app[data-quiz-size="tiny"] .after { flex-direction: row; align-items: center; }
.quiz-screen #app[data-quiz-size="tiny"] .question-actions { flex: 1; }
.quiz-screen #app[data-quiz-size="tiny"] .question-actions a { padding: 4px; }
.quiz-screen #app[data-quiz-size="tiny"] .battle-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quiz-screen #app[data-quiz-size="tiny"] .contestant > .small,
.quiz-screen #app[data-quiz-size="tiny"] .contestant .tier { display: none; }
.quiz-screen #app[data-quiz-size="tiny"] .battle-status { padding: 4px 8px; }
.quiz-screen #app[data-quiz-size="tiny"] #qcard > .progress { display: none; }
.quiz-screen #app[data-quiz-size="tiny"] .battle-status { display: flex; align-items: center; gap: 8px; }
.quiz-screen #app[data-quiz-size="tiny"] .battle-status > .row { flex: none; gap: 8px; }
.quiz-screen #app[data-quiz-size="tiny"] .battle-progress { flex: 1; margin: 0; }
.quiz-screen #app[data-quiz-size="tiny"] .timer { font-size: 14px; }
.quiz-screen #app[data-quiz-size="tiny"] .contestant { padding: 2px 6px; gap: 2px; }
.quiz-screen #app[data-quiz-size="tiny"] .contestant .row { display: contents; }
.quiz-screen #app[data-quiz-size="tiny"] .contestant .row > :first-child { display: none; }
.quiz-screen #app[data-quiz-size="tiny"] .contestant .progress { grid-column: 1 / -1; }
@media (max-width: 359px) {
  .quiz-screen .rate, .quiz-screen .rating-tools { gap: 2px; }
}
@media (max-width: 767px) {
  .quiz-screen #app[data-quiz-size="tiny"] .question-layout { display: flex; gap: 4px; }
  .quiz-screen #app[data-quiz-size="tiny"] .question-prompt { display: grid; flex: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); }
  .quiz-screen #app[data-quiz-size="tiny"] .q-text { grid-column: 1 / -1; height: 100%; }
  .quiz-screen #app[data-quiz-size="tiny"] .answered .q-text { grid-column: auto; }
  .quiz-screen #app[data-quiz-size="tiny"] .feedback { min-height: 0; height: 100%; max-height: none; }
  .quiz-screen #app[data-quiz-size="tiny"] .choices { width: 100%; }
}

/* ---- 결과 요약 ---- */
.score-big { text-align: center; padding: 10px 0; }
.score-big .n { font-size: 48px; font-weight: 900; line-height: 1; letter-spacing: -0.03em; }
.score-big .lp { color: var(--ok); font-weight: 800; margin-top: 6px; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; }
.vs .name { font-weight: 800; }
.vs .big { font-size: 34px; font-weight: 900; }
.vs .mid { color: var(--muted); font-weight: 800; }
.outcome { text-align: center; font-size: 26px; font-weight: 900; margin: 6px 0 2px; }
.outcome.win { color: var(--ok); } .outcome.loss { color: var(--bad); } .outcome.draw { color: var(--muted); }

/* ---- 티어 배지 ---- */
.tier { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; padding: 3px 10px 3px 4px; border-radius: 999px; color: #fff; background: var(--tier-color, var(--tier-stone)); }
.tier svg { width: 20px; height: 20px; }
.tier.lg { font-size: 18px; padding: 8px 16px 8px 8px; gap: 10px; }
.tier.lg svg { width: 34px; height: 34px; }
.tier-stone { --tier-color: var(--tier-stone); }
.tier-bronze { --tier-color: var(--tier-bronze); }
.tier-silver { --tier-color: var(--tier-silver); }
.tier-gold { --tier-color: var(--tier-gold); }
.tier-platinum { --tier-color: var(--tier-platinum); }
.tier-diamond { --tier-color: var(--tier-diamond); }
.tier-master { --tier-color: var(--tier-master); }
.tier-grandmaster { --tier-color: var(--tier-grandmaster); }
.tier-legend { --tier-color: var(--tier-legend); box-shadow: 0 0 0 2px #ffd38a inset; }

/* ---- 표 / 목록 ---- */
.table-wrap, .tbl-wrap { max-width: 100%; overflow-x: auto; }
.responsive-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.responsive-table th, .responsive-table td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.responsive-table thead th { color: var(--muted); font-size: 13px; }
.responsive-table tr.me { background: var(--primary-soft); }
.responsive-table .no, .responsive-table .lp { font-weight: 800; }
.responsive-table .tier { white-space: nowrap; }
.seg { display: inline-flex; max-width: 100%; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { min-height: var(--tap); padding: 6px 16px; border: 0; border-radius: 999px; background: transparent; font-weight: 700; color: var(--muted); }
.seg button[aria-selected="true"] { background: var(--primary); color: var(--primary-ink); }

.question-layout { display: grid; gap: 16px; margin-top: 16px; }
.choice-option { min-width: 0; }
.choice-option > .choice { width: 100%; height: 100%; }
.choice-figure-grid, .figure-preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-figure-grid .choice-option { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.choice-figure-grid .choice { height: auto; flex: 1; border-radius: 0; }
.inline-math { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; padding: 3px 1px; }
.inline-math .katex { font-size: 1.1em; }
.math-error { color: var(--bad); }
.question-figure { display: block; width: 100%; height: auto; max-height: 35vh; max-height: 35dvh; object-fit: contain; }
.figure-open { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; min-height: 44px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.choice-figure-grid .question-figure { max-height: 16vh; max-height: 16dvh; }
/* 그림도 카드의 남은 높이 안에서 줄인다. 질문·해설 스크롤과 하단 조작을 유지한다. */
.quiz-screen .question-stimulus { order: 1; flex: 1; min-height: 76px; display: flex; flex-direction: column; gap: 4px; }
.quiz-screen .question-stimulus .q-text { flex: 1; }
.quiz-screen .question-stimulus > .figure-open { order: 2; flex: 0 1 auto; min-height: 44px; height: clamp(44px, 12vh, 140px); height: clamp(44px, 12cqh, 140px); }
.quiz-screen .question-stimulus > .figure-open .question-figure { flex: 1; height: 0; }
.quiz-screen .figure-open { padding: 2px; gap: 0; }
.quiz-screen .figure-open .small { font-size: 10px; }
.quiz-screen .question-figure { height: clamp(24px, 12vh, 140px); height: clamp(24px, 12cqh, 140px); min-height: 0; }
.quiz-screen .choice-figure-grid .question-figure { height: clamp(24px, 8vh, 100px); height: clamp(24px, 8cqh, 100px); }
.quiz-screen .choice-figure-grid .choice-option { min-height: 0; }
/* 세로 공간이 부족하면 텍스트 보기 역시 두 줄로 배치해 그림과 조작 공간을 확보한다. */
.quiz-screen #app:not([data-quiz-size="large"]) .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quiz-screen #app[data-quiz-size="tiny"] .question-stimulus { grid-column: 1 / -1; }
.quiz-screen #app[data-quiz-size="tiny"] .answered .question-stimulus { grid-column: auto; }
.quiz-screen #app[data-quiz-size="tiny"] .question-stimulus .q-text { height: auto; }
.quiz-screen #app[data-quiz-size="tiny"] .question-figure { height: 24px; }
.quiz-screen #app[data-quiz-size="tiny"] .choice-figure-grid .figure-open .small { display: none; }
.quiz-screen #app[data-quiz-size="tiny"] .choice-figure-grid .choice-option { flex-direction: row; }
.quiz-screen #app[data-quiz-size="tiny"] .choice-figure-grid .figure-open { width: auto; min-width: 44px; flex: 1; }
.quiz-screen #app[data-quiz-size="tiny"] .choice-figure-grid .choice { width: auto; height: auto; }
/* 짧은 가로 대결은 진행 상태도 필요하므로 질문 그림과 보기를 나란히 둔다. */
.quiz-screen #app[data-quiz-size="tiny"] .question-layout.has-question-figure { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.quiz-screen #app[data-quiz-size="tiny"] .has-question-figure .question-prompt { display: flex; flex-direction: column; }
.quiz-screen #app[data-quiz-size="tiny"] .has-question-figure .feedback { height: auto; }
/* 대결 종료 예고 등 알림이 하단 다음 버튼을 가리지 않게 헤더 아래에 둔다. */
.quiz-screen .toast { top: calc(var(--header-height) + 4px); bottom: auto; }
.figure-dialog { width: min(92vw, 900px); max-height: 90vh; max-height: 90dvh; border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--surface); color: var(--text); }
.figure-dialog::backdrop { background: rgba(0, 0, 0, .65); }
.figure-dialog .question-figure { max-height: 75vh; max-height: 75dvh; margin-bottom: 12px; }
.figure-dialog .btn { display: block; margin-left: auto; }
/* 현재 기본 UI는 밝은 테마. 어두운 테마에서는 img의 검은 currentColor를 필터로 밝힌다. */
[data-theme="dark"] .question-figure, .theme-dark .question-figure { filter: invert(1) hue-rotate(180deg); }
/* 명도·색상·신호 상태가 자료인 그림은 밝은 바탕에서 원래 색을 보존한다. */
.question-figure.preserve-colors { background: #fff; }
[data-theme="dark"] .question-figure.preserve-colors, .theme-dark .question-figure.preserve-colors { filter: none; }
.keyboard-hint { display: none; }
.battle-progress { display: grid; gap: 12px; margin-top: 16px; }
.contestant { padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.contestant .row { margin-top: 10px; margin-bottom: 6px; }
.question-actions a { min-height: var(--tap); display: inline-flex; align-items: center; padding: 8px 16px; }
.mode-grid { margin-bottom: 14px; }
@media (min-width: 768px) {
  .question-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .keyboard-hint { display: block; }
  .battle-progress { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media not all and (min-width: 768px) {
  main { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .nav { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .brand { gap: 6px; font-size: 14px; }
  .brand small { letter-spacing: 0; }
  .who { font-size: 12px; }
  .card { padding: 16px; }
  .question-layout { gap: 8px; }
  .q-head { flex-wrap: wrap; }
  .q-head > :last-child { margin-left: auto; }
  .after .row > .btn { width: 100%; min-height: 52px; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  /* 같은 표를 모바일에서는 항목명이 붙은 세로 카드로 표시한다. */
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td, .responsive-table th { display: block; }
  .responsive-table thead { display: none; }
  .responsive-table tr { margin-bottom: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
  .responsive-table td, .responsive-table tbody th { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 6px; padding: 6px 0; border: 0; }
  .responsive-table [data-label]::before { content: attr(data-label); font-weight: 600; font-size: 13px; color: var(--muted); }
  .responsive-table td > div { grid-column: 2; }
  .responsive-table .tier { justify-self: start; white-space: normal; }
  .responsive-table tr.me { box-shadow: 0 0 0 2px var(--primary) inset; }
  .admin-page #filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .admin-page #filters .input { width: 100%; }
  .admin-page #qtable, .admin-page #qtable tbody, .admin-page #qtable tr { display: block; }
  .admin-page #qtable thead { display: none; }
  .admin-page #qtable tr { padding: 12px; margin-bottom: 12px; background: var(--surface-2); border-radius: 12px; }
  .admin-page #qtable td { display: block; padding: 6px 0; border: 0; text-align: left; }
  .admin-page #qtable td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
  .admin-page #qtable .qtext { max-width: none; }
  .admin-page .admin-table, .admin-page .admin-table tbody, .admin-page .admin-table tr { display: block; }
  .admin-page .admin-table thead { display: none; }
  .admin-page .admin-table tr { padding: 12px; margin-bottom: 12px; background: var(--surface-2); border-radius: 12px; }
  .admin-page .admin-table td { display: block; padding: 6px 0; border: 0; text-align: left; max-width: none; }
  .admin-page .admin-table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
  .admin-page #tokenForm { flex-direction: column; align-items: stretch; }
}

.timer { font-variant-numeric: tabular-nums; font-weight: 900; font-size: 20px; }
.timer.hot { color: var(--bad); }
.dots { display: inline-block; width: 1.2em; text-align: left; }
.waiting { text-align: center; padding: 24px 0; }
.waiting .pulse { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); margin: 0 auto 12px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(.9); opacity: .6; } 50% { transform: scale(1.05); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .waiting .pulse { animation: none; } * { transition: none !important; } }

/* ---- 승급 연출 ---- */
.promo {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--promo) 55%, transparent) 0%, rgba(10, 12, 24, .92) 70%);
  color: #fff; text-align: center; cursor: pointer; animation: promo-in .35s ease both; outline: none;
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .promo { background: rgba(10, 12, 24, .92); }
}
.promo.out { animation: promo-out .3s ease both; }
.promo-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.promo-body { position: relative; padding: 24px; max-width: 90vw; max-height: 100%; overflow-y: auto; }
.promo-emblem {
  position: relative; width: 150px; height: 150px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--promo); display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: 0 0 0 8px rgba(255,255,255,.12), 0 20px 60px rgba(0,0,0,.45);
  animation: emblem-in .9s cubic-bezier(.2, 1.4, .3, 1) both;
}
.promo-emblem svg { width: 96px; height: 96px; position: relative; z-index: 1; filter: drop-shadow(0 4px 10px rgba(0,0,0,.35)); }
.promo-glow { position: absolute; inset: -30%; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.55), transparent 60%); animation: glow 1.6s ease-in-out .3s infinite alternate; }
.promo-shine { position: absolute; top: -20%; bottom: -20%; left: -60%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.75), transparent); transform: skewX(-20deg); animation: shine 1.4s ease .5s 2; }
.promo-title { margin: 0; font-size: 44px; font-weight: 900; letter-spacing: -0.02em; text-shadow: 0 4px 24px rgba(0,0,0,.4); animation: pop .6s cubic-bezier(.2, 1.4, .3, 1) .25s both; }
.promo-mode { margin: 4px 0 10px; font-weight: 700; opacity: .85; animation: rise .5s ease .4s both; }
.promo-from-to { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0; font-size: 20px; font-weight: 800; animation: rise .5s ease .55s both; flex-wrap: wrap; }
.promo-from-to .old { opacity: .6; text-decoration: line-through; }
.promo-from-to .new { font-size: 26px; color: #fff; padding: 4px 14px; border-radius: 999px; background: var(--promo); box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.promo-hint { margin-top: 26px; font-size: 13px; opacity: .6; animation: rise .5s ease 1.2s both; }
@keyframes promo-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes promo-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes emblem-in { 0% { transform: scale(.2) rotate(-20deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes glow { from { opacity: .35; transform: scale(.9); } to { opacity: .9; transform: scale(1.1); } }
@keyframes shine { from { left: -60%; } to { left: 120%; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
/* 움직임 줄이기: 페이드만 */
.promo.reduced, .promo.reduced .promo-emblem, .promo.reduced .promo-title, .promo.reduced .promo-mode, .promo.reduced .promo-from-to, .promo.reduced .promo-hint { animation: promo-in .3s ease both; }
.promo.reduced .promo-glow, .promo.reduced .promo-shine { animation: none; display: none; }
.promo.reduced.out { animation: promo-out .3s ease both; }

/* 작은 화면의 승급 크기는 기본 승급 스타일 뒤에서 적용한다. */
@media not all and (min-width: 768px) {
  .promo { overflow-y: auto; padding: max(12px, env(safe-area-inset-top)) 0 max(12px, env(safe-area-inset-bottom)); }
  .promo-emblem { width: 96px; height: 96px; margin-bottom: 12px; }
  .promo-emblem svg { width: 64px; height: 64px; }
  .promo-title { font-size: 32px; }
  .promo-body { padding: 16px; }
  .promo-hint { margin-top: 12px; }
}

/* 계정 진입점도 768px 기준의 두 분류 안에 배치한다. */
.who-account { min-width: 44px; display: flex; flex-direction: column; justify-content: center; min-height: var(--tap); text-decoration: none; overflow-wrap: anywhere; }
#accountForm, #resetForm { max-width: 440px; }
#resetResult { overflow-wrap: anywhere; }
.account-actions, .account-session { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.player-nickname { min-width: 44px; min-height: var(--tap); display: inline-flex; align-items: center; overflow-wrap: anywhere; }
.account-entry { display: grid; gap: 10px; }
.account-sidebar { display: none; }
.topbar { flex-wrap: wrap; }
.who { max-width: 100%; flex: 1 1 240px; flex-wrap: wrap; justify-content: flex-end; }
@media not all and (min-width: 768px) {
  .topbar .who { width: 100%; justify-content: space-between; }
  .who .btn { padding: 8px 12px; }
  .player-nickname { max-width: 100%; }
}
@media (min-width: 768px) {
  .account-sidebar { display: block; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
  .account-sidebar .card { padding: 0; margin: 0; box-shadow: none; background: transparent; }
  .account-sidebar h2 { font-size: 16px; }
  .account-sidebar .account-actions, .account-sidebar .account-session { flex-direction: column; align-items: stretch; }
  .account-sidebar .who-account { max-width: 100%; }
}

/* 화면 설정은 풀이 상단과 내 정보에서 같은 값을 사용한다. */
.display-controls { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.display-controls .btn { min-height: 44px; padding: 4px 8px; font-size: 12px; white-space: nowrap; }
.display-controls a { display: none; }
.rating-toggle { display: none; }
.answer-mark:empty { display: none; }
.answer-mark { font-size: 22px; font-weight: 900; flex: none; }
.choice.correct, .choice.wrong { border-width: 3px; }
.choice.selected { box-shadow: inset 0 0 0 2px var(--primary); font-weight: 800; }
.quiz-screen #app .choice-option { min-height: 0; }
.quiz-screen #app .choice { overflow: hidden; }
.quiz-screen #app .choice-text { min-width: 0; min-height: 0; max-height: 100%; overflow-y: auto; scrollbar-width: thin; }
/* 긴 보기의 줄 수가 늘어도 해설과 다음 버튼을 밀어내지 않는다. */
.quiz-screen #app .choices[data-long-choices="true"] { height: 45%; min-height: 96px; grid-auto-rows: minmax(44px, 1fr); }
.quiz-screen #app[data-quiz-size="large"] .choices[data-long-choices="true"] { min-height: 216px; }
.tv-mode { --text: #101828; --muted: #344054; --line: #667085; --primary: #2444c4; --ok: #08633c; --bad: #a51624; --ok-soft: #e4f8ed; --bad-soft: #ffebee; }
.tv-mode.quiz-screen #app .q-text { font-size: 22px; line-height: 1.4; }
.tv-mode.quiz-screen #app .choice { font-size: 20px; line-height: 1.4; }
.tv-mode.quiz-screen #app .choice .num { font-size: 16px; }
.tv-mode.quiz-screen #app .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(44px, 1fr)); height: clamp(100px, 30vh, 320px); min-height: 100px; align-self: stretch; }
.tv-mode.quiz-screen #app .choice-option { min-height: 0; }
.tv-mode.quiz-screen #app .choice { height: 100%; overflow: hidden; }
.tv-mode.quiz-screen #app .choice-text { min-width: 0; min-height: 0; max-height: 100%; overflow-y: auto; scrollbar-width: thin; }
.tv-mode.quiz-screen #app .choice-figure-grid .figure-open { flex: 1; min-height: 44px; }
.tv-mode.quiz-screen #app .choice-figure-grid .question-figure { flex: 1; height: 0; }
.tv-mode.quiz-screen #app .choice-figure-grid .choice { flex: 0 0 44px; height: 44px; }
.tv-mode .feedback .verdict { font-size: 18px; }
.tv-mode .choice.selected { border: 3px solid var(--primary); background: #e4e9ff; }
.tv-mode .choice.correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.tv-mode .choice.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }

/* 가로 저높이 판정은 layout.js와 같다. 회전은 DOM을 보존한다. */
@media (orientation: landscape) and (max-height: 500px) {
  body.quiz-screen { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .promo { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); overflow-y: auto; }
  .promo-body { padding: 12px; }
  .promo-emblem { width: 80px; height: 80px; margin-bottom: 8px; }
  .promo-emblem svg { width: 52px; height: 52px; }
  .promo-title { font-size: 30px; }
  .promo-hint { margin-top: 8px; }
  .quiz-screen .topbar { display: none; }
  /* 높이 0으로 메뉴를 감추고 풀이 영역을 끝까지 사용한다. */
  .quiz-screen .nav { visibility: hidden; position: fixed; top: auto; bottom: 0; height: 0; min-height: 0; padding: 0; border: 0; overflow: hidden; }
  .quiz-screen #app { margin: 0; width: 100%; max-width: none; padding: max(4px, env(safe-area-inset-top)) 6px max(4px, env(safe-area-inset-bottom)); gap: 0; }
  .quiz-screen #app #qcard { padding: 4px 6px; gap: 6px; }
  .quiz-screen #qcard > .progress { display: none; }
  .quiz-screen .q-head { min-height: 44px; gap: 6px; flex-wrap: nowrap; }
  .quiz-screen .q-head > :first-child { display: none; }
  .quiz-screen .question-counter { font-size: 16px; font-weight: 800; white-space: nowrap; }
  .quiz-screen .display-controls a { display: inline-flex; }
  /* 알림이 뜬 동안 위쪽에 한 줄을 확보해 그림·답안·다음 버튼을 가리지 않는다. */
  .quiz-screen:has(.toast:not([hidden])) #app { padding-top: calc(36px + env(safe-area-inset-top)); }
  .quiz-screen .toast { top: calc(4px + env(safe-area-inset-top)); left: 50%; bottom: auto; max-width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)); padding: 4px 10px; font-size: 14px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .quiz-screen #app .question-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 12px; align-items: stretch; }
  .quiz-screen #app .question-prompt { display: flex; flex-direction: column; min-height: 0; gap: 6px; }
  .quiz-screen #app .q-text { height: auto; min-height: 1.4em; font-size: 18px; line-height: 1.4; flex: 1; }
  .quiz-screen #app .question-stimulus { min-height: 80px; flex: 1; }
  .quiz-screen #app .question-stimulus > .figure-open { flex: 0 1 38%; height: 100px; min-height: 44px; }
  .quiz-screen #app .question-stimulus .question-figure { height: 0; flex: 1; }
  .quiz-screen #app .keyboard-hint { display: none; }
  .quiz-screen #app .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(44px, 1fr)); gap: 6px; align-self: stretch; min-height: 0; }
  .quiz-screen #app .choices.choices-stacked { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(4, minmax(44px, 1fr)); }
  .quiz-screen #app .choices[data-long-choices="true"] { height: auto; min-height: 0; }
  .quiz-screen #app .choice-option { min-height: 0; }
  .quiz-screen #app .choice { min-height: 44px; padding: 6px; font-size: 16px; line-height: 1.4; overflow: hidden; align-items: center; }
  .quiz-screen #app .choice-text { min-width: 0; min-height: 0; max-height: 100%; overflow-y: auto; }
  .quiz-screen #app .choice-figure-grid .choice-option { flex-direction: column; }
  .quiz-screen #app .choice-figure-grid .figure-open { width: 100%; flex: 1; min-height: 44px; }
  .quiz-screen #app .choice-figure-grid .choice { flex: 0 0 44px; width: 100%; height: 44px; }
  .quiz-screen #app .choice-figure-grid .question-figure { height: 0; flex: 1; }
  .quiz-screen #app .choice-figure-grid .figure-open .small { display: block; }
  .quiz-screen #app .feedback { min-height: 68px; max-height: 50%; height: auto; padding: 2px 6px; }
  .quiz-screen #app .feedback.expanded { max-height: 70%; }
  .quiz-screen #app .explain { font-size: 15px; line-height: 1.4; max-height: 2.8em; }
  .quiz-screen #app .feedback .verdict { font-size: 15px; }
  .quiz-screen #app .after { display: flex; flex-direction: row; align-items: center; gap: 6px; }
  .quiz-screen #app .rating-toggle { display: block; min-width: 80px; min-height: 44px; padding: 4px 8px; font-size: 13px; }
  .quiz-screen #app .rating-tools { display: none; }
  .quiz-screen #app .ratings-open .rating-tools { display: flex; }
  .quiz-screen #app .question-actions { flex: 1; }
  .quiz-screen #app .question-actions a { display: none; }
  .quiz-screen #app .review-note form { max-height: calc(var(--visible-height) - 110px); }
  .quiz-screen #app .battle-status { display: flex; align-items: center; flex: 1; min-width: 0; padding: 0; border: 0; box-shadow: none; background: transparent; gap: 6px; }
  .quiz-screen #app .battle-status h2 { display: none; }
  .quiz-screen #app .battle-status > .row { flex: none; }
  .quiz-screen #app .timer { font-size: 16px; }
  .quiz-screen #app .battle-progress { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1; margin: 0; gap: 4px; }
  .quiz-screen #app .contestant { grid-template-columns: minmax(0, 1fr) auto; padding: 0 4px; border: 0; }
  .quiz-screen #app .contestant strong, .quiz-screen #app .contestant .tier { display: none; }
  .quiz-screen #app .contestant > .small:not(.row) { display: block; grid-column: 1; grid-row: 1; }
  .quiz-screen #app .contestant .row > :last-child { grid-column: 2; grid-row: 1; }
  .quiz-screen #app .contestant .progress { grid-column: 1 / -1; }
  .tv-mode.quiz-screen #app .q-text { font-size: 22px; }
  .tv-mode.quiz-screen #app .choice { font-size: 20px; }
  .tv-mode.quiz-screen #app .choices { height: auto; min-height: 0; }
}
