:root {
  --bg: #071018;
  --bg2: #0c1a24;
  --panel: rgba(10, 24, 34, 0.78);
  --panel-s: rgba(14, 32, 46, 0.92);
  --line: rgba(255, 220, 160, 0.12);
  --text: #f3efe4;
  --muted: #9aa7b4;
  --red: #e31b23;
  --red-d: #9a1016;
  --gold: #f5c400;
  --gold-d: #c49200;
  --sky: #3eb5e0;
  --green: #1aa34a;
  --pink: #ff4d8d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Bebas Neue", "Outfit", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #app { height: 100%; width: 100%; overflow: hidden; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font); user-select: none; }
button, input, select { font-family: inherit; }
button { cursor: pointer; }
img { display: block; }
.hidden { display: none !important; }

#sky-bg {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.view {
  position: absolute; inset: 0; z-index: 2;
  display: none; flex-direction: column;
}
.view.active { display: flex; }

/* LOGO */
.logo-type {
  font-family: var(--display); font-size: 92px; letter-spacing: 0.08em;
  line-height: 0.85; color: var(--gold);
  text-shadow: 0 4px 0 var(--red-d), 0 10px 30px rgba(227, 27, 35, 0.35);
}
.logo-tag { color: var(--muted); letter-spacing: 0.22em; text-transform: uppercase; font-size: 12px; margin-top: 8px; }
.logo-kite { width: 92px; height: 104px; filter: drop-shadow(0 12px 18px rgba(227,27,35,.4)); }
.logo-kite.sm { width: 58px; height: 66px; }
.logo-kite.xs { width: 28px; height: 32px; filter: none; }

