:root {
  color-scheme: dark;
  --ink: #111314;
  --ink-2: #191c1d;
  --panel: rgba(29, 33, 34, .92);
  --line: rgba(232, 236, 228, .18);
  --text: #f3f4ee;
  --muted: #aeb8b2;
  --teal: #54b6a7;
  --amber: #f2b84b;
  --coral: #e76f51;
  --sage: #94b49f;
  --paper: #e8e2d5;
  --danger: #d95d52;
  font-family: Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--ink); color: var(--text); }
body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button, select, input, textarea { border-radius: 8px; }
button {
  border: 1px solid rgba(255,255,255,.12);
  background: #f0eee5;
  color: #141716;
  padding: 10px 14px;
  min-height: 42px;
  cursor: pointer;
  font-weight: 700;
}
button:hover { filter: brightness(1.05); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.quiet { background: rgba(255,255,255,.08); color: var(--text); }
button.danger { background: var(--danger); color: white; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.24);
  color: var(--text);
  padding: 11px 12px;
}
textarea { resize: vertical; line-height: 1.5; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
a { color: var(--text); text-decoration: none; }

.portrait-guard {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #111314;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  padding: 28px;
}
.portrait-guard strong { font-size: 28px; }
.portrait-guard span { color: var(--muted); }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background:
    linear-gradient(180deg, rgba(244,238,222,.06), transparent 42%),
    radial-gradient(circle at 18% 0%, rgba(84,182,167,.20), transparent 26%),
    linear-gradient(110deg, #111314, #1a1d1d 45%, #171413);
}

.topbar {
  position: relative;
  height: 72px;
  padding: 12px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.eyebrow { margin: 0 0 2px; color: var(--sage); font-size: 12px; font-weight: 800; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
.brand-logo {
  display: grid;
  gap: 1px;
  line-height: 1.05;
}
.brand-logo strong {
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 950;
  letter-spacing: .02em;
}
.brand-logo span {
  color: var(--sage);
  font-size: 12px;
  font-weight: 800;
}
.mode-tabs { display: flex; gap: 8px; }
.tab { background: rgba(255,255,255,.08); color: var(--text); min-width: 92px; }
.tab.is-active { background: var(--teal); color: #071110; }

.view { display: none; min-height: calc(100vh - 72px); }
.view.is-active { display: block; }

.arena-grid {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(360px, 420px);
}
.exam-stage {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), transparent 36%),
    linear-gradient(180deg, #242323 0 58%, #3c3129 58% 100%);
  border-right: 1px solid var(--line);
}
.judge-row {
  height: 45%;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 5vw;
  padding: 34px 5vw 0;
  perspective: 900px;
}
.judge {
  width: clamp(120px, 16vw, 188px);
  height: 240px;
  position: relative;
  transform-origin: 50% 100%;
  animation: judgeIdle 5s ease-in-out infinite;
}
.judge-center { transform: scale(1.1); animation-duration: 4.6s; }
.judge-right { animation-delay: .7s; }
.judge-left { animation-delay: 1.2s; }
.judge-head {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 72px;
  height: 82px;
  transform: translateX(-50%);
  border-radius: 40% 40% 44% 44%;
  background: #d7b095;
  box-shadow: inset 0 -9px rgba(102,68,54,.18);
}
.judge-head::before {
  content: "";
  position: absolute;
  inset: -9px 6px auto;
  height: 28px;
  border-radius: 24px 24px 8px 8px;
  background: #2b2520;
}
.judge-head::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 39px;
  height: 3px;
  border-radius: 2px;
  background: #4c3328;
  box-shadow: 0 16px 0 -1px rgba(76,51,40,.65);
  animation: blink 4.8s infinite;
}
.judge-head i {
  position: absolute;
  left: 16px;
  top: 35px;
  width: 40px;
  height: 12px;
  border-top: 2px solid rgba(35,31,28,.65);
  border-left: 2px solid rgba(35,31,28,.65);
  border-right: 2px solid rgba(35,31,28,.65);
  border-radius: 10px 10px 2px 2px;
}
.judge-body {
  position: absolute;
  left: 50%;
  top: 78px;
  width: 124px;
  height: 118px;
  transform: translateX(-50%);
  border-radius: 36px 36px 10px 10px;
  background: linear-gradient(90deg, #2d3536, #40494a);
}
.judge-body::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 34px;
  height: 74px;
  transform: translateX(-50%);
  background: #ede4d0;
  clip-path: polygon(10% 0, 90% 0, 62% 100%, 38% 100%);
}
.judge-body b {
  position: absolute;
  right: -18px;
  bottom: 16px;
  width: 54px;
  height: 12px;
  background: #d7b095;
  border-radius: 999px;
  transform-origin: left center;
  animation: writeNote 2.6s ease-in-out infinite;
}
.judge-desk {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 172px;
  height: 48px;
  transform: translateX(-50%);
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #67503e, #3e2c22);
  box-shadow: 0 16px 30px rgba(0,0,0,.28);
}
.judge-desk em {
  position: absolute;
  right: 22px;
  top: -8px;
  width: 44px;
  height: 28px;
  background: var(--paper);
  border-radius: 4px;
  transform: rotate(-5deg);
}
.stage-floor {
  position: absolute;
  inset: 45% 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7vw;
  padding: 18px 5vw 28px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.05), transparent 22% 78%, rgba(255,255,255,.04)),
    linear-gradient(180deg, #554234, #2c241f);
}
.lottery-wrap {
  position: relative;
  width: min(48vw, 540px);
  aspect-ratio: 13 / 8;
  display: grid;
  place-items: center;
}
#lotteryCanvas { width: 100%; height: 100%; }
.hand-button {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  background: var(--amber);
  min-width: 190px;
}
.candidate-mark {
  width: 18vw;
  min-width: 160px;
  height: 44%;
  align-self: end;
  border-radius: 110px 110px 12px 12px;
  background: linear-gradient(180deg, #69716c, #242828);
  display: grid;
  place-items: start center;
  padding-top: 24px;
  color: rgba(255,255,255,.72);
  box-shadow: 0 22px 40px rgba(0,0,0,.25);
}

.exam-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  background: rgba(8,10,10,.34);
}
.panel-block, .editor-band, .manage-band, .settings-band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.license-status-box {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(84, 182, 167, .28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(84, 182, 167, .16), rgba(255, 255, 255, .04)),
    rgba(0, 0, 0, .12);
}
.license-status-box span {
  color: var(--sage);
  font-size: 12px;
  font-weight: 850;
}
.license-status-box strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}
.small-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}
.small-link-row a {
  color: var(--paper);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(232, 226, 213, .45);
}
.small-link-row a::before {
  content: "· ";
  color: var(--amber);
}
.license-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}
.license-strip strong { color: var(--text); }
.row-between, .section-head, .button-row, .timer-actions, .question-actions, .stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.row-between, .section-head, .stat-row { justify-content: space-between; }
.stat-row {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
.stat-row b { color: var(--amber); font-size: 18px; }
.question-block h2 {
  min-height: 92px;
  display: flex;
  align-items: center;
  font-size: clamp(20px, 2.3vw, 32px);
  line-height: 1.28;
}
.judge-speech {
  margin: 0 0 8px;
  color: var(--amber);
  font-weight: 800;
}
.answer-text {
  margin: 0 0 12px;
  padding: 12px;
  min-height: 96px;
  background: rgba(255,255,255,.07);
  border-radius: 8px;
  color: #eae5d9;
  line-height: 1.55;
  font-size: 13px;
}
.is-hidden { display: none !important; }
.timer-display {
  text-align: center;
  font-size: clamp(44px, 7vw, 82px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--paper);
  padding: 10px 0 14px;
}
.timer-actions, .question-actions, .button-row { flex-wrap: wrap; }
.timer-actions button, .question-actions button, .rating-block button { flex: 1 1 auto; }
.stop-call {
  margin: 12px 0 0;
  padding: 12px;
  text-align: center;
  border-radius: 8px;
  background: var(--coral);
  color: white;
  font-weight: 900;
  font-size: 22px;
  animation: callPulse .9s ease-in-out infinite;
}
.rating-block {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.rating-block button:nth-child(1) { background: #3b3f40; color: white; }
.rating-block button:nth-child(2) { background: var(--coral); color: white; }
.rating-block button:nth-child(3) { background: var(--teal); color: #06110f; }
.rating-block button:nth-child(4) { background: var(--sage); color: #111314; }

.cards-grid {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 14px;
}
.input-layout { display: grid; gap: 12px; }
.file-button {
  width: auto;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
  cursor: pointer;
  font-weight: 800;
}
.file-button input { display: none; }
.manage-layout {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(280px, .95fr) minmax(360px, 1.05fr);
  gap: 12px;
  min-height: 370px;
}
.card-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: 52vh;
  background: rgba(0,0,0,.18);
}
.card-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px;
}
.card-row.is-active { background: rgba(84,182,167,.18); }
.card-row small { color: var(--muted); }
.card-form { display: grid; gap: 12px; }
.settings-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 14px;
}
.notice {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}
.link-grid {
  display: grid;
  gap: 6px;
}
.link-grid a {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font-size: 13px;
  line-height: 1.35;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.official-link-list a::before {
  content: "· ";
  color: var(--amber);
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: 8px;
  background: #f0eee5;
  color: #111314;
  box-shadow: 0 18px 46px rgba(0,0,0,.34);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}
.toast.is-visible { transform: translateY(0); opacity: 1; }

@keyframes judgeIdle {
  0%, 100% { transform: translateY(0) rotateX(0); }
  45% { transform: translateY(3px) rotateX(2deg); }
}
@keyframes blink {
  0%, 46%, 50%, 100% { transform: scaleY(1); }
  48% { transform: scaleY(.12); }
}
@keyframes writeNote {
  0%, 100% { transform: rotate(-8deg) translateX(0); }
  50% { transform: rotate(6deg) translateX(8px); }
}
@keyframes callPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

@media (max-width: 980px) {
  .topbar { height: 64px; padding: 10px 12px; }
  h1 { font-size: 18px; }
  .tab { min-width: 70px; padding: 8px 10px; }
  .arena-grid { grid-template-columns: 1fr 340px; min-height: calc(100vh - 64px); }
  .exam-panel { padding: 10px; gap: 8px; }
  .panel-block { padding: 10px; }
  .question-block h2 { min-height: 70px; font-size: 20px; }
  .rating-block { grid-template-columns: repeat(2, 1fr); }
  .stage-floor { gap: 3vw; padding-inline: 3vw; }
}

@media (orientation: portrait) and (max-width: 760px) {
  .portrait-guard { display: grid; }
}

/* Full-screen simulator overlay */
:root { --topbar-height: 72px; }
html, body { width: 100%; height: 100%; overflow: hidden; }
.app-shell {
  height: 100dvh;
  min-height: 100dvh;
  display: block;
  overflow: hidden;
}
.topbar {
  position: fixed;
  z-index: 30;
  top: max(0px, env(safe-area-inset-top));
  left: max(0px, env(safe-area-inset-left));
  right: max(0px, env(safe-area-inset-right));
  background: rgba(17, 19, 20, .62);
  backdrop-filter: blur(14px);
}
.view {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}
#view-cards,
#view-settings {
  overflow: auto;
  padding-top: var(--topbar-height);
}
.arena-grid {
  position: relative;
  height: 100dvh;
  min-height: 100dvh;
  display: block;
}
.exam-stage {
  position: absolute;
  inset: 0;
  border-right: 0;
}
.judge-row {
  height: 50dvh;
  padding-top: calc(var(--topbar-height) + 20px);
  gap: clamp(34px, 8vw, 116px);
}
.judge {
  width: clamp(106px, 13vw, 176px);
  height: clamp(188px, 27vh, 240px);
}
.stage-floor {
  inset: 48dvh 0 0;
  justify-content: flex-start;
  padding-left: clamp(18px, 8vw, 116px);
  padding-right: min(430px, 39vw);
}
.lottery-wrap {
  width: min(45vw, 560px);
  min-width: 300px;
}
.candidate-mark {
  position: absolute;
  right: min(430px, 39vw);
  bottom: 0;
  width: clamp(120px, 15vw, 220px);
  min-width: 0;
  height: 42%;
  opacity: .82;
}
.exam-panel {
  position: absolute;
  z-index: 20;
  top: calc(var(--topbar-height) + 10px);
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(392px, 37vw);
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(232, 236, 228, .18);
  border-radius: 8px;
  background: rgba(13, 16, 16, .58);
  backdrop-filter: blur(16px);
}
.panel-block {
  background: rgba(18, 22, 22, .64);
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
}
.question-block h2 {
  min-height: 76px;
  font-size: clamp(18px, 2.1vw, 30px);
}
.timer-display {
  font-size: clamp(40px, 5.6vw, 78px);
}
.hand-button.is-drawing {
  animation: drawButtonKick .85s ease-in-out;
}
.admin-tools.is-hidden {
  display: none !important;
}

@keyframes drawButtonKick {
  0%, 100% { transform: translateX(-50%) scale(1); }
  35% { transform: translateX(-50%) scale(1.08) rotate(-1deg); }
  70% { transform: translateX(-50%) scale(.98) rotate(1deg); }
}

@media (max-width: 980px) {
  :root { --topbar-height: 64px; }
  .exam-panel {
    top: calc(var(--topbar-height) + 8px);
    right: 8px;
    bottom: 8px;
    width: min(350px, 43vw);
  }
  .stage-floor {
    padding-left: 5vw;
    padding-right: 45vw;
  }
  .lottery-wrap {
    width: min(47vw, 430px);
    min-width: 250px;
  }
  .candidate-mark {
    right: 45vw;
  }
  .judge-row {
    gap: clamp(18px, 6vw, 64px);
  }
  .judge {
    transform: scale(.86);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  :root { --topbar-height: 56px; }
  .topbar {
    height: var(--topbar-height);
    padding: 7px 10px;
  }
  .topbar h1 { font-size: 16px; }
  .topbar .eyebrow { display: none; }
  .tab {
    min-width: 62px;
    min-height: 36px;
    padding: 7px 9px;
  }
  .judge-row {
    height: 48dvh;
    padding-top: calc(var(--topbar-height) + 4px);
  }
  .judge {
    transform: scale(.72);
  }
  .stage-floor {
    inset: 45dvh 0 0;
    padding-left: 3vw;
    padding-right: 44vw;
  }
  .lottery-wrap {
    width: 42vw;
    min-width: 220px;
  }
  .candidate-mark {
    height: 36%;
  }
  .exam-panel {
    top: calc(var(--topbar-height) + 6px);
    bottom: 6px;
    right: 6px;
    width: 41vw;
    padding: 7px;
    gap: 7px;
  }
  .panel-block { padding: 8px; }
  .license-strip { font-size: 12px; }
  .question-block h2 {
    min-height: 46px;
    font-size: 16px;
  }
  .judge-speech,
  .stat-row,
  label,
  .notice { font-size: 11px; }
  .timer-display {
    font-size: 42px;
    padding: 2px 0 8px;
  }
  button {
    min-height: 34px;
    padding: 7px 8px;
  }
  .rating-block {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
  }
}


/* Immersive entry and deeper 3D polish */
.start-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 18%, rgba(242, 184, 75, .20), transparent 24%),
    linear-gradient(180deg, rgba(17, 19, 20, .88), rgba(17, 19, 20, .96));
  backdrop-filter: blur(18px);
}
.start-gate.is-hidden { display: none; }
.start-card {
  width: min(520px, 92vw);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  padding: 24px;
  background: rgba(20, 24, 24, .78);
  box-shadow: 0 30px 90px rgba(0,0,0,.45), inset 0 1px rgba(255,255,255,.08);
}
.start-card h2 { font-size: clamp(26px, 5vw, 42px); }
.start-card p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.fullscreen-nav {
  min-width: 76px;
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.exam-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 24% 58%, rgba(255,255,255,.10), transparent 25%),
    radial-gradient(ellipse at 55% 20%, rgba(242,184,75,.11), transparent 30%),
    linear-gradient(180deg, rgba(0,0,0,.0), rgba(0,0,0,.32));
  z-index: 0;
}
.judge-row,
.stage-floor {
  z-index: 1;
}
.judge {
  filter: drop-shadow(0 22px 24px rgba(0,0,0,.36));
}
.judge-body {
  box-shadow: inset 16px 0 22px rgba(255,255,255,.05), inset -18px 0 22px rgba(0,0,0,.20);
}
.judge-desk {
  box-shadow: 0 26px 36px rgba(0,0,0,.34), inset 0 1px rgba(255,255,255,.18);
}
.stage-floor::before {
  content: "";
  position: absolute;
  left: 4vw;
  right: 4vw;
  top: 6%;
  height: 22%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.06), transparent);
  transform: perspective(620px) rotateX(64deg);
  transform-origin: 50% 0;
}
.lottery-wrap {
  filter: drop-shadow(0 28px 38px rgba(0,0,0,.38));
}
#lotteryCanvas {
  filter: saturate(1.05) contrast(1.05);
}
.candidate-mark {
  display: none !important;
}
.stage-floor {
  padding-right: min(400px, 36vw);
}
.lottery-wrap {
  width: min(52vw, 620px);
}

