@import url('https://fonts.googleapis.com/css2?family=Changa:wght@400;500;600;700;800&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  --night: #06111f;
  --panel: rgba(7, 22, 38, 0.88);
  --cyan: #69f2e7;
  --cyan-soft: #b5fff7;
  --orange: #ff805d;
  --line: rgba(159, 239, 232, 0.25);
  --text: #f3fffc;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #020914;
  color: var(--text);
  font-family: "Changa", system-ui, sans-serif;
  user-select: none;
  touch-action: none;
}

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 10%, #173958 0, transparent 38%),
    #020914;
}

button { font: inherit; }

.game-shell {
  position: relative;
  width: min(100vw, calc(100vh * 12 / 7));
  aspect-ratio: 12 / 7;
  max-height: 100vh;
  overflow: hidden;
  background: #0a2231;
  box-shadow: 0 30px 100px #000;
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  direction: rtl;
  pointer-events: none;
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font: 700 13px/1 Rajdhani, sans-serif;
  letter-spacing: .12em;
  transform: skew(-8deg);
}

.top-actions { display: flex; gap: 8px; pointer-events: auto; }

.gamepad-status {
  position: absolute;
  left: 50%;
  top: 21px;
  transform: translate(-50%, -12px);
  padding: 7px 13px;
  border: 1px solid rgba(105,242,231,.28);
  border-radius: 18px;
  background: rgba(3,16,27,.72);
  color: var(--cyan);
  font-size: 11px;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  white-space: nowrap;
}

.gamepad-status.connected { opacity: 1; transform: translate(-50%, 0); }

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: rgba(2, 12, 22, .42);
  color: #fff;
  font: 600 16px/1 Rajdhani, sans-serif;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: .2s ease;
}

.icon-btn:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-1px); }
.icon-btn.muted { color: #ff9a82; border-color: rgba(255,128,93,.5); }

.screen {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  visibility: hidden;
  opacity: 0;
  transition: opacity .4s ease, visibility .4s;
  background: linear-gradient(90deg, rgba(2,10,18,.95) 0%, rgba(2,10,18,.72) 42%, rgba(2,10,18,.12) 78%);
  pointer-events: none;
}

.screen.visible { visibility: visible; opacity: 1; pointer-events: auto; }

.hero-card {
  z-index: 2;
  width: 48%;
  min-width: 440px;
  padding: 118px 7% 38px 2%;
  direction: rtl;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cyan);
  font: 600 14px/1 Rajdhani, "Changa", sans-serif;
  letter-spacing: .12em;
}

