/* MindGrid v1.4 — vivid game look: design tokens, themes, components, boards, map, splash */
:root {
  --bg: #f1eeff; --bg2: #e6f4ff; --surface: #ffffff; --surface2: #efecfb; --text: #1d1940; --muted: #6b6790; --line: #e1dcf3;
  --ink: #241f4d; --accent: #6d4aff; --accent2: #9b5cff; --accent-ink: #ffffff; --good: #12b76a; --bad: #f04461; --gold: #ffb800;
  --c-blocks: #ff8a1f; --c-pipes: #0fbf94; --c-link: #ff4d6d; --c-crowns: #8b5cf6; --c-lights: #1fa2f2; --c-balance: #f5b400;
  --sun: #ff9f0a; --moon: #5b5bf0;
  --pipe-off: #cdc8e0; --glow-off: #e9e5f6;
  --r0: #ffb3c0; --r1: #ffe08a; --r2: #b5ecb0; --r3: #a9dcff; --r4: #d5c4ff; --r5: #ffc2e6; --r6: #9ff0df; --r7: #ffcf9e; --r8: #e2ef9a; --r9: #cfd3e6;
  --radius: 20px; --shadow: 0 10px 30px rgba(60, 40, 160, .12); --shadow-sm: 0 2px 6px rgba(60, 40, 160, .14);
  --blob1: rgba(155, 92, 255, .22); --blob2: rgba(31, 162, 242, .2); --blob3: rgba(255, 138, 31, .16);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #110d2b; --bg2: #0a1530; --surface: #1d1842; --surface2: #2a2457; --text: #f4f1ff; --muted: #a9a3d1; --line: #342d66;
    --ink: #ece8ff; --accent: #8f78ff; --accent2: #b06bff; --accent-ink: #fff; --good: #2fd68a; --bad: #ff6680; --gold: #ffc933;
    --c-blocks: #ff9f43; --c-pipes: #26e0b0; --c-link: #ff6b85; --c-crowns: #a78bfa; --c-lights: #3cb8ff; --c-balance: #ffcb2e;
    --sun: #ffb340; --moon: #8c8cff;
    --pipe-off: #463f7a; --glow-off: #2b255a;
    --r0: #7d3346; --r1: #7a6224; --r2: #2f6a3c; --r3: #245a80; --r4: #4f3c8c; --r5: #7d3466; --r6: #1f6b62; --r7: #7d4a22; --r8: #5d6a26; --r9: #474b66;
    --shadow: 0 10px 30px rgba(0, 0, 0, .45); --shadow-sm: 0 2px 6px rgba(0, 0, 0, .5);
    --blob1: rgba(143, 120, 255, .28); --blob2: rgba(38, 224, 176, .14); --blob3: rgba(255, 107, 133, .16);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #110d2b; --bg2: #0a1530; --surface: #1d1842; --surface2: #2a2457; --text: #f4f1ff; --muted: #a9a3d1; --line: #342d66;
  --ink: #ece8ff; --accent: #8f78ff; --accent2: #b06bff; --accent-ink: #fff; --good: #2fd68a; --bad: #ff6680; --gold: #ffc933;
  --c-blocks: #ff9f43; --c-pipes: #26e0b0; --c-link: #ff6b85; --c-crowns: #a78bfa; --c-lights: #3cb8ff; --c-balance: #ffcb2e;
  --sun: #ffb340; --moon: #8c8cff;
  --pipe-off: #463f7a; --glow-off: #2b255a;
  --r0: #7d3346; --r1: #7a6224; --r2: #2f6a3c; --r3: #245a80; --r4: #4f3c8c; --r5: #7d3466; --r6: #1f6b62; --r7: #7d4a22; --r8: #5d6a26; --r9: #474b66;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45); --shadow-sm: 0 2px 6px rgba(0, 0, 0, .5);
  --blob1: rgba(143, 120, 255, .28); --blob2: rgba(38, 224, 176, .14); --blob3: rgba(255, 107, 133, .16);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--bg); }
body {
  color: var(--text); min-height: 100vh; position: relative;
  background: linear-gradient(170deg, var(--bg) 0%, var(--bg2) 100%) fixed;
  font: 16px/1.45 Nunito, "Segoe UI", Roboto, system-ui, -apple-system, sans-serif; font-weight: 600;
  -webkit-tap-highlight-color: transparent; padding-bottom: calc(96px + env(safe-area-inset-bottom));
  animation: pageIn .28s ease; /* opacity only: a transform here would trap position:fixed children */
}
body::before { /* soft colour blobs behind everything */
  content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background: radial-gradient(30% 25% at 15% 10%, var(--blob1), transparent 70%),
    radial-gradient(30% 25% at 90% 30%, var(--blob2), transparent 70%),
    radial-gradient(35% 25% at 30% 95%, var(--blob3), transparent 70%);
}
body.focus { padding-bottom: 24px; }
/* Android app: native AdMob banner sits at the very bottom; lift the tab bar above it */
:root { --ad-h: 0px; }
.native-app body { padding-bottom: calc(96px + var(--ad-h) + env(safe-area-inset-bottom)); }
.native-app body.focus { padding-bottom: 24px; }
.native-app .tabbar { bottom: calc(var(--ad-h) + 8px); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.wrap { max-width: 560px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px 8px; }
.ico { width: 22px; height: 22px; flex: none; }
.ico .fd { fill: currentColor; fill-opacity: .22; stroke: none; }
.ico .fd2 { fill: #fff; fill-opacity: .55; stroke: none; }
.ico .fl { fill: currentColor; }
.muted { color: var(--muted); }
h1 { font-size: 30px; font-weight: 900; letter-spacing: -.02em; margin: 2px 0 4px; line-height: 1.12; }
h2 { font-size: 19px; font-weight: 900; margin: 26px 0 12px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
h2 .ico { width: 20px; height: 20px; color: var(--accent); }
.eyebrow { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 900; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 23px; letter-spacing: -.02em; }
.logo { width: 38px; height: 38px; display: block; filter: drop-shadow(0 4px 8px rgba(80, 50, 200, .3)); }
.chips { display: flex; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--line); font-weight: 900; font-size: 14px; white-space: nowrap; box-shadow: var(--shadow-sm);
}
.chip .ico { width: 18px; height: 18px; }
.chip.flame .ico { color: #ff7a1a; }
.chip.flame.cold .ico { color: var(--muted); }
.chip.iqchip { color: var(--accent); }
.chip.gold .ico { color: var(--gold); }
.iconbtn {
  width: 44px; height: 44px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 3px 0 var(--line);
}
.iconbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }

/* Segmented control */
.seg { display: flex; background: var(--surface2); border-radius: 15px; padding: 4px; gap: 4px; }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted); font-weight: 800; font-size: 14px;
  padding: 9px 6px; border-radius: 11px; cursor: pointer; transition: background .15s, color .15s;
}
.seg button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* Progress bar */
.progress { display: flex; align-items: center; gap: 12px; margin: 16px 2px 12px; font-size: 14px; color: var(--muted); font-weight: 800; }
.bar { flex: 1; height: 10px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), #7ee8a2); border-radius: 99px; transition: width .5s; }