@media (orientation: landscape) and (max-height: 520px) {
  .start-card {
    padding: 16px;
  }
  .fullscreen-nav {
    display: none;
  }
  .stage-floor {
    padding-right: 42vw;
  }
  .lottery-wrap {
    width: min(45vw, 410px);
  }
}


/* Product polish: judge character and text import */
.judge-head {
  background: linear-gradient(180deg, #e2b99d, #c99072);
}
.judge-head::after {
  top: 35px;
  height: 3px;
  background: #3c2c26;
  box-shadow: 28px 0 0 #3c2c26;
  width: 7px;
  left: 22px;
  right: auto;
}
.judge-head u {
  position: absolute;
  left: 50%;
  top: 58px;
  width: 30px;
  height: 8px;
  transform: translateX(-50%);
  border-bottom: 3px solid rgba(82, 48, 37, .86);
  border-radius: 0 0 18px 18px;
  text-decoration: none;
}
.judge.is-speaking .judge-head u {
  animation: mouthTalk .22s ease-in-out infinite;
}
.judge.is-active {
  filter: drop-shadow(0 24px 26px rgba(0,0,0,.40)) drop-shadow(0 0 22px rgba(242,184,75,.22));
}
.judge-female .judge-head::before {
  inset: -12px -2px auto;
  height: 34px;
  border-radius: 28px 28px 12px 12px;
  background: linear-gradient(180deg, #332823, #1e1917);
}
.judge-female .judge-body {
  background: linear-gradient(90deg, #343a3d, #4b5454);
}
.judge-female .judge-body::before {
  background: #f2ead8;
}
.judge-male .judge-head::before {
  background: linear-gradient(180deg, #2b2520, #191715);
}
.judge-head i {
  opacity: .55;
}
.split-import {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 12px;
}
@keyframes mouthTalk {
  0%, 100% { height: 6px; border-bottom-width: 3px; transform: translateX(-50%) scaleX(.82); }
  50% { height: 15px; border-bottom-width: 7px; transform: translateX(-50%) scaleX(1.05); }
}
@media (max-width: 760px) {
  .split-import {
    grid-template-columns: 1fr;
  }
}


/* Collapsible simulator chrome, centered draw bowl, and subtle venue controls */
:root {
  --exam-panel-alpha: .58;
  --exam-panel-block-alpha: .64;
}
.topbar {
  gap: 12px;
  transition: height .2s ease, padding .2s ease, background .2s ease;
}
.brand-block {
  min-width: 0;
}
.brand-block h1 {
  white-space: nowrap;
}
.chrome-toggle {
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255,255,255,.10);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.16);
  font-size: 12px;
  line-height: 1;
}
.topbar-toggle {
  position: absolute;
  left: 50%;
  bottom: -13px;
  z-index: 25;
  transform: translateX(-50%);
}
body.topbar-collapsed {
  --topbar-height: 32px;
}
body.topbar-collapsed .topbar {
  height: var(--topbar-height);
  padding: 4px max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left));
  justify-content: center;
  background: rgba(17, 19, 20, .44);
}
body.topbar-collapsed .brand-block,
body.topbar-collapsed .mode-tabs {
  display: none;
}
.exam-panel {
  background: rgba(13, 16, 16, var(--exam-panel-alpha));
  transition: width .22s ease, opacity .2s ease, background .2s ease;
}
.exam-panel .panel-block {
  background: rgba(18, 22, 22, var(--exam-panel-block-alpha));
}
.panel-toggle {
  position: absolute;
  left: -13px;
  top: 50%;
  z-index: 25;
  margin: 0;
  transform: translateY(-50%);
  background: rgba(17,19,20,.74);
}
.exam-panel.is-collapsed {
  width: 34px;
  padding: 6px;
  overflow: visible;
}
.exam-panel.is-collapsed > :not(.panel-toggle) {
  display: none !important;
}
.exam-panel.is-collapsed .panel-toggle {
  left: -13px;
}
.panel-controls {
  padding: 10px;
}
.compact-range {
  gap: 8px;
}
.compact-range input {
  padding: 0;
}
.stage-floor {
  justify-content: center;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.lottery-wrap {
  width: min(54vw, 620px);
}
.csv-only-layout {
  max-width: 760px;
}
.csv-import-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.primary-file {
  background: var(--amber);
  color: #111314;
  border-color: rgba(0,0,0,.12);
}
.inline-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.inline-check input {
  width: auto;
  accent-color: var(--teal);
}

@media (max-width: 980px) {
  .brand-block h1 {
    font-size: 16px;
  }
  .lottery-wrap {
    width: min(52vw, 500px);
    min-width: 240px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .lottery-wrap {
    width: min(46vw, 420px);
  }
  .exam-panel.is-collapsed {
    width: 44px;
  }
}


/* Compact vivid exam HUD refinement */
:root {
  --exam-panel-alpha: .28;
  --exam-panel-block-alpha: .36;
}
button,
.file-button {
  position: relative;
  background-image: linear-gradient(180deg, rgba(255,255,255,.26), rgba(0,0,0,.08));
  box-shadow: 0 7px 0 rgba(0,0,0,.26), 0 16px 28px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.35);
  transform: translateY(0);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
button:hover,
.file-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 0 rgba(0,0,0,.26), 0 20px 34px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.38);
}
button:active,
.file-button:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 rgba(0,0,0,.28), 0 10px 18px rgba(0,0,0,.24), inset 0 2px 6px rgba(0,0,0,.16);
}
button.quiet {
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.05));
}
.tab.is-active,
.timer-actions button.is-selected {
  background: linear-gradient(180deg, #72d0bf, #3f9f92);
  color: #06110f;
  box-shadow: 0 7px 0 rgba(12,82,74,.65), 0 16px 28px rgba(0,0,0,.24), inset 0 1px rgba(255,255,255,.46);
}
.hand-button {
  background: radial-gradient(circle at 35% 18%, #ffe39a, #f2b84b 55%, #bc7c22);
  box-shadow: 0 9px 0 #7e4f15, 0 22px 38px rgba(0,0,0,.36), inset 0 2px rgba(255,255,255,.46);
}
.exam-panel {
  gap: 6px;
  padding: 8px;
  overflow: hidden;
  font-size: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,.26), inset 0 1px rgba(255,255,255,.12);
}
.exam-panel .panel-block {
  padding: 8px 9px;
  box-shadow: 0 10px 28px rgba(0,0,0,.16), inset 0 1px rgba(255,255,255,.10);
}
.exam-panel .panel-controls {
  padding: 6px 8px;
}
.exam-panel label,
.exam-panel .stat-row,
.exam-panel .judge-speech {
  font-size: 11px;
}
.exam-panel select,
.exam-panel input {
  padding: 7px 8px;
  min-height: 32px;
}
.exam-panel button {
  min-height: 30px;
  padding: 6px 8px;
  font-size: 12px;
}
.license-strip {
  align-items: center;
  font-size: 11px;
}
.stat-row {
  margin-top: 6px;
}
.stat-row b {
  font-size: 15px;
}
.question-block h2 {
  min-height: 48px;
  max-height: 78px;
  overflow: hidden;
  font-size: clamp(16px, 1.55vw, 23px);
}
.answer-text {
  max-height: 138px;
  overflow: auto;
  padding: 8px;
}
.timer-display {
  font-size: clamp(34px, 4.4vw, 58px);
  padding: 2px 0 6px;
}
.timer-actions,
.question-actions {
  gap: 6px;
}
.rating-block {
  gap: 6px;
}
.panel-toggle {
  margin-bottom: 5px;
}
.topbar h1 {
  font-size: clamp(18px, 2vw, 24px);
}

@media (orientation: landscape) and (max-height: 520px) {
  .exam-panel {
    gap: 4px;
    padding: 5px;
  }
  .exam-panel .panel-block {
    padding: 6px 7px;
  }
  .panel-controls {
    padding: 4px 6px;
  }
  .question-block h2 {
    min-height: 34px;
    max-height: 54px;
    font-size: 14px;
  }
  .timer-display {
    font-size: 32px;
    padding: 0 0 3px;
  }
  .exam-panel button {
    min-height: 27px;
    padding: 4px 6px;
    font-size: 11px;
  }
  .rating-block {
    grid-template-columns: repeat(4, 1fr);
  }
}


/* Review-flow polish: flat draw control, stable canvas, readable prompts */
.topbar .brand-block .eyebrow {
  display: none;
}
.brand-block {
  display: flex;
  align-items: center;
}
.hand-button,
.hand-button:hover,
.hand-button:active,
.hand-button.is-drawing {
  background: #f2b84b;
  background-image: none;
  color: #111314;
  box-shadow: none;
  filter: none;
  animation: none;
  transform: translateX(-50%);
  transition: background-color .15s ease, filter .15s ease;
}
.hand-button:hover {
  filter: brightness(1.03);
}
.hand-button:active {
  filter: brightness(.96);
}
.question-block h2 {
  min-height: 92px;
  max-height: 152px;
  overflow: auto;
  align-items: flex-start;
  padding: 4px 0;
  font-size: var(--question-font-size, clamp(15px, 1.5vw, 22px));
  line-height: 1.34;
  scrollbar-width: thin;
}
.question-block h2.is-long {
  line-height: 1.42;
}
.timer-block {
  padding-top: 7px;
  padding-bottom: 7px;
}
.exam-panel .question-block {
  min-height: 238px;
}

@media (orientation: landscape) and (max-height: 520px) {
  .question-block h2 {
    min-height: 58px;
    max-height: 96px;
    font-size: var(--question-font-size, 14px);
  }
  .answer-text {
    min-height: 74px;
    max-height: 112px;
    font-size: 11px;
    line-height: 1.38;
  }
  .exam-panel .question-block {
    min-height: 190px;
  }
}


/* Single-deck question bank and output-mode controls */
.deck-title-display {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.25;
  color: var(--paper);
}
.panel-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.deck-title-editor {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  min-width: min(420px, 100%);
}
.manage-head {
  align-items: end;
  flex-wrap: wrap;
}
.csv-import-box {
  align-items: stretch;
}
.card-row small {
  color: var(--muted);
}
.card-form label textarea {
  min-height: 94px;
}

@media (max-width: 760px) {
  .deck-title-editor {
    grid-template-columns: 1fr;
  }
}

/* Exam scoring and clearer problem-bank stats */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}
.stat-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 6px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 7px;
  background: rgba(255,255,255,.055);
  text-align: center;
}
.stat-row small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}
.stat-row b {
  color: var(--amber);
  font-size: 20px;
  line-height: 1;
}
.exam-finish-block {
  padding: 10px;
}
.finish-exam-button {
  width: 100%;
  background: linear-gradient(180deg, #f2c15d, #d6962e);
  color: #111314;
  border-color: rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 8px 18px rgba(0,0,0,.24);
}
.exam-result-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5, 7, 7, .62);
  backdrop-filter: blur(6px);
}
.exam-result-card {
  position: relative;
  width: min(520px, calc(100vw - 36px));
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03)),
    rgba(20, 24, 24, .96);
  box-shadow: 0 28px 80px rgba(0,0,0,.52);
  text-align: center;
}
.exam-result-card.is-pass {
  border-color: rgba(242,184,75,.45);
  box-shadow: 0 30px 90px rgba(0,0,0,.56), 0 0 34px rgba(242,184,75,.18);
}
.exam-result-card.is-fail {
  border-color: rgba(231,111,81,.35);
}
.exam-result-card > strong {
  color: var(--amber);
  font-size: clamp(44px, 9vw, 78px);
  line-height: 1;
}
.exam-result-card p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}
.result-status {
  font-size: 17px !important;
  font-weight: 850;
}
.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.09);
  color: var(--text);
}
.result-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.result-breakdown span {
  padding: 6px 7px;
  border-radius: 7px;
  background: rgba(255,255,255,.07);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chrome-toggle {
  width: 26px !important;
  min-width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  padding: 0 !important;
}

.purchase-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 7, 7, .66);
  backdrop-filter: blur(8px);
}
.purchase-card {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 34px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(84, 182, 167, .30);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(84, 182, 167, .10), rgba(255,255,255,.03)),
    rgba(20, 24, 24, .97);
  box-shadow: 0 30px 86px rgba(0,0,0,.56);
}
.purchase-card h2 {
  font-size: 26px;
}
.purchase-card .button-row {
  flex-wrap: wrap;
}
.purchase-card .button-row button {
  flex: 1 1 180px;
}
.app-version {
  position: fixed;
  z-index: 35;
  left: max(10px, env(safe-area-inset-left));
  bottom: max(6px, env(safe-area-inset-bottom));
  color: rgba(243, 244, 238, .46);
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
}
.manual-corner-link {
  position: fixed;
  z-index: 45;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(6px, env(safe-area-inset-bottom));
  padding: 5px 8px;
  border: 1px solid rgba(232, 236, 228, .18);
  border-radius: 7px;
  background: rgba(17, 19, 20, .58);
  color: rgba(243, 244, 238, .72);
  font-size: 11px;
  line-height: 1;
  text-decoration: none;
  backdrop-filter: blur(10px);
}
.manual-corner-link:hover {
  color: var(--paper);
  background: rgba(17, 19, 20, .76);
}

