:root {
  --bg: #0e0f12;
  --bg-2: #13161c;
  --surface: rgba(21, 24, 33, 0.92);
  --surface-2: rgba(17, 20, 28, 0.84);
  --border: rgba(75, 84, 105, 0.3);
  --text: #f2f4f8;
  --muted: #9aa3b2;
  --dim: #687282;
  --accent: #6c8cff;
  --mint: #2ce6a6;
  --mint-soft: rgba(44, 230, 166, 0.17);
  --crimson: #ff3d5a;
  --crimson-soft: rgba(255, 61, 90, 0.15);
  --gold: #f5c542;
  --eternal: #8e44ff;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.38);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --board-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255,255,255,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; font-family: var(--font); color: var(--text); background: var(--bg); overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
body { background-image: radial-gradient(circle at 20% 0%, rgba(108,140,255,.22), transparent 34%), radial-gradient(circle at 100% 20%, rgba(44,230,166,.12), transparent 28%), radial-gradient(circle at 40% 100%, rgba(255,61,90,.1), transparent 24%), linear-gradient(180deg, #12151c 0%, #090a0d 100%); overflow: hidden; }
body::before { content: ""; position: fixed; inset: 0; background: url('../img/texture-noise.svg'); opacity: .085; pointer-events: none; mix-blend-mode: soft-light; }
button, input, textarea, select { font: inherit; }
button { appearance: none; border: 0; outline: 0; color: var(--text); background: transparent; cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
input { width: 100%; border-radius: 16px; border: 1px solid var(--border); background: rgba(255,255,255,.05); color: var(--text); padding: 14px 16px; outline: none; }
input:focus { border-color: rgba(108,140,255,.6); box-shadow: 0 0 0 4px rgba(108,140,255,.16); }
a { color: inherit; }
.hidden { display: none !important; }
.fade-in { animation: fadeIn .24s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatGlow { 0%,100% { transform: translateY(0); opacity: .92; } 50% { transform: translateY(-4px); opacity: 1; } }
#app { position: relative; min-height: 100dvh; padding-top: calc(var(--safe-top) + 18px); padding-bottom: var(--safe-bottom); }
.bg-orbit { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.bg-orbit::before,.bg-orbit::after { content: ""; position: absolute; border-radius: 999px; filter: blur(24px); opacity: .18; }
.bg-orbit::before { width: 42vmax; height: 42vmax; background: radial-gradient(circle, rgba(44,230,166,.55), rgba(44,230,166,0)); left: -14vmax; top: -10vmax; animation: floatGlow 7s ease-in-out infinite; }
.bg-orbit::after { width: 36vmax; height: 36vmax; background: radial-gradient(circle, rgba(108,140,255,.4), rgba(108,140,255,0)); right: -10vmax; top: 12vmax; animation: floatGlow 9s ease-in-out infinite reverse; }
.global-header { position: relative; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 0 18px 14px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-lockup img { width: 32px; height: 32px; }
.brand-title { font-size: 24px; font-weight: 700; letter-spacing: 2px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .8px; text-transform: uppercase; }
.header-spacer { flex: 1; }
.icon-btn,.pill-btn,.nav-btn,.primary-btn,.secondary-btn,.danger-btn,.level-card { transition: transform .12s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease, opacity .18s ease; }
.icon-btn:active,.nav-btn:active,.primary-btn:active,.secondary-btn:active,.danger-btn:active,.level-card:active { transform: scale(.97); }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255,255,255,.05); display: inline-grid; place-items: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn:hover { background: rgba(255,255,255,.08); }
.primary-btn,.secondary-btn,.danger-btn,.google-btn { border-radius: 18px; min-height: 52px; padding: 14px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; font-weight: 700; letter-spacing: .2px; }
.primary-btn { background: linear-gradient(180deg, rgba(108,140,255,.28), rgba(108,140,255,.16)); border: 1px solid rgba(108,140,255,.45); box-shadow: 0 10px 26px rgba(108,140,255,.18); }
.primary-btn:hover { background: linear-gradient(180deg, rgba(108,140,255,.34), rgba(108,140,255,.18)); }
.secondary-btn { background: rgba(255,255,255,.05); border: 1px solid var(--border); }
.secondary-btn:hover { background: rgba(255,255,255,.08); }
.danger-btn { background: rgba(255,61,90,.1); border: 1px solid rgba(255,61,90,.34); color: #ffd8de; }
.danger-btn:hover { background: rgba(255,61,90,.16); }
.google-btn { background: #fff; color: #111; }
#screen-stack { position: relative; z-index: 10; height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 88px); }
.screen { display: none; height: 100%; padding: 0 18px 18px; }
.screen.active { display: block; }
.screen-scroll { height: 100%; overflow: auto; padding-right: 2px; }
.screen-scroll::-webkit-scrollbar { width: 10px; }
.screen-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 999px; }
.panel { background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025)); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.stack { display: grid; gap: 16px; }
.section-title { font-size: 18px; font-weight: 700; }
.section-copy { font-size: 14px; color: var(--muted); line-height: 1.5; }
.small { font-size: 12px; color: var(--muted); }
.center { text-align: center; }
.hero { min-height: calc(100% - 12px); display: grid; align-content: start; gap: 18px; }
.hero-card { padding: 26px; position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; inset: auto 0 0 0; height: 84px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.18)); }
.hero-logo { width: min(380px, 92%); max-width: 100%; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--border); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .9px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hero-stat { padding: 14px; border-radius: 18px; background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.08); }
.hero-stat strong { display: block; font-size: 22px; margin-bottom: 4px; }
.home-grid { display: grid; gap: 16px; }
.home-actions { display: grid; gap: 12px; }
.nav-btn { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; min-height: 68px; border-radius: 20px; padding: 18px; border: 1px solid var(--border); background: rgba(255,255,255,.045); text-align: left; }
.nav-btn:hover { background: rgba(255,255,255,.07); }
.nav-btn .meta { display: grid; gap: 4px; }
.nav-btn .meta b { font-size: 16px; }
.nav-btn .meta span { font-size: 13px; color: var(--muted); }
.nav-btn .accent { color: var(--accent); font-size: 24px; }
.level-grid-wrap { padding-bottom: 10px; }
.level-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.level-card { position: relative; min-height: 96px; border-radius: 20px; border: 1px solid var(--border); background: rgba(255,255,255,.045); padding: 14px; text-align: left; display: grid; align-content: space-between; }
.level-card.locked { opacity: .55; }
.level-card .num { font-size: 18px; font-weight: 700; }
.level-card .tier { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.level-card .stars { display: flex; gap: 4px; color: var(--gold); }
.level-card .best { font-size: 12px; color: var(--muted); }
.level-card.active-level { border-color: rgba(108,140,255,.5); box-shadow: 0 0 0 3px rgba(108,140,255,.14); }
.profile-card,.settings-card,.lb-card,.daily-card { padding: 20px; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.kv-row + .kv-row { margin-top: 10px; }
.kv-row label { color: var(--muted); font-size: 13px; }
.value-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid var(--border); }
.progress-bar { position: relative; width: 100%; height: 12px; background: rgba(255,255,255,.05); border-radius: 999px; overflow: hidden; border: 1px solid rgba(255,255,255,.08); }
.progress-bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--accent)); border-radius: inherit; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; }
.switch { width: 56px; height: 32px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid var(--border); position: relative; }
.switch::after { content: ""; position: absolute; width: 24px; height: 24px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: transform .18s ease; }
.switch.on { background: rgba(44,230,166,.18); border-color: rgba(44,230,166,.35); }
.switch.on::after { transform: translateX(24px); background: var(--mint); }
.lb-list { display: grid; gap: 10px; }
.lb-row { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; border-radius: 16px; padding: 12px 14px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.lb-rank { font-weight: 700; color: var(--accent); }
.lb-name { font-weight: 600; }
.lb-sub { font-size: 12px; color: var(--muted); }
.lb-score { text-align: right; font-weight: 700; }
.game-screen { height: 100%; }
.game-shell { height: 100%; display: grid; grid-template-rows: auto 1fr auto; gap: 14px; }
.game-topbar,.game-footer,.info-panel,.board-card { border: 1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.game-topbar { display: grid; gap: 12px; padding: 16px 16px 14px; border-radius: 24px; }
.game-topbar .row-main { display: flex; align-items: center; gap: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; padding: 8px 10px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,.05); font-size: 12px; color: var(--muted); }
.tag.mint { color: var(--mint); border-color: rgba(44,230,166,.28); background: rgba(44,230,166,.1); }
.tag.red { color: #ffc7d0; border-color: rgba(255,61,90,.28); background: rgba(255,61,90,.1); }
.tag.blue { color: #d5ddff; border-color: rgba(108,140,255,.34); background: rgba(108,140,255,.1); }
.board-and-panel { min-height: 0; display: grid; gap: 14px; }
.board-card { position: relative; min-height: 0; border-radius: 28px; overflow: hidden; box-shadow: var(--board-shadow); }
#boardCanvas { display: block; width: 100%; height: 100%; touch-action: none; background: radial-gradient(circle at 50% 10%, rgba(108,140,255,.12), rgba(0,0,0,0) 36%), #0b0c10; }
.board-hud { pointer-events: none; position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; }
.board-floating { display: flex; justify-content: space-between; gap: 10px; }
.board-mini-card { min-width: 120px; padding: 10px 12px; border-radius: 18px; background: rgba(12, 13, 18, 0.72); border: 1px solid rgba(255,255,255,.09); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.board-mini-card b { display: block; font-size: 22px; margin-top: 4px; }
.info-panel { border-radius: 24px; padding: 16px; overflow: auto; }
.info-stack { display: grid; gap: 16px; }
.metric-card { padding: 14px; border-radius: 18px; background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.06); }
.metric-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.metric-head .metric-name { font-size: 12px; color: var(--muted); }
.metric-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.hint-box { padding: 16px; border-radius: 18px; background: linear-gradient(180deg, rgba(108,140,255,.12), rgba(108,140,255,.04)); border: 1px solid rgba(108,140,255,.2); }
.game-footer { border-radius: 24px; padding: 14px; }
.control-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.seed-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.seed-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.12); }
.seed-dot.filled { background: var(--mint); box-shadow: 0 0 0 4px rgba(44,230,166,.15); }
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 22px); transform: translateX(-50%) translateY(20px); min-width: min(88vw, 420px); max-width: 92vw; padding: 14px 18px; border-radius: 18px; background: rgba(12, 14, 19, .86); border: 1px solid var(--border); box-shadow: 0 16px 32px rgba(0,0,0,.32); backdrop-filter: blur(16px); opacity: 0; pointer-events: none; transition: opacity .22s ease, transform .22s ease; z-index: 40; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.modal-layer { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(4, 5, 8, 0.56); backdrop-filter: blur(10px); z-index: 50; }
.modal-layer.open { display: flex; }
.modal { width: min(460px, 100%); border-radius: 30px; padding: 24px; background: linear-gradient(180deg, rgba(20,22,30,.96), rgba(10,11,15,.96)); border: 1px solid rgba(255,255,255,.09); box-shadow: 0 30px 60px rgba(0,0,0,.48); }
.modal-title { font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.modal-copy { color: var(--muted); line-height: 1.5; }
.modal-actions { display: grid; gap: 10px; margin-top: 18px; }
.result-hero { display: grid; gap: 14px; text-align: center; }
.result-score { font-size: 48px; font-weight: 700; }
.result-stars { color: var(--gold); font-size: 28px; letter-spacing: 4px; }
.ring { --ring: .52; width: 124px; height: 124px; border-radius: 50%; margin: 6px auto 10px; display: grid; place-items: center; background: conic-gradient(var(--mint) calc(var(--ring) * 1turn), rgba(255,255,255,.08) 0); box-shadow: 0 0 0 8px rgba(255,255,255,.03), 0 12px 30px rgba(0,0,0,.32); position: relative; }
.ring::after { content: ""; width: 86px; height: 86px; border-radius: inherit; background: #12151c; box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.ring-label { position: absolute; font-size: 22px; font-weight: 700; z-index: 1; }
.splash { position: fixed; inset: 0; background: radial-gradient(circle at 50% 30%, rgba(108,140,255,.18), transparent 30%), #090a0d; display: grid; place-items: center; z-index: 60; transition: opacity .7s ease, visibility .7s ease; }
.splash.hide { opacity: 0; visibility: hidden; }
.splash-card { text-align: center; display: grid; gap: 14px; }
.splash-card img { width: min(360px, 84vw); margin: 0 auto; }
.splash-tag { color: var(--muted); letter-spacing: 1.8px; text-transform: uppercase; font-size: 12px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; color: var(--muted); font-size: 12px; padding-bottom: 8px; }
.desktop-only { display: none; }
@media (min-width: 900px) { .desktop-only { display: block; } .screen { padding-inline: 24px; } .hero { grid-template-columns: 1.25fr .85fr; align-items: stretch; } .home-grid { grid-template-columns: 1.1fr .9fr; } .level-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } .board-and-panel { grid-template-columns: minmax(0, 1.65fr) minmax(300px, .8fr); } }
@media (orientation: portrait) { .board-and-panel { grid-template-rows: minmax(0, 1fr) auto; } .board-card { aspect-ratio: 9 / 16; max-height: calc(100dvh - 310px); } }
@media (orientation: landscape) and (max-width: 899px) { #screen-stack { height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 76px); } .board-and-panel { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); } .control-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 639px) { .level-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .hero-card, .profile-card, .settings-card, .lb-card, .daily-card, .modal { padding: 18px; } .game-topbar, .game-footer, .info-panel { padding: 14px; } .metric-value { font-size: 24px; } .global-header { padding-inline: 14px; } .screen { padding-inline: 14px; } .hero-stats { grid-template-columns: repeat(1, minmax(0,1fr)); } }