.eyebrow span { width: 34px; height: 2px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

h1 {
  margin: 16px 0 14px;
  font-size: clamp(60px, 7vw, 96px);
  line-height: .8;
  letter-spacing: -.06em;
  text-shadow: 0 10px 35px rgba(0,0,0,.4);
}

.hero-jadoo { display: inline-block; font-size: 1.2em; color: #fff; }
h1 em { display: inline-block; color: transparent; -webkit-text-stroke: 1.5px var(--cyan); font-size: .64em; font-style: normal; letter-spacing: -.02em; }

.hero-card > p {
  max-width: 440px;
  margin: 8px 0 25px;
  color: rgba(235,255,252,.68);
  font-size: 16px;
  line-height: 1.9;
}

.difficulty-picker {
  width: 285px;
  margin: 0 0 17px;
  display: grid;
  gap: 7px;
}

.difficulty-picker > span {
  color: rgba(255,255,255,.52);
  font-size: 11px;
}

.difficulty-picker > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgba(105,242,231,.24);
  background: rgba(2,14,24,.55);
}

.difficulty-picker button {
  height: 35px;
  border: 0;
  border-inline-start: 1px solid rgba(105,242,231,.14);
  background: transparent;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  cursor: pointer;
  transition: .18s ease;
}

.difficulty-picker button:last-child { border-inline-start: 0; }
.difficulty-picker button:hover { color: #fff; background: rgba(105,242,231,.08); }
.difficulty-picker button.active,
.difficulty-picker button[aria-pressed="true"] { color: #06131e; background: var(--cyan); font-weight: 800; }

.primary-btn {
  min-width: 230px;
  height: 58px;
  padding: 0 10px 0 20px;
  border: 1px solid var(--cyan);
  background: var(--cyan);
  color: #06131e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  cursor: pointer;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 10px 35px rgba(65, 241, 225, .13);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  transition: transform .2s ease, filter .2s ease;
}

.primary-btn b {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(4, 24, 32, .28);
  font-size: 21px;
}

.primary-btn:hover { transform: translateY(-3px); filter: brightness(1.08); }

.controls-hint { display: flex; gap: 24px; margin-top: 28px; direction: ltr; }
.controls-hint div { display: grid; gap: 4px; text-align: center; color: rgba(255,255,255,.42); font-size: 10px; }
kbd { min-width: 46px; padding: 5px 8px; border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.75); font: 600 11px/1 Rajdhani, sans-serif; }

.aircraft-preview { position: absolute; inset: 0 42% 0 0; pointer-events: none; }
.target-ring { position: absolute; border: 1px solid rgba(105,242,231,.22); border-radius: 50%; top: 50%; left: 54%; transform: translate(-50%,-50%); }
.ring-a { width: 430px; height: 430px; box-shadow: inset 0 0 70px rgba(72,231,218,.04); }
.ring-b { width: 300px; height: 300px; border-style: dashed; animation: spin 18s linear infinite; }
.ring-a::before, .ring-a::after { content:""; position:absolute; background:rgba(105,242,231,.28); }
.ring-a::before { width: 120%; height: 1px; top: 50%; left: -10%; }
.ring-a::after { height: 120%; width: 1px; left: 50%; top: -10%; }

.plane-silhouette { position: absolute; width: 340px; height: 360px; top: 52%; left: 54%; transform: translate(-50%,-50%) rotate(-7deg); filter: drop-shadow(0 35px 25px rgba(0,0,0,.48)); }
.plane-silhouette i { position: absolute; display: block; background: linear-gradient(90deg, #5d6d72, #e3f4ef 48%, #50646c); }
.plane-silhouette .body { width: 58px; height: 320px; left: 141px; top: 5px; clip-path: polygon(50% 0, 73% 12%, 85% 72%, 65% 100%, 35% 100%, 15% 72%, 27% 12%); }
.plane-silhouette .wing { width: 155px; height: 185px; top: 92px; }
.plane-silhouette .wing-l { left: 3px; clip-path: polygon(100% 0, 100% 66%, 0 94%, 12% 72%); }
.plane-silhouette .wing-r { right: 3px; clip-path: polygon(0 0, 0 66%, 100% 94%, 88% 72%); }
.plane-silhouette .tail { width: 120px; height: 82px; left: 110px; bottom: 4px; clip-path: polygon(45% 0, 55% 0, 100% 100%, 57% 78%, 43% 78%, 0 100%); }

.spec { position: absolute; min-width: 105px; padding: 10px 14px; border-inline-start: 2px solid var(--cyan); background: rgba(5,19,30,.68); display: grid; direction: rtl; }
.spec small { color: rgba(255,255,255,.45); font-size: 10px; }
.spec strong { color: var(--cyan); font: 700 18px Rajdhani, sans-serif; }
.spec-a { top: 24%; left: 24%; }
.spec-b { bottom: 21%; right: 9%; }

.compact-screen { align-items: center; justify-content: center; background: rgba(1,8,15,.72); backdrop-filter: blur(8px); }
.dialog-card { width: min(430px, 86%); padding: 44px 46px; text-align: center; border: 1px solid var(--line); background: linear-gradient(145deg, rgba(14,39,56,.98), rgba(5,17,29,.98)); box-shadow: 0 30px 80px rgba(0,0,0,.48); clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px); }
.dialog-card h2 { margin: 7px 0 4px; font-size: 42px; }
.dialog-card p { color: rgba(255,255,255,.55); margin: 0 0 25px; }
.dialog-card .primary-btn { margin: 0 auto; }
.status-label { color: var(--cyan); font-size: 12px; letter-spacing: .12em; }
.status-label.danger { color: var(--orange); }
.stage-route { margin: 14px 0 2px; color: rgba(255,255,255,.42); font: 700 13px Rajdhani, sans-serif; letter-spacing: .22em; direction: ltr; }
.stage-route i { padding: 0 12px; color: var(--cyan); font-style: normal; }
.stage-card h2 { margin-top: 4px; }
.text-btn { margin-top: 18px; border: 0; background: transparent; color: rgba(255,255,255,.55); cursor: pointer; }
.text-btn:hover { color: #fff; }
.result-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 24px 0; direction: rtl; }
.result-grid div { padding: 12px 4px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); display: grid; }
.result-grid small { font-size: 10px; color: rgba(255,255,255,.45); }
.result-grid strong { font: 700 24px Rajdhani, sans-serif; color: var(--cyan); }

.touch-controls { position: absolute; z-index: 5; inset: auto 0 18px; display: none; justify-content: flex-end; align-items: flex-end; padding: 0 34px; pointer-events: none; direction: ltr; }
.fire-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid var(--orange);
  background: rgba(255,92,66,.24);
  color: #fff;
  font-weight: 700;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 0 25px rgba(255,90,62,.18);
}
.fire-btn * { pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

@media (hover: none), (pointer: coarse) {
  .touch-controls.active { display: flex; }
  .controls-hint { display: none; }
  .top-bar { padding: 12px 18px; }
}

@media (max-width: 760px) {
  .hero-card { min-width: 0; width: 62%; padding: 80px 5% 20px 2%; }
  .hero-card > p { font-size: 12px; line-height: 1.6; margin-bottom: 14px; }
  h1 { font-size: 54px; }
  .primary-btn { height: 48px; min-width: 190px; font-size: 14px; }
  .aircraft-preview { inset: 0 45% 0 0; transform: scale(.78); transform-origin: center; }
  .brand { font-size: 12px; }
}

@media (orientation: portrait) and (max-width: 700px) {
  .game-shell {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    aspect-ratio: auto;
    box-shadow: none;
  }

  .top-bar {
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  }

  .brand { font-size: 11px; gap: 7px; }
  .brand-mark { width: 29px; height: 29px; font-size: 11px; }
  .icon-btn { width: 34px; height: 34px; }
  .gamepad-status { top: calc(12px + env(safe-area-inset-top)); font-size: 0; padding: 7px 9px; }
  .gamepad-status span { font-size: 15px; }

  .screen {
    background: linear-gradient(0deg, rgba(2,10,18,.98) 0%, rgba(2,10,18,.86) 46%, rgba(2,10,18,.12) 82%);
  }

  .hero-card {
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 43vh 24px calc(26px + env(safe-area-inset-bottom));
    align-items: center;
    justify-content: flex-start;
    text-align: center;
  }

  .eyebrow { font-size: 11px; }
  h1 { margin: 13px 0 10px; font-size: clamp(58px, 18vw, 78px); line-height: .82; }
  .hero-card > p { max-width: 330px; margin: 6px auto 17px; font-size: 12px; line-height: 1.7; }
  .hero-card .primary-btn { width: min(285px, 85vw); }
  .difficulty-picker { width: min(285px, 85vw); margin-bottom: 14px; }
  .controls-hint { display: none; }

  .aircraft-preview {
    inset: calc(34px + env(safe-area-inset-top)) 0 auto;
    width: 100%;
    height: 38vh;
    transform: none;
  }

  .target-ring { left: 50%; top: 52%; }
  .ring-a { width: 300px; height: 300px; }
  .ring-b { width: 215px; height: 215px; }
  .plane-silhouette { left: 50%; top: 53%; transform: translate(-50%,-50%) rotate(-7deg) scale(.62); }
  .spec { display: none; }

  .touch-controls {
    inset: auto 0 calc(20px + env(safe-area-inset-bottom));
    padding: 0 24px;
  }

  .touch-controls.active { display: flex; }
  .fire-btn { width: 98px; height: 98px; background: rgba(255,92,66,.3); }
  .fire-btn:active { transform: scale(.92); background: rgba(255,92,66,.46); }

  .dialog-card { width: 90%; padding: 36px 24px; }
  .dialog-card h2 { font-size: 36px; }
  .result-grid { gap: 5px; }
  .result-grid strong { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