/* Puzzle tiles (art) */
.pic {
  width: 54px; height: 54px; border-radius: 17px; display: grid; place-items: center; flex: none; color: #fff; position: relative;
  background: linear-gradient(150deg, color-mix(in srgb, var(--pc, var(--accent)) 70%, #fff) 0%, var(--pc, var(--accent)) 45%, color-mix(in srgb, var(--pc, var(--accent)) 75%, #000) 100%);
  box-shadow: 0 6px 14px -4px color-mix(in srgb, var(--pc, var(--accent)) 70%, transparent), inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -3px 0 rgba(0, 0, 0, .12);
}
.pic svg { width: 36px; height: 36px; overflow: visible; }
.pic .ico { width: 28px; height: 28px; }
.pic .ico .fd { fill: #fff; fill-opacity: .3; }

/* Cards */
.card {
  display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; transition: transform .12s, box-shadow .12s; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, color-mix(in srgb, var(--pc, var(--accent)) 10%, transparent), transparent 55%); pointer-events: none; }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
a.card:active { transform: scale(.985); }
.card .body { flex: 1; min-width: 0; position: relative; z-index: 1; }
.card .title { font-weight: 900; font-size: 17px; }
.card .sub { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.status { font-size: 13px; font-weight: 900; padding: 7px 13px; border-radius: 99px; background: var(--surface2); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; position: relative; z-index: 1; }
.status.done { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.status.prog { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.status.go { background: var(--pc); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--pc) 65%, #000); }
.status .ico { width: 15px; height: 15px; }

/* Buttons: chunky, glossy */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; width: 100%;
  background: linear-gradient(180deg, var(--accent2), var(--accent)); color: #fff; font-weight: 900; font-size: 17px; letter-spacing: .01em;
  padding: 14px 22px; border-radius: 16px; box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 60%, #000), 0 10px 22px -6px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: transform .08s, box-shadow .08s; position: relative; text-shadow: 0 1px 0 rgba(0, 0, 0, .15);
}
.btn::before { content: ""; position: absolute; left: 8px; right: 8px; top: 4px; height: 40%; border-radius: 12px; background: linear-gradient(rgba(255, 255, 255, .28), transparent); pointer-events: none; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1.5px solid var(--line); box-shadow: 0 4px 0 var(--line); text-shadow: none; }
.btn.ghost::before { display: none; }
.btn.danger { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); box-shadow: none; }
.btn.gold { background: linear-gradient(180deg, #ffd34d, #ffae00); color: #3b2500; box-shadow: 0 5px 0 #c07d00, 0 10px 22px -6px rgba(255, 170, 0, .6); text-shadow: none; }
.btn + .btn { margin-top: 10px; }
.btn .ico { width: 22px; height: 22px; }

/* Floating tab bar */
.tabbar {
  position: fixed; left: 10px; right: 10px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 20; display: flex; justify-content: space-around;
  max-width: 540px; margin: 0 auto; border-radius: 24px; padding: 6px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1.5px solid var(--line); box-shadow: 0 12px 30px rgba(40, 20, 120, .18);
}
.tab { flex: 1; max-width: 100px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; font-weight: 900; color: var(--muted); padding: 4px 0 3px; border-radius: 16px; }
.tab .tb { display: grid; place-items: center; width: 44px; height: 30px; border-radius: 12px; transition: background .2s, transform .2s; }
.tab .ico { width: 23px; height: 23px; }
.tab.active { color: var(--accent); }
.tab.active .tb { background: linear-gradient(180deg, var(--accent2), var(--accent)); color: #fff; transform: translateY(-2px); box-shadow: 0 6px 14px -4px var(--accent); }
.tab.active .tb .fd { fill: #fff; fill-opacity: .3; }

/* ---------- Home hub ---------- */
.iqhero {
  position: relative; display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 26px; color: #fff; overflow: hidden;
  background: linear-gradient(135deg, #6d4aff 0%, #b14bff 55%, #ff5c9a 100%); box-shadow: 0 16px 34px -10px rgba(109, 74, 255, .6);
}
.iqhero::before { content: ""; position: absolute; width: 220px; height: 220px; right: -60px; top: -90px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.iqhero::after { content: ""; position: absolute; width: 140px; height: 140px; right: 40px; bottom: -90px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.gauge { position: relative; width: 104px; height: 104px; flex: none; z-index: 1; }
.gauge svg { width: 100%; height: 100%; transform: rotate(135deg); }
.gauge circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.gauge .g-bg { stroke: rgba(255, 255, 255, .22); }
.gauge .g-fg { stroke: #fff; transition: stroke-dasharray 1s ease; filter: drop-shadow(0 0 6px rgba(255, 255, 255, .7)); }
.gauge .g-num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1; }
.gauge .g-num b { font-size: 34px; font-weight: 900; display: block; }
.gauge .g-num small { display: block; font-size: 9px; font-weight: 900; letter-spacing: .06em; opacity: .85; margin-top: 2px; }
.iqhero .info { position: relative; z-index: 1; min-width: 0; }
.iqhero .rank { font-size: 22px; font-weight: 900; line-height: 1.1; }
.iqhero .info p { margin: 4px 0 8px; font-size: 13.5px; opacity: .9; font-weight: 700; }
.iqhero .pill { display: inline-flex; align-items: center; gap: 5px; background: rgba(255, 255, 255, .2); padding: 5px 11px; border-radius: 99px; font-size: 13px; font-weight: 900; }
.iqhero .pill .ico { width: 16px; height: 16px; }
.bigplay {
  display: flex; align-items: center; gap: 14px; margin: 14px 0 0; padding: 16px; border-radius: 24px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--pc) 80%, #fff), var(--pc) 50%, color-mix(in srgb, var(--pc) 70%, #000));
  box-shadow: 0 6px 0 color-mix(in srgb, var(--pc) 55%, #000), 0 16px 30px -10px var(--pc); transition: transform .08s, box-shadow .08s;
}
.bigplay:active { transform: translateY(5px); box-shadow: 0 1px 0 color-mix(in srgb, var(--pc) 55%, #000); }
.bigplay .pic { background: rgba(255, 255, 255, .22); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3); width: 60px; height: 60px; }
.bigplay .body { flex: 1; min-width: 0; }
.bigplay .t1 { font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.bigplay .t2 { font-size: 22px; font-weight: 900; line-height: 1.1; }
.bigplay .t3 { font-size: 13.5px; font-weight: 800; opacity: .9; }
.bigplay .go { width: 50px; height: 50px; border-radius: 50%; background: #fff; color: var(--pc); display: grid; place-items: center; flex: none; animation: nudgeR 1.6s ease-in-out infinite; }
.bigplay .go .ico { width: 26px; height: 26px; }
.dailycard .minis { display: flex; gap: 5px; margin-top: 6px; }
.dailycard .minis i { width: 22px; height: 22px; border-radius: 7px; background: var(--surface2); display: grid; place-items: center; color: #fff; }
.dailycard .minis i.on { background: var(--pc); }
.dailycard .minis .ico { width: 14px; height: 14px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 22px; overflow: hidden;
  background: var(--surface); border: 1.5px solid var(--line); box-shadow: 0 4px 0 color-mix(in srgb, var(--pc) 35%, var(--line)), var(--shadow-sm);
  transition: transform .1s;
}
.mode::before { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: color-mix(in srgb, var(--pc) 16%, transparent); }
.mode:active { transform: translateY(3px); }
.mode .pic { width: 58px; height: 58px; }
.mode b { font-size: 17px; font-weight: 900; position: relative; }
.mode .lv { font-size: 13px; color: var(--muted); font-weight: 800; position: relative; display: flex; justify-content: space-between; }
.mode .lv em { font-style: normal; color: var(--pc); }
.mode .mbar { height: 7px; border-radius: 99px; background: var(--surface2); overflow: hidden; position: relative; }
.mode .mbar i { display: block; height: 100%; border-radius: 99px; background: var(--pc); }
.mode.mixmode { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; color: #fff; border: 0;
  background: linear-gradient(120deg, #1a1446, #3b1f8f 50%, #8a2be2); box-shadow: 0 5px 0 #120c35, 0 14px 28px -10px rgba(110, 50, 230, .7); }
.mode.mixmode::before { background: rgba(255, 255, 255, .08); width: 160px; height: 160px; }
.mode.mixmode .pic { background: rgba(255, 255, 255, .1); width: 64px; height: 64px; }
.mode.mixmode .lv { color: rgba(255, 255, 255, .8); }
.mode.mixmode .mtxt { flex: 1; min-width: 0; position: relative; }
.mode.mixmode .tag { position: absolute; top: 10px; right: 12px; background: #ff5c7a; color: #fff; font-size: 11px; font-weight: 900; padding: 3px 9px; border-radius: 99px; letter-spacing: .06em; }

/* ---------- Play screen ---------- */
body.page-play { background: radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--pc) 22%, var(--bg)) 0%, var(--bg) 60%, var(--bg2) 100%) fixed; }
.playbar { display: grid; grid-template-columns: 44px 1fr 76px; align-items: center; gap: 10px; margin-bottom: 8px; }
.playbar .mid { text-align: center; min-width: 0; }
.playbar .name { font-weight: 900; font-size: 21px; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; }
.playbar .name .pic { width: 30px; height: 30px; border-radius: 9px; }
.playbar .name .pic svg { width: 21px; height: 21px; }
.playbar .meta { font-size: 13px; color: var(--muted); font-weight: 800; }
.timer { justify-self: end; font-variant-numeric: tabular-nums; font-weight: 900; font-size: 16px; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1.5px solid var(--line); padding: 6px 10px; border-radius: 12px; }
.timer .ico { width: 16px; height: 16px; color: var(--pc); }
.timer.hidden { visibility: hidden; }
.timer.overpar { color: var(--muted); }
.parline { display: flex; justify-content: center; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; color: var(--muted); margin: 0 0 6px; min-height: 20px; }
.parline .stars .ico { width: 16px; height: 16px; }
.banner { text-align: center; font-size: 13.5px; color: var(--good); font-weight: 800; margin: 0 0 4px; min-height: 18px; }
.stage { display: flex; flex-direction: column; align-items: center; margin: 4px 0 16px; }
.board {
  position: relative; width: min(100%, 480px, max(280px, calc(100vh - 320px))); aspect-ratio: 1 / 1;
  touch-action: none; user-select: none; -webkit-user-select: none; container-type: inline-size;
  filter: drop-shadow(0 14px 26px color-mix(in srgb, var(--pc) 30%, transparent));
}
.board.solved { pointer-events: none; animation: solvedPulse .8s ease; }
.board.solved::before { /* shine sweep */
  content: ""; position: absolute; inset: 0; z-index: 6; border-radius: 16px; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 48%, transparent 66%) no-repeat;
  background-size: 250% 100%; animation: shine 1s .15s ease both;
}
.board.nudge { animation: nudge .3s; }
.grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); }
.tools { display: flex; gap: 12px; justify-content: center; }
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 86px; padding: 10px 12px; border-radius: 18px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 900; cursor: pointer; position: relative;
  box-shadow: 0 4px 0 var(--line); transition: transform .08s, box-shadow .08s;
}
.tool .ico { width: 24px; height: 24px; color: var(--pc); }
.tool:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.tool:disabled { opacity: .45; cursor: default; }
.tool.hint { background: linear-gradient(180deg, #ffd34d, #ffb300); border-color: transparent; color: #3b2500; box-shadow: 0 4px 0 #c07d00; }
.tool.hint .ico { color: #3b2500; }
.tool .count { position: absolute; top: -7px; right: -5px; font-size: 11px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--bad); color: #fff; display: grid; place-items: center; padding: 0 5px; }
.tool .count:empty { display: none; }
details.rules { margin: 18px 0 0; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
details.rules summary { cursor: pointer; padding: 14px 0; font-weight: 900; list-style: none; display: flex; align-items: center; gap: 8px; }
details.rules summary .ico { color: var(--pc); }
details.rules summary::-webkit-details-marker { display: none; }
details.rules ol { margin: 0 0 8px; padding-left: 20px; }
details.rules li { margin: 4px 0; }
details.rules p { margin: 6px 0 14px; color: var(--muted); font-size: 14px; }

/* Board outline drawn on top so cell backgrounds never hide it */
.blocks-board::after, .pipes-board::after, .link-board::after, .balance-board::after {
  content: ""; position: absolute; inset: 0; border-radius: 16px; pointer-events: none; z-index: 4;
  box-shadow: inset 0 0 0 2.5px color-mix(in srgb, var(--pc) 70%, var(--ink));
}

/* Blocks */
.blocks-board { border-radius: 16px; background: var(--surface); overflow: hidden; }
.blocks-board .grid { z-index: 2; pointer-events: none; }
.blocks-board .cell { border-right: 1px dashed var(--line); border-bottom: 1px dashed var(--line); display: grid; place-items: center; }
.blocks-board .cell b { font-size: calc(100cqw / var(--n) * .44); font-weight: 900; }
.blocks-board .layer { position: absolute; inset: 0; z-index: 1; }
.rect {
  position: absolute; border-radius: 11px; border: 2.5px solid var(--muted);
  background: color-mix(in srgb, var(--muted) 12%, transparent); transition: background .15s, border-color .15s; animation: pop .2s;
}
.rect.ok { border-color: var(--rc); background: linear-gradient(150deg, color-mix(in srgb, var(--rc) 55%, transparent), color-mix(in srgb, var(--rc) 30%, transparent)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35); }
.rect.ghost {
  display: none; z-index: 3; border: 2.5px dashed var(--c-blocks); background: color-mix(in srgb, var(--c-blocks) 16%, transparent); animation: none;
  align-items: flex-start; justify-content: flex-end; padding: 2px 7px; font-weight: 900; font-size: 13px; color: var(--c-blocks); pointer-events: none;
}

/* Pipes */
.pipes-board { border-radius: 16px; overflow: hidden; background: var(--surface); }
.pipes-board .cell { border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer; box-shadow: inset 0 0 0 .5px var(--line); }
.pipes-board .rotor { width: 100%; height: 100%; transition: transform .18s cubic-bezier(.3, 1.4, .6, 1); }
.pipe { width: 100%; height: 100%; display: block; overflow: visible; }
.pipe line { stroke: var(--pipe-off); stroke-width: 18; stroke-linecap: round; transition: stroke .2s; }
.pipe circle { fill: var(--pipe-off); transition: fill .2s; }
.pipe circle.end { fill: var(--surface); stroke: var(--pipe-off); stroke-width: 7; }
.pipe circle.src { fill: var(--c-pipes); }
.pipe circle.src-dot { fill: var(--surface); }
.pipes-board .cell.on .pipe { filter: drop-shadow(0 0 4px color-mix(in srgb, var(--c-pipes) 70%, transparent)); }
.pipes-board .cell.on line { stroke: var(--c-pipes); }
.pipes-board .cell.on circle { fill: var(--c-pipes); }
.pipes-board .cell.on circle.end { fill: var(--surface); stroke: var(--c-pipes); }
.pipes-board .cell.on circle.src-dot { fill: var(--surface); }
.pipes-board .cell.hinted { background: color-mix(in srgb, var(--c-pipes) 14%, transparent); }

/* Link */
.link-board { border-radius: 16px; overflow: hidden; background: var(--surface); }
.link-board .bg .cell { box-shadow: inset 0 0 0 .5px var(--line); transition: background .12s; }
.link-board .bg .cell.on { background: color-mix(in srgb, var(--c-link) 18%, var(--surface)); }
.link-board .trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 0 3px color-mix(in srgb, var(--c-link) 60%, transparent)); }
.link-board .trail polyline { fill: none; stroke: var(--c-link); stroke-width: .34; stroke-linecap: round; stroke-linejoin: round; }
.link-board .trail circle { fill: var(--c-link); }
.link-board .top { pointer-events: none; }
.link-board .slot { display: grid; place-items: center; }
.link-board .num {
  width: 64%; aspect-ratio: 1; border-radius: 50%; color: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, .25), inset 0 1.5px 0 rgba(255, 255, 255, .3);
  background: linear-gradient(160deg, color-mix(in srgb, var(--ink) 75%, var(--c-link)), var(--ink));
  display: grid; place-items: center; font-weight: 900; font-size: calc(100cqw / var(--n) * .3);
}
[data-theme="dark"] .link-board .num { color: #1d1842; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .link-board .num { color: #1d1842; } }

/* Crowns */
.crowns-board { border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 60%, var(--ink)); }
.crowns-board .cell { display: grid; place-items: center; cursor: pointer; position: relative; outline: .5px solid color-mix(in srgb, var(--ink) 18%, transparent); outline-offset: -.5px; }
.crowns-board .crown { width: 64%; height: 64%; color: var(--ink); filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .18)); }
.crowns-board .cell.bad .crown { color: var(--bad); }
.crowns-board .cell.bad::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, transparent 0 6px, color-mix(in srgb, var(--bad) 22%, transparent) 6px 9px); pointer-events: none; }
.crowns-board .x { font-size: calc(100cqw / var(--n) * .42); color: color-mix(in srgb, var(--ink) 55%, transparent); font-weight: 600; line-height: 1; }
.crowns-board .cell.pop .crown { animation: pop .35s; }

/* Glow */
.lights-board .grid { gap: 7px; }
.lights-board .cell {
  border: 0; border-radius: 16px; background: var(--glow-off); cursor: pointer; transition: background .18s, box-shadow .18s, transform .1s;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08);
}
.lights-board .cell:active { transform: scale(.94); }
.lights-board .cell.on {
  background: radial-gradient(circle at 35% 30%, #fff 0%, color-mix(in srgb, var(--c-lights) 55%, #fff) 25%, var(--c-lights) 70%);
  box-shadow: 0 0 24px color-mix(in srgb, var(--c-lights) 70%, transparent), inset 0 0 0 3px color-mix(in srgb, #fff 30%, transparent);
}
.lights-board .cell.hint { outline: 3px solid var(--gold); outline-offset: 2px; animation: hintPulse 1s infinite; }
.moves { display: flex; gap: 22px; justify-content: center; margin-top: 12px; font-size: 14px; color: var(--muted); font-weight: 800; }
.moves b { color: var(--text); }

/* Balance */
.balance-board { border-radius: 16px; overflow: hidden; background: var(--surface); }
.balance-board .cell {
  border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer; display: grid; place-items: center;
  box-shadow: inset 0 0 0 .5px var(--line); position: relative;
}
.balance-board .cell.mid-c { box-shadow: inset 0 0 0 .5px var(--line), inset -1.5px 0 0 color-mix(in srgb, var(--ink) 30%, transparent); }
.balance-board .cell.mid-r { box-shadow: inset 0 0 0 .5px var(--line), inset 0 -1.5px 0 color-mix(in srgb, var(--ink) 30%, transparent); }
.balance-board .cell.mid-c.mid-r { box-shadow: inset 0 0 0 .5px var(--line), inset -1.5px 0 0 color-mix(in srgb, var(--ink) 30%, transparent), inset 0 -1.5px 0 color-mix(in srgb, var(--ink) 30%, transparent); }
.balance-board .cell.given { background: var(--surface2); cursor: default; }
.balance-board .cell.hinted { background: color-mix(in srgb, var(--c-balance) 18%, transparent); }
.balance-board .sym { width: 70%; height: 70%; animation: pop .2s; filter: drop-shadow(0 1.5px 0 rgba(0, 0, 0, .15)); }
.balance-board .sun circle { fill: var(--sun); }
.balance-board .sun path { stroke: var(--sun); stroke-width: 2; stroke-linecap: round; }
.balance-board .moon path { fill: var(--moon); }
.balance-board .cell.given .sym { animation: none; filter: saturate(1.15); }
.balance-board .cell.bad::after { content: ""; position: absolute; inset: 3px; border-radius: 6px; border: 2px solid var(--bad); pointer-events: none; }

/* Share + toast */
.sharebtn { cursor: pointer; padding: 5px 11px; font-size: 13px; color: var(--text); }
.toast {
  position: fixed; left: 50%; bottom: calc(110px + var(--ad-h) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 900; font-size: 14px;
  box-shadow: var(--shadow); animation: fade .2s; white-space: nowrap;
}
.toast.out { opacity: 0; transition: opacity .25s; }
.sharebox {
  width: 100%; margin: 12px 0 16px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); resize: none;
  background: var(--surface2); color: var(--text); font: 14px/1.5 ui-monospace, Consolas, monospace;
}

/* Modal */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(15, 8, 45, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .18s; }
.modal-back.out { opacity: 0; transition: opacity .15s; }
.modal { background: var(--surface); border-radius: 28px; padding: 26px 22px 20px; width: 100%; max-width: 390px; box-shadow: 0 30px 60px rgba(0, 0, 0, .35); animation: popIn .35s cubic-bezier(.3, 1.4, .6, 1); text-align: center; position: relative; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal h3 { font-size: 28px; font-weight: 900; margin: 6px 0 2px; letter-spacing: -.02em; }
.modal .pic { margin: 0 auto 8px; width: 70px; height: 70px; border-radius: 22px; }
.modal .pic svg { width: 46px; height: 46px; }
.modal ol { text-align: left; padding-left: 20px; margin: 14px 0; }
.modal ol li { margin: 6px 0; }
.modal .ctl { text-align: left; color: var(--muted); font-size: 14px; background: var(--surface2); border-radius: 14px; padding: 10px 12px; margin: 0 0 16px; }
.statrow { display: flex; gap: 8px; margin: 16px 0; }
.statrow > div { flex: 1; background: var(--surface2); border-radius: 16px; padding: 10px 4px; }
.statrow b { display: block; font-size: 21px; font-weight: 900; font-variant-numeric: tabular-nums; }
.statrow span { font-size: 11px; color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.newbest { display: inline-block; background: color-mix(in srgb, var(--gold) 22%, transparent); color: color-mix(in srgb, var(--gold) 70%, var(--text)); font-weight: 900; font-size: 12px; padding: 4px 10px; border-radius: 99px; letter-spacing: .06em; text-transform: uppercase; }

/* Win screen */
.win { padding-top: 0; overflow: visible; }
.win .ribbon {
  margin: -18px -8px 6px; padding: 12px 10px 14px; border-radius: 20px; color: #fff; font-size: 26px; font-weight: 900; letter-spacing: -.01em;
  background: linear-gradient(135deg, color-mix(in srgb, var(--pc) 75%, #fff), var(--pc) 55%, color-mix(in srgb, var(--pc) 70%, #000));
  box-shadow: 0 6px 0 color-mix(in srgb, var(--pc) 55%, #000); transform: translateY(-14px); animation: dropIn .5s cubic-bezier(.3, 1.5, .6, 1) both;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .18);
}
.win .ribbon small { display: block; font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.bigstars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin: 2px 0 6px; height: 74px; }
.bigstars i { width: 56px; height: 56px; color: color-mix(in srgb, var(--muted) 25%, transparent); display: grid; place-items: center; }
.bigstars i:nth-child(2) { width: 72px; height: 72px; }
.bigstars i .ico { width: 100%; height: 100%; }
.bigstars i .ico .fl { stroke: none; }
.bigstars i.on { color: var(--gold); filter: drop-shadow(0 4px 0 color-mix(in srgb, var(--gold) 55%, #000)) drop-shadow(0 0 12px color-mix(in srgb, var(--gold) 60%, transparent)); animation: starIn .5s cubic-bezier(.3, 1.6, .6, 1) both; }
.win .speed { font-weight: 900; color: var(--muted); font-size: 14px; margin-bottom: 4px; display: inline-flex; gap: 6px; align-items: center; }
.win .speed .ico { width: 18px; height: 18px; color: var(--gold); }
.iqbox { display: flex; align-items: center; gap: 12px; margin: 12px 0 14px; padding: 12px 14px; border-radius: 18px; text-align: left; color: #fff; background: linear-gradient(135deg, #6d4aff, #b14bff); box-shadow: 0 10px 22px -10px rgba(109, 74, 255, .8); }
.iqbox .ico { width: 34px; height: 34px; flex: none; }
.iqbox .ico .fd { fill: #fff; fill-opacity: .3; }
.iqbox div { flex: 1; min-width: 0; }
.iqbox small { display: block; font-size: 11.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.iqbox b { font-size: 26px; font-weight: 900; line-height: 1.1; }
.iqbox .delta { font-size: 15px; font-weight: 900; padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, .22); white-space: nowrap; }
.iqbox .rk { display: block; font-size: 13px; font-weight: 800; opacity: .9; }
.levelup { display: inline-flex; align-items: center; gap: 6px; background: var(--gold); color: #3b2500; font-weight: 900; font-size: 13px; padding: 5px 12px; border-radius: 99px; margin-bottom: 8px; animation: popIn .5s .9s both; }
.flowtag { font-size: 13px; font-weight: 900; color: #ff7a1a; margin: -4px 0 8px; }

/* Stars (small) */
.stars { display: inline-flex; gap: 1px; }
.stars .st { width: 14px; height: 14px; color: color-mix(in srgb, var(--muted) 35%, transparent); display: inline-grid; }
.stars .st.on { color: var(--gold); }
.stars .ico { width: 100%; height: 100%; }
.stars .ico .fl { stroke: none; }

/* Confetti */
.confetti { position: fixed; left: 50%; top: 32%; width: 0; height: 0; pointer-events: none; z-index: 60; }
.confetti i { position: absolute; width: 9px; height: 13px; border-radius: 2px; animation: burst 1.6s cubic-bezier(.15, .7, .35, 1) forwards; }
.confetti i.c1 { border-radius: 50%; width: 10px; height: 10px; }
.confetti i.c2 { width: 5px; height: 16px; }

/* ---------- Journey map ---------- */
.jhead { position: sticky; top: 0; z-index: 15; margin: 0 -16px; padding: max(12px, env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.jhead .topbar { margin: 0; }
.world-map { position: relative; margin: 6px -16px 0; overflow: hidden; }
.world { position: absolute; left: 0; right: 0; overflow: hidden; }
.world .deco { position: absolute; font-size: 30px; opacity: .55; pointer-events: none; filter: saturate(1.2); animation: floaty 6s ease-in-out infinite; }
.world-banner {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 3; text-align: center; color: #fff; white-space: nowrap;
  padding: 8px 22px 9px; border-radius: 16px; font-weight: 900; box-shadow: 0 5px 0 rgba(0, 0, 0, .25), 0 12px 24px -8px rgba(0, 0, 0, .4);
}
.world-banner small { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.world-banner b { font-size: 18px; }
.world-banner .ws { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; margin-left: 6px; background: rgba(0, 0, 0, .2); padding: 2px 8px; border-radius: 99px; vertical-align: 2px; }
.world-banner .ws .ico { width: 13px; height: 13px; color: #ffd43b; }
.world-banner .ws .ico .fl { stroke: none; }
.world-map svg.road { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.road .r-edge { fill: none; stroke: rgba(0, 0, 0, .14); stroke-width: 34; stroke-linecap: round; }
.road .r-base { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 26; stroke-linecap: round; }
.road .r-done { fill: none; stroke: #ffd43b; stroke-width: 26; stroke-linecap: round; }
.road .r-dash { fill: none; stroke: rgba(0, 0, 0, .12); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 12; }
.lvl {
  position: absolute; z-index: 2; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 20px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .2);
  background: linear-gradient(160deg, color-mix(in srgb, var(--pc) 70%, #fff), var(--pc) 55%, color-mix(in srgb, var(--pc) 75%, #000));
  box-shadow: 0 5px 0 color-mix(in srgb, var(--pc) 55%, #000), 0 8px 16px -4px rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .4);
  border: 3px solid #fff;
}
.lvl:active { transform: translateY(3px); }
.lvl .stars { position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, .35); padding: 2px 5px; border-radius: 99px; }
.lvl .stars .st { width: 13px; height: 13px; color: rgba(255, 255, 255, .35); }
.lvl .stars .st.on { color: #ffd43b; }
.lvl .mini { position: absolute; right: -8px; top: -8px; width: 26px; height: 26px; border-radius: 9px; border: 2px solid #fff; }
.lvl .mini svg { width: 18px; height: 18px; }
.lvl.locked { background: linear-gradient(160deg, #e9e6f5, #c9c4de); color: #8e88ad; box-shadow: 0 5px 0 #a9a3c4; text-shadow: none; border-color: rgba(255, 255, 255, .8); }
.lvl.locked .ico { width: 22px; height: 22px; }
.lvl.current { width: 80px; height: 80px; margin: -40px 0 0 -40px; font-size: 26px; animation: bounce 1.4s ease-in-out infinite; }
.lvl.current::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; border: 4px solid #fff; opacity: .7; animation: ring 1.6s ease-out infinite; }
.lvl.boss { border-radius: 24px; }
.you { position: absolute; z-index: 4; transform: translate(-50%, -100%); margin-top: -50px; display: flex; flex-direction: column; align-items: center; pointer-events: none; animation: youBounce 1.4s ease-in-out infinite; }
@keyframes youBounce { 50% { transform: translate(-50%, calc(-100% - 6px)); } }
.you .logo { width: 40px; height: 40px; border: 3px solid #fff; border-radius: 14px; }
.you span { margin-top: -4px; background: #fff; color: #3b2b8f; font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 99px; box-shadow: var(--shadow-sm); }
.jplay { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + var(--ad-h) + env(safe-area-inset-bottom)); z-index: 18; width: min(330px, calc(100% - 40px)); }

/* ---------- Archive ---------- */
.calhead { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 12px; }
.calhead strong { font-size: 19px; font-weight: 900; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 900; padding-bottom: 2px; }
.day {
  aspect-ratio: 1; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-weight: 900; font-size: 15px; gap: 3px; box-shadow: 0 3px 0 var(--line);
}
a.day:active { transform: translateY(2px); box-shadow: none; }
.day.dis { opacity: .35; box-shadow: none; }
.day.blank { visibility: hidden; }
.day.today { border: 2px solid var(--accent); }
.day.full { background: linear-gradient(160deg, var(--accent2), var(--accent)); color: #fff; border-color: transparent; box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.dots { display: flex; gap: 2px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--pc); }
.day.full .dots i.on { background: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 16px; font-size: 13px; color: var(--muted); font-weight: 800; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--pc); }

/* ---------- Stats / IQ ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); }
.tile b { display: block; font-size: 30px; font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 13px; font-weight: 800; }
.skills { display: grid; gap: 10px; }
.skill { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; padding: 10px 12px; }
.skill .pic { width: 42px; height: 42px; border-radius: 13px; }
.skill .pic svg { width: 28px; height: 28px; }
.skill .sk { flex: 1; min-width: 0; }
.skill .sk div { display: flex; justify-content: space-between; font-weight: 900; font-size: 14.5px; }
.skill .sk div span { color: var(--muted); font-size: 12.5px; }
.skill .sbar { height: 8px; border-radius: 99px; background: var(--surface2); margin-top: 6px; overflow: hidden; }
.skill .sbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, color-mix(in srgb, var(--pc) 60%, #fff), var(--pc)); }
.ranks { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.ranks div { flex: none; padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); font-size: 12.5px; font-weight: 900; color: var(--muted); text-align: center; }
.ranks div b { display: block; color: var(--text); font-size: 15px; }
.ranks div.on { background: linear-gradient(160deg, var(--accent2), var(--accent)); color: rgba(255, 255, 255, .85); border-color: transparent; }
.ranks div.on b { color: #fff; }
.trend { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px; }
.trend svg { width: 100%; height: 110px; display: block; }
.trend .tl { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.trend .ta { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.trend p { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); font-weight: 800; display: flex; justify-content: space-between; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.week div { font-size: 12px; color: var(--muted); font-weight: 900; }
.week i { display: grid; place-items: center; margin: 4px auto 0; width: 36px; height: 36px; border-radius: 50%; background: var(--surface2); color: var(--muted); font-style: normal; font-size: 13px; }
.week i.on { background: linear-gradient(160deg, #4be39a, var(--good)); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--good) 60%, #000); }
.week i .ico { width: 18px; height: 18px; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.table th, .table td { padding: 10px 6px; text-align: center; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table td:first-child, .table th:first-child { text-align: left; padding-left: 12px; font-weight: 900; }
.table tr:last-child td { border-bottom: 0; }
.table .dotname { display: inline-flex; align-items: center; gap: 8px; }
.table .dotname i { width: 10px; height: 10px; border-radius: 50%; background: var(--pc); }
.note { font-size: 12.5px; color: var(--muted); margin: 10px 2px 0; font-weight: 700; }

/* Settings */
.group { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .lbl { font-weight: 900; }
.row .lbl small { display: block; font-weight: 700; color: var(--muted); font-size: 13px; }
.row .seg { min-width: 220px; }
.switch { position: relative; width: 52px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface2); border: 1px solid var(--line); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 23px; height: 23px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + span { background: linear-gradient(90deg, #4be39a, var(--good)); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(21px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.about { color: var(--muted); font-size: 14px; margin-top: 18px; text-align: center; font-weight: 700; }
.about img { height: 40px; display: block; margin: 0 auto 8px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .3)); }

/* How to */
.howto .card { align-items: flex-start; }
.howto ol { margin: 6px 0 6px; padding-left: 20px; }
.howto li { margin: 3px 0; font-size: 14.5px; }
.howto .ctl { color: var(--muted); font-size: 13.5px; margin: 6px 0 0; }

/* ---------- Splash + ad break ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; color: #fff; overflow: hidden; cursor: pointer;
  background: radial-gradient(80% 60% at 50% 40%, #2b1d78 0%, #120c35 60%, #07051a 100%);
}
.splash.out { opacity: 0; transform: scale(1.04); transition: opacity .4s, transform .4s; }
.splash::before { content: ""; position: absolute; inset: 0; background: radial-gradient(2px 2px at 20% 30%, #fff8, transparent), radial-gradient(2px 2px at 70% 20%, #fff6, transparent), radial-gradient(1.5px 1.5px at 40% 80%, #fff7, transparent), radial-gradient(2px 2px at 85% 70%, #fff5, transparent), radial-gradient(1.5px 1.5px at 10% 85%, #fff6, transparent); }
.sp-studio, .sp-game { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.sp-studio img { width: min(230px, 60vw); animation: studioIn 1.2s cubic-bezier(.3, 1.4, .6, 1) both; }
.sp-studio span { margin-top: 10px; font-size: 13px; letter-spacing: .4em; text-transform: uppercase; opacity: 0; animation: fade .5s .5s forwards; font-weight: 800; }
.splash.step2 .sp-studio { opacity: 0; transform: scale(.9); transition: opacity .35s, transform .35s; }
.sp-game { opacity: 0; pointer-events: none; }
.splash.step2 .sp-game { opacity: 1; transition: opacity .3s .1s; }
.sp-game .logo { width: 108px; height: 108px; filter: drop-shadow(0 12px 30px rgba(140, 100, 255, .6)); }
.splash.step2 .sp-game .lt { animation: tileIn .5s cubic-bezier(.3, 1.6, .6, 1) both; transform-box: fill-box; transform-origin: center; }
.splash.step2 .lt.t2 { animation-delay: .08s; } .splash.step2 .lt.t3 { animation-delay: .16s; } .splash.step2 .lt.t4 { animation-delay: .24s; }
.sp-title { font-size: 46px; font-weight: 900; margin: 14px 0 4px; letter-spacing: -.02em; }
.sp-title span { display: inline-block; }
.splash.step2 .sp-title span { animation: dropIn .5s .3s cubic-bezier(.3, 1.5, .6, 1) both; }
.splash.step2 .sp-title span + span { animation-delay: .4s; background: linear-gradient(90deg, #ffb02e, #ff5c7a, #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sp-tag { margin: 0 0 22px; opacity: .85; font-weight: 800; }
.sp-load { width: 190px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .15); overflow: hidden; margin: 0 auto; }
.sp-load i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ffb02e, #ff5c7a, #a78bfa, #22d3a6); }
.splash.step2 .sp-load i { animation: load 1.5s .15s ease-in-out forwards; }
.sp-tip { margin: 14px 0 0; font-size: 13px; opacity: .7; font-weight: 700; }
.adbreak { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(10, 6, 35, .8); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .2s; padding: 20px; }
.ab-card { background: linear-gradient(160deg, #2b1d78, #120c35); color: #fff; border-radius: 26px; padding: 26px 24px 18px; text-align: center; max-width: 320px; box-shadow: 0 30px 60px rgba(0, 0, 0, .5); animation: popIn .35s cubic-bezier(.3, 1.4, .6, 1); }
.ab-card .logo { width: 64px; height: 64px; margin: 0 auto 10px; }
.ab-card b { display: block; font-size: 22px; font-weight: 900; }
.ab-card span { display: block; margin: 6px 0 16px; font-size: 14px; opacity: .85; font-weight: 700; }
.ab-card .sp-load i { animation: load 1.1s ease-in-out forwards; }
.ab-card small { display: block; margin-top: 12px; font-size: 11px; opacity: .6; letter-spacing: .08em; text-transform: uppercase; }

.mixintro { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(15, 8, 45, .55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); animation: fade .2s; }
.mixintro.out { opacity: 0; transition: opacity .3s; }
.mi-card { text-align: center; color: #fff; padding: 22px 34px; border-radius: 28px; animation: popIn .45s cubic-bezier(.3, 1.6, .6, 1);
  background: linear-gradient(150deg, color-mix(in srgb, var(--pc) 75%, #fff), var(--pc) 50%, color-mix(in srgb, var(--pc) 70%, #000)); box-shadow: 0 8px 0 color-mix(in srgb, var(--pc) 55%, #000), 0 30px 60px rgba(0, 0, 0, .4); }
.mi-card small { display: block; font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.mi-card .pic { width: 92px; height: 92px; margin: 12px auto; background: rgba(255, 255, 255, .2); animation: spinIn .6s cubic-bezier(.3, 1.5, .6, 1); }
.mi-card .pic svg { width: 62px; height: 62px; }
.mi-card b { display: block; font-size: 30px; font-weight: 900; }
.mi-card span { font-weight: 800; opacity: .9; }
@keyframes spinIn { 0% { transform: rotate(-200deg) scale(.3); } 100% { transform: none; } }

/* ---------- Puzzle art animations ---------- */
.art .a-slide { animation: slideBlock 3.2s ease-in-out infinite; transform-box: fill-box; }
.art .a-flow { animation: flow 1.2s linear infinite; }
.art .a-pulse { animation: pulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.art .a-draw { stroke-dasharray: 100; animation: draw 3.4s ease-in-out infinite; }
.art .a-bob { animation: bob 2.4s ease-in-out infinite; }
.art .a-twinkle { animation: twinkle 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.art .a-glow { animation: glowcell 2.4s ease-in-out infinite; }
.art .a-glow.g2 { animation-delay: 1.2s; }
.art .a-spin { animation: spin 10s linear infinite; transform-box: view-box; transform-origin: 14px 20px; }
.art .a-rock { animation: rock 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.art .a-hop { animation: hop 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.art .a-hop.h2 { animation-delay: .3s; } .art .a-hop.h3 { animation-delay: .6s; } .art .a-hop.h4 { animation-delay: .9s; }
.logo .lt { transform-box: fill-box; transform-origin: center; }
.brand .logo .lt { animation: tileWiggle 6s ease-in-out infinite; }
.brand .logo .lt.t2 { animation-delay: .15s; } .brand .logo .lt.t3 { animation-delay: .3s; } .brand .logo .lt.t4 { animation-delay: .45s; }

/* Animations */
@keyframes pageIn { from { opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 70% { transform: scale(1.04); } 100% { transform: none; opacity: 1; } }
@keyframes popIn { 0% { transform: scale(.7); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes dropIn { 0% { transform: translateY(-40px); opacity: 0; } 100% { transform: translateY(-14px); opacity: 1; } }
@keyframes starIn { 0% { transform: scale(0) rotate(-40deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes solvedPulse { 40% { transform: scale(1.04); } }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -60% 0; } }
@keyframes nudge { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes hintPulse { 50% { outline-color: transparent; } }
@keyframes burst { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), calc(var(--dy) + 260px)) rotate(var(--rot)); opacity: 0; } }
@keyframes nudgeR { 50% { transform: translateX(4px); } }
@keyframes bounce { 50% { transform: translateY(-6px); } }
@keyframes ring { 0% { transform: scale(.85); opacity: .8; } 100% { transform: scale(1.25); opacity: 0; } }
@keyframes floaty { 50% { transform: translateY(-8px); } }
@keyframes load { to { width: 100%; } }
@keyframes studioIn { 0% { transform: scale(.4) rotate(-6deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes tileIn { 0% { transform: scale(0) rotate(90deg); } 100% { transform: none; } }
@keyframes tileWiggle { 0%, 88%, 100% { transform: none; } 92% { transform: scale(1.12) rotate(6deg); } 96% { transform: scale(.95); } }
@keyframes slideBlock { 0%, 30% { transform: translateY(0); } 45%, 75% { transform: translateY(-3px); } 90%, 100% { transform: translateY(0); } }
@keyframes flow { to { stroke-dashoffset: -16; } }
@keyframes pulse { 50% { transform: scale(1.35); } }
@keyframes draw { 0% { stroke-dashoffset: 100; } 55%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -100; } }
@keyframes bob { 50% { transform: translateY(-2.5px); } }
@keyframes twinkle { 0%, 100% { transform: scale(.5) rotate(0); opacity: .4; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }
@keyframes glowcell { 0%, 100% { fill-opacity: .35; } 50% { fill-opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rock { 50% { transform: rotate(-12deg); } }
@keyframes hop { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-3px) scale(1.06); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .sp-game { opacity: 1; } }

@media (max-width: 420px) {
  h1 { font-size: 26px; }
  .row { flex-wrap: wrap; }
  .row .seg { min-width: 0; width: 100%; }
  .tool { min-width: 76px; padding: 9px 8px; }
  .gauge { width: 92px; height: 92px; }
  .gauge .g-num b { font-size: 30px; }
  .iqhero .rank { font-size: 19px; }
}
.page-journey .world-map { margin-bottom: 70px; }
.about img { height: 58px; background: #120c35; padding: 8px 14px; border-radius: 16px; box-sizing: content-box; }
.tuned { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 13px; font-weight: 800; color: var(--muted); margin: -2px 0 10px; }
.tuned .ico { width: 18px; height: 18px; color: var(--accent); flex: none; }