@media (max-width: 760px) {
  .brand-logo strong { font-size: 22px; }
  .brand-logo span { font-size: 10px; }
  .purchase-modal { padding: 10px; }
  .purchase-card {
    width: min(100%, calc(100vw - 20px));
    padding: 18px;
  }
}

/* v16: non-scrolling compact settings dashboard */
#view-settings {
  overflow: hidden !important;
  padding-top: var(--topbar-height);
}
#view-settings .settings-grid {
  height: calc(100dvh - var(--topbar-height));
  min-height: 0;
  overflow: hidden;
  padding: 10px 44px 30px 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
#view-settings .settings-band {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}
#view-settings .section-head {
  align-items: flex-start;
  min-height: 0;
}
#view-settings h2 {
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.18;
}
#view-settings .eyebrow {
  font-size: 10px;
}
#view-settings .input-layout,
#view-settings .link-grid {
  gap: 7px;
  min-height: 0;
}
#view-settings label {
  gap: 4px;
  font-size: 11px;
}
#view-settings input,
#view-settings select {
  min-height: 32px;
  padding: 7px 9px;
  font-size: 12px;
}
#view-settings input[type="range"] {
  min-height: 26px;
  padding: 0;
}
#view-settings button {
  min-height: 31px;
  padding: 6px 8px;
  font-size: 12px;
}
#view-settings .button-row {
  gap: 6px;
}
#view-settings .button-row button {
  flex: 1 1 92px;
}
#view-settings .notice {
  font-size: 11px;
  line-height: 1.34;
}
#view-settings .license-status-box {
  padding: 8px 10px;
}
#view-settings .license-status-box span {
  font-size: 10px;
}
#view-settings .license-status-box strong {
  font-size: 12px;
  line-height: 1.3;
}
#view-settings .small-link-row a,
#view-settings .link-grid a {
  font-size: 12px;
  line-height: 1.25;
}
#view-settings .inline-check {
  min-height: 26px;
}
.fullscreen-nav[aria-pressed="true"] {
  background: linear-gradient(180deg, #f2c15d, #d6962e);
  color: #111314;
}

/* v17: tighter mobile landscape framing */
.app-shell,
.view,
.arena-grid {
  width: 100svw;
  max-width: 100vw;
}

@media (orientation: landscape) and (max-height: 620px) {
  #view-settings .settings-grid {
    padding: 7px 42px 24px 7px;
    gap: 7px;
  }
  #view-settings .settings-band {
    padding: 8px;
    gap: 5px;
  }
  #view-settings h2 { font-size: 15px; }
  #view-settings .notice { font-size: 10px; line-height: 1.25; }
  #view-settings .license-status-box { padding: 7px 8px; }
  #view-settings input,
  #view-settings select,
  #view-settings button {
    min-height: 28px;
    padding: 5px 7px;
  }
}

