:root {
  color-scheme: dark;
  --ink: #101114;
  --ink-2: #17191d;
  --panel: #202228;
  --panel-soft: #2a2d33;
  --paper: #f7efe1;
  --muted: #adb6bd;
  --teal: #3be2c0;
  --coral: #ff756b;
  --amber: #ffd166;
  --mint: #b7f7d4;
  --violet: #b9a6ff;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--paper);
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(135deg, #101114 0%, #17191d 44%, #231d22 100%);
  background-size: 34px 34px, 34px 34px, auto;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 34px;
}

.topbar {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.9rem);
  line-height: 0.93;
  letter-spacing: 0;
}

.game-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.game-menu {
  display: grid;
  gap: 10px;
  position: sticky;
  top: 18px;
}

.game-tab {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  display: grid;
  grid-template-columns: 35px 1fr;
  gap: 10px;
  align-items: center;
  color: var(--paper);
  text-align: left;
  background: rgba(32, 34, 40, 0.78);
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.game-tab span {
  color: var(--amber);
  font-weight: 900;
}

.game-tab:hover,
.game-tab:focus-visible {
  transform: translateX(3px);
  border-color: rgba(59, 226, 192, 0.56);
  outline: none;
}

.game-tab.is-active {
  border-color: rgba(255, 117, 107, 0.75);
  background: linear-gradient(135deg, rgba(255, 117, 107, 0.2), rgba(59, 226, 192, 0.12));
}

.play-zone {
  min-width: 0;
}

.canvas-frame {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(247, 239, 225, 0.08), rgba(247, 239, 225, 0.02)),
    var(--panel);
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  background: #111318;
  touch-action: none;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.primary-action,
.ghost-action {
  min-width: 88px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 850;
}

.primary-action {
  color: #101114;
  background: var(--teal);
  box-shadow: 0 10px 24px rgba(59, 226, 192, 0.18);
}

.ghost-action {
  color: var(--paper);
  border-color: var(--line);
  background: rgba(32, 34, 40, 0.72);
}

.primary-action:hover,
.primary-action:focus-visible,
.ghost-action:hover,
.ghost-action:focus-visible {
  outline: 2px solid rgba(255, 209, 102, 0.58);
  outline-offset: 2px;
}

.stats-line {
  margin: 0;
  color: var(--paper);
  font-weight: 800;
  text-align: right;
}

.instructions {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.student-plan {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(32, 34, 40, 0.7);
  box-shadow: var(--shadow);
}

.plan-heading {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.plan-heading h2 {
  margin: 0;
  color: var(--paper);
  font-size: 1rem;
  letter-spacing: 0;
}

.plan-heading a {
  flex: 0 0 auto;
  color: #101114;
  background: var(--amber);
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 850;
  text-decoration: none;
}

.student-plan iframe {
  display: block;
  width: 100%;
  height: min(68vh, 620px);
  min-height: 390px;
  border: 0;
  background: #f7efe1;
}

@media (max-width: 880px) {
  .app-shell {
    width: min(100% - 22px, 720px);
    padding-top: 18px;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .game-menu {
    position: static;
    grid-template-columns: repeat(5, minmax(134px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .game-tab {
    min-width: 134px;
    min-height: 54px;
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .game-tab:hover,
  .game-tab:focus-visible {
    transform: translateY(-2px);
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: calc(100% - 16px);
  }

  .canvas-frame {
    padding: 6px;
  }

  .control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .action-buttons {
    width: 100%;
  }

  .primary-action,
  .ghost-action {
    flex: 1 1 0;
  }

  .stats-line {
    text-align: left;
  }
}
