:root {
  --bg: #FFF5EA; --ink: #2A1E14; --muted: #8C7A6A; --line: rgba(60, 40, 20, .08);
  --accent: #FF6B3D; --accent2: #7C4DFF; --card: #fff;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --font: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Nunito", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { position: fixed; inset: 0; overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; touch-action: manipulation; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
img { -webkit-user-drag: none; }
#app { position: absolute; inset: 0; }

/* screens */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; opacity: 0; transform: translateY(10px); transition: opacity .25s ease, transform .25s ease; }
.screen.in { opacity: 1; transform: none; }
.screen.out { opacity: 0; transform: translateY(-6px); pointer-events: none; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: calc(var(--st) + 14px) 16px 24px; }
.hub, .lb { background:
  radial-gradient(900px 400px at 110% -10%, rgba(255, 168, 120, .35), transparent 60%),
  radial-gradient(700px 380px at -20% 30%, rgba(170, 140, 255, .18), transparent 60%), var(--bg); }

.pressable { transition: transform .14s ease, filter .14s ease; }
.pressable:active { transform: scale(.965); filter: brightness(.97); }

/* hub header */
.hub-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.duo { display: flex; flex-shrink: 0; }
.duo .face { width: 46px; height: 46px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 4px 14px rgba(80, 40, 10, .18); object-fit: cover; }
.duo .face + .face { margin-left: -14px; }
.hello { font-size: 14px; color: var(--muted); font-weight: 600; }
h1 { font-size: 24px; line-height: 1.1; margin: 2px 0 0; font-weight: 800; letter-spacing: -.3px; }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 19px; background: rgba(255, 255, 255, .75); box-shadow: 0 2px 10px rgba(60, 30, 10, .08), inset 0 0 0 1px var(--line); flex-shrink: 0; transition: transform .12s; }
.icon-btn:active { transform: scale(.9); }

.install-hint { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; font-size: 14px; margin-bottom: 12px; text-align: left; }
.install-hint .arrow { margin-left: auto; color: var(--muted); font-size: 20px; }

