:root {
  --ink: #f5f0dc;
  --muted: #9aa5ad;
  --night: #07121b;
  --panel: #0e1d28;
  --line: rgba(255, 255, 255, .11);
  --red: #ee3b32;
  --red-dark: #bd251f;
  --yellow: #ffc928;
  --green: #63df45;
  --cyan: #42bde8;
  --display: "Chakra Petch", sans-serif;
  --body: "Inter", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--night); scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    radial-gradient(circle at 18% 65%, rgba(38, 139, 180, .16), transparent 30%),
    #07121b;
  background-size: 32px 32px, 32px 32px, auto;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .14;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.2) 3px 4px);
  z-index: 10;
}

a { color: inherit; }
button { font: inherit; }

.page-shell { width: min(1240px, calc(100% - 64px)); margin: 0 auto; }

.topbar {
  height: 86px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 12px; width: max-content; font: 700 18px var(--display); text-decoration: none; letter-spacing: 0; }
.brand-mark { width: 28px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; border: 3px solid var(--ink); background: linear-gradient(var(--red) 0 45%, #111 45% 55%, var(--ink) 55%); box-shadow: 0 0 0 2px #05090d; }
.brand-mark span { width: 8px; aspect-ratio: 1; border: 2px solid #111; border-radius: 50%; background: var(--ink); }
.topbar-status { display: flex; align-items: center; gap: 9px; color: #b3bec5; font: 600 12px var(--display); text-transform: uppercase; }
.signal { width: 7px; aspect-ratio: 1; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(99,223,69,.8); }
.icon-button { justify-self: end; width: 42px; aspect-ratio: 1; display: grid; place-items: center; color: var(--ink); border: 1px solid var(--line); border-radius: 5px; background: rgba(255,255,255,.035); cursor: pointer; transition: background .2s, transform .2s; }
.icon-button:hover { background: rgba(255,255,255,.09); transform: translateY(-1px); }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-off { display: none; }
.sound-toggle[aria-pressed="false"] .sound-on { display: none; }
.sound-toggle[aria-pressed="false"] .sound-off { display: block; }

.login-layout { min-height: calc(100vh - 162px); display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(400px, .82fr); gap: clamp(52px, 7vw, 104px); align-items: center; padding: 60px 0 52px; }

.hero { position: relative; min-width: 0; padding-left: clamp(0px, 2vw, 24px); }
.hero::before { content: "151"; position: absolute; top: 1%; left: -8%; z-index: -1; color: rgba(255,255,255,.025); font: 700 clamp(190px, 25vw, 350px)/.8 var(--display); }
.eyebrow { display: flex; align-items: center; gap: 12px; color: var(--yellow); font: 700 12px var(--display); text-transform: uppercase; }
.eyebrow::before { content: ""; width: 34px; height: 2px; background: var(--red); }
.eyebrow strong { padding-left: 12px; color: #aab5bd; border-left: 1px solid var(--line); font-weight: 600; }
.game-logo { display: block; width: min(100%, 600px); margin: 20px 0 10px; filter: drop-shadow(0 24px 24px rgba(0,0,0,.34)); }
.hero h1 { margin: 0; font: 700 clamp(28px, 3.1vw, 46px)/1.03 var(--display); }
.hero h1 span { color: var(--yellow); }
.hero-copy { max-width: 570px; margin: 18px 0 32px; color: #aeb8be; font-size: 15px; line-height: 1.7; }
.progress-preview { max-width: 570px; padding: 18px 20px 16px; border-left: 3px solid var(--red); background: rgba(255,255,255,.035); }
.progress-meta, .progress-caption { display: flex; justify-content: space-between; gap: 20px; }
.progress-meta { margin-bottom: 13px; font: 600 12px var(--display); text-transform: uppercase; }
.progress-meta strong { color: var(--yellow); }
.progress-track { height: 6px; overflow: hidden; background: rgba(255,255,255,.12); }
.progress-track span { display: block; width: 56%; height: 100%; background: linear-gradient(90deg, var(--red), var(--yellow)); animation: loadProgress 1.4s cubic-bezier(.16,1,.3,1) both; }
.progress-caption { margin-top: 10px; color: #73818a; font: 600 10px var(--display); text-transform: uppercase; }

.access-panel { position: relative; padding: clamp(28px, 3.5vw, 46px); border: 1px solid rgba(255,255,255,.14); background: rgba(13, 28, 39, .94); box-shadow: 18px 18px 0 rgba(0,0,0,.16), 0 28px 70px rgba(0,0,0,.24); }
.access-panel::before, .access-panel::after { content: ""; position: absolute; width: 34px; height: 4px; background: var(--red); }
.access-panel::before { top: -2px; left: 24px; }
.access-panel::after { right: 24px; bottom: -2px; }
.panel-head { display: flex; align-items: center; gap: 16px; }
.step-number { width: 46px; aspect-ratio: 1; display: grid; place-items: center; flex: 0 0 auto; color: var(--yellow); border: 1px solid rgba(255,201,40,.4); background: rgba(255,201,40,.07); font: 700 14px var(--display); }
.kicker { margin: 0 0 4px; color: var(--red); font: 700 11px var(--display); text-transform: uppercase; }
.panel-head h2 { margin: 0; font: 700 clamp(23px, 2.2vw, 31px)/1.1 var(--display); }
.panel-copy { margin: 22px 0 24px; color: #9da9b0; font-size: 14px; line-height: 1.6; }

.telegram-button { position: relative; width: 100%; min-height: 76px; display: grid; grid-template-columns: 46px 1fr 24px; align-items: center; gap: 14px; padding: 12px 18px; color: white; text-align: left; border: 0; border-radius: 5px; background: #249ad4; box-shadow: inset 0 -4px rgba(0,0,0,.16), 0 12px 26px rgba(36,154,212,.17); cursor: pointer; transition: transform .2s, background .2s, box-shadow .2s; overflow: hidden; }
.telegram-button::before { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,.14) 49%, transparent 70%); transform: translateX(-100%); transition: transform .55s; }
.telegram-button:hover { transform: translateY(-2px); background: #2aa8e4; box-shadow: inset 0 -4px rgba(0,0,0,.16), 0 18px 32px rgba(36,154,212,.23); }
.telegram-button:hover::before { transform: translateX(100%); }
.telegram-button:active { transform: translateY(1px); }
.telegram-icon { width: 44px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.16); }
.telegram-icon svg, .telegram-mini svg { width: 24px; fill: currentColor; }
.button-label { display: grid; gap: 3px; position: relative; }
.button-label strong { font: 700 16px var(--display); }
.button-label small { opacity: .76; font-size: 11px; }
.arrow { width: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.button-loader { display: none; position: absolute; right: 22px; width: 20px; aspect-ratio: 1; border: 2px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }
.telegram-button.loading { pointer-events: none; }
.telegram-button.loading .arrow { visibility: hidden; }
.telegram-button.loading .button-loader { display: block; }

.trust-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.trust-row > div { min-width: 0; display: flex; gap: 10px; align-items: flex-start; }
.trust-row svg { width: 18px; flex: 0 0 auto; color: var(--green); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.trust-row span { display: grid; gap: 3px; }
.trust-row strong { color: #dfe6e9; font-size: 11px; }
.trust-row small { color: #778690; font-size: 9px; line-height: 1.35; }
.divider { display: flex; align-items: center; gap: 14px; margin: 27px 0 12px; color: #65737d; font: 600 9px var(--display); text-transform: uppercase; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.quick-links { display: grid; }
.quick-links a { min-height: 65px; display: grid; grid-template-columns: 38px 1fr 18px; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); text-decoration: none; transition: background .2s, padding .2s; }
.quick-links a:hover { padding: 0 10px; background: rgba(255,255,255,.035); }
.quick-links a > span:nth-child(2) { display: grid; gap: 3px; }
.quick-links strong { font: 600 13px var(--display); }
.quick-links small { color: #72808a; font-size: 10px; }
.quick-links a > svg { width: 17px; fill: none; stroke: #6e7b84; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link-icon { width: 34px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 4px; }
.trophy { color: #171a13; background: var(--yellow); font: 800 14px var(--display); }
.telegram-mini { color: white; background: #249ad4; }
.telegram-mini svg { width: 19px; }
.legal-copy { margin: 22px 0 0; color: #66747d; font-size: 9px; line-height: 1.6; text-align: center; }
.legal-copy a:hover { color: var(--ink); }

footer { min-height: 76px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: center; color: #687781; border-top: 1px solid var(--line); font: 600 10px var(--display); text-transform: uppercase; }
footer nav { display: flex; gap: 24px; }
footer a { text-decoration: none; transition: color .2s; }
footer a:hover { color: var(--ink); }
.footer-code { justify-self: end; color: #46555f; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; width: min(380px, calc(100% - 32px)); min-height: 74px; display: grid; grid-template-columns: 40px 1fr 24px; gap: 12px; align-items: center; padding: 13px 14px; border: 1px solid rgba(99,223,69,.35); background: #11251e; box-shadow: 0 20px 50px rgba(0,0,0,.35); transform: translateY(130%); opacity: 0; transition: transform .35s, opacity .35s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast-ball { width: 36px; aspect-ratio: 1; border-radius: 50%; border: 3px solid #080c0e; background: linear-gradient(var(--red) 0 45%, #111 45% 56%, #f4f0df 56%); box-shadow: inset 0 0 0 2px rgba(255,255,255,.2); }
.toast > span:nth-child(2) { display: grid; gap: 3px; }
.toast strong { font: 700 12px var(--display); }
.toast small { color: #8fa198; font-size: 9px; line-height: 1.4; }
.toast button { color: #8fa198; border: 0; background: none; font-size: 22px; cursor: pointer; }

@keyframes loadProgress { from { width: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .page-shell { width: min(680px, calc(100% - 40px)); }
  .login-layout { grid-template-columns: 1fr; gap: 42px; padding: 52px 0; }
  .hero { text-align: center; padding-left: 0; }
  .eyebrow { justify-content: center; }
  .game-logo { margin-left: auto; margin-right: auto; }
  .hero-copy, .progress-preview { margin-left: auto; margin-right: auto; }
  footer { grid-template-columns: 1fr auto; }
  footer nav { order: 3; grid-column: 1 / -1; justify-content: center; padding-bottom: 22px; }
}

@media (max-width: 560px) {
  .page-shell { width: min(100% - 24px, 480px); }
  .topbar { height: 68px; grid-template-columns: 1fr auto; }
  .topbar-status { display: none; }
  .brand { font-size: 15px; }
  .login-layout { min-height: auto; padding: 38px 0 32px; gap: 34px; }
  .hero::before { left: 0; font-size: 190px; }
  .eyebrow { font-size: 10px; gap: 8px; }
  .game-logo { width: 100%; margin-top: 14px; }
  .hero h1 { font-size: 28px; }
  .hero-copy { margin-top: 14px; font-size: 13px; }
  .progress-preview { padding: 15px 14px 13px; }
  .progress-meta { font-size: 10px; }
  .access-panel { padding: 24px 18px; }
  .panel-head h2 { font-size: 22px; }
  .step-number { width: 40px; }
  .telegram-button { min-height: 72px; grid-template-columns: 40px 1fr 20px; gap: 11px; padding: 10px 14px; }
  .telegram-icon { width: 40px; }
  .button-label strong { font-size: 14px; }
  .trust-row { grid-template-columns: 1fr; gap: 13px; }
  footer { min-height: 68px; }
  footer nav { gap: 15px; flex-wrap: wrap; }
  .footer-code { display: none; }
  .toast { right: 16px; bottom: 16px; }
}

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