/* RubikFish web app — dark, Cubzor-inspired */
:root {
  --bg: #0d0d0f;
  --bg-soft: #121214;
  --panel: #17171a;
  --panel-2: #1e1e22;
  --panel-3: #26262b;
  --border: #2c2c32;
  --border-soft: #232328;
  --text: #f3eee6;
  --muted: #a29b92;
  --muted-2: #746e66;
  --accent: #f2e9dc;
  --accent-text: #141414;
  --green: #26c281;
  --red: #e5484d;
  --blue: #3b82f6;
  --yellow: #ffd400;
  --orange: #ff7a00;
  --radius: 22px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
html[data-theme="light"] {
  --bg: #f4f1ea;
  --bg-soft: #ece7dd;
  --panel: #ffffff;
  --panel-2: #f7f4ee;
  --panel-3: #eee9df;
  --border: #ddd6c9;
  --border-soft: #e8e2d7;
  --text: #1b1a17;
  --muted: #6b655d;
  --muted-2: #8b8479;
  --accent: #1b1a17;
  --accent-text: #fffaf0;
  --shadow: 0 20px 60px rgba(40, 30, 10, .12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(255,255,255,.045), transparent 60%),
    radial-gradient(900px 500px at 0% 20%, rgba(38,194,129,.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1,h2,h3,h4 { margin: 0 0 .45em; line-height: 1.15; letter-spacing: -.02em; }
h1 { font-size: clamp(30px, 4vw, 54px); font-weight: 800; }
h2 { font-size: clamp(22px, 2.3vw, 30px); font-weight: 750; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: .5em 0; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; color: var(--muted-2); }

/* Header */
.topbar-wrap { position: sticky; top: 0; z-index: 40; padding: 12px 16px 0; background: linear-gradient(180deg, var(--bg) 10%, transparent); }
.topbar {
  max-width: 1480px; margin: 0 auto; height: 64px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px 0 20px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; white-space: nowrap; }
.brand-cube { width: 35px; height: 35px; flex: 0 0 35px; display: block; filter: drop-shadow(0 3px 6px rgba(0,0,0,.35)); }
.nav { display: flex; align-items: center; gap: 2px; margin-left: 14px; }
.nav a { padding: 9px 13px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; transition: .15s; }
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a.active { color: var(--text); background: var(--panel-3); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; transition: .15s;
}
.icon-btn:hover { color: var(--text); background: var(--panel-3); }
.menu-btn { display: none; margin-left: auto; }

/* Layout */
.app { max-width: 1480px; margin: 0 auto; padding: 26px 18px 60px; }
.page { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card, .panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.panel { padding: 22px; }
.panel-tight { padding: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.center { text-align: center; }
.mt { margin-top: 18px; } .mt-s { margin-top: 10px; } .mb { margin-bottom: 18px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  font-weight: 700; font-size: 14px; transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--panel-3); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(.96); background: var(--accent); }
.btn-green { background: var(--green); color: #04130b; border-color: var(--green); }
.btn-danger { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.btn-sm { min-height: 34px; padding: 6px 12px; border-radius: 9px; font-size: 12.5px; }
.btn-lg { min-height: 52px; padding: 13px 24px; font-size: 15px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 42px; padding: 0; }

/* Inputs */
.input, .select, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 13px; border-radius: 11px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text); outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px;
}
.input:focus { border-color: color-mix(in srgb, var(--text) 35%, var(--border)); }
textarea.input { min-height: 90px; resize: vertical; }
label.field { display: block; margin-bottom: 10px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
label.field .input { margin-top: 5px; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 26px; align-items: center; min-height: 520px; }
.hero h1 { font-size: clamp(38px, 5.4vw, 74px); letter-spacing: -.045em; }
.hero .lead { color: var(--muted); font-size: 17px; max-width: 56ch; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 14px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero-stats { display: flex; gap: 26px; margin-top: 30px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 22px; }
.hero-art { position: relative; min-height: 420px; }
.cube-stage { position: relative; width: 100%; height: 100%; min-height: 320px; border-radius: var(--radius); overflow: hidden; }
.cube-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.stage-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.feature-card { padding: 20px; border-radius: 18px; background: var(--panel); border: 1px solid var(--border); transition: .2s; }
.feature-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--text) 20%, var(--border)); }
.feature-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--border); font-size: 20px; margin-bottom: 14px; }

/* Solve / net */
.solve-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr); gap: 20px; align-items: start; }
.net-wrap { padding: clamp(14px, 2vw, 28px); }
.net {
  display: grid; gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas: ". u . ." "l f r b" ". d . .";
  max-width: 760px; margin: 0 auto;
}
.net .face-box { min-width: 0; }
.face-U { grid-area: u; } .face-L { grid-area: l; } .face-F { grid-area: f; }
.face-R { grid-area: r; } .face-B { grid-area: b; } .face-D { grid-area: d; }
.face-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 8px; }
.face-title { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; padding: 2px 4px 8px; }
.face-title b { font-size: 12px; letter-spacing: .04em; }
.face-title span { color: var(--muted-2); font-size: 10px; }
.face-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.cell {
  aspect-ratio: 1; border-radius: 7px; border: 1px dashed var(--border);
  background: transparent; padding: 0; position: relative; transition: .1s;
  min-width: 0; color: rgba(0,0,0,.55); font-weight: 800; font-size: 11px;
}
.cell:hover { border-color: var(--muted); }
.cell.filled { border-style: solid; border-color: rgba(0,0,0,.18); }
.cell.center { outline: 1px solid color-mix(in srgb, var(--text) 20%, transparent); outline-offset: 1px; cursor: default; }
.cell.selected { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); z-index: 1; }
.c-W { background: #f5f5f5; color: #222; } .c-Y { background: #ffd400; color: #3a2f00; }
.c-R { background: #d92b2b; color: #fff; } .c-O { background: #ff7a00; color: #3a1800; }
.c-B { background: #1f5fd6; color: #fff; } .c-G { background: #00a651; color: #fff; }
.palette { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-bottom: 20px; }
.swatch { width: 42px; height: 42px; border-radius: 10px; border: 2px solid transparent; position: relative; }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg); }
.swatch small { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 9px; }
.color-legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 24px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.progress { height: 7px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--green); transition: width .25s; }
.solve-aside { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 16px; }
.stage-card { padding: 10px; }
.stage-card .cube-stage { min-height: 300px; }
.solve-actions { display: grid; gap: 9px; }
.note { color: var(--muted); font-size: 12px; line-height: 1.5; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border-soft); }