.daily { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-radius: 22px; color: #fff; text-align: left; margin-bottom: 14px;
  background: linear-gradient(120deg, #FF7A45, #FF4F8B 60%, #B45CFF); box-shadow: 0 10px 26px rgba(255, 90, 90, .35); position: relative; overflow: hidden; }
.daily::after { content: ""; position: absolute; right: -30px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.daily.done { background: linear-gradient(120deg, #34C38F, #2BA6C9); box-shadow: 0 10px 26px rgba(40, 170, 150, .3); }
.daily-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; opacity: .9; }
.daily-title { font-size: 19px; font-weight: 800; margin-top: 3px; }
.streak { display: flex; flex-direction: column; align-items: center; z-index: 1; min-width: 64px; }
.streak .flame { font-size: 22px; line-height: 1; }
.streak b { font-size: 24px; line-height: 1.1; }
.streak small { font-size: 10px; font-weight: 700; opacity: .9; text-transform: uppercase; }

.sec { font-size: 15px; font-weight: 800; margin: 22px 4px 10px; color: #5A4636; letter-spacing: .2px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, 1fr); } .scroll { padding-left: max(24px, calc(50% - 420px)); padding-right: max(24px, calc(50% - 420px)); } }
.gcard { position: relative; overflow: hidden; border-radius: 22px; padding: 14px; min-height: 148px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left; color: #fff;
  box-shadow: 0 8px 20px rgba(60, 30, 10, .14), inset 0 1px 0 rgba(255, 255, 255, .35); }
.gcard::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120px 90px at 85% 10%, rgba(255, 255, 255, .28), transparent 70%); pointer-events: none; }
.gcard.big { width: 100%; min-height: 170px; flex-direction: row; align-items: center; gap: 14px; padding: 18px; }
.gcard.big .gicon { width: 96px; height: 96px; font-size: 64px; }
.gcard.big .gtitle { font-size: 24px; }
.gcard.big .gtext { flex: 1; }
.gicon { width: 58px; height: 58px; display: grid; place-items: center; font-size: 42px; line-height: 1; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .18)); }
.gicon.svg svg { width: 100%; height: 100%; }
.gicon.faces { display: flex; width: auto; }
.gicon.faces .face { width: 52px; height: 52px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .9); object-fit: cover; }
.gicon.faces .face + .face { margin-left: -16px; }
.gicon.sm { width: 38px; height: 38px; font-size: 28px; }
.gicon.sm.faces .face { width: 34px; height: 34px; border-width: 2px; }
.gicon.sm.faces .face + .face { margin-left: -12px; }
.gtitle { font-size: 17px; font-weight: 800; letter-spacing: -.2px; text-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.gsub { font-size: 12.5px; font-weight: 600; opacity: .92; margin-top: 2px; }
.chip { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, .22); font-size: 12px; font-weight: 700; }
.play-pill { position: absolute; right: 14px; bottom: 14px; background: #fff; color: #2A1E14; font-weight: 800; font-size: 13px; padding: 8px 14px; border-radius: 99px; box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin: 28px 0 8px; font-weight: 600; }

/* tab bar */
.tabbar { display: flex; justify-content: space-around; padding: 8px 20px calc(var(--sb) + 6px); background: rgba(255, 250, 244, .86); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 24px; }
.tab .ti { font-size: 22px; filter: grayscale(1); opacity: .6; transition: all .2s; }
.tab.on { color: var(--accent); }
.tab.on .ti { filter: none; opacity: 1; transform: translateY(-1px); }

/* leaderboard */
.lb-summary { background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: 0 6px 18px rgba(60, 30, 10, .08); margin-bottom: 14px; }
.lb-sum-title { font-weight: 800; font-size: 14px; margin-bottom: 8px; }
.lb-sum-row { display: flex; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.pill { background: #F6EDE4; color: var(--ink); padding: 6px 12px; border-radius: 99px; font-weight: 600; }
.pill.me { background: #FFE3D6; }
.lb-off { margin-top: 8px; font-size: 12px; color: var(--muted); }
.lb-list { display: grid; gap: 12px; }
@media (min-width: 700px) { .lb-list { grid-template-columns: 1fr 1fr; } }
.lb-card { background: #fff; border-radius: 20px; padding: 12px 14px; box-shadow: 0 4px 14px rgba(60, 30, 10, .07); }
.lb-game { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.lb-game small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.lb-card ol { list-style: none; margin: 0; padding: 0; }
.lb-card li { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 15px; }
.lb-card li.me { font-weight: 800; }
.lb-card .rk { width: 26px; text-align: center; font-size: 17px; }
.lb-card .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-card .sc { font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-empty, .lb-loading { color: var(--muted); font-size: 14px; padding: 6px 4px; }

/* game screen */
.screen.game { background: #1B1530; color: #fff; }
.gtop { display: flex; align-items: center; gap: 10px; padding: calc(var(--st) + 8px) 12px 8px; position: relative; z-index: 5; }
.gtop .icon-btn { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
.gt-mid { flex: 1; min-width: 0; text-align: center; }
.gt-title { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-sub { font-size: 12.5px; opacity: .75; font-weight: 600; min-height: 15px; }
.gt-actions { display: flex; gap: 8px; min-width: 42px; justify-content: flex-end; }
.stage { flex: 1; position: relative; overflow: hidden; padding-bottom: var(--sb); }

/* light-theme game screens */
.screen.game.light { background: #FFF5EA; color: var(--ink); }
.screen.game.light .gtop .icon-btn { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(60, 30, 10, .08), inset 0 0 0 1px var(--line); }

/* buttons */
.btn { padding: 14px 18px; border-radius: 16px; font-weight: 800; font-size: 16px; background: #F1E8DF; color: var(--ink); transition: transform .12s; flex: 1; }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(135deg, #FF7A45, #FF4F8B); color: #fff; box-shadow: 0 6px 16px rgba(255, 90, 90, .35); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px #EADCCF; }
.pbtn { padding: 10px 16px; border-radius: 14px; font-weight: 800; font-size: 14px; background: rgba(255, 255, 255, .14); color: #fff; display: inline-flex; align-items: center; gap: 6px; transition: transform .12s, opacity .2s; }
.pbtn:active { transform: scale(.94); }
.pbtn:disabled { opacity: .35; }
.pbtn .badge { background: #FF6B3D; color: #fff; font-size: 11px; border-radius: 99px; padding: 1px 6px; }

/* overlays */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(20, 12, 30, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s; }
.overlay.show { opacity: 1; }
.sheet { width: min(380px, 100%); background: #FFFDF9; color: var(--ink); border-radius: 28px; padding: 22px 20px 18px; text-align: center; box-shadow: 0 30px 60px rgba(0, 0, 0, .3); transform: scale(.9) translateY(10px); transition: transform .28s cubic-bezier(.2, 1.4, .4, 1); max-height: calc(100vh - 40px); overflow-y: auto; }
.overlay.show .sheet { transform: none; }
.sheet h2 { margin: 6px 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.sheet-sub { color: var(--muted); margin: 4px 0 12px; font-size: 15px; font-weight: 600; line-height: 1.35; }
.sheet-emoji { font-size: 52px; line-height: 1; margin-top: 2px; }
.sheet-img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, .18); }
.sheet-btns { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.sheet .stats { display: flex; justify-content: center; gap: 10px; margin: 10px 0 2px; }
.sheet .stat { background: #F6EDE4; border-radius: 14px; padding: 8px 12px; min-width: 80px; }
.sheet .stat b { display: block; font-size: 20px; }
.sheet .stat small { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; }
.sheet .newbest { display: inline-block; background: linear-gradient(135deg, #FFC83D, #FF8A3D); color: #fff; font-weight: 800; padding: 4px 12px; border-radius: 99px; font-size: 13px; margin-top: 4px; }
.choice-grid { display: grid; gap: 10px; margin-top: 8px; }
.choice { padding: 14px; border-radius: 16px; background: #F6EDE4; font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 12px; text-align: left; transition: transform .12s; }
.choice:active { transform: scale(.97); }
.choice small { display: block; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.choice .ce { font-size: 28px; }
.choice.sel { box-shadow: inset 0 0 0 3px var(--accent); background: #FFF0E8; }

.settings { text-align: left; display: grid; gap: 10px; margin-top: 8px; }
.lbl { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.inp { width: 100%; padding: 13px 14px; border-radius: 14px; border: 2px solid #EADCCF; background: #fff; font: inherit; font-size: 17px; font-weight: 700; color: var(--ink); outline: none; -webkit-user-select: text; user-select: text; }
.inp:focus { border-color: var(--accent); }
.inp.big { text-align: center; font-size: 20px; }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 14px; background: #F6EDE4; font-weight: 700; }
.toggle i { width: 46px; height: 28px; border-radius: 99px; background: #D9CBBE; position: relative; transition: background .2s; }
.toggle i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s; }
.toggle.on i { background: #34C38F; }
.toggle.on i::after { transform: translateX(18px); }
.linkish { text-align: left; padding: 12px 14px; border-radius: 14px; background: #F6EDE4; font-weight: 700; }
.fine { font-size: 12.5px; color: var(--muted); margin: 4px 2px 0; line-height: 1.4; }
.steps { text-align: left; font-size: 16px; line-height: 1.5; padding-left: 22px; margin: 8px 0; }
.steps li { margin: 6px 0; }
.onb .inp { margin-top: 4px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--sb) + 90px); transform: translate(-50%, 20px); background: rgba(30, 20, 40, .92); color: #fff; padding: 10px 18px; border-radius: 99px; font-weight: 700; font-size: 14px; opacity: 0; transition: all .25s; z-index: 200; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; z-index: 150; pointer-events: none; width: 100vw; height: 100vh; }

/* shared game bits */
.bottom-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(var(--sb) + 12px); display: flex; justify-content: center; gap: 10px; z-index: 4; }
.hud { display: flex; justify-content: center; gap: 10px; padding: 4px 12px 8px; }
.hud .box { background: rgba(255, 255, 255, .1); border-radius: 14px; padding: 6px 14px; text-align: center; min-width: 84px; }
.light .hud .box { background: #fff; box-shadow: 0 2px 10px rgba(60, 30, 10, .07); }
.hud .box small { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; opacity: .65; }
.hud .box b { font-size: 20px; font-variant-numeric: tabular-nums; }
.shake { animation: shake .32s; }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes popin { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes floatup { from { transform: translate(-50%, 0) scale(.8); opacity: 0; } 20% { opacity: 1; transform: translate(-50%, -10px) scale(1.05); } to { transform: translate(-50%, -60px) scale(1); opacity: 0; } }
.floater { position: absolute; left: 50%; font-weight: 900; font-size: 26px; color: #fff; text-shadow: 0 3px 10px rgba(0, 0, 0, .35); animation: floatup 1.1s ease-out forwards; pointer-events: none; z-index: 20; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.floater img { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; object-fit: cover; }
