@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;600&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --bg-start: #f5f8ff;
  --bg-end: #d7e5ff;
  --ink: #1b2a44;
  --muted: #6b7b95;
  --primary: #1f7bff;
  --primary-dark: #145ac0;
  --border: #78b0ff;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Lexend', 'Trebuchet MS', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, var(--bg-start), var(--bg-end));
  overflow-y: auto;
}

.app { width: 100%; padding: 24px; display: flex; justify-content: center; }

.game-shell {
  position: relative;
  width: min(860px, 92vw);
  height: auto;
  min-height: 92vh;
  background: #f8fbff;
  border: 4px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 20px 50px rgba(17, 45, 90, 0.2);
  overflow: visible;
}

.screen { position: relative; display: none; padding: 24px; min-height: 100%; }
.screen.active { display: flex; justify-content: center; align-items: flex-start; }

.menu-btn {
  position: absolute; top: 18px; right: 18px; width: 46px; height: 46px;
  border-radius: 12px; border: 2px solid var(--border); background: #eef5ff;
  display: flex; flex-direction: column; justify-content: center; gap: 6px; z-index: 5; cursor: pointer;
}
.menu-btn span { height: 3px; background: var(--primary); border-radius: 999px; }

.audio-btn {
  position: absolute;
  top: 70px;
  right: 18px;
  background: #eef5ff;
  border: 2px solid var(--border);
  border-radius: 12px;
  width: 46px;
  height: 46px;
  cursor: pointer;
  z-index: 5;
  font-size: 20px;
}
.audio-panel {
  position: absolute;
  top: 124px;
  right: 18px;
  display: none;
  background: #eef5ff;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  z-index: 5;
}
.audio-panel.active { display: block; }
.audio-volume-vertical {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 24px;
  height: 130px;
  accent-color: var(--primary);
}

.menu-panel {
  position: absolute; top: 70px; right: 22px; width: 220px; background: var(--primary);
  color: #fff; border-radius: 16px; padding: 16px; display: none; z-index: 6;
}
.menu-panel.active { display: block; }
.menu-panel h4 { margin: 0 0 10px; font-family: 'Space Grotesk', sans-serif; }
.menu-item {
  width: 100%; padding: 8px 10px; background: rgba(255, 255, 255, 0.15);
  color: #fff; border: none; border-radius: 10px; margin-bottom: 8px; cursor: pointer;
}
.menu-close {
  width: 100%; padding: 6px 10px; background: #fff; color: var(--primary);
  border: none; border-radius: 10px; cursor: pointer; font-weight: 600;
}

.cover-card-full {
  width: min(720px, 95%);
  background: var(--card);
  border: 6px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(20, 50, 100, 0.12);
}
.cover-content {
  text-align: center;
}
.cover-badges {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}
.badge {
  background: var(--primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.cover-author {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 20px;
}
.primary.large { padding: 14px 32px; font-size: 18px; }
.cover-description {
  margin-top: 32px;
  text-align: left;
}
.cover-description h3 {
  color: var(--ink);
  margin-bottom: 12px;
}
.cover-description > p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 24px;
}
.cover-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.info-card {
  background: #f2f7ff;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.info-icon { font-size: 32px; margin-bottom: 8px; }
.info-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.info-value { font-weight: 600; color: var(--ink); }
.cover-image,
.preplay-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  border: 2px solid #d7e6ff;
  background: linear-gradient(135deg, #cfe2ff, #f9fbff);
  background-image: url('assets/cover.jpg');
  background-size: 95%;
  background-position: center;
  background-repeat: no-repeat;
  margin-bottom: 16px;
}
.cover-content h1 { margin: 6px 0 4px; font-family: 'Space Grotesk', sans-serif; }

.primary, .level-btn, .advance-btn {
  background: var(--primary); color: #fff; border: none; padding: 12px 18px; border-radius: 12px; font-weight: 600; cursor: pointer;
}
.primary.large { padding: 14px 22px; }

.preplay-card, .level-card, .names-card, .spinner-card, .question-card {
  width: min(520px, 90%); background: var(--card); border: 3px solid var(--border);
  border-radius: 22px; padding: 24px; text-align: center; box-shadow: 0 16px 40px rgba(20, 50, 100, 0.12);
}
.preplay-note { margin: 10px 0 4px; font-size: 14px; color: var(--primary-dark); font-weight: 600; }
.level-note { margin: 10px 0 4px; font-size: 14px; color: var(--primary-dark); font-weight: 600; }
.names-note { margin: 8px 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.instructions-list { text-align: left; margin: 12px 0 18px; padding-left: 20px; color: var(--ink); font-weight: 600; column-gap: 22px; }
.instructions-list li { margin: 8px 0; line-height: 1.4; }

#screen-level .level-card {
  width: min(640px, 92%);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
}
#screen-level .level-card h2 { text-align: center; }
#screen-level .level-note { text-align: center; }
@media (min-width: 700px) {
  .instructions-list { column-count: 2; }
}
.team-input { margin: 12px 0; }
.team-input-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.team-token-preview {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #111;
}
.team-token-preview .mark { font-size: 18px; line-height: 1; }
.team-input input {
  width: min(360px, 90%);
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--border);
  font-weight: 600;
  text-align: center;
}

.play-btn { width: 90px; height: 90px; border-radius: 50%; border: 3px solid var(--border); background: #f2f7ff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; margin-top: 20px; }
.play-btn .triangle { width:0; height:0; border-top:16px solid transparent; border-bottom:16px solid transparent; border-left:26px solid var(--primary); margin-left:6px; }

.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.06)} }

