/* Raze Play – brand palette taken from the logo:
   navy plate, indigo controller half, orange "R" half, teal + crimson accents. */
:root {
  --bg: #171a35;
  --bg-deep: #0e1028;
  --surface: #1f2349;
  --surface-2: #292e5e;
  --line: #3a4080;
  --text: #fff6ea;
  --muted: #aab0dc;

  --indigo: #4b46a8;
  --indigo-deep: #2a2766;
  --orange: #ff9a2e;
  --orange-deep: #f3591b;
  --orange-shadow: #a33410;
  --teal: #2fb3a8;
  --teal-deep: #1f7f86;
  --crimson: #d63a56;
  --ok: #3ddc97;
  --bad: #ff5d73;

  --radius: 20px;
  --grad: linear-gradient(180deg, #ffb347 0%, var(--orange) 40%, var(--orange-deep) 100%);
  --font: "Fredoka", ui-rounded, "Segoe UI Rounded", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(75, 70, 168, 0.45), transparent 70%),
    radial-gradient(700px 420px at -5% 8%, rgba(47, 179, 168, 0.16), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 500 17px/1.55 var(--font);
  overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.08; margin: 0; letter-spacing: 0.005em; font-weight: 700; }
body, button, input { font-synthesis: none; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 8px; background: #fff; color: #000; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px max(20px, calc((100vw - 1100px) / 2));
  background: rgba(23, 26, 53, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--indigo-deep);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.35rem; text-decoration: none; letter-spacing: 0.02em; }
.brand img { display: block; width: 42px; height: 42px; }
.brand span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav nav { display: flex; gap: 22px; }
.nav nav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 1rem; padding: 6px 2px; border-bottom: 3px solid transparent; }
.nav nav a:hover { color: var(--text); border-bottom-color: var(--orange); }

/* ---------- Layout ---------- */
.section, .hero, .footer { max-width: 1100px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.section { padding-top: 68px; padding-bottom: 8px; }
.section-head { margin-bottom: 26px; }
.section-head h2 { font-size: clamp(1.8rem, 4.4vw, 2.5rem); }
.section-head h2::after { content: ""; display: block; width: 64px; height: 6px; border-radius: 6px; margin-top: 10px; background: linear-gradient(90deg, var(--orange), var(--orange-deep) 60%, var(--crimson)); }
.section-head p { color: var(--muted); margin-top: 10px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center;
  padding-top: 56px; padding-bottom: 20px;
}
.eyebrow { display: inline-block; text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.78rem; font-weight: 700; color: var(--teal); background: rgba(47, 179, 168, 0.12); border: 2px solid rgba(47, 179, 168, 0.35); padding: 5px 12px; border-radius: 999px; margin-bottom: 18px; }
.hero h1 { font-size: clamp(2.5rem, 7vw, 4.4rem); }
.grad {
  display: inline-block;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 var(--orange-shadow));
}
.lead { color: var(--muted); font-size: 1.15rem; margin-top: 20px; max-width: 32em; }
.cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }

.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.5; z-index: -1; pointer-events: none; }
.b1 { width: 300px; height: 300px; background: var(--indigo); top: 20px; left: -90px; }
.b2 { width: 300px; height: 300px; background: var(--orange-deep); opacity: 0.28; right: -40px; top: 60px; }