@media (orientation: landscape) and (max-width: 940px) and (max-height: 520px) {
  :root { --topbar-height: 50px; }
  .topbar {
    height: var(--topbar-height);
    padding: 6px calc(8px + env(safe-area-inset-right)) 6px calc(8px + env(safe-area-inset-left));
    gap: 6px;
  }
  .brand-logo strong { font-size: 18px; }
  .brand-logo span { font-size: 9px; }
  .mode-tabs { gap: 4px; }
  .tab,
  .fullscreen-nav {
    min-width: 0;
    min-height: 30px;
    padding: 5px 7px;
    font-size: 11px;
  }
  .judge-row {
    height: 44svh;
    padding-top: calc(var(--topbar-height) + 2px);
    gap: clamp(8px, 4vw, 28px);
  }
  .judge {
    width: clamp(82px, 12vw, 124px);
    height: 170px;
    transform: scale(.66);
  }
  .stage-floor {
    inset: 42svh 0 0;
    padding-left: calc(8px + env(safe-area-inset-left)) !important;
    padding-right: calc(47vw + env(safe-area-inset-right)) !important;
    justify-content: center;
  }
  .lottery-wrap {
    width: min(42vw, 340px);
    min-width: 168px;
  }
  .hand-button {
    min-width: 136px;
    min-height: 30px;
    padding: 6px 8px;
    font-size: 11px;
  }
  .exam-panel {
    top: calc(var(--topbar-height) + 4px);
    right: calc(4px + env(safe-area-inset-right));
    bottom: calc(4px + env(safe-area-inset-bottom));
    width: min(360px, 45vw);
    padding: 5px;
    gap: 4px;
  }
  .exam-panel .panel-block {
    padding: 5px 6px;
  }
  .question-block h2 {
    min-height: 42px;
    max-height: 68px;
    font-size: var(--question-font-size, 13px);
  }
  .answer-text {
    min-height: 82px;
    max-height: 118px;
    font-size: 10.5px;
    line-height: 1.35;
  }
  .exam-panel .question-block {
    min-height: 178px;
  }
  .timer-display {
    font-size: 30px;
    padding: 0 0 3px;
  }
}
