@font-face {
  font-family: 'Inter';
  src: url('../../public/fonts/Inter-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Roboto';
  src: url('../../public/fonts/Roboto-Black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --teal: #00C9A7;
  --yellow: #EEFF41;
  --black: #111111;
  --white: #FFFFFF;
  --red: #FF3B30;
  --card-size: clamp(72px, 19vw, 140px);
  --gap: clamp(8px, 2vw, 16px);
  --btn-font-size: clamp(16px, 4vw, 22px);
  --btn-pad-y: clamp(14px, 3vw, 20px);
  --btn-pad-x: clamp(48px, 13vw, 96px);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  touch-action: manipulation;
  /* Kiosk hardening — no text selection, no iOS long-press callout, no
     browser tap-highlight. Combined with the contextmenu / selectstart
     prevent-default in main.js, this kills the double-tap "Copy / Inspect"
     bubble that pops up on mobile and on Windows touch screens. */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  background: #000;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
  position: fixed;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* ── Desktop landscape: render as a centered portrait frame.
   Inside the frame, retype-sized off vh so content fits the narrow column
   instead of the much wider viewport width. ── */
@media (orientation: landscape) and (min-width: 900px) {
  body {
    background:
      radial-gradient(ellipse at center, #1a1a1a 0%, #000 70%);
  }

  #app {
    width: min(56vh, 100vw);
    height: min(100vh, 178vh);
    aspect-ratio: 9 / 16;
    max-height: 100vh;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6),
      0 0 0 1px rgba(255, 255, 255, 0.04);
    border-radius: 28px;
  }

  .screen {
    border-radius: 28px;
  }

  /* Higher-specificity overrides (#app .x) so these beat the per-screen
     stylesheets' class-only rules regardless of source order.
     Sizes tuned so longest title ("Your Mission") fits the ~430px frame
     interior with breathing room on both sides. */
  #app .splash-title {
    font-size: clamp(40px, 8vh, 96px);
  }

  #app .splash-sub {
    font-size: clamp(12px, 2vh, 22px);
  }

  #app .splash-tap {
    font-size: clamp(12px, 2.1vh, 22px);
    font-weight: 600;
    bottom: 11.2vh;
    top: auto;
  }

  #app .tut-title {
    font-size: clamp(40px, 8.5vh, 84px);
  }

  #app .tut-sub {
    font-size: clamp(14px, 2.1vh, 22px);
    font-weight: 600;
  }

  #app .journey-title {
    font-size: clamp(40px, 8.5vh, 84px);
  }

  #app .journey-sub {
    font-size: clamp(16px, 3vh, 28px);
  }

  #app .journey-list {
    width: min(92%, 480px);
    gap: clamp(12px, 2vh, 22px);
    margin-top: clamp(20px, 4vh, 40px);
  }

  #app .journey-card {
    width: 100%;
    height: auto;
    aspect-ratio: 379.24 / 109.11;
    padding: 0 clamp(20px, 3vh, 32px);
    border-radius: 0;
  }

  #app .journey-card .lvl-name {
    font-size: clamp(20px, 3.6vh, 32px);
  }

  #app .journey-card .lvl-cta {
    font-size: clamp(12px, 2vh, 17px);
  }

  #app .journey-card .lvl-check {
    width: clamp(34px, 5.6vh, 50px);
    height: clamp(34px, 5.6vh, 50px);
    right: clamp(20px, 3vh, 32px);
    border-radius: 0;
  }

  #app .game-top {
    font-size: clamp(14px, 2.4vh, 22px);
  }

  .intro-badge {
    font-size: clamp(30px, 7vh, 72px);
  }

  /* Mirror kiosk proportions: gameplay top 377/1920 ≈ 19.6vh, L/R 60/1080 ≈ 5.5vw of frame */
  #app #game {
    justify-content: flex-start;
    padding-top: 19.6vh;
    gap: clamp(6px, 1.4vh, 14px);
  }

  #app .game-grid {
    width: 89%;
    gap: clamp(8px, 1.4vh, 14px);
  }

  #app .game-top {
    width: 89%;
  }

  /* Mirror kiosk proportions: mission/tutorial header top 305/1920 ≈ 15.9vh */
  #app .journey-header,
  #app .tut-header {
    margin-top: 15.9vh;
    width: min(92%, 560px);
  }

  #app .outro-title {
    font-size: clamp(26px, 5.5vh, 48px);
  }

  #app .outro-sub {
    font-size: clamp(11px, 1.9vh, 18px);
  }

  #app .outro-btn {
    font-size: clamp(15px, 3vh, 24px);
  }

  /* Consistent brand logo across all screens — kiosk parity (220-320/1080 width, 221/1920 ≈ 11.5vh bottom) */
  #app .tut-brand,
  #app .game-brand,
  #app .journey-brand {
    width: clamp(110px, 22vh, 180px);
    bottom: 11.5vh;
  }
}

/* ── Screen transitions ── */
.screen {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(0.97);
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

/* ── Shared button ── */
.btn {
  background: var(--black);
  color: var(--white);
  border: none;
  cursor: pointer;
  border-radius: 100px;
  font-family: 'Inter', sans-serif;
  font-size: var(--btn-font-size);
  letter-spacing: 2px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.12s, box-shadow 0.12s;
  animation: fadeUp 0.6s 0.5s ease both;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}

.btn-yellow {
  background: var(--yellow);
  color: var(--black);
}

/* ── Keyframes ── */
@keyframes splashPop {
  from {
    transform: scale(0.65);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeUp {
  from {
    transform: translateY(22px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes cardEnter {
  from {
    transform: scale(0.6) translateY(20px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

@keyframes scorePulse {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.28);
  }

  100% {
    transform: scale(1);
  }
}

@media (min-width: 900px) {
  :root {
    --card-size: clamp(120px, 11vw, 165px);
  }
}

@media (max-width: 380px) {
  :root {
    --card-size: 68px;
  }
}

@media (orientation: portrait) and (min-width: 1000px) and (min-height: 1700px) {
  :root {
    --card-size: clamp(196px, 19vw, 238px);
    --gap: clamp(22px, 2.6vw, 34px);
    --btn-font-size: clamp(36px, 3.8vw, 52px);
    --btn-pad-y: 28px;
    --btn-pad-x: 110px;
  }
}