:root { color-scheme: light dark; }
* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

#screen-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 100;
}
#screen-overlay.fading {
  opacity: 1;
  pointer-events: auto;
}

#wrong-note {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  color: rgba(255, 255, 255, 0.88);
  max-width: 480px;
  width: calc(100% - 64px);
  padding: 24px 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.4s ease 0.1s;
}
#wrong-note.visible {
  opacity: 1;
}
.note-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.4;
  margin-bottom: 14px;
}
.note-item + .note-item {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.note-item-stmt {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.45;
  margin-bottom: 8px;
}
.note-item-def {
  font-size: 14px;
  font-style: italic;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.82);
}
.note-continue {
  margin-top: 22px;
  padding: 9px 16px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.65);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  display: block;
  width: 100%;
}
.note-continue:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.9);
}

/* ── Layout: image fills viewport, sidebar overlays on the right ── */
.game-layout {
  position: relative;
  height: 100dvh;
  width: 100%;
}

.img-panel {
  position: absolute;
  inset: 0;
  background: #000;
  overflow: hidden;
}
.img-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@keyframes specimen-reveal {
  0%   { opacity: 0; filter: blur(20px) brightness(0.1); }
  20%  { opacity: 1; filter: blur(14px) brightness(0.4); }
  70%  { opacity: 1; filter: blur(3px)  brightness(0.88); }
  100% { opacity: 1; filter: blur(0px)  brightness(1); }
}
.img-panel--reveal img {
  animation: specimen-reveal 2.4s ease-out forwards;
}

.sidebar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 16px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.game-layout.sidebar-collapsed .sidebar {
  transform: translateX(100%);
}