.hero-art { position: relative; display: grid; place-items: center; min-height: 280px; }
.hero-logo { width: min(100%, 520px); height: auto; animation: float 6s ease-in-out infinite; filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.45)); }
.tile {
  position: absolute; display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--surface-2); border: 2px solid var(--line);
  font-size: 1.7rem; font-weight: 700;
  box-shadow: 0 5px 0 var(--bg-deep);
  animation: float 6s ease-in-out infinite;
}
.t1 { left: 2%;  top: 4%;  color: var(--orange); }
.t2 { right: 4%; top: 0;   color: var(--teal); animation-delay: -2s; }
.t3 { right: 0;  bottom: 6%; color: #ff7d92; animation-delay: -4s; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-12px) rotate(1.5deg); } }

/* ---------- Buttons: chunky, game-style ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 26px; border-radius: 16px; border: 0;
  font-weight: 700; font-size: 1.05rem; text-decoration: none; letter-spacing: 0.02em;
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}
.btn.primary {
  background: var(--grad); color: #fff;
  text-shadow: 0 2px 0 rgba(120, 30, 5, 0.55);
  box-shadow: 0 5px 0 var(--orange-shadow), 0 12px 24px rgba(243, 89, 27, 0.35);
}
.btn.primary:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 7px 0 var(--orange-shadow), 0 16px 28px rgba(243, 89, 27, 0.4); }
.btn.primary:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--orange-shadow); }
.btn.ghost { background: var(--indigo); color: #fff; box-shadow: 0 5px 0 var(--indigo-deep); }
.btn.ghost:hover { transform: translateY(-2px); filter: brightness(1.12); }
.btn.ghost:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--indigo-deep); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.link-btn { background: none; border: 0; color: var(--muted); padding: 10px; text-decoration: underline; }

/* ---------- App cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 22px; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), #1b1f42);
  border: 2px solid var(--line);
  box-shadow: 0 6px 0 var(--bg-deep);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.card.live { cursor: pointer; }
.card.live:hover { transform: translateY(-5px); border-color: var(--orange); box-shadow: 0 11px 0 var(--bg-deep), 0 20px 40px rgba(243, 89, 27, 0.18); }
.card.skeleton { min-height: 200px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
.card-top { display: flex; gap: 14px; align-items: center; }
.icon {
  flex: none; width: 66px; height: 66px; border-radius: 20px;
  display: grid; place-items: center; font-size: 2rem; font-weight: 700; color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2), 0 4px 0 rgba(0, 0, 0, 0.35);
}
.icon.has-img, .modal-icon.has-img { background: var(--surface-2); overflow: hidden; padding: 0; text-shadow: none; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35); }
.icon img, .modal-icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.icon.sm { width: 54px; height: 54px; border-radius: 16px; font-size: 1.5rem; }
.icon[hidden] { display: none; }
.title-row { display: flex; align-items: center; gap: 14px; }
.card h3 { font-size: 1.3rem; }
.genre { color: var(--muted); font-size: 0.9rem; }
.card p.desc { color: var(--muted); font-size: 1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.chip { font-size: 0.8rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip.on { background: rgba(47, 179, 168, 0.18); color: #6ee7d9; }
.badge { align-self: flex-start; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 4px 11px; border-radius: 999px; background: rgba(255, 154, 46, 0.16); color: var(--orange); border: 2px solid rgba(255, 154, 46, 0.4); }
.card .btn { margin-top: 4px; }

/* Store badges (Google Play / App Store) */
.badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.store-badge {
  display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px 0 12px;
  background: #000; color: #fff; text-decoration: none;
  border: 2px solid #a6a6a6; border-radius: 10px; transition: transform 0.12s, border-color 0.12s;
}
.store-badge:hover { transform: translateY(-2px); border-color: #fff; }
.store-badge svg { width: 26px; height: 26px; flex: none; }
.store-badge .bt { display: grid; line-height: 1.05; text-align: left; }
.store-badge small { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.store-badge b { font-size: 1.15rem; font-weight: 600; }
.store-badge.official { padding: 0; border: 0; background: none; border-radius: 0; height: 48px; }
.store-badge.official img { display: block; height: 48px; width: auto; }

/* ---------- Modals & toast ---------- */
.modal {
  border: 2px solid var(--line); border-radius: 26px; padding: 30px 28px 24px;
  background: linear-gradient(180deg, var(--surface), #1b1f42); color: var(--text);
  width: min(92vw, 410px); text-align: center;
  box-shadow: 0 8px 0 var(--bg-deep), 0 30px 60px rgba(0, 0, 0, 0.5);
}
.modal::backdrop { background: rgba(8, 9, 24, 0.75); backdrop-filter: blur(4px); }
.modal[open] { animation: pop 0.22s ease-out; }
@keyframes pop { from { transform: scale(0.93); opacity: 0; } }
.modal h3 { font-size: 1.55rem; margin: 14px 0 8px; }
.modal p { color: var(--muted); }
.modal .close { position: absolute; top: 10px; right: 14px; background: none; border: 0; font-size: 2rem; color: var(--muted); line-height: 1; }
.modal-icon { width: 76px; height: 76px; border-radius: 22px; margin: 0 auto; display: grid; place-items: center; font-size: 2.3rem; font-weight: 700; background: var(--grad); text-shadow: 0 2px 0 rgba(120, 30, 5, 0.5); box-shadow: 0 5px 0 var(--orange-shadow); }
.stores { display: grid; gap: 12px; margin: 22px 0 6px; }
.store-btn {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 14px 18px; border-radius: 16px; background: var(--surface-2); border: 2px solid var(--line);
  font-weight: 700; text-decoration: none; transition: border-color 0.15s, transform 0.15s;
}
.store-btn:hover { border-color: var(--orange); transform: translateY(-2px); }
.store-btn small { display: block; color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.store-btn svg { width: 30px; height: 30px; flex: none; }
.store-btn .rec { margin-left: auto; font-size: 0.72rem; color: #6ee7d9; background: rgba(47, 179, 168, 0.18); padding: 3px 9px; border-radius: 999px; }
.store-btn.off { opacity: 0.55; pointer-events: none; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--surface-2); border: 2px solid var(--line); padding: 12px 20px; border-radius: 14px; font-weight: 600;
  transition: all 0.25s; pointer-events: none; z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */
.footer {
  margin-top: 80px; padding-top: 28px; padding-bottom: 36px; border-top: 2px solid var(--indigo-deep);
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.95rem;
}
.footer .fbrand { display: flex; align-items: center; gap: 12px; }
.footer .fbrand img { width: 40px; height: 40px; }
.footer strong { color: var(--text); display: block; line-height: 1.2; }
.footer .ver { margin-left: 6px; padding: 1px 10px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.footer .ver:hover { border-color: var(--orange); color: var(--text); }
.changelog { text-align: left; margin-top: 14px; max-height: 50vh; overflow: auto; }
.changelog h4 { margin: 14px 0 4px; font-size: 1rem; color: var(--orange); }
.changelog ul { margin: 0; padding-left: 20px; color: var(--muted); }
.footer .links { display: flex; gap: 20px; }
.footer .links a { text-decoration: none; font-weight: 600; }
.footer .links a:hover { color: var(--orange); }

/* ---------- Sudoku ---------- */
.sudoku {
  display: grid; grid-template-columns: minmax(0, 480px) minmax(240px, 1fr); gap: 30px; align-items: start;
  padding: 22px; border-radius: 28px; background: rgba(14, 16, 40, 0.55); border: 2px solid var(--indigo-deep);
}
.board-wrap { position: relative; }
.board {
  display: grid; grid-template-columns: repeat(9, 1fr);
  aspect-ratio: 1; width: 100%;
  border: 4px solid #5a53c9; border-radius: 16px; overflow: hidden;
  background: #3a3f80; gap: 1px;
  box-shadow: 0 6px 0 var(--bg-deep);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.cell {
  position: relative; display: grid; place-items: center;
  background: var(--surface); border: 0; padding: 0; border-radius: 0;
  font-size: clamp(1.15rem, 4.8vw, 2rem); font-weight: 600; color: #ffb347;
  transition: background 0.1s;
}
.cell.given { color: #fff6ea; font-weight: 700; background: #232852; }
.cell.peer { background: #2b3068; }
.cell.given.peer { background: #2f3470; }
.cell.same { background: #3d3a94; }
.cell.sel { background: #5a53c9; }
.cell.err { color: #fff; background: rgba(214, 58, 86, 0.65); }
/* thick 3x3 box separators */
.cell:nth-child(3n):not(:nth-child(9n)) { box-shadow: 2px 0 0 #5a53c9; }
.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) { box-shadow: 0 2px 0 #5a53c9; }
.cell:nth-child(n+19):nth-child(-n+27):nth-child(3n):not(:nth-child(9n)),
.cell:nth-child(n+46):nth-child(-n+54):nth-child(3n):not(:nth-child(9n)) { box-shadow: 2px 0 0 #5a53c9, 0 2px 0 #5a53c9; }
.notes { position: absolute; inset: 2px; display: grid; grid-template-columns: repeat(3, 1fr); font-size: clamp(0.5rem, 1.8vw, 0.74rem); line-height: 1; color: var(--muted); font-weight: 600; }
.notes span { display: grid; place-items: center; }

.panel { display: grid; gap: 16px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 80px; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 8px 14px; }
.stat small { display: block; color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.stat b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.seg { display: flex; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 4px; gap: 4px; }
.seg button { flex: 1; background: none; border: 0; padding: 9px 6px; border-radius: 12px; font-weight: 700; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--grad); color: #fff; text-shadow: 0 1px 0 rgba(120, 30, 5, 0.5); box-shadow: 0 3px 0 var(--orange-shadow); }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.btn.mini { padding: 9px 6px; font-size: 0.92rem; border-radius: 12px; box-shadow: 0 4px 0 var(--indigo-deep); }
.btn.mini:disabled { opacity: 0.45; cursor: default; transform: none; }
.board.hidden-board .cell { color: transparent; }
.board.hidden-board .notes { visibility: hidden; }
.pause {
  position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 20px;
  background: rgba(14, 16, 40, 0.94); backdrop-filter: blur(6px); border-radius: 16px; z-index: 2;
}
.pause.show { display: grid; animation: pop 0.2s ease-out; }
.pause h3 { font-size: 1.9rem; }
.pause p { color: var(--muted); margin: 6px 0 18px; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 10px 4px; font-size: 0.85rem; font-weight: 600; color: var(--muted); display: grid; gap: 2px; place-items: center; }
.tool b { font-size: 1.25rem; color: var(--text); }
.tool[aria-pressed="true"] { border-color: var(--orange); color: var(--orange); background: rgba(255, 154, 46, 0.12); }
.tool:hover { border-color: var(--teal); }
.pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.pad button {
  position: relative; background: var(--indigo); border: 0; border-radius: 12px;
  padding: 9px 0 15px; font-size: 1.45rem; font-weight: 700; color: #fff;
  box-shadow: 0 4px 0 var(--indigo-deep);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.1s;
}
.pad button:hover { filter: brightness(1.15); }
.pad button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--indigo-deep); }
.pad button small { position: absolute; bottom: 3px; left: 0; right: 0; font-size: 0.64rem; font-weight: 600; color: #cfd2f5; }
.pad button:disabled { opacity: 0.3; cursor: default; box-shadow: none; transform: none; }

.after-banner {
  display: none; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 16px; background: linear-gradient(135deg, rgba(75, 70, 168, 0.35), rgba(243, 89, 27, 0.22));
  border: 2px solid var(--orange);
}
.after-banner.show { display: flex; }
.after-banner span { font-weight: 600; }
.after-banner .btn { padding: 9px 18px; }

.result {
  position: absolute; inset: 0; display: none; place-items: center; text-align: center; padding: 20px;
  background: rgba(14, 16, 40, 0.9); backdrop-filter: blur(4px); border-radius: 16px;
}
.result.show { display: grid; animation: pop 0.25s ease-out; }
.result h3 { font-size: 2rem; }
.result p { color: var(--muted); margin: 8px 0 18px; }
.result .row { display: grid; gap: 12px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .hero-art { order: -1; min-height: 0; }
  .hero-logo { width: min(86%, 380px); }
  .sudoku { grid-template-columns: 1fr; padding: 14px; }
  .nav nav a:nth-child(3) { display: none; }
  .pad { gap: 4px; }
  .tile { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
