@font-face { font-family: 'Tajawal'; src: url('/fonts/Tajawal-Medium.ttf') format('truetype'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Tajawal'; src: url('/fonts/Tajawal-Bold.ttf') format('truetype'); font-weight: 600 700; font-display: swap; }
@font-face { font-family: 'Tajawal'; src: url('/fonts/Tajawal-ExtraBold.ttf') format('truetype'); font-weight: 800 900; font-display: swap; }
@font-face { font-family: 'Kufi'; src: url('/fonts/ReemKufi-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --night: #0d1830;
  --night2: #16264a;
  --paper: #fff8ec;
  --paper2: #f3e8d4;
  --ink: #2a2116;
  --muted: #7d6f5c;
  --gold: #f6b73c;
  --gold2: #e09a12;
  --good: #2e9d62;
  --bad: #d64545;
  --line: rgba(42, 33, 22, .12);
  --r: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--night); color: var(--paper); font-size: 16px; line-height: 1.5;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none;
}
input, select, textarea { -webkit-user-select: text; user-select: text; font: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: 'Kufi', 'Tajawal', sans-serif; margin: .2em 0 .4em; line-height: 1.3; }
h1 { font-size: 2.6rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.12rem; }
a { color: inherit; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 16px; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.end { margin-top: 22px; }
#app { height: 100%; }

/* ---------- buttons, inputs, chips ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 11px 16px; font-weight: 700; font-size: 1rem;
  background: rgba(255, 255, 255, .1); color: inherit; transition: transform .12s, filter .2s; min-height: 44px;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(180deg, #ffcf5a, var(--gold2)); color: #3b2500; box-shadow: 0 4px 0 #a86f05; }
.btn.primary:active { box-shadow: 0 1px 0 #a86f05; transform: translateY(3px); }
.btn.danger { background: #d64545; color: #fff; box-shadow: 0 4px 0 #8f2626; }
.btn.ghost { background: transparent; text-decoration: underline; text-underline-offset: 4px; opacity: .85; }
.btn.big { width: 100%; padding: 14px; font-size: 1.1rem; }
.btn:disabled { opacity: .55; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ''; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%; border: 3px solid currentColor; border-color: #3b2500 transparent; animation: spin .8s linear infinite; }
.icon-btn { border: 0; background: rgba(255, 255, 255, .08); width: 42px; height: 42px; border-radius: 12px; font-size: 1.1rem; display: grid; place-items: center; }
.chev { font-size: 2rem; line-height: 1; transform: scaleX(-1); display: inline-block; margin-top: -4px; }
.input {
  width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 1.05rem;
  background: #fff; color: var(--ink); outline: none; margin: 6px 0;
}
.input:focus { border-color: var(--gold); }
.input.code { letter-spacing: .5em; text-align: center; font-size: 1.5rem; direction: ltr; }
.lbl { display: block; font-weight: 700; margin-top: 10px; font-size: .92rem; }
.err { color: #ff8b8b; min-height: 1.2em; margin: 4px 0; font-weight: 700; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chip { border: 0; padding: 7px 14px; border-radius: 99px; background: rgba(255, 255, 255, .1); font-weight: 700; font-size: .92rem; }
.chip.on { background: var(--gold); color: #3b2500; }
.chip.scope { margin-inline-start: 0; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; background: #e0b25a; color: #3b2500; font-weight: 800; font-size: .8rem; }
.badge.good { background: var(--good); color: #fff; }
.tabs { display: flex; background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 4px; gap: 4px; margin-top: 8px; }
.tab { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 11px; font-weight: 800; }
.tab.on { background: var(--paper); color: var(--ink); }
.loading { text-align: center; padding: 30px; font-size: 1.6rem; opacity: .6; }
.card { background: rgba(255, 255, 255, .06); border-radius: var(--r); padding: 14px; margin: 14px 0; }

/* ---------- shell ---------- */
.screen { height: 100%; display: flex; flex-direction: column; background: radial-gradient(120% 70% at 50% 0%, var(--night2), var(--night)); }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + var(--safe-t)) 12px 8px; background: rgba(10, 18, 38, .65); backdrop-filter: blur(8px); position: relative; z-index: 3;
}
.top-title { font-family: 'Kufi', sans-serif; font-size: 1.02rem; opacity: .95; text-align: center; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-chip { display: flex; align-items: center; gap: 6px; border: 0; background: rgba(255, 255, 255, .08); padding: 3px 10px 3px 4px; border-radius: 99px; max-width: 46%; }
.me-chip .chip-lamp { width: 30px; height: 32px; display: grid; place-items: center; }
.me-chip .chip-txt { display: flex; flex-direction: column; text-align: start; line-height: 1.15; min-width: 0; }
.me-chip b { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-chip small { font-size: .72rem; color: var(--gold); font-weight: 700; }
.day-stars { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: .9rem; background: rgba(255, 255, 255, .08); padding: 4px 10px; border-radius: 99px; direction: ltr; }
main.content { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; position: relative; }
nav.bottom {
  display: flex; justify-content: space-around; padding: 6px 8px calc(6px + var(--safe-b)); background: rgba(10, 18, 38, .92);
  border-top: 1px solid rgba(255, 255, 255, .06); z-index: 3;
}
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; font-size: .78rem; font-weight: 700; opacity: .6; padding: 4px 18px; border-radius: 12px; }
.nav-btn.on { opacity: 1; color: var(--gold); background: rgba(246, 183, 60, .1); }

/* ---------- city ---------- */
.city { position: relative; width: 100%; max-width: 560px; margin: 0 auto; }
.city-svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.city-svg text { font-family: 'Tajawal', sans-serif; }
.place { cursor: pointer; outline: none; }
.place:focus-visible .tag-bg { stroke: var(--gold); stroke-width: 2; }
.place .bld { transition: transform .15s; transform-box: fill-box; transform-origin: 50% 100%; }
.place:active .bld { transform: scale(.95); }
.tag-bg { fill: rgba(16, 26, 50, .78); }
.tag-t { fill: #fff; font-size: 12.5px; font-weight: 800; }
.tag-s { fill: #f6d38a; font-size: 9.5px; font-weight: 700; }
.site .tag-s { fill: #c9d3e0; }
.site .tag-t { fill: #dfe6ee; }
.ghost * { fill: rgba(255, 255, 255, .06) !important; stroke: rgba(255, 255, 255, .5) !important; stroke-width: 1.4 !important; stroke-dasharray: 3 3; }
.halo { fill: none; stroke: #ffd34d; stroke-width: 3; animation: halo 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.flag { animation: bob 1.2s ease-in-out infinite; }
.twinkle { animation: twinkle 3s ease-in-out infinite; }
.win { animation: flicker 4s ease-in-out infinite; }
.beam { animation: beam 6s ease-in-out infinite; transform-origin: 0 -97px; }
.smoke circle { animation: smoke 3.5s ease-out infinite; }
.smoke circle:nth-child(2) { animation-delay: 1.1s; } .smoke circle:nth-child(3) { animation-delay: 2.2s; }
.jets { animation: jets 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.crane { animation: crane 7s ease-in-out infinite; transform-origin: 30px -104px; }
.wave { animation: wave 2.4s ease-in-out infinite; }
.lamp-walker { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); cursor: pointer; }
.lamp-walker.walking .lamp { animation: walk .34s ease-in-out infinite; }
.lamp-live .lamp-flame { animation: flame 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.lamp-live .lamp-glow { animation: glow 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.lamp-rays { animation: spin 18s linear infinite; transform-origin: 50px 56px; }

.city-card {
  position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 12px 12px;
  background: linear-gradient(180deg, rgba(13, 24, 48, 0), rgba(13, 24, 48, .92) 30%);
}
.station {
  flex: 1; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 4px 10px; align-items: center;
  border: 0; text-align: start; background: var(--paper); color: var(--ink); border-radius: 16px; padding: 10px 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.station.muted { color: var(--muted); display: block; }
.station .st-top { display: flex; flex-direction: column; line-height: 1.25; }
.station .st-top small { color: var(--muted); font-size: .76rem; font-weight: 700; }
.station .st-top b { font-size: .98rem; }
.station .go { grid-row: 1 / span 2; grid-column: 2; background: var(--gold); color: #3b2500; font-weight: 800; padding: 8px 14px; border-radius: 12px; }
.bar { height: 7px; background: var(--paper2); border-radius: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffcf5a, var(--gold2)); border-radius: 9px; transition: width .6s; }
.daily { border: 0; background: #2b3e6b; color: #fff; border-radius: 16px; padding: 8px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 800; font-size: .8rem; min-width: 84px; }
.daily .d-ico { color: var(--gold); }
.daily.login { flex: 1; font-size: .9rem; }

/* ---------- sheets, toasts ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(5, 10, 22, 0); z-index: 20; display: flex; align-items: flex-end; justify-content: center; transition: background .25s; }
.sheet-back.in { background: rgba(5, 10, 22, .55); }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--paper); color: var(--ink);
  border-radius: 24px 24px 0 0; padding-bottom: calc(10px + var(--safe-b)); transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .9, .3, 1.1);
}
.sheet-back.in .sheet { transform: none; }
.sheet .muted { color: var(--muted); }
.sheet .btn { background: var(--paper2); color: var(--ink); }
.sheet .btn.primary { background: linear-gradient(180deg, #ffcf5a, var(--gold2)); color: #3b2500; }
.sheet .btn.ghost { background: transparent; }
.sheet-grip { width: 44px; height: 5px; border-radius: 9px; background: var(--paper2); margin: 10px auto 0; }
.toast { position: fixed; left: 50%; top: calc(14px + var(--safe-t)); transform: translate(-50%, -150%); background: var(--paper); color: var(--ink); padding: 10px 18px; border-radius: 14px; font-weight: 800; z-index: 30; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); transition: transform .3s; max-width: 90vw; text-align: center; }
.toast.in { transform: translate(-50%, 0); }
.toast.error { background: #ffe1e1; color: #8f2626; }
.site-head { display: flex; align-items: center; gap: 10px; }
.votebar { height: 10px; background: var(--paper2); border-radius: 9px; overflow: hidden; margin: 10px 0 4px; }
.votebar i { display: block; height: 100%; background: #3aa66a; }

/* ---------- welcome / login / chooser ---------- */
.welcome, .login, .chooser {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: calc(24px + var(--safe-t)) 24px calc(24px + var(--safe-b)); text-align: center;
  background: radial-gradient(90% 60% at 50% 30%, #2a3f73, var(--night));
}
.welcome .lead { font-size: 1.1rem; opacity: .9; max-width: 22em; }
.welcome .btn.big, .login .btn.big { max-width: 360px; }
.w-lamp { animation: float 3.5s ease-in-out infinite; }
.login-head { display: flex; flex-direction: column; align-items: center; }
.login-body { width: 100%; max-width: 380px; text-align: start; }
.step { font-weight: 800; font-size: 1.05rem; }
.who { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.who-btn { border: 2px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 10px 4px; font-weight: 800; }
.who-btn.on { border-color: var(--gold); background: rgba(246, 183, 60, .18); color: var(--gold); }
.btn.choice { width: 100%; margin: 6px 0; background: rgba(255, 255, 255, .1); }
.link { margin-top: 8px; opacity: .8; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; width: 100%; max-width: 480px; }
.who-card { border: 0; background: rgba(255, 255, 255, .07); border-radius: 20px; padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .15s; }
.who-card:active { transform: scale(.95); }
.who-card small { color: var(--gold); font-weight: 700; }
.fatal { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; }

/* ---------- game screen ---------- */
.game { height: 100%; display: flex; flex-direction: column; background: radial-gradient(120% 80% at 50% 0%, #2a3557, #121a30); }
.game-top { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 12px 6px; }
.game-title { flex: 1; text-align: center; }
.game-title b { font-family: 'Kufi', sans-serif; font-size: 1.15rem; color: var(--gc); }
.hud { display: flex; justify-content: center; gap: 12px; font-size: .86rem; font-weight: 700; opacity: .9; }
.game-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px; min-height: 0; touch-action: none; }
.game-tools { display: flex; justify-content: center; gap: 10px; padding: 8px 12px calc(12px + var(--safe-b)); }
.btn.tool { background: rgba(255, 255, 255, .1); font-size: .95rem; }

/* pipes */
.pipes-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.pipes { width: 100%; height: 100%; max-height: 72vh; touch-action: manipulation; }
.pipes .tile { cursor: pointer; }
.pipes .p-edge { stroke: #1d150e; stroke-width: 34; stroke-linecap: round; fill: none; }
.pipes .p-in { stroke: #b07a3c; stroke-width: 22; stroke-linecap: round; fill: none; transition: stroke .25s ease var(--d, 0ms); }
.pipes .wet .p-in { stroke: #44b4f0; }
.pipes .inlet { fill: #44b4f0; }
.pipes .outlet { fill: #7a5c34; transition: fill .3s .4s; }
.pipes.solved .outlet { fill: #44b4f0; }
.pipes .flowers { transform-box: fill-box; transform-origin: center; transform: scale(.6); transition: transform .5s .6s cubic-bezier(.3, 1.6, .5, 1); }
.pipes.solved .flowers { transform: scale(1.25); }
.pipes .tile.flash rect { fill: #6b5a2a; }

/* blocks */
.blocks-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.b-board { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; background: #1b2440; padding: 6px; border-radius: 14px; aspect-ratio: 1; touch-action: none; }
.b-cell { border-radius: 5px; background: rgba(255, 255, 255, .06); }
.b-cell.ghost { background: rgba(255, 255, 255, .32); }
.b-cell.will { box-shadow: inset 0 0 0 3px #fff; }
.b-cell.clearing { animation: clearCell .38s ease-out; }
.c1 { background: linear-gradient(145deg, #ff8a80, #e5534b) !important; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.c2 { background: linear-gradient(145deg, #ffd166, #e9a823) !important; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.c3 { background: linear-gradient(145deg, #7ee08a, #3aa655) !important; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.c4 { background: linear-gradient(145deg, #7cc8ff, #3a8ee0) !important; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.c5 { background: linear-gradient(145deg, #c3a1ff, #8a5ce0) !important; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.c6 { background: linear-gradient(145deg, #ffa86b, #ee7a2b) !important; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.c7 { background: linear-gradient(145deg, #6fe3d8, #22b3a5) !important; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.b-tray { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; min-height: 120px; }
.b-slot { display: grid; place-items: center; background: rgba(255, 255, 255, .04); border-radius: 14px; min-height: 120px; }
.b-piece { display: grid; gap: 2px; touch-action: none; cursor: grab; transition: opacity .15s, transform .15s; }
.b-piece.lifted { opacity: .25; }
.b-piece.nofit { opacity: .45; filter: grayscale(.6); }
.b-piece.floating { position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; opacity: .95; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .45)); transition: none; }
.b-piece.floating.back { opacity: 0; transition: opacity .15s; }
.b-pop { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font-family: 'Kufi', sans-serif; font-size: 2rem; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, .3); opacity: 0; pointer-events: none; transform: translateY(10px); }
.b-pop.show { animation: popText .7s ease-out; }
.b-pop.big.show { animation: popText 1.4s ease-out; font-size: 1.8rem; }
.blocks-wrap.over .b-board { filter: grayscale(.7) brightness(.8); transition: filter .6s; }

/* 2048 */
.g2048-wrap { width: 100%; max-width: 420px; text-align: center; }
.g-board { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: #3b3150; padding: 0; border-radius: 16px; aspect-ratio: 1; touch-action: none; overflow: hidden; }
.g-slot { margin: 6px; border-radius: 10px; background: rgba(255, 255, 255, .08); }
.g-tiles { position: absolute; inset: 0; }
.g-tile { position: absolute; left: 0; top: 0; width: 25%; height: 25%; padding: 6px; transition: transform .11s ease-in-out; }
.g-tile span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 10px; font-family: 'Kufi', sans-serif; font-size: 1.9rem; color: #3b2500; background: #fff3d6; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12); }
.g-tile.new span { animation: appear .18s ease-out; }
.g-tile.pop span { animation: popTile .18s ease-out; }
.v4 span { background: #ffe3a8; } .v8 span { background: #ffbe76; color: #fff; } .v16 span { background: #ff9f5a; color: #fff; }
.v32 span { background: #ff7b5a; color: #fff; } .v64 span { background: #ff5a5a; color: #fff; } .v128 span { background: #7ee08a; color: #fff; font-size: 1.6rem; }
.v256 span { background: #3aa655; color: #fff; font-size: 1.6rem; } .v512 span { background: #4fc3f7; color: #fff; font-size: 1.6rem; }
.v1024 span { background: #3a8ee0; color: #fff; font-size: 1.25rem; } .v2048 span, .v4096 span { background: linear-gradient(145deg, #ffd166, #e09a12); color: #fff; font-size: 1.25rem; }
.g-help { opacity: .6; font-size: .9rem; }
.g2048-wrap.over .g-board { filter: grayscale(.7) brightness(.8); transition: filter .6s; }

/* result */
.result { text-align: center; }
.res-lamp { margin-top: -6px; }
.res-stars { margin: 6px 0 10px; }
.stars { display: inline-flex; gap: 4px; direction: ltr; }
.star path { fill: #d8cfc0; transition: fill .2s; }
.star.on path { fill: #f6b73c; stroke: #c9860a; stroke-width: 1; }
.res-stars .star.on { animation: starPop .35s cubic-bezier(.3, 1.8, .5, 1); }
.res-line { margin: 4px 0; font-weight: 700; }
.res-line.good { color: var(--good); }
.res-line.gold { color: #b07400; }
.res-medal { display: flex; align-items: center; gap: 12px; text-align: start; background: #fff; border-radius: 16px; padding: 8px 12px; margin: 10px 0; animation: medalIn .6s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: 1.3s; }
.res-medal div { display: flex; flex-direction: column; }
.res-medal small { font-size: .8rem; color: #b07400; font-weight: 800; }
.res-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

/* boards */
.board { display: flex; flex-direction: column; gap: 6px; }
.brow { display: grid; grid-template-columns: 34px 32px 1fr auto; align-items: center; gap: 8px; border: 0; text-align: start; background: rgba(255, 255, 255, .06); border-radius: 14px; padding: 6px 10px; }
.brow.me { background: rgba(246, 183, 60, .2); outline: 2px solid var(--gold); }
.brow .rk { font-weight: 900; text-align: center; font-size: 1.05rem; }
.brow .bn { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brow .bn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow .bn small { opacity: .65; font-size: .75rem; }
.brow .bv { font-weight: 900; color: var(--gold); white-space: nowrap; }
.gap { text-align: center; opacity: .5; }
.daily-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(255, 255, 255, .07); border-radius: 16px; padding: 12px; margin-bottom: 6px; }
.daily-card div { display: flex; flex-direction: column; }
.showcase { display: flex; justify-content: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.showcase .sc { display: flex; flex-direction: column; align-items: center; max-width: 90px; font-weight: 700; font-size: .8rem; }

/* fame */
.fame-head { text-align: center; }
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: 8px; margin: 10px 0 20px; }
.pod { display: flex; flex-direction: column; align-items: center; text-align: center; font-size: .85rem; }
.pod .block { width: 100%; border-radius: 12px 12px 0 0; background: linear-gradient(180deg, #ffcf5a, #c9860a); color: #3b2500; font-family: 'Kufi', sans-serif; font-size: 1.6rem; display: grid; place-items: center; }
.pod.p1 .block { height: 90px; } .pod.p2 .block { height: 64px; background: linear-gradient(180deg, #e9eef3, #9aa7b4); } .pod.p3 .block { height: 48px; background: linear-gradient(180deg, #f0b07c, #a8622e); }
.pod .block.empty { opacity: .3; }
.fame-row { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .06); border-radius: 14px; padding: 8px 12px; margin: 6px 0; }
.fame-row div { display: flex; flex-direction: column; }
.fame-row small { opacity: .7; }

/* me */
.me-head { display: flex; align-items: center; gap: 14px; }
.me-head h2 { margin: 0; }
.rank-line b { color: var(--gold); font-size: 1.1rem; }
.medals .mgroup { margin-bottom: 16px; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin-top: 6px; }
.medal-cell { border: 0; background: rgba(255, 255, 255, .05); border-radius: 14px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; font-weight: 700; line-height: 1.2; text-align: center; }
.medal-cell.locked { opacity: .55; }
.medal-cell.shown { outline: 2px solid var(--gold); }
.nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.num { background: rgba(255, 255, 255, .06); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; border-inline-start: 4px solid var(--gc); }
.num small { opacity: .75; }
.lamps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lamp-pick { border: 2px solid transparent; background: #fff; border-radius: 16px; padding: 6px; }
.lamp-pick.on { border-color: var(--gold); }

/* admin */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.stat { background: rgba(255, 255, 255, .07); border-radius: 14px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.stat b { font-size: 1.4rem; color: var(--gold); }
.rank-edit { display: grid; grid-template-columns: 20px 1fr 1.4fr 70px; gap: 6px; align-items: center; }
.srow { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }

/* ---------- motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes halo { 0%, 100% { opacity: .9; transform: scale(1); } 50% { opacity: .35; transform: scale(1.12); } }
@keyframes bob { 0%, 100% { transform: translate(30px, -96px); } 50% { transform: translate(30px, -102px); } }
@keyframes twinkle { 0%, 100% { opacity: .9; } 50% { opacity: .25; } }
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: .85; } 50% { opacity: .65; } 55% { opacity: .9; } }
@keyframes beam { 0%, 100% { transform: rotate(-8deg); opacity: .9; } 50% { transform: rotate(8deg); opacity: .6; } }
@keyframes smoke { 0% { transform: translateY(6px); opacity: 0; } 30% { opacity: .7; } 100% { transform: translateY(-16px); opacity: 0; } }
@keyframes jets { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.15); } }
@keyframes crane { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-6deg); } }
@keyframes wave { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px); } }
@keyframes walk { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-4px) rotate(4deg); } }
@keyframes flame { 0%, 100% { transform: scale(1, 1); } 30% { transform: scale(.94, 1.06); } 60% { transform: scale(1.04, .95); } }
@keyframes glow { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .8; transform: scale(.94); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes clearCell { 0% { background: #fff; transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes popText { 0% { opacity: 0; transform: translateY(14px) scale(.8); } 25% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-24px) scale(1); } }
@keyframes appear { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes popTile { 0% { transform: scale(1); } 50% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes starPop { 0% { transform: scale(0) rotate(-30deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes medalIn { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (min-width: 700px) {
  .city-card { max-width: 560px; margin: 0 auto; }
}
.tag { cursor: pointer; }

/* iPhone: the real visible height (Safari's bars), and the blur needs its prefix. */
@supports (height: 100dvh) {
  html, body, #app { height: 100dvh; }
}
header.top, nav.bottom { -webkit-backdrop-filter: blur(8px); }