/* ── Sidebar toggle tab ── */
.sidebar-toggle {
  position: absolute;
  right: 300px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 52px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-right: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 20;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-toggle:hover {
  background: rgba(0, 0, 0, 0.80);
}
.game-layout.sidebar-collapsed .sidebar-toggle {
  right: 0;
}
.sidebar-toggle-icon {
  display: block;
  width: 7px;
  height: 7px;
  border-right: 2px solid rgba(255, 255, 255, 0.75);
  border-bottom: 2px solid rgba(255, 255, 255, 0.75);
  transform: rotate(-45deg); /* → close */
  transition: transform 0.3s ease;
  flex-shrink: 0;
  margin-left: -2px; /* optical centering */
}
.game-layout.sidebar-collapsed .sidebar-toggle-icon {
  transform: rotate(135deg); /* ← open */
  margin-left: 2px;
}

/* sidebar sections */
.season-info .meta {
  opacity: 0.55;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.season-info h2 {
  margin: 2px 0 0;
  font-size: 16px;
  font-style: italic;
}
.chapter-info .chapter-title {
  font-size: 14px;
  font-weight: 600;
  font-style: italic;
  margin: 0;
}
.chapter-info .chapter-num {
  font-size: 11px;
  opacity: 0.55;
  margin: 2px 0 0;
}
.chapter-info .chapter-name {
  font-size: 14px;
  font-style: italic;
  letter-spacing: 0.04em;
  margin: 6px 0 0;
}

.score-box {
  align-items: baseline;
  border-left: 2px solid rgba(255, 255, 255, 0.22);
  display: flex;
  gap: 6px;
  padding: 4px 0 4px 12px;
}
.score-box .score-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.score-box .score-label {
  font-size: 12px;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.banner--incorrect {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 80, 80, 0.2);
  border: 1px solid rgba(255, 80, 80, 0.4);
  font-size: 13px;
}

@keyframes delta-pop {
  0%   { opacity: 0; transform: translateY(3px) scale(0.85); }
  40%  { opacity: 1; transform: translateY(-1px) scale(1.08); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.score-delta {
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  margin-left: auto;
  letter-spacing: 0.02em;
}
.score-delta--bonus {
  color: #f5c400;
}
.score-delta--pop {
  animation: delta-pop 0.25s ease-out forwards;
}

@keyframes score-flash {
  0%, 100% { border-left-color: rgba(255, 255, 255, 0.22); }
  50%       { border-left-color: rgba(245, 196, 0, 0.9); }
}
.score-box--flash {
  animation: score-flash 0.4s ease-in-out 3;
}

.error-msg {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 80, 80, 0.2);
  border: 1px solid rgba(255, 80, 80, 0.4);
  font-size: 13px;
}

.answer-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.answer-btn {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  font-size: 13px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  width: 100%;
  text-align: left;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.35;
}
.answer-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}
.answer-btn:disabled:not(.answer-btn--correct):not(.answer-btn--wrong) {
  opacity: 0.35;
  cursor: default;
}

.answer-btn--wrong {
  background: rgba(255, 80, 80, 0.22);
  border-color: rgba(255, 80, 80, 0.5);
  pointer-events: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.answer-btn--correct {
  background: rgba(0, 200, 120, 0.22) !important;
  border-color: rgba(0, 200, 120, 0.45) !important;
  pointer-events: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.next-btn {
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  width: 100%;
  color: #0a0a0a;
  margin-top: 8px;
}
.next-btn:hover {
  background: #ffffff;
}

.restart-btn {
  color: rgba(255, 255, 255, 0.35);
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}
.restart-btn:hover {
  color: rgba(255, 255, 255, 0.7);
}

.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}
.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

/* ── Mobile layout: sidebar overlays at the bottom ── */
@media (max-width: 600px) {
  body { overflow: hidden; }

  .game-layout {
    position: relative;
    height: 100dvh;
  }
  .img-panel {
    position: absolute;
    inset: 0;
  }
  .sidebar {
    position: absolute;
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    height: calc(100dvh - 48px);
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 12px 14px;
    gap: 8px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .game-layout.sidebar-collapsed .sidebar {
    transform: translateY(100%);
  }
  .sidebar-toggle {
    right: auto;
    left: 50%;
    bottom: calc(100dvh - 48px);
    top: auto;
    transform: translateX(-50%);
    width: 52px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .game-layout.sidebar-collapsed .sidebar-toggle {
    right: auto;
    bottom: 0;
  }
  .sidebar-toggle-icon {
    transform: rotate(45deg); /* ↓ close */
    margin-left: 0;
  }
  .game-layout.sidebar-collapsed .sidebar-toggle-icon {
    transform: rotate(225deg); /* ↑ open */
    margin-left: 0;
  }
  .score-box { padding: 7px 10px; }
  .score-box .score-num { font-size: 22px; }
  .chapter-info .chapter-title { font-size: 13px; }
  .chapter-info .chapter-num { font-size: 11px; }
  .chapter-info .chapter-name { font-size: 13px; }
  .answer-btn { padding: 8px 10px; font-size: 12px; }
}

/* ── Done screen ── */
.done-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 32px 16px 64px;
  overflow-y: auto;
  height: 100dvh;
  color: rgba(255, 255, 255, 0.92);
}
.level-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
}
.level-row + .level-row {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.level-row-label {
  font-size: 13px;
}
.level-row-score {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0.8;
}
.done-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.done-score {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}
.card {
  border: 1px solid rgba(127, 127, 127, 0.22);
  border-radius: 14px;
  padding: 16px;
  margin-top: 16px;
}
.small {
  font-size: 13px;
  opacity: 0.75;
}
.break {
  padding: 10px 0;
}
.done-btn {
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid rgba(60, 140, 255, 0.35);
  background: rgba(60, 140, 255, 0.15);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: inherit;
}

/* ── Home screen ── */
.home-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: rgba(255, 255, 255, 0.92);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.home-title {
  font-size: clamp(28px, 6.5vw, 48px);
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.25;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}
.home-eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 48px;
  text-align: center;
  background: rgba(0, 0, 0, 0.38);
  border-radius: 4px;
  padding: 3px 10px;
  display: inline-block;
}
.season-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 400px;
}
.season-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.season-card-meta {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.4;
  margin-bottom: 8px;
}
.season-card-name {
  font-size: 20px;
  font-style: italic;
  font-weight: 600;
  margin: 0 0 6px;
}
.season-card-sub {
  font-size: 12px;
  opacity: 0.4;
}
.season-play-btn {
  background: rgba(255, 255, 255, 0.92);
  border: none;
  border-radius: 8px;
  color: #0a0a0a;
  cursor: pointer;
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 13px;
  padding: 10px 16px;
  text-align: center;
  text-decoration: none;
  width: 100%;
}
.season-play-btn:hover {
  background: #ffffff;
}
.season-restart-link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 0;
  text-align: center;
  text-transform: uppercase;
  width: 100%;
}
.season-restart-link:hover {
  color: rgba(255, 255, 255, 0.75);
}

/* ── Home nav ── */
.home-nav {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.6);
  padding: 5px;
}
.home-nav-link {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 1.00);
  text-decoration: none;
}
.home-nav-link:hover {
  color: rgba(0, 0, 0, 1.00);
  text-decoration: underline;
}
.home-hr {
  width: 100%;
  max-width: 400px;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin: 0 0 20px;
}

/* ── Info pages (How it works / About) ── */
.info-wrap {
  max-width: 540px;
  margin: 0 auto;
  padding: 40px 20px 72px;
  color: rgba(255, 255, 255, 0.88);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
}
.info-topbar {
  margin-bottom: 32px;
}
.info-back {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
}
.info-back:hover {
  color: rgba(255, 255, 255, 0.85);
}
.info-title {
  font-size: 22px;
  font-style: italic;
  font-weight: 700;
  margin: 6px 0 28px;
}
.info-card {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  padding: 20px 22px;
  margin-bottom: 14px;
}
.info-card a{
  color: rgba(255, 255, 255, 1);
}
.info-card a:hover{
  color: rgba(255, 255, 255, 1);
  text-decoration: underline;
}
.info-score-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 10px;
}
.info-score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
}
.info-score-label {
  opacity: 0.7;
}
.info-score-pts {
  font-weight: 700;
  opacity: 0.85;
}
.info-score-row--bonus .info-score-pts {
  color: rgba(180, 255, 160, 0.9);
}
.info-score-row--max {
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  margin-top: 2px;
}
.info-score-row--max .info-score-label,
.info-score-row--max .info-score-pts {
  opacity: 1;
  font-weight: 700;
}

/* ── Error screen ── */
.error-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 32px 16px;
}