.board-header { width: 80%; margin: 20px auto 12px; padding: 14px; text-align: center; border-radius: 18px; border: 3px solid var(--border); background: #eef5ff; font-weight: 700; }
.start-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  font-weight: 900;
  color: #1f7bff;
  text-shadow: 0 6px 16px rgba(31, 123, 255, 0.35);
  z-index: 30;
  background: rgba(248, 251, 255, 0.65);
  border-radius: 20px;
}
.board-wrap { position: relative; width: 100%; height: 860px; display: flex; justify-content: center; align-items: center; }
.map-container { position: relative; width: 100%; height: 100%; max-width: 900px; margin: 0 auto; }
.map-connections { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; overflow: visible; }
.connection-track-line { fill: none; stroke: #cfe1ff; stroke-width: 28px; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(65, 120, 200, 0.25)); }
.connection-line { fill: none; stroke: #9cc1ff; stroke-width: 6px; stroke-dasharray: 18 10; stroke-linecap: round; stroke-linejoin: round; }
.map-node { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; background: #fff; border: 4px solid #72a6ff; border-radius: 50%; font-family: 'Lexend', sans-serif; font-weight: 900; color: #2755a6; box-shadow: 0 4px 10px rgba(31,123,255,0.2); z-index: 2; text-shadow: 0 0 0 #2755a6, 0.8px 0 #2755a6, -0.8px 0 #2755a6, 0 0.8px #2755a6, 0 -0.8px #2755a6; }
.map-node.step { width: 70px; height: 70px; font-size: 26px; }

.map-container.show-grid {
  background-image: linear-gradient(#e6efff 1px, transparent 1px),
    linear-gradient(90deg, #e6efff 1px, transparent 1px);
  background-size: 40px 40px;
}

.map-container:not(.show-grid) .coord-overlay {
  display: none;
}
.coord-overlay {
  position: absolute;
  top: 40%;
  left: 0;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #b6d3ff;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #2755a6;
  z-index: 20;
  pointer-events: none;
}
.map-node.start { width: 112px; height: 112px; border-color: #72a6ff; background: #eef5ff; flex-wrap: wrap; padding: 12px; gap: 6px; }
.start-slot { width: 26px; height: 26px; background: #ccdfff; border-radius: 50%; }
.map-node.finish { width: 112px; height: 112px; border-color: #2f6fd1; background: #fff; font-size: 40px; color: #ffb84a; box-shadow: 0 0 20px rgba(255,184,74,0.4); }
.player-tokens { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.player-token { position: absolute; width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 4px 8px rgba(0,0,0,0.3); transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; font-weight: 900; color: #1b2a44; }
.player-token .mark { font-size: 22px; line-height: 1; }
.player-token.pulse {
  animation: tokenPulse 1.2s ease-in-out infinite;
}
@keyframes tokenPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.18); }
}
.map-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 700;
  color: #2b4f99;
}
.bonus-card {
  position: absolute;
  display: none;
  gap: 10px;
  padding: 8px 12px;
  background: #f3f7ff;
  border: 3px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(31, 123, 255, 0.2);
  font-weight: 900;
  z-index: 12;
}
.bonus-item { display: flex; align-items: center; gap: 10px; font-size: 28px; font-weight: 900; }
.bonus-ok { color: #1f9d55; }
.bonus-bad { color: #e04f5f; }
.hand-indicator {
  position: absolute;
  font-size: 52px;
  color: var(--primary);
  z-index: 30;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  line-height: 1;
  transform: scaleX(-1);
}
.screen#screen-board { flex-direction: column; align-items: center; }
.hand-indicator {
  position: absolute;
  font-size: 52px;
  color: var(--primary);
  z-index: 30;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  line-height: 1;
  transform: scaleX(-1);
}

.spinner-card { width: min(560px, 90%); }
.spinner-title { font-size: 24px; font-weight: 700; margin-bottom: 16px; }
.spinner-instruction { font-weight: 600; color: var(--primary-dark); }
.wheel-wrap { position: relative; width: min(460px, 90vw); height: min(460px, 90vw); margin: 44px auto 18px; }
.wheel-pointer {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 24px solid var(--primary);
  filter: drop-shadow(0 2px 4px rgba(31, 123, 255, 0.35));
  z-index: 2;
}
.wheel { width: 100%; height: 100%; margin: 0; border-radius: 50%; border: 6px solid var(--border); background: #1f7bff; position: relative; display: grid; place-items: center; }
.wheel-svg { width: 100%; height: 100%; display: block; }
.wheel-base { fill: #1f7bff; }
.wheel-lines line { stroke: #ffffff; stroke-width: 1.5; }
.wheel-center { fill: #f1f6ff; }
.wheel-text { pointer-events: none; fill: #eaf2ff; font-size: 24px; font-weight: 900; text-anchor: middle; dominant-baseline: middle; stroke: #eaf2ff; stroke-width: 1.2; paint-order: stroke; }

.question-card { width: min(620px, 92%); text-align: left; }
.question-top { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.question-topic { font-size: 14px; font-weight: 700; color: var(--primary-dark); }
.question-bonus { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.bonus-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 12px; font-weight: 800; font-size: 14px; border: 2px solid var(--border); background: #f4f8ff; }
.bonus-pill.ok { color: #1f9d55; }
.bonus-pill.bad { color: #e04f5f; }
.question-body { display: grid; gap: 12px; margin: 20px 0; }
.question-text { font-size: 22px; font-weight: 600; }
.timer { margin-top: 8px; font-weight: 700; color: var(--primary); }
.options { display: grid; gap: 12px; }
.options.hidden { display: none; }
.option-btn { padding: 12px; border: 2px solid var(--border); border-radius: 14px; background: #f2f7ff; font-weight: 600; cursor: pointer; text-align: left; display: flex; justify-content: flex-start; align-items: center; gap: 10px; }
.option-btn:disabled { opacity: 0.6; cursor: default; }
.option-number { font-weight: 800; color: var(--primary-dark); }
.option-text { text-align: left; }
.feedback { margin-top: 12px; font-weight: 800; font-size: 26px; text-transform: uppercase; letter-spacing: 1px; text-align: center; }
.feedback.correct { color: #24d26a; text-shadow: 0 0 10px rgba(36, 210, 106, 0.65); }
.feedback.incorrect { color: #ff4f5a; text-shadow: 0 0 10px rgba(255, 79, 90, 0.6); }
.correct-answer { margin-top: 10px; font-weight: 700; color: #1f9d55; text-align: center; }
.answer-continue { margin: 18px auto 0; }

.podium-card {
  width: min(520px, 90%);
  background: var(--card);
  border: 3px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(20, 50, 100, 0.12);
}
.podium-list {
  margin: 18px 0 24px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 12px;
  min-height: 220px;
  font-weight: 800;
  color: var(--ink);
  flex-wrap: nowrap;
}
.podium-item {
  width: calc((100% - 24px) / 3);
  max-width: 150px;
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  border: 3px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 12px 10px;
  text-align: center;
  background: #f2f7ff;
  color: #1b2a44;
}
.podium-item:nth-child(1) {
  height: 150px;
  background: linear-gradient(180deg, #e7edf7, #cfd9ea);
  color: #223;
}
.podium-item:nth-child(2) {
  height: 200px;
  background: linear-gradient(180deg, #f8d777, #f2c14e);
  color: #2b2b2b;
}
.podium-item:nth-child(3) {
  height: 120px;
  background: linear-gradient(180deg, #e7c19b, #d3a77f);
  color: #2b2b2b;
}
.podium-item:nth-child(2) > div:nth-child(2) {
  font-size: 34px;
  line-height: 1;
}
.podium-item:nth-child(2) > div:nth-child(3) {
  font-size: 20px;
  font-weight: 900;
}
.podium-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.podium-subtitle {
  margin: 6px 0;
  color: var(--muted);
  font-weight: 600;
}
.level-btn.secondary {
  background: #e9f1ff;
  color: var(--primary-dark);
  border: 2px solid var(--border);
}

@media (max-width: 860px) {
  .game-shell { height: auto; min-height: 90vh; }
  .wheel-wrap { width: min(360px, 90vw); height: min(360px, 90vw); }
  .board-wrap { height: 660px; }
  .podium-item { width: calc((100% - 20px) / 3); max-width: 130px; }
  .podium-list { min-height: 180px; }
}

.question-top { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.question-topic { font-size: 14px; font-weight: 700; color: var(--primary-dark); }

.no-caret, .no-caret * { user-select: none; -webkit-user-select: none; caret-color: transparent; }
.no-caret input, .no-caret textarea { user-select: text; caret-color: auto; }
.wheel { pointer-events: auto; user-select: none; -webkit-user-select: none; }
.wheel-svg, .wheel-text { pointer-events: none; user-select: none; -webkit-user-select: none; }
.wheel-wrap, .spinner-card { user-select: none; -webkit-user-select: none; }