/* Camera */
.cam-layout { display: grid; grid-template-columns: 1.5fr .8fr; gap: 16px; }
.cam-preview { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 4/3; }
.cam-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-grid { position: absolute; inset: 0; pointer-events: none; background:
  linear-gradient(to right, transparent 33.2%, rgba(255,255,255,.55) 33.2%, rgba(255,255,255,.55) 33.6%, transparent 33.6%, transparent 66.3%, rgba(255,255,255,.55) 66.3%, rgba(255,255,255,.55) 66.7%, transparent 66.7%),
  linear-gradient(to bottom, transparent 33.2%, rgba(255,255,255,.55) 33.2%, rgba(255,255,255,.55) 33.6%, transparent 33.6%, transparent 66.3%, rgba(255,255,255,.55) 66.3%, rgba(255,255,255,.55) 66.7%, transparent 66.7%); }
.cam-face-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.cam-face-tabs button { flex: 1 1 44px; padding: 8px 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); font-weight: 700; font-size: 12px; }
.cam-face-tabs button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* Solution */
.solution-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(360px,.85fr); gap: 20px; align-items: start; }
.solution-stage { min-height: 520px; }
.step-list { max-height: 430px; overflow: auto; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-soft); }
.step { display: flex; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); align-items: flex-start; cursor: pointer; }
.step:last-child { border-bottom: 0; }
.step.active { background: color-mix(in srgb, var(--green) 12%, transparent); }
.step .num { width: 26px; color: var(--muted-2); font-family: ui-monospace, monospace; font-size: 12px; padding-top: 2px; }
.step .mv { font-family: ui-monospace, monospace; font-weight: 800; min-width: 34px; }
.step .desc { color: var(--muted); font-size: 12.5px; }
.playback { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.playback .spacer { flex: 1; }
.speed-select { min-height: 36px; padding: 6px 10px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--border); }
.loading { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--text); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Timer */
.timer-grid { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(340px,.7fr); gap: 20px; align-items: start; }
.timer-main { padding: clamp(18px, 3vw, 36px); min-height: 560px; display: flex; flex-direction: column; }
.scramble-line { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(17px, 2.2vw, 30px); line-height: 1.5; letter-spacing: .08em; word-spacing: .2em; min-height: 2.6em; }
.timer-display {
  margin: auto 0; text-align: center; font-family: "Arial Black", Impact, ui-sans-serif, system-ui;
  font-size: clamp(76px, 13vw, 190px); font-weight: 900; letter-spacing: -.055em; line-height: 1;
  font-variant-numeric: tabular-nums; padding: 20px 0; user-select: none; transition: color .15s;
}
.timer-display.holding { color: var(--red); }
.timer-display.ready { color: var(--green); }
.timer-display.running { color: var(--text); }
.timer-hint { text-align: center; color: var(--muted); }
.timer-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 19px; font-family: ui-monospace, monospace; }
.stat span { color: var(--muted); font-size: 11.5px; }
.solve-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.solve-table th, .solve-table td { padding: 8px 6px; border-bottom: 1px solid var(--border-soft); text-align: left; }
.solve-table th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.solve-table td.mono { font-family: ui-monospace, monospace; }
.solve-table tr.current td { color: var(--green); }

