:root {
  --bg: #05060a;
  --bg-2: #0c1018;
  --panel: rgba(17, 21, 32, .78);
  --panel-solid: #121724;
  --line: rgba(255,255,255,.12);
  --line-strong: rgba(255,255,255,.22);
  --text: #fff7e8;
  --muted: #a8adbb;
  --gold: #f5c963;
  --gold-2: #ffecab;
  --red: #e43d4d;
  --red-2: #8d1828;
  --green: #62d997;
  --blue: #7bb8ff;
  --shadow: 0 28px 90px rgba(0,0,0,.48);
  --radius: 26px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(228,61,77,.22), transparent 31%),
    radial-gradient(circle at 82% 8%, rgba(245,201,99,.13), transparent 26%),
    linear-gradient(135deg, #05060a 0%, #101522 52%, #070a10 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.024) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 84%);
}

a { color: inherit; }
button, input { font: inherit; }
button:disabled { opacity: .58; cursor: not-allowed; }

.page-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  gap: 28px;
  align-items: center;
  padding: 36px 0;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.026));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  min-height: 650px;
  border-radius: var(--radius);
  padding: clamp(26px, 4vw, 56px);
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -190px;
  bottom: -240px;
  width: 560px;
  height: 560px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(228,61,77,.33), transparent 65%);
}

.badge-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 36px; }
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.26);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 850;
}
.badge.gold { color: #1b1206; background: linear-gradient(135deg, var(--gold), var(--gold-2)); border-color: rgba(245,201,99,.65); }
.badge.green { color: #eafff3; background: rgba(98,217,151,.12); border-color: rgba(98,217,151,.36); }

.kicker {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: .29em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(46px, 7vw, 88px);
  line-height: .88;
  letter-spacing: -.07em;
}

h1 span {
  display: block;
  background: linear-gradient(135deg, #fff 0%, #ffe1a0 38%, #ff6f7d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy {
  margin: 28px 0 0;
  max-width: 640px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.65;
}

.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 42px; }
.stat {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(0,0,0,.24);
  padding: 18px;
}
.stat strong { display: block; font-size: 25px; letter-spacing: -.04em; }
.stat span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }

.city-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 120px;
  opacity: .48;
  background:
    linear-gradient(to top, rgba(0,0,0,.92), transparent),
    repeating-linear-gradient(90deg, rgba(255,255,255,.12) 0 4px, transparent 4px 38px);
}

