:root {
  --u: 1px;           /* 1 ontwerp-px (1920-raster) in schermpixels */
  --h: 1px;           /* HUD-schaal: nooit kleiner dan leesbaar */
  --accent: #f2a33a;
  --ink: #f6f1ea;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #03040a; overflow: hidden; color: var(--ink);
  font-family: Outfit, system-ui, -apple-system, "Segoe UI", sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
#stage { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); overflow: hidden; background: #0a1222; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.bars { position: absolute; left: calc(var(--h) * 45); top: calc(var(--h) * 40); width: calc(var(--h) * 330); }
.bar { display: grid; grid-template-columns: calc(var(--h) * 30) 1fr auto; align-items: center; row-gap: calc(var(--h) * 6); margin-bottom: calc(var(--h) * 20); }
.bar .ico { width: calc(var(--h) * 22); height: calc(var(--h) * 22); grid-row: 1 / span 2; align-self: end; fill: currentColor; stroke: none; }
.bar.fuel .ico { fill: none; stroke: currentColor; stroke-width: 1.7; }
.bar .lbl { font-size: calc(var(--h) * 13); letter-spacing: .22em; color: rgba(255, 255, 255, .75); font-weight: 500; }
.bar .val { font-size: calc(var(--h) * 14); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar .track { grid-column: 2 / span 2; height: calc(var(--h) * 7); border-radius: 999px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.bar .fill { height: 100%; width: 50%; border-radius: 999px; }
.bar.water { color: #cfeeff; }
.bar.water .fill { background: linear-gradient(90deg, #9ed6f2, #dff4ff); box-shadow: 0 0 10px rgba(160, 220, 255, .7); }
.bar.fuel { color: #ffd9a0; }
.bar.fuel .fill { background: linear-gradient(90deg, #f2a33a, #ffd27a); box-shadow: 0 0 10px rgba(242, 163, 58, .55); }
.bar.empty .lbl { color: #ff9a6a; }
.bar.empty .track { animation: pulse 1s ease-in-out infinite; }
.bar.water.empty .ico { fill: none; stroke: #ff9a6a; stroke-width: 1.7; }
.bar.low .lbl, .bar.low .val { color: #ff9a6a; }
.bar.low .fill { background: linear-gradient(90deg, #ff7a3a, #ffb05a); }
@keyframes pulse { 50% { background: rgba(255, 140, 70, .55); box-shadow: 0 0 12px rgba(255, 140, 70, .6); } }

.score { position: absolute; left: 50%; top: calc(var(--h) * 34); transform: translateX(-50%); text-align: center; }
.slbl { font-size: calc(var(--h) * 11); letter-spacing: .34em; color: rgba(255, 255, 255, .65); padding-left: .34em; }
.snum { font-size: calc(var(--h) * 45); font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.05; }

.mini { position: absolute; right: calc(var(--h) * 40); top: calc(var(--h) * 36); padding: calc(var(--h) * 8); border-radius: calc(var(--h) * 13);
  background: rgba(6, 10, 20, .38); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#minimap { display: block; width: calc(var(--h) * 400); height: calc(var(--h) * 75); }

.tip { position: absolute; left: 50%; bottom: calc(var(--h) * 120); transform: translateX(-50%); max-width: 80%; text-align: center;
  font-size: calc(var(--h) * 22); font-weight: 400; line-height: 1.35; padding: calc(var(--h) * 10) calc(var(--h) * 22); border-radius: 999px;
  background: rgba(6, 10, 20, .62); border: 1px solid rgba(255, 255, 255, .12); opacity: 0; transition: opacity .4s; }
.tip.on { opacity: 1; }
.tip b { color: #ffd27a; font-weight: 600; }
.banner { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); text-align: center; font-size: calc(var(--h) * 54); font-weight: 600;
  letter-spacing: .04em; opacity: 0; transition: opacity .5s; text-shadow: 0 2px 24px rgba(0, 0, 0, .7); white-space: nowrap; }
.banner small { display: block; font-size: .42em; font-weight: 400; letter-spacing: .12em; opacity: .85; margin-top: .3em; }
.banner.on { opacity: 1; }

.corner { position: absolute; top: calc(var(--h) * 150); width: calc(var(--h) * 60); height: calc(var(--h) * 60); min-width: 34px; min-height: 34px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .16); background: rgba(6, 10, 20, .4); color: #fff; font-size: calc(var(--h) * 22);
  cursor: pointer; z-index: 6; display: grid; place-items: center; font-family: inherit; }
.corner.mute { right: calc(var(--h) * 40); }
.corner.pause { right: calc(var(--h) * 120); }

/* ---------- touch ---------- */
#touch { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.tleft { position: absolute; left: max(10px, env(safe-area-inset-left)); bottom: max(14px, calc(var(--h) * 40)); display: flex; flex-direction: column; gap: calc(var(--h) * 24); }
.tbtn { pointer-events: auto; width: calc(var(--h) * 170); height: calc(var(--h) * 170); min-width: 70px; min-height: 70px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .28); background: rgba(10, 16, 30, .35); color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-family: inherit; touch-action: none; }
.tbtn .arr { font-size: calc(var(--h) * 60); line-height: 1; }
.tbtn small { font-size: calc(var(--h) * 17); letter-spacing: .08em; opacity: .8; margin-top: .2em; }
.tbtn.on { background: rgba(242, 163, 58, .35); border-color: rgba(255, 210, 122, .8); }
.tbtn.drop { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(18px, calc(var(--h) * 60)); width: calc(var(--h) * 230); height: calc(var(--h) * 230); }
.tbtn.drop.on { background: rgba(120, 200, 255, .35); border-color: rgba(200, 236, 255, .9); }

/* ---------- overlays ---------- */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10;
  background: radial-gradient(ellipse at 50% 40%, rgba(10, 14, 30, .35), rgba(3, 4, 10, .78)); padding: 12px; overflow-y: auto; }
#menu, #loading { background: radial-gradient(ellipse at 50% 30%, rgba(10, 14, 30, .2), rgba(3, 4, 10, .7)); }
.panel { width: min(560px, 100%); max-height: 100%; overflow-y: auto; padding: 26px 30px; border-radius: 22px; background: rgba(10, 14, 28, .62);
  border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.panel.wide { width: min(880px, 100%); }
.kicker { color: var(--accent); font-size: 12px; letter-spacing: .26em; text-transform: uppercase; font-weight: 600; }
.logo { font-size: clamp(38px, 7vw, 68px); margin: 4px 0 6px; font-weight: 700; letter-spacing: -.01em;
  background: linear-gradient(180deg, #fff6de, #f4b676 60%, #d98b62); -webkit-background-clip: text; background-clip: text; color: transparent; }
.title { font-size: clamp(28px, 4.4vw, 40px); margin: 4px 0 8px; font-weight: 600; }
.sub { color: rgba(246, 241, 234, .8); font-size: 15px; line-height: 1.5; margin: 0 0 16px; }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 16px; }
.lv { position: relative; text-align: left; padding: 12px 12px 10px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .12); cursor: pointer;
  background: linear-gradient(160deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)); color: var(--ink); font-family: inherit; min-height: 86px; }
.lv:hover:not(:disabled) { border-color: rgba(242, 163, 58, .7); background: linear-gradient(160deg, rgba(242, 163, 58, .18), rgba(255, 255, 255, .03)); }
.lv .n { font-size: 11px; letter-spacing: .2em; color: rgba(255, 255, 255, .55); }
.lv .t { font-size: 15px; font-weight: 600; margin: 3px 0 4px; line-height: 1.2; }
.lv .b { font-size: 12px; color: #ffd27a; font-variant-numeric: tabular-nums; }
.lv .m { position: absolute; right: 10px; top: 9px; font-size: 14px; }
.lv:disabled { opacity: .38; cursor: default; }
.howto { display: grid; gap: 6px; font-size: 13.5px; color: rgba(246, 241, 234, .82); margin-bottom: 12px; }
.ht b { color: #fff; font-weight: 600; }
.kbd { display: inline-block; min-width: 1.6em; text-align: center; padding: 0 .4em; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .08); font-size: .92em; }
.opt { display: flex; gap: 8px; align-items: center; font-size: 13px; color: rgba(246, 241, 234, .75); cursor: pointer; }
.best { color: rgba(246, 241, 234, .65); font-size: 13px; margin: 10px 0 0; }
.facts { display: grid; gap: 6px; margin: 0 0 18px; font-size: 14px; }
.facts div { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.facts span:last-child { color: #ffd27a; font-weight: 500; }
.row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.row.col { flex-direction: column; }
.btn { font-family: inherit; font-size: 16px; font-weight: 600; padding: 12px 20px; border-radius: 999px; cursor: pointer; border: 1px solid transparent; }
.btn.primary { background: linear-gradient(180deg, #ffc56a, #f2a33a); color: #2a1606; box-shadow: 0 6px 24px rgba(242, 163, 58, .35); }
.btn.ghost { background: rgba(255, 255, 255, .06); color: var(--ink); border-color: rgba(255, 255, 255, .16); }
.r-stats { display: grid; gap: 6px; margin: 6px 0 4px; }
.r-stats div { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .05); font-size: 15px; }
.r-stats div.tot { background: rgba(242, 163, 58, .16); font-weight: 600; font-size: 17px; }
.r-stats span:last-child { font-variant-numeric: tabular-nums; }
.rot { font-size: 54px; text-align: center; margin-bottom: 8px; }

@media (max-width: 640px), (max-height: 520px) {
  .levels { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .lv { min-height: 64px; padding: 8px; }
  .lv .t { font-size: 12.5px; }
  .panel { padding: 16px 18px; }
  .howto { display: none; }
  .logo { font-size: 34px; }
  .sub { font-size: 13px; margin-bottom: 10px; }
}

#rotate { position: fixed; z-index: 20; background: #03040a; }

#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bar.gas { color: #e8e2ff; }
.bar.gas .ico { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.bar.gas .fill { background: linear-gradient(90deg, #8f86c8, #d9d2ff); box-shadow: 0 0 10px rgba(190, 180, 255, .45); }
.flight { margin-top: calc(var(--h) * 6); font-size: calc(var(--h) * 15); letter-spacing: .12em; color: rgba(255, 255, 255, .78); font-variant-numeric: tabular-nums; white-space: nowrap; }
.flight b { color: #fff; font-weight: 600; }
.flight .warn { color: #ff9a6a; font-weight: 600; }
.tturn { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(10px, calc(var(--h) * 24)); display: flex; gap: calc(var(--h) * 30); }
.tbtn.sm { width: calc(var(--h) * 130); height: calc(var(--h) * 130); min-width: 58px; min-height: 58px; }
.tright { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(18px, calc(var(--h) * 60)); display: flex; align-items: flex-end; gap: 10px; }
.tright .tbtn.drop { position: static; }
.tgas { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; font-size: 11px; letter-spacing: .1em; }
.tgas input { writing-mode: vertical-lr; direction: rtl; width: 46px; height: calc(var(--h) * 260); min-height: 120px; accent-color: #d9d2ff; touch-action: none; }