/* Simulator */
.play-grid { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(360px,.7fr); gap: 20px; align-items: start; }
.play-stage { min-height: 580px; }
.move-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.move-pad .btn { padding: 8px 4px; min-height: 38px; font-family: ui-monospace, monospace; }
.history { display: flex; flex-wrap: wrap; gap: 5px; min-height: 30px; }
.history span { padding: 3px 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--border-soft); font-family: ui-monospace, monospace; font-size: 12px; }

/* Learn */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 10px 14px; font-weight: 650; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--text); }
.alg-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.alg-card code { display: block; font-family: ui-monospace, monospace; font-size: 13px; color: var(--text); background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 9px; padding: 9px 10px; margin-top: 8px; overflow-wrap: anywhere; }
.alg-card h4 { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
details.faq { border-bottom: 1px solid var(--border); padding: 12px 0; }
details.faq summary { cursor: pointer; font-weight: 650; }
details.faq p { color: var(--muted); }

/* Footer */
.footer { border-top: 1px solid var(--border); margin-top: 40px; background: var(--bg-soft); }
.footer-inner { max-width: 1480px; margin: 0 auto; padding: 46px 18px 30px; display: grid; grid-template-columns: 1.2fr .7fr .7fr .7fr; gap: 28px; }
.footer h4 { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 10px; }
.footer a { display: block; color: var(--muted); padding: 4px 0; font-size: 13px; }
.footer a:hover { color: var(--text); }
.footer-brand p { color: var(--muted); font-size: 13px; max-width: 36ch; }
.footer-bottom { border-top: 1px solid var(--border); text-align: center; padding: 16px; color: var(--muted-2); font-size: 12px; }

/* Modal / toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(5px); z-index: 80; display: grid; place-items: center; padding: 18px; }
.modal { width: min(920px, 100%); max-height: 92vh; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel-3); border: 1px solid var(--border); border-radius: 11px; padding: 10px 14px; box-shadow: var(--shadow); font-size: 13px; animation: fade .2s; max-width: 360px; }

/* Utilities */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hidden { display: none !important; }
.wrap-anywhere { overflow-wrap: anywhere; }
.scroll-y { overflow-y: auto; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
.green { color: var(--green); } .red { color: var(--red); }
kbd { background: var(--panel-3); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; font-family: ui-monospace, monospace; font-size: 11px; }

/* Responsive */
@media (max-width: 1120px) {
  .solve-grid, .timer-grid, .play-grid, .solution-grid { grid-template-columns: 1fr; }
  .solve-aside { position: static; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 360px; }
  .footer-inner { grid-template-columns: 1.2fr 1fr 1fr; }
}
@media (max-width: 820px) {
  .topbar { border-radius: 18px; height: auto; min-height: 60px; flex-wrap: wrap; padding: 8px 10px; }
  .menu-btn { display: inline-flex; }
  .nav { display: none; width: 100%; order: 5; flex-direction: column; align-items: stretch; margin: 4px 0 2px; }
  .nav.open { display: flex; }
  .nav a { padding: 11px 12px; border-radius: 10px; }
  .top-actions { margin-left: 0; }
  .app { padding: 18px 12px 40px; }
  .net { gap: 6px; grid-template-areas: ". u ." "l f r" "b d ."; grid-template-columns: repeat(3, 1fr); }
  .face-title span { display: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .cam-layout { grid-template-columns: 1fr; }
  .timer-main { min-height: 430px; }
  .timer-stats { grid-template-columns: repeat(2,1fr); }
  .solve-table .hide-sm { display: none; }
  .step .desc { font-size: 11.5px; }
}

/* ---------------------------------------------------------------- */
/* Auth + account                                                   */
/* ---------------------------------------------------------------- */
.auth-slot { display: flex; align-items: center; gap: 6px; }
.auth-loading { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--text); animation: spin .8s linear infinite; display: inline-block; }
.auth-login-btn { min-height: 36px; padding: 6px 13px; }
.auth-signup-btn { min-height: 36px; padding: 6px 13px; }
.user-wrap { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); transition: .15s;
}
.user-chip:hover { background: var(--panel-3); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #26c281, #1f5fd6); color: #fff;
  font-weight: 800; font-size: 11px; letter-spacing: .02em;
}
.user-name { font-weight: 650; font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); font-size: 11px; }
.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 244px; z-index: 60;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 8px;
}
.user-pop[hidden] { display: none; }
.pop-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.pop-head span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.user-pop a, .user-pop button {
  display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px;
  border: 0; background: transparent; color: var(--text); font-size: 13px;
}
.user-pop a:hover, .user-pop button:hover { background: var(--panel-2); }
.user-pop button[data-logout] { color: var(--red); }