.auth-stack { display: grid; gap: 16px; }
.auth-card, .mini-card, .game-card, .topbar {
  border-radius: var(--radius);
}
.auth-card { padding: clamp(22px, 3vw, 32px); }
.auth-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 22px; }
.auth-head h2 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.auth-head p { margin: 7px 0 0; color: var(--muted); line-height: 1.5; }
.status-pill {
  flex: none;
  display: inline-flex;
  padding: 8px 11px;
  border-radius: 999px;
  color: #fff6db;
  background: rgba(245,201,99,.1);
  border: 1px solid rgba(245,201,99,.25);
  font-size: 12px;
  font-weight: 850;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(0,0,0,.28);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.tab-btn {
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  padding: 12px 14px;
  font-weight: 950;
  cursor: pointer;
}
.tab-btn.active { color: var(--text); background: linear-gradient(135deg, rgba(228,61,77,.92), rgba(141,24,40,.92)); }

.form-panel { display: none; }
.form-panel.active { display: block; }
.field { margin-top: 13px; }
label { display: block; margin-bottom: 7px; color: #d9dbe4; font-size: 13px; font-weight: 850; }
input {
  width: 100%;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 15px;
  background: rgba(4,5,9,.62);
  color: var(--text);
  outline: none;
  padding: 15px;
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus { border-color: rgba(245,201,99,.75); box-shadow: 0 0 0 4px rgba(245,201,99,.12); background: rgba(4,5,9,.78); }

.primary-btn, .secondary-btn, .ghost-btn {
  width: 100%;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 950;
  letter-spacing: .01em;
  padding: 15px 16px;
}
.primary-btn { margin-top: 18px; border: 0; color: #fff; background: linear-gradient(135deg, #ff4c5d, #a91f31 48%, #f5c963 130%); box-shadow: 0 16px 38px rgba(228,61,77,.24); }
.secondary-btn { margin-top: 10px; color: var(--text); background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.ghost-btn { color: var(--text); background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.message { min-height: 24px; margin-top: 14px; color: var(--muted); line-height: 1.5; }
.message.good { color: var(--green); }
.message.bad { color: #ff808c; }

.force-card {
  display: none;
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(245,201,99,.08);
  border: 1px solid rgba(245,201,99,.24);
}
.force-card.active { display: block; }
.force-card h3 { margin: 0 0 6px; font-size: 18px; }
.force-card p { margin: 0 0 14px; color: #f5ddb0; line-height: 1.5; }

.mini-card { padding: 18px; }
.mini-card h3 { margin: 0 0 5px; font-size: 18px; }
.mini-card p { margin: 0; color: var(--muted); font-size: 13px; }
.online-list { display: grid; gap: 10px; margin-top: 14px; }
.player-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.24); border-radius: 16px; padding: 12px; }
.player-row strong { display: block; }
.player-row small { color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 999px; background: var(--green); box-shadow: 0 0 0 5px rgba(98,217,151,.12); }

/* Game shell */
.game-layout { padding: 24px 0 42px; }
.topbar {
  position: sticky;
  top: 14px;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--red), var(--red-2));
  color: white;
  font-weight: 1000;
  letter-spacing: -.07em;
  box-shadow: 0 14px 30px rgba(228,61,77,.22);
}
.top-title strong { display: block; font-size: 18px; }
.top-title span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.player-strip { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.player-pill {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.25);
  border-radius: 999px;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}
.player-pill strong { color: var(--text); }
.player-pill.owner strong { color: var(--gold); }

.game-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.side-nav { border-radius: 22px; padding: 14px; align-self: start; }
.side-nav a {
  display: flex;
  justify-content: space-between;
  text-decoration: none;
  color: var(--muted);
  padding: 13px 12px;
  border-radius: 14px;
  font-weight: 850;
}
.side-nav a.active, .side-nav a:hover { color: var(--text); background: rgba(255,255,255,.07); }
.side-nav small { color: var(--gold); }

.content-grid { display: grid; gap: 18px; }
.welcome-card { padding: clamp(22px, 3vw, 32px); border-radius: var(--radius); position: relative; overflow: hidden; }
.welcome-card::after { content: ""; position: absolute; right: -80px; top: -120px; width: 280px; height: 280px; border-radius: 999px; background: radial-gradient(circle, rgba(245,201,99,.18), transparent 70%); }
.welcome-card h1 { font-size: clamp(34px, 5vw, 62px); }
.welcome-card p { color: var(--muted); max-width: 760px; line-height: 1.6; font-size: 16px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { padding: 18px; border-radius: 20px; border: 1px solid var(--line); background: rgba(0,0,0,.22); }
.stat-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 850; }
.stat-card strong { display: block; margin-top: 8px; font-size: 25px; letter-spacing: -.04em; }

.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.game-card { padding: 18px; }
.game-card h3 { margin: 0; font-size: 20px; }
.game-card p { color: var(--muted); line-height: 1.5; }
.game-card .primary-btn, .game-card .secondary-btn { margin-top: 10px; }
.lock-note { margin-top: 12px; color: var(--muted); font-size: 12px; }

.loading-cover {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(5,6,10,.86);
  backdrop-filter: blur(12px);
}
.loading-cover.hidden { display: none; }
.loader-card { border: 1px solid var(--line); border-radius: 22px; background: var(--panel-solid); padding: 24px; box-shadow: var(--shadow); }
.loader-card strong { display: block; font-size: 22px; }
.loader-card span { display: block; margin-top: 6px; color: var(--muted); }

@media (max-width: 960px) {
  .auth-layout, .game-grid { grid-template-columns: 1fr; }
  .hero-card { min-height: auto; }
  .hero-stats, .stats-grid, .action-grid { grid-template-columns: 1fr; }
  .topbar { position: static; grid-template-columns: auto 1fr; }
  .player-strip { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 540px) {
  .page-shell { width: min(100% - 22px, 1180px); }
  .auth-layout { padding: 18px 0; }
  .auth-head { display: block; }
  .status-pill { margin-top: 12px; }
  .hero-card, .auth-card, .welcome-card { border-radius: 20px; }
}