/* BOOT */
#view-boot { align-items: center; justify-content: center; }
.boot-mark { text-align: center; animation: rise 0.8s ease both; }
.boot-bar {
  width: 240px; height: 6px; margin: 28px auto 10px; border-radius: 99px;
  background: rgba(255,255,255,.08); overflow: hidden;
}
.boot-bar i {
  display: block; height: 100%; width: 8%;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width .25s ease;
}
.boot-msg { color: var(--muted); font-size: 13px; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* AUTH */
#view-auth { align-items: center; justify-content: center; padding: 24px; }
.auth-wrap {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 36px;
  width: min(920px, 100%); align-items: center;
}
.hero-points { margin-top: 28px; list-style: none; display: grid; gap: 10px; color: #d7e6ef; }
.hero-points li { padding-left: 22px; position: relative; }
.hero-points li::before {
  content: ""; position: absolute; left: 0; top: 8px; width: 10px; height: 10px;
  background: var(--red); transform: rotate(45deg);
}
.logo-row { display: flex; gap: 16px; align-items: center; }
.auth-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: 22px; box-shadow: var(--shadow); backdrop-filter: blur(16px);
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: rgba(0,0,0,.25); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tab {
  border: 0; background: transparent; color: var(--muted); padding: 10px;
  border-radius: 10px; font-weight: 700;
}
.tab.active { background: #173246; color: var(--text); }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
input, select {
  background: #07141d; border: 1px solid var(--line); color: var(--text);
  padding: 12px 14px; border-radius: 12px; outline: none; font-size: 15px;
}
input:focus, select:focus { border-color: #e8c04a; }
.btn {
  border: 0; background: #1c3a4e; color: var(--text); padding: 12px 16px;
  border-radius: 12px; font-weight: 700; letter-spacing: .04em;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #ff4a4a, var(--red-d));
  box-shadow: 0 8px 20px rgba(227,27,35,.35);
  color: #fff;
}
.btn.xl { padding: 14px 18px; font-size: 16px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.auth-error { color: #ff8a8a; min-height: 1.2em; font-size: 13px; margin-top: 8px; }
.fine { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* MENU */
#view-menu { display: none; }
#view-menu.active { display: grid; grid-template-columns: 210px 1fr; grid-template-rows: 64px 1fr; }
.topbar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 18px;
  padding: 0 18px; border-bottom: 1px solid var(--line);
  background: rgba(7,16,24,.72); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 28px; letter-spacing: .12em; color: var(--gold); }
.who { display: flex; align-items: center; gap: 10px; margin-left: 12px; }
.who strong { display: block; font-size: 14px; }
.who em { font-style: normal; color: var(--muted); font-size: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--red), #7a1020); font-weight: 800;
}
.xp-chip { flex: 1; max-width: 280px; }
.xp-bar { height: 8px; background: #12202b; border-radius: 99px; overflow: hidden; }
.xp-bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--sky), var(--gold)); }
.xp-chip span { font-size: 11px; color: var(--muted); }
.coin-chip { display: flex; align-items: center; gap: 8px; background: #132230; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); }
.coin {
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe27a, var(--gold) 45%, var(--gold-d));
  box-shadow: inset 0 0 0 2px rgba(120,80,0,.35);
}

.sidenav {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 10px;
  border-right: 1px solid var(--line); background: rgba(7,16,24,.45);
}
.navbtn {
  text-align: left; background: transparent; border: 0; color: var(--muted);
  padding: 10px 12px; border-radius: 10px; font-weight: 650; font-size: 14px;
}
.navbtn.active, .navbtn:hover { background: #173246; color: var(--text); }
.navbtn.ghost { margin-top: auto; color: #c98989; }

.menu-main { overflow: auto; padding: 22px 28px 48px; }
.page { display: none; animation: rise .35s ease; }
.page.active { display: block; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-family: var(--display); font-size: 42px; letter-spacing: .06em; }
.page-head p { color: var(--muted); }
.subh { margin: 28px 0 12px; font-family: var(--display); letter-spacing: .08em; font-size: 26px; }

.play-actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.create-row { display: flex; gap: 8px; }
.room-list { display: grid; gap: 10px; }
.room {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
}
.room b { font-size: 16px; }
.room span { color: var(--muted); font-size: 13px; }

.hangar { display: grid; grid-template-columns: 280px 1fr; gap: 22px; }
.hangar-preview {
  background: radial-gradient(circle at 50% 30%, #24506a, #0b1822 70%);
  border: 1px solid var(--line); border-radius: 18px; padding: 12px; text-align: center;
}
#kite-preview { width: 100%; height: auto; }
.loadout-name { margin-top: 6px; color: var(--gold); font-weight: 700; }
.hangar-cols { display: grid; gap: 16px; }
.cat h4 { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--line); background: #10202c; color: var(--text);
  padding: 8px 10px; border-radius: 10px; font-size: 13px;
}
.pill.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.pill.locked { opacity: .45; }
.rarity { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }

.shop-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  display: grid; gap: 6px;
}
.card h4 { font-size: 16px; }
.card p { color: var(--muted); font-size: 13px; min-height: 2.4em; }
.price { color: var(--gold); font-weight: 800; }
.owned { color: var(--green); font-size: 12px; font-weight: 700; }

.mission { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
.mission .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.prog { height: 8px; background: #12202b; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ach { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.ach.on { border-color: var(--gold); }
.ach h4 { font-size: 14px; }
.ach p { color: var(--muted); font-size: 12px; }

.rank-table { display: grid; gap: 6px; }
.rank-row {
  display: grid; grid-template-columns: 42px 1fr 80px 80px 70px; gap: 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px;
}
.rank-row.head { background: transparent; border: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.rank-row.me { border-color: var(--gold); }
.seg { display: flex; gap: 6px; background: #10202c; padding: 4px; border-radius: 12px; }
.segbtn { border: 0; background: transparent; color: var(--muted); padding: 8px 12px; border-radius: 9px; font-weight: 700; }
.segbtn.active { background: #1e3d52; color: var(--text); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat b { font-size: 26px; font-family: var(--display); letter-spacing: .04em; display: block; }
.stat span { color: var(--muted); font-size: 12px; }
.history { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.history div { background: var(--panel); border-radius: 10px; padding: 8px 12px; border: 1px solid var(--line); }

.settings { display: grid; gap: 14px; max-width: 420px; }
.set { display: grid; gap: 6px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.set.check { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
input[type="range"] { width: 100%; accent-color: var(--gold); }

/* GAME / HUD */
#view-game { background: #000; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
#hud * { pointer-events: auto; }
.hud-top, .hud-left, .hud-bottom, .minimap-wrap, .help-hint, .killfeed, .touch-ui, .tablist {
  pointer-events: none;
}
.hud-top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; align-items: center; }
.wind-box {
  width: 84px; height: 84px; border-radius: 50%;
  background: rgba(8,18,26,.55); border: 1px solid var(--line);
  display: grid; place-items: center; position: relative;
}
#wind-arrow { width: 42px; height: 42px; transform-origin: 50% 50%; }
#wind-lab { position: absolute; bottom: 8px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.score-box { text-align: center; background: rgba(8,18,26,.5); padding: 8px 16px; border-radius: 12px; border: 1px solid var(--line); }
.score-box b { font-family: var(--display); font-size: 32px; letter-spacing: .06em; display: block; }
.score-box small { color: var(--muted); }
.score-box em { display: block; color: var(--gold); font-style: normal; min-height: 1em; font-weight: 700; }
.day-chip { background: rgba(8,18,26,.5); border: 1px solid var(--line); padding: 6px 10px; border-radius: 999px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.player-toast {
  position: absolute; top: 110px; left: 50%; transform: translateX(-50%);
  color: var(--gold); font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  text-shadow: 0 2px 8px #000; pointer-events: none; white-space: nowrap;
}
.killfeed { position: absolute; top: 16px; right: 16px; display: grid; gap: 6px; width: 260px; }
.kf {
  background: rgba(8,18,26,.72); border-left: 3px solid var(--red); padding: 6px 10px;
  font-size: 13px; border-radius: 6px; animation: rise .25s ease;
}

.hud-left { position: absolute; left: 16px; bottom: 110px; width: min(340px, 46vw); }
.chat-log { max-height: 160px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; font-size: 13px; text-shadow: 0 1px 2px #000; pointer-events: none; }
.chat-log .sys { color: var(--gold); }
.chat-log b { color: #9be7ff; }
#chat-form { margin-top: 6px; pointer-events: auto; }
#chat-form input { width: 100%; background: rgba(8,18,26,.8); }

.hud-bottom {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; gap: 18px; align-items: flex-end;
}
.meters { display: grid; gap: 6px; width: min(360px, 50vw); }
.meter span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.bar { height: 8px; background: rgba(255,255,255,.1); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 40%; background: var(--sky); }
.bar.tension i { background: linear-gradient(90deg, #3eb5e0, var(--gold), var(--red)); }
.bar.boost i { background: var(--gold); }
.alt-speed { display: flex; gap: 14px; background: rgba(8,18,26,.5); padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); }
.alt-speed div { text-align: center; }
.alt-speed b { font-family: var(--display); font-size: 26px; display: block; line-height: 1; }
.alt-speed small { color: var(--muted); font-size: 10px; letter-spacing: .1em; }

.minimap-wrap {
  position: absolute; right: 16px; bottom: 16px;
  width: 168px; height: 168px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line); background: rgba(8,18,26,.55);
}
#minimap { width: 100%; height: 100%; }

.help-hint {
  position: absolute; top: 16px; left: 16px; display: flex; flex-wrap: wrap; gap: 6px; max-width: 280px;
}
.help-hint span {
  background: rgba(8,18,26,.5); border: 1px solid var(--line); padding: 4px 8px;
  border-radius: 999px; font-size: 11px; color: var(--muted);
}

.overlay {
  position: absolute; inset: 0; background: rgba(4,8,12,.62);
  display: grid; place-items: center; pointer-events: auto;
}
.pause-card, .cut-card {
  background: var(--panel-s); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px; text-align: center; min-width: 280px; display: grid; gap: 10px;
}
.pause-card h2, .cut-card h2 { font-family: var(--display); letter-spacing: .08em; font-size: 40px; }
.cut-kicker { color: var(--red); letter-spacing: .2em; font-weight: 800; }
.tablist {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--panel-s); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 20px; min-width: 280px; pointer-events: auto;
}
.tablist h3 { font-family: var(--display); letter-spacing: .08em; margin-bottom: 8px; }
.tablist li { list-style: none; padding: 4px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }

.touch-ui {
  position: absolute; inset: 0; pointer-events: none;
}
.stick {
  position: absolute; left: 24px; bottom: 24px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(255,255,255,.08); border: 1px solid var(--line);
  pointer-events: auto;
}
#stick-knob {
  position: absolute; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(245,196,0,.85); left: 33px; top: 33px;
}
.touch-btns {
  position: absolute; right: 190px; bottom: 24px; display: flex; flex-direction: column; gap: 8px;
  pointer-events: auto;
}
.touch-btns button {
  border: 0; background: rgba(8,18,26,.7); color: #fff; padding: 12px 16px;
  border-radius: 12px; font-weight: 800; letter-spacing: .08em;
}
.touch-btns button.boost { background: var(--red); }

#toasts {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 50; display: grid; gap: 8px; pointer-events: none;
}
.toast {
  background: #132230; border: 1px solid var(--gold); color: var(--text);
  padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow);
  animation: rise .25s ease;
}

@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .hero-points, .auth-hero .logo-tag { display: none; }
  #view-menu.active { grid-template-columns: 1fr; grid-template-rows: 56px auto 1fr; }
  .sidenav { flex-direction: row; overflow: auto; border-right: 0; border-bottom: 1px solid var(--line); grid-column: 1; }
  .navbtn { white-space: nowrap; }
  .hangar { grid-template-columns: 1fr; }
  .logo-type { font-size: 64px; }
  .help-hint { display: none; }
  .minimap-wrap { width: 120px; height: 120px; }
  .hud-bottom { width: 92%; }
}