.modal.auth-dialog { width: min(470px, 100%); }
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 2px; }
.auth-tabs { display: flex; background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 20px; }
.auth-tabs button { flex: 1; padding: 9px; border: 0; background: transparent; border-radius: 9px; color: var(--muted); font-weight: 700; }
.auth-tabs button.active { background: var(--panel-3); color: var(--text); }
.auth-head h3 { font-size: 24px; margin-bottom: 6px; }
.auth-head p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.auth-field { display: block; margin-bottom: 14px; }
.auth-field > span:first-child { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.auth-field small { display: block; color: var(--muted-2); font-size: 11px; margin-top: 5px; }
.input-wrap { display: block; position: relative; }
.input-wrap .input { padding-right: 44px; }
.eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font-size: 16px; padding: 6px; }
.eye:hover { color: var(--text); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 14px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--green); }
.check.terms { font-size: 12px; margin: 2px 0 14px; }
.link-btn { border: 0; background: transparent; color: var(--muted); text-decoration: underline; font-size: 12.5px; padding: 0; }
.link-btn:hover { color: var(--text); }
.link-btn:disabled { opacity: .5; cursor: not-allowed; text-decoration: none; }
.auth-error { color: var(--red); font-size: 12.5px; min-height: 18px; margin: 6px 0; }
.auth-note { background: color-mix(in srgb, var(--green) 10%, transparent); border: 1px solid color-mix(in srgb, var(--green) 28%, var(--border)); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.auth-note.dev { background: rgba(255, 212, 0, .08); border-color: rgba(255, 212, 0, .25); }
.auth-note code { color: var(--yellow); font-weight: 800; letter-spacing: 2px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.auth-email-pill { display: inline-flex; gap: 8px; align-items: center; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; font-size: 12.5px; margin-bottom: 14px; }
.otp { text-align: center; font-size: 24px; letter-spacing: .45em; font-weight: 800; padding-left: .45em; }
.pw-strength { display: flex; align-items: center; gap: 10px; margin: -6px 0 14px; font-size: 11px; color: var(--muted); }
.pw-bar { flex: 1; height: 5px; background: var(--panel-3); border-radius: 99px; overflow: hidden; }
.pw-bar i { display: block; height: 100%; transition: width .2s; }
.turnstile { display: flex; justify-content: center; margin: 10px 0; }
.auth-unavailable { padding: 10px 4px 4px; }

.account-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 20px; align-items: start; }
.account-profile { padding: clamp(20px, 3vw, 30px); }
.account-top { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.avatar-xl {
  width: 78px; height: 78px; border-radius: 22px; display: grid; place-items: center;
  background: linear-gradient(135deg, #26c281, #1f5fd6); color: #fff;
  font-weight: 900; font-size: 25px; letter-spacing: .02em;
}
.account-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.account-stats b { display: block; font-size: 22px; font-family: ui-monospace, monospace; }
.account-stats span { color: var(--muted); font-size: 11.5px; }
.account-guest { max-width: 650px; margin: 40px auto; text-align: center; padding: 42px 24px; }
.account-orb {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 24px; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--border); font-size: 32px;
}

@media (max-width: 1120px) {
  .account-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .auth-signup-btn { display: none; }
  .user-name { display: none; }
  .user-chip { padding: 4px; }
  .chev { display: none; }
  .account-stats { grid-template-columns: repeat(2, 1fr); }
  .modal.auth-dialog { padding: 16px; }
  .auth-head h3 { font-size: 21px; }
}

/* ---------------------------------------------------------------- */
/* Hero figure (RUBIKFISH.png) + engagement                         */
/* ---------------------------------------------------------------- */
.hero-figure { position: relative; display: grid; place-items: center; min-height: 420px; border-radius: var(--radius); overflow: hidden; background: radial-gradient(circle at 60% 35%, rgba(38,194,129,.12), transparent 60%), var(--panel); border: 1px solid var(--border); }
.hero-figure img { width: 100%; height: 100%; max-height: 460px; object-fit: contain; display: block; filter: drop-shadow(0 18px 40px rgba(0,0,0,.35)); }
.hero-figure-caption { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

.engagement-panel { padding: 20px 22px; }
.badge-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12px; color: var(--muted); transition: .15s; }
.badge.on { border-color: color-mix(in srgb, var(--green) 40%, var(--border)); color: var(--text); background: color-mix(in srgb, var(--green) 10%, var(--panel-2)); }
.badge-icon { font-size: 15px; line-height: 1; }
.badge-name { font-weight: 650; }
.badge-state { color: var(--muted-2); font-weight: 800; }
.badge.on .badge-state { color: var(--green); }

.daily-card { position: relative; overflow: hidden; }
.daily-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(320px,.75fr); gap: 20px; align-items: start; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ach { display: flex; gap: 12px; padding: 12px; border-radius: 13px; background: var(--panel-2); border: 1px solid var(--border); align-items: flex-start; }
.ach.on { border-color: color-mix(in srgb, var(--green) 38%, var(--border)); background: color-mix(in srgb, var(--green) 7%, var(--panel-2)); }
.ach-icon { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; background: var(--panel-3); border: 1px solid var(--border); filter: grayscale(1); opacity: .6; }
.ach.on .ach-icon { filter: none; opacity: 1; }
.ach-body { flex: 1; min-width: 0; }

.how-art { border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: var(--panel); min-height: 260px; display: grid; place-items: center; }
.how-art img { width: 100%; height: 100%; max-height: 340px; object-fit: contain; }

.about-head { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(280px,.8fr); gap: 26px; align-items: center; }
.about-art { border-radius: 20px; overflow: hidden; border: 1px solid var(--border); background: var(--panel-2); min-height: 220px; display: grid; place-items: center; }
.about-art img { width: 100%; height: 100%; max-height: 340px; object-fit: contain; }
.about-dl-note { padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel-2); }

/* ---------------------------------------------------------------- */
/* Download page                                                    */
/* ---------------------------------------------------------------- */
.dl-hero { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(280px,.85fr); gap: 26px; align-items: center; padding: clamp(20px,3vw,36px); }
.dl-hero-art { border-radius: 20px; overflow: hidden; border: 1px solid var(--border); background: radial-gradient(circle at 55% 40%, rgba(38,194,129,.12), transparent 62%), var(--panel-2); min-height: 220px; display: grid; place-items: center; }
.dl-hero-art img { width: 100%; height: 100%; max-height: 360px; object-fit: contain; }

.dl-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.dl-fact { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px; }
.dl-fact span { display: block; color: var(--muted); font-size: 11.5px; }
.dl-fact b { display: block; font-size: 15px; margin-top: 2px; }

.dl-recommend { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--green) 35%, var(--border)); background: color-mix(in srgb, var(--green) 8%, var(--panel-2)); }
.dl-recommend-name { font-size: 20px; font-weight: 800; margin: 2px 0 4px; }

