/* ============================================================================
   test-play-game.css — "Arcade" theme for the Python Test play screen.
   Re-skinned to the brand identity (violet #7c3aed / cyan #0ea5e9) to match the
   Tests catalogue. Green is reserved for "correct/passed" and coral for
   "wrong/lost" semantics only. Gold is the arcade "you are here" beacon + heat.
   Question surfaces stay light for legibility; chrome goes dark violet.
   ========================================================================== */
#test-game {
  --game-ink: #171326;
  --game-muted: #6b6690;
  --game-panel: #ffffff;
  --game-line: rgba(20, 16, 40, 0.14);
  --game-violet: #7c3aed;
  --game-violet-2: #6d28d9;
  --game-violet-deep: #4c1d95;
  --game-cyan: #0ea5e9;
  --game-grad: linear-gradient(120deg, #7c3aed 0%, #6366f1 48%, #0ea5e9 100%);
  --game-green: #16c07a;
  --game-green-dark: #0f8f5a;
  --game-coral: #ff5d6c;
  --game-gold: #f5b301;
  color: var(--game-ink);
  isolation: isolate;
  min-height: calc(100vh - 160px);
  overflow: hidden;
  position: relative;
}
#test-game::before,
#test-game::after {
  content: "";
  pointer-events: none;
  position: absolute;
  z-index: -1;
}
#test-game::before {
  background:
    linear-gradient(135deg, rgba(124, 58, 237, 0.20), rgba(14, 165, 233, 0.10)),
    radial-gradient(circle at 18% 16%, rgba(124, 58, 237, 0.30), transparent 30%),
    radial-gradient(circle at 84% 12%, rgba(14, 165, 233, 0.24), transparent 28%);
  border-radius: 0 0 32px 32px;
  inset: 0 0 auto;
  min-height: 360px;
}
#test-game::after {
  background-image:
    linear-gradient(90deg, rgba(20, 16, 40, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 16, 40, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  inset: 0;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 72%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 72%);
}
#test-game .game-shell {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.93), rgba(248, 246, 255, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(76, 29, 149, 0.15);
  margin-inline: auto;
  max-width: 1180px;
  padding: clamp(0.9rem, 2.2vw, 1.35rem);
  position: relative;
}
#test-game .game-shell__top {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}
#test-game .game-brand { align-items: center; display: flex; gap: 0.8rem; min-width: 0; }
#test-game .game-brand__mark {
  align-items: center;
  background: var(--game-grad);
  border: none;
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(76, 29, 149, 0.3);
  color: #fff;
  display: grid;
  flex: 0 0 48px;
  font-size: 1.2rem;
  height: 48px;
  justify-items: center;
  transform: rotate(-3deg);
}
#test-game .game-brand__eyebrow {
  color: var(--game-violet-2);
  display: block;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#test-game .game-brand__title {
  display: block;
  font-family: "Space Grotesk", "Plus Jakarta Sans", sans-serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1;
}
#test-game .game-pill {
  align-items: center;
  background: #171326;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  white-space: nowrap;
}
#test-game .game-pill i { color: var(--game-gold); }
#test-game #game-hud { grid-template-columns: minmax(180px, 1.25fr) repeat(3, minmax(130px, 0.8fr)); }
#test-game .hud-tile {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--game-line);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(76, 29, 149, 0.08);
  min-height: 84px;
  overflow: hidden;
  position: relative;
}
#test-game .hud-tile::after {
  background: var(--game-grad);
  bottom: 0; content: ""; height: 5px; left: 0; position: absolute; right: 0;
}
#test-game .hud-label { color: var(--game-muted); font-weight: 900; }
#test-game .hud-value { font-weight: 900; }
#test-game .hud-value small { color: var(--game-muted); display: block; font-size: 0.72rem; font-weight: 800; margin-top: 0.2rem; }
#test-game .avatar-sigil {
  background: linear-gradient(145deg, #2a1f52, #171326);
  border: 3px solid var(--game-violet);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18), 0 12px 20px rgba(76, 29, 149, 0.25);
  font-size: 1.2rem;
  animation: z2h-sigil-float 6s ease-in-out infinite;
}
#test-game .phase-map-shell {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 243, 255, 0.92));
  border: 1px solid var(--game-line);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 16px 36px rgba(76, 29, 149, 0.08);
  margin-bottom: 1rem;
  padding: 0.85rem;
}
#test-game .phase-map-shell__label {
  align-items: center; color: var(--game-muted); display: flex; font-size: 0.78rem;
  font-weight: 900; gap: 0.45rem; margin-bottom: 0.55rem; text-transform: uppercase;
}
#test-game .phase-map-shell__label i { color: var(--game-violet); }
#test-game #phase-map { grid-template-columns: repeat(10, minmax(38px, 1fr)); margin: 0; }
#test-game .phase-node {
  background: linear-gradient(180deg, #fff, #f1ecff);
  border: 2px solid var(--game-line);
  box-shadow: inset 0 -5px 0 rgba(20, 16, 40, 0.06);
  min-width: 38px;
  transition: transform 220ms ease, background 220ms ease, color 220ms ease, box-shadow 220ms ease;
}
#test-game .phase-node::before {
  background: rgba(124, 58, 237, 0.25); content: ""; height: 3px; position: absolute;
  right: calc(100% + 2px); top: 50%; transform: translateY(-50%); width: 0.55rem;
}
#test-game .phase-node:first-child::before { display: none; }
#test-game .phase-node.is-past {
  background: linear-gradient(180deg, #9a6bf5, var(--game-violet)); border-color: var(--game-violet-2); color: #fff;
}
#test-game .phase-node.is-current {
  background: linear-gradient(180deg, #ffdd8a, var(--game-gold));
  border-color: #d99a17;
  box-shadow: inset 0 -6px 0 rgba(167, 103, 0, 0.16), 0 0 0 4px rgba(124, 58, 237, 0.16), 0 18px 28px rgba(245, 179, 1, 0.4);
  color: #3a2600;
  transform: translateY(-7px) scale(1.04);
  animation: z2h-node-beacon 2.4s ease-in-out infinite;
}
#test-game #phase-map.is-celebrating .phase-node.is-current { animation: z2h-node-pop 620ms cubic-bezier(0.2, 1.4, 0.35, 1); }
#test-game .game-panel {
  animation: z2h-panel-in 300ms ease both;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--game-line);
  border-radius: 18px;
  box-shadow: 0 24px 56px rgba(76, 29, 149, 0.12);
  overflow: hidden;
  position: relative;
}
#test-game .game-panel::before,
#test-game .modal-pop::before {
  background: var(--game-grad);
  content: ""; height: 7px; left: 0; position: absolute; right: 0; top: 0;
}
#test-game .game-price-strip { background: linear-gradient(135deg, #1a1330, #2a1f52); border-radius: 14px; gap: 0.65rem; padding: 0.75rem 0.9rem; }
#test-game .game-price-strip span { font-weight: 850; }
#test-game .game-price-strip strong { background: rgba(255, 255, 255, 0.1); border-radius: 999px; color: #67e8f9; padding: 0.3rem 0.55rem; }
#test-game .avatar-grid { gap: 0.9rem; grid-template-columns: repeat(4, minmax(130px, 1fr)); }
#test-game .avatar-choice,
#test-game .answer-tile,
#test-game .step-chip,
#test-game .course-prize {
  border: 2px solid var(--game-line);
  border-radius: 14px;
  font-weight: 850;
  position: relative;
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease, background 170ms ease;
}
#test-game .avatar-choice:hover,
#test-game .answer-tile:hover,
#test-game .step-chip:hover,
#test-game .course-prize:hover { border-color: var(--game-violet); box-shadow: 0 16px 30px rgba(124, 58, 237, 0.2); transform: translateY(-3px); }
#test-game .avatar-choice:focus-visible,
#test-game .answer-tile:focus-visible,
#test-game .step-chip:focus-visible,
#test-game .course-prize:focus-visible,
#test-game .short-input:focus-visible { outline: 4px solid rgba(124, 58, 237, 0.3); outline-offset: 2px; }
#test-game .avatar-choice.is-selected,
#test-game .answer-tile.is-selected,
#test-game .step-chip.is-selected { background: linear-gradient(180deg, #f3ecff, #ffffff); border-color: var(--game-violet); box-shadow: 0 18px 30px rgba(124, 58, 237, 0.2); }
#test-game .avatar-choice { display: grid; gap: 0.65rem; min-height: 174px; padding: 1rem; }
#test-game .avatar-choice__icon {
  align-items: center;
  background: linear-gradient(145deg, #2a1f52, #171326);
  border: 3px solid var(--game-violet);
  border-radius: 18px;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22);
  color: #fff;
  display: grid;
  font-size: 1.7rem;
  height: 58px;
  justify-items: center;
  width: 58px;
}
#test-game .avatar-choice.is-selected .avatar-choice__icon { border-color: var(--game-cyan); box-shadow: inset 0 -5px 0 rgba(0,0,0,0.22), 0 0 0 4px rgba(14,165,233,0.2); }
#test-game .avatar-choice strong { display: block; font-size: 1.08rem; line-height: 1.05; }
#test-game .avatar-choice span { opacity: 1; }
#test-game .avatar-choice__line { color: var(--game-muted); font-size: 0.84rem; font-weight: 750; }
#test-game .avatar-choice__tag { align-self: end; background: rgba(124, 58, 237, 0.1); border-radius: 999px; color: var(--game-violet-2); display: inline-block; font-size: 0.78rem; font-weight: 900; padding: 0.32rem 0.55rem; width: max-content; }
#test-game .question-card {
  animation: z2h-card-pop 260ms ease both;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 248, 255, 0.98));
  border: 1px solid var(--game-line);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 #fff;
  padding: clamp(0.2rem, 0.5vw, 0.35rem);
}
#test-game .question-top { flex-wrap: wrap; margin-bottom: 0.85rem; }
#test-game .question-count,
#test-game .difficulty-badge { align-items: center; border-radius: 999px; display: inline-flex; font-size: 0.84rem; font-weight: 900; gap: 0.4rem; padding: 0.44rem 0.7rem; }
#test-game .question-count { background: rgba(124, 58, 237, 0.1); color: var(--game-violet-2); }
#test-game .difficulty-badge { background: #fff2df; color: #8a5200; }
#test-game .difficulty-meter { background: rgba(138, 82, 0, 0.14); border-radius: 999px; display: inline-block; height: 8px; overflow: hidden; width: 70px; }
#test-game .difficulty-meter span { background: linear-gradient(90deg, var(--game-gold), var(--game-coral)); display: block; height: 100%; }
#test-game .question-prompt { font-family: "Space Grotesk", "Plus Jakarta Sans", sans-serif; font-size: clamp(1.42rem, 3.2vw, 2.22rem); font-weight: 800; line-height: 1.08; max-width: 920px; }
#test-game .question-prompt code { color: var(--game-violet-2); }
#test-game .code-frame { background: #120d24; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 16px; box-shadow: 0 18px 34px rgba(76, 29, 149, 0.28); margin: 0 0 1rem; overflow: hidden; }
#test-game .code-frame__bar { align-items: center; background: #1c1430; color: #cdb8ff; display: flex; font-size: 0.78rem; font-weight: 850; gap: 0.45rem; padding: 0.55rem 0.8rem; }
#test-game .code-dot { border-radius: 50%; display: inline-block; height: 10px; width: 10px; }
#test-game .code-dot--red { background: #ff6b6b; }
#test-game .code-dot--gold { background: #ffd166; }
#test-game .code-dot--mint { background: #34d399; margin-right: 0.35rem; }
#test-game .code-block { background: transparent; border-radius: 0; color: #d8d3f0; line-height: 1.6; margin: 0; }
#test-game .answer-arena { min-height: 160px; }
#test-game .answers-grid { gap: 0.85rem; }
#test-game .answer-tile { align-items: center; display: grid; gap: 0.65rem; grid-template-columns: auto 1fr auto; min-height: 82px; overflow: hidden; }
#test-game .answer-tile::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 45%; height: 100%; z-index: 1;
  transform: skewX(-20deg); background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.14), transparent);
  transition: left 0.55s ease; pointer-events: none;
}
#test-game .answer-tile:hover::after { left: 130%; }
#test-game .answer-key { background: #2a1f52; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.24); font-size: 0.86rem; height: 34px; width: 34px; }
#test-game .answer-copy { display: block; line-height: 1.28; min-width: 0; overflow-wrap: anywhere; }
#test-game .answer-check { align-items: center; background: #ece7f7; border-radius: 999px; color: #8a84a9; display: grid; height: 30px; justify-items: center; width: 30px; }
#test-game .answer-tile.is-selected .answer-check { background: var(--game-violet); color: #fff; }
#test-game .short-answer-console { background: linear-gradient(180deg, #1c1430, #120d24); border-radius: 18px; box-shadow: 0 18px 34px rgba(76, 29, 149, 0.26); display: grid; gap: 0.65rem; padding: 1rem; }
#test-game .short-answer-console__label { color: #b7a6ef; font-size: 0.78rem; font-weight: 900; text-transform: uppercase; }
#test-game .short-input { border-radius: 12px; font-size: clamp(1rem, 2vw, 1.25rem); }
#test-game .order-zone-card { background: #f7f5ff; border: 1px solid var(--game-line); border-radius: 16px; padding: 0.8rem; }
#test-game .order-zone-card__title { color: var(--game-muted); display: block; font-size: 0.78rem; font-weight: 900; margin-bottom: 0.55rem; text-transform: uppercase; }
#test-game .chip-zone { border-radius: 13px; min-height: 136px; }
#test-game .chip-zone--target { background: #f3ecff; border-color: rgba(124, 58, 237, 0.3); }
#test-game .step-chip { align-items: center; display: inline-flex; gap: 0.45rem; }
#test-game .step-chip i { color: var(--game-cyan); }
#test-game .game-nav { background: rgba(255, 255, 255, 0.82); border: 1px solid var(--game-line); border-radius: 16px; gap: 0.85rem; padding: 0.8rem; }
#test-game .progress-cluster { display: grid; gap: 0.35rem; min-width: min(360px, 100%); }
#test-game .progress-label { color: var(--game-muted); font-size: 0.78rem; font-weight: 900; text-transform: uppercase; }
#test-game .progress-rail { height: 14px; width: min(360px, 100%); }
#test-game .progress-fill { background: linear-gradient(90deg, var(--game-violet), var(--game-cyan)); box-shadow: 0 0 16px rgba(124, 58, 237, 0.35); }
#test-game .game-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; justify-content: flex-end; }
#test-game .game-actions .btn,
#test-game .modal-pop .btn { border-radius: 999px; font-weight: 900; }
#test-game .game-actions .btn:disabled { cursor: not-allowed; opacity: 0.56; }
#test-game .game-modal { background: rgba(15, 11, 31, 0.68); }
#test-game .modal-pop { animation: z2h-modal-bounce 380ms cubic-bezier(0.2, 1.35, 0.35, 1) both; background: linear-gradient(180deg, #ffffff, #faf8ff); border: 1px solid rgba(255, 255, 255, 0.8); border-radius: 20px; box-shadow: 0 34px 90px rgba(15, 11, 31, 0.38); max-width: 760px; position: relative; width: min(100%, 760px); }
#test-game .modal-pop--loss::before { background: linear-gradient(90deg, var(--game-coral), var(--game-gold)); }
#test-game .modal-pop--win::before { background: linear-gradient(90deg, var(--game-violet), var(--game-cyan), var(--game-gold)); }
#test-game .modal-badge { align-items: center; background: var(--game-grad); border: 4px solid #fff; border-radius: 50%; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18), 0 16px 28px rgba(76, 29, 149, 0.28); color: #fff; display: grid; font-size: 1.65rem; height: 70px; justify-items: center; margin-bottom: 0.8rem; width: 70px; }
#test-game .game-modal.is-pass .modal-badge { background: linear-gradient(145deg, var(--game-green-dark), var(--game-green)); }
#test-game .game-modal.is-fail .modal-badge,
#test-game .modal-pop--loss .modal-badge { background: linear-gradient(145deg, #da3349, #ff6b6b); }
#test-game .modal-pop--win .modal-badge { background: linear-gradient(145deg, var(--game-violet-deep), var(--game-cyan)); }
#test-game .review-item { border-radius: 14px; }
#test-game .review-item strong { align-items: center; display: flex; gap: 0.45rem; }
#test-game .review-item.is-correct { background: #effcf6; border-color: rgba(22, 192, 122, 0.35); }
#test-game .review-item.is-correct strong { color: var(--game-green-dark); }
#test-game .review-item.is-wrong strong { color: #d33049; }
#test-game .review-item small { color: var(--game-muted); display: block; font-weight: 800; }
#test-game .course-prize { align-items: center; display: flex; gap: 0.65rem; }
#test-game .course-prize::before { align-items: center; background: rgba(124, 58, 237, 0.1); border-radius: 999px; color: var(--game-violet-2); content: "\f091"; display: grid; flex: 0 0 36px; font: var(--fa-font-solid); height: 36px; justify-items: center; }
@keyframes z2h-modal-bounce { 0% { opacity: 0; transform: translateY(20px) scale(0.94); } 70% { transform: translateY(-5px) scale(1.01); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes z2h-node-pop { 0%, 100% { transform: translateY(-7px) scale(1.04); } 50% { transform: translateY(-18px) scale(1.16); } }
@keyframes z2h-node-beacon { 0%, 100% { box-shadow: inset 0 -6px 0 rgba(167, 103, 0, 0.16), 0 0 0 4px rgba(124, 58, 237, 0.16), 0 18px 28px rgba(245, 179, 1, 0.4); } 50% { box-shadow: inset 0 -6px 0 rgba(167, 103, 0, 0.16), 0 0 0 8px rgba(124, 58, 237, 0.06), 0 20px 34px rgba(245, 179, 1, 0.55); } }
@keyframes z2h-sigil-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes z2h-panel-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes z2h-card-pop { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 991.98px) {
  #test-game .game-shell { border-radius: 16px; }
  #test-game .game-shell__top { align-items: flex-start; flex-direction: column; }
  #test-game #game-hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #test-game #phase-map { grid-template-columns: repeat(5, minmax(42px, 1fr)); }
  #test-game .phase-node:nth-child(6)::before { display: none; }
  #test-game .avatar-grid, #test-game .answers-grid, #test-game .order-zones, #test-game .prize-grid { grid-template-columns: 1fr; }
  #test-game .game-nav { align-items: stretch; flex-direction: column; }
  #test-game .game-actions { justify-content: stretch; }
  #test-game .game-actions .btn { flex: 1 1 150px; }
}
@media (max-width: 575.98px) {
  #test-game { min-height: calc(100vh - 120px); }
  #test-game #game-hud { grid-template-columns: 1fr; }
  #test-game .hud-tile { min-height: 72px; }
  #test-game #phase-map { gap: 0.42rem; grid-template-columns: repeat(5, minmax(34px, 1fr)); }
  #test-game .phase-node { min-width: 34px; }
  #test-game .phase-node::before { width: 0.42rem; }
  #test-game .question-prompt { font-size: 1.35rem; }
  #test-game .answer-tile { grid-template-columns: auto 1fr; }
  #test-game .answer-check { display: none; }
  #test-game .modal-pop { border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  #test-game *, #test-game *::before, #test-game *::after { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
}

/* Play-page containment: the mobile nav lives off-canvas in the base layout. */
html,
body {
  overflow-x: hidden;
}
@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip;
  }
}
@media (max-width: 575.98px) {
  #test-game .code-block {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }
}
