:root {
  color-scheme: dark;
  --bg-1: #0a0a0a;
  --bg-2: #000000;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-active: rgba(255, 255, 255, 0.16);
  --border: rgba(255, 255, 255, 0.16);
  --yellow: #fff302;
  --yellow-dim: #d9cf02;
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.6);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}

html, body {
  position: fixed;
  inset: 0;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app {
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Hub screen */

#screen-hub {
  justify-content: center;
  align-items: center;
  padding: 24px;
  gap: 6px;
  text-align: center;
}

.brand-badge {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 3px rgba(255, 243, 2, 0.15);
  margin-bottom: 12px;
}

.brand-logo {
  width: 60%;
  height: 60%;
  object-fit: contain;
  display: block;
}

#screen-hub h1 {
  font-size: 32px;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.game-list {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 28px;
}

.game-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  text-align: left;
}

.game-card:active {
  background: var(--surface-active);
  transform: scale(0.98);
}

.game-card-icon {
  font-size: 26px;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--yellow);
  border-radius: 14px;
}

.game-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.game-card-name {
  font-size: 18px;
  font-weight: 800;
}

.game-card-desc {
  font-size: 13px;
  color: var(--text-dim);
}

/* Game sub-pages (difficulty select) */

.sub-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
}

.select-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px 90px;
  gap: 6px;
  text-align: center;
}

.select-body h1 {
  font-size: 26px;
  margin: 0 0 28px 0;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.game-label {
  margin: 6px 0 0 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #000000;
  background: var(--yellow);
  padding: 4px 12px;
  border-radius: 999px;
}

.subtitle {
  color: var(--text-dim);
  margin: 14px 0 28px 0;
  font-size: 16px;
}

.difficulty-list {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.diff-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 20px 22px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  text-align: left;
}

.diff-btn:active {
  background: var(--surface-active);
  transform: scale(0.98);
}

.diff-name {
  font-size: 20px;
  font-weight: 800;
}

.diff-desc {
  font-size: 14px;
  color: var(--text-dim);
}

.diff-easy {
  border-color: var(--yellow);
}

.diff-easy .diff-name {
  color: var(--yellow);
}

.diff-hard {
  background: var(--yellow);
  border-color: var(--yellow);
}

.diff-hard .diff-name {
  color: #000000;
}

.diff-hard .diff-desc {
  color: rgba(0, 0, 0, 0.65);
}

.diff-hard:active {
  background: var(--yellow-dim);
}

/* Quiz screen */

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:active {
  background: var(--surface-active);
}

.pill {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 6px 14px;
  border-radius: 999px;
}

.timer-pill.low {
  color: #000000;
  background: var(--yellow);
  border-color: var(--yellow);
  animation: pulse-low 1s ease-in-out infinite;
}

@keyframes pulse-low {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.score-pill {
  color: var(--yellow);
}

.question-area {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 20px;
  min-height: 0;
}

.question {
  font-size: clamp(36px, 10vw, 56px);
  font-weight: 800;
  letter-spacing: -0.01em;
  text-align: center;
  transition: opacity 0.1s;
  color: var(--text);
}

.answer-display {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  width: 160px;
  font-size: 32px;
  font-weight: 700;
  border-bottom: 3px solid var(--yellow);
  color: var(--yellow);
  transition: opacity 0.1s;
}

.celebrate {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 88px;
  font-weight: 800;
  color: var(--yellow);
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 30px rgba(255, 243, 2, 0.6);
}

.celebrate.pop {
  animation: celebrate-pop 0.3s ease-out;
}

@keyframes celebrate-pop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  40%  { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  70%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

.question-area.flash .question,
.question-area.flash .answer-display {
  opacity: 0;
}

/* Shooter game */

.shooter-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
}

#shooter-canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 96 / 170;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 12px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  touch-action: none;
}

/* Dino game */

.dino-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 8px 16px;
}

#dino-canvas {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 200 / 90;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: 12px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  touch-action: none;
}

.dino-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 4px 28px calc(20px + env(safe-area-inset-bottom));
}

.dino-jump-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  background: var(--yellow);
  color: #000000;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 6px 0 var(--yellow-dim),
    0 10px 18px -6px rgba(0, 0, 0, 0.7);
  transition: transform 0.05s ease-out, box-shadow 0.05s ease-out;
}

.dino-jump-btn.pressed {
  transform: translateY(5px) scale(0.96);
  box-shadow:
    0 1px 0 var(--yellow-dim),
    0 2px 6px -2px rgba(0, 0, 0, 0.7);
}

/* Keypad */

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
}

.key {
  font-family: inherit;
  font-size: 26px;
  font-weight: 700;
  padding: 18px 0;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.key:active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #000000;
  transform: scale(0.97);
}

.key-spacer {
  background: transparent;
  border-color: transparent;
  pointer-events: none;
}

/* End of session screen */

#screen-shooter-end,
#screen-dino-end {
  justify-content: center;
  align-items: center;
  padding: 24px;
  text-align: center;
}

.end-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#screen-shooter-end h1,
#screen-dino-end h1 {
  font-size: 30px;
  margin: 0 0 8px 0;
  font-weight: 800;
  color: var(--text);
}

.end-score {
  font-size: 76px;
  font-weight: 800;
  color: var(--yellow);
  line-height: 1;
  text-shadow: 0 0 40px rgba(255, 243, 2, 0.35);
}

.end-actions {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}

.primary-btn, .secondary-btn {
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  padding: 16px;
  border-radius: 16px;
  border: none;
}

.primary-btn {
  background: var(--yellow);
  color: #000000;
}

.primary-btn:active {
  background: var(--yellow-dim);
  transform: scale(0.98);
}

.secondary-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.secondary-btn:active {
  background: var(--surface-active);
}