.dl-tiers { display: grid; gap: 10px; margin-top: 14px; }
.dl-tier { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel-2); }
.dl-tier.recommended { border-color: color-mix(in srgb, var(--green) 40%, var(--border)); background: color-mix(in srgb, var(--green) 7%, var(--panel-2)); }
.dl-tier-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 3px; }
.dl-tier-head b { font-size: 15px; }
.dl-tier-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.dl-tier-side { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.dl-code { display: grid; gap: 6px; margin: 10px 0; }
.dl-code code { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 9px; padding: 9px 11px; overflow-wrap: anywhere; }

@media (max-width: 1120px) {
  .hero-figure { min-height: 340px; }
  .dl-hero, .about-head, .daily-grid { grid-template-columns: 1fr; }
  .about-art, .dl-hero-art { min-height: 200px; }
}
@media (max-width: 820px) {
  .dl-tier { grid-template-columns: 1fr; }
  .dl-tier-side { flex-direction: row; flex-wrap: wrap; }
  .dl-tier-side .btn { flex: 1 1 auto; }
  .engagement-panel .between { flex-direction: column; }
  .badge-name { font-size: 11.5px; }
}

/* ---- Vì sao tạo tài khoản (home) ---- */
.why-account { padding: 22px; border-radius: 18px; border: 1px solid var(--border); background: linear-gradient(160deg, color-mix(in srgb, var(--green) 7%, var(--panel)), var(--panel)); }
.why-grid { margin-top: 16px; }
.why-card { display: flex; gap: 13px; align-items: flex-start; padding: 15px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel-2); }
.why-card h3 { margin: 0; font-size: 15.5px; }
.why-icon { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; font-size: 19px; border-radius: 11px; background: color-mix(in srgb, var(--green) 12%, var(--bg-soft)); border: 1px solid color-mix(in srgb, var(--green) 26%, var(--border)); }
.why-foot { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border-soft); }

@media (max-width: 820px) {
  .why-card { padding: 13px; }
}
