:root {
  --field: #0F3D2E; --field2: #17553F; --gold: #F2B233; --ink: #13201B; --paper: #F5F7F2;
  --muted: #66746D; --blue: #1F5FD6; --line: #D8E0DA; --bad: rgba(214, 60, 60, .30);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: #E7ECE8; color: var(--ink);
  font-family: "Nirmala UI", "Noto Sans Devanagari", "Mangal", "Segoe UI", system-ui, sans-serif; }
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--paper); padding-bottom: 30px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; cursor: pointer; color: var(--field); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill { background: #FFF4D6; border-radius: 20px; padding: 4px 10px; font-size: 14px; font-weight: 700; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; min-width: 38px; height: 36px; font-size: 15px; cursor: pointer; font-family: inherit; }
.screen { display: none; padding: 14px; }
.screen.on { display: block; }
.title { font-size: 26px; margin: 8px 0 2px; color: var(--field); }
.title2 { font-size: 20px; margin: 4px 0; }
.sub { margin: 0 0 14px; color: var(--muted); }
.card { background: #fff; border-radius: 16px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(15, 61, 46, .08); }
.card.daily { background: linear-gradient(150deg, var(--field), var(--field2)); color: #fff; }
.card.soft { background: #fff; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.big-line { font-size: 21px; font-weight: 700; margin: 6px 0 2px; }
.big-line.dark { color: var(--ink); margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.muted-light { font-size: 13px; opacity: .85; }
.mini { display: grid; gap: 2px; width: 112px; margin: 10px 0; }
.mini span { aspect-ratio: 1; border-radius: 3px; }
.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-size: 16px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn.blue { background: var(--blue); color: #fff; }
.btn.green { background: #1FA855; color: #fff; }
.btn.line { background: #fff; color: var(--field); border: 1.5px solid var(--line); font-weight: 600; }
.btn.ad { background: #FFF4D6; color: var(--ink); width: 100%; margin-top: 10px; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--blue); padding: 10px 0 0; font-size: 15px; cursor: pointer; font-family: inherit; }
.switch-row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 15px; }
.switch-row input { width: 22px; height: 22px; }
.foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 18px; }
.foot a { color: var(--muted); }

/* levels */
.group-title { margin: 14px 0 8px; font-weight: 700; color: var(--field); }
.level-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lv { aspect-ratio: 1; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 17px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; font-family: inherit; color: var(--ink); }
.lv small { font-size: 10px; letter-spacing: -1px; }
.lv.done { background: #EAF6EE; border-color: #9ED3B1; }
.lv.next { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.lv.lock { color: #B5BFB9; background: #F1F3F1; cursor: default; }

/* play */
.play-head { margin-bottom: 6px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--blue); font-size: 17px; }
.rules { background: #fff; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.6; margin-bottom: 10px; color: #33423B; }
.rules .tap { color: var(--muted); font-size: 13px; }
.grid-wrap { touch-action: manipulation; }
.grid { display: grid; border: 3px solid var(--field); border-radius: 10px; overflow: hidden; background: var(--field); user-select: none; }
.cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.cell .m { pointer-events: none; line-height: 1; }
.cell.x .m::after { content: "✕"; color: rgba(19, 32, 27, .5); font-size: .9em; }
.cell.ax .m::after { content: "·"; color: rgba(19, 32, 27, .35); font-size: 1.6em; }
.cell.f .m::after { content: "🧢"; font-size: 1.35em; }
.cell.h .m::after { content: "🧢"; font-size: 1.35em; filter: drop-shadow(0 0 3px #F2B233); }
.cell.bad { background-image: repeating-linear-gradient(45deg, var(--bad) 0 5px, transparent 5px 10px) !important; }
.cell.pop { animation: pop .45s ease both; }
@keyframes pop { 50% { transform: scale(1.18); } }
.count { text-align: center; color: var(--muted); margin: 8px 0; font-size: 14px; }
.tools { display: flex; gap: 8px; }
.tools .btn { flex: 1; padding: 10px 6px; font-size: 14px; }

/* zones */
.z0 { background: #CFE8D5; } .z1 { background: #FFE6A6; } .z2 { background: #CFE0FF; } .z3 { background: #F4D3E8; }
.z4 { background: #FFD3C2; } .z5 { background: #C8EEF2; } .z6 { background: #E6DEC4; } .z7 { background: #DCD3F7; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(10, 20, 15, .55); display: none; align-items: flex-end; justify-content: center; z-index: 20; }
.modal.on { display: flex; }
.sheet { background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0; padding: 18px 16px 24px; max-height: 92vh; overflow: auto; }
.sheet h3 { margin: 4px 0 10px; text-align: center; font-size: 22px; }
.sheet ol { padding-left: 22px; line-height: 1.7; margin: 0 0 12px; }
.win-emoji { text-align: center; font-size: 46px; }
.win-stars { text-align: center; font-size: 32px; letter-spacing: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.stats div { background: var(--paper); border-radius: 12px; text-align: center; padding: 8px 4px; }
.stats b { display: block; font-size: 20px; }
.stats small { color: var(--muted); font-size: 12px; }
.share-box { background: #E8F7EE; border: 1px dashed #6AC58F; border-radius: 12px; padding: 10px 12px; white-space: pre-line; line-height: 1.6; font-size: 15px; }
.demo-grid { display: grid; grid-template-columns: repeat(4, 44px); gap: 0; justify-content: center; margin: 4px 0 12px; border: 2px solid var(--field); width: max-content; margin-inline: auto; }
.demo-grid span { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: rgba(19, 32, 27, .5); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 14px; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 30; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; }

/* simple pages */
.page { max-width: 720px; margin: 0 auto; background: #fff; min-height: 100vh; padding: 20px 18px 40px; line-height: 1.7; }
.page h1 { color: var(--field); }
.page a { color: var(--blue); }

/* v2: rank, super over, series, balls */
.small { font-size: 13px; }
.card.rank .bar { height: 8px; background: #E4EBE6; border-radius: 6px; margin: 8px 0 6px; overflow: hidden; }
.card.rank .bar i { display: block; height: 100%; background: linear-gradient(90deg, #F2B233, #E39A0B); border-radius: 6px; }
.card.super { background: linear-gradient(150deg, #1D2B64, #2F4FB0); color: #fff; }
.card.super .big-line { margin-top: 0; }
.series { background: #fff; border-radius: 16px; padding: 12px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(15, 61, 46, .08); }
.series.closed { opacity: .75; }
.series-head { display: flex; align-items: center; gap: 10px; }
.series-head b { display: block; font-size: 16px; }
.series-head small { color: var(--muted); }
.series-head em { color: #C2410C; font-style: normal; font-weight: 700; }
.series-icon { font-size: 26px; }
.series-count { margin-left: auto; font-weight: 700; color: var(--field); }
.series-bar { height: 6px; background: #E4EBE6; border-radius: 4px; margin: 8px 0 10px; overflow: hidden; }
.series-bar i { display: block; height: 100%; background: #2E9D63; }
.balls { display: flex; gap: 8px; justify-content: center; margin: 2px 0 10px; }
.balls span { width: 16px; height: 16px; border-radius: 50%; background: #E1E6E2; border: 2px solid #C9D2CC; }
.balls span.b-done { background: #D64545; border-color: #B83232; }
.balls span.b-now { background: #fff; border-color: #D64545; box-shadow: 0 0 0 3px rgba(214, 69, 69, .2); }
.win-rank { text-align: center; font-weight: 700; color: #B7791F; background: #FFF4D6; border-radius: 10px; padding: 6px; margin: 6px 0; }
.z8 { background: #F6D6A8; } .z9 { background: #D9EFC2; }
/* phones with notch / Android 16 edge-to-edge: keep header and content clear of system bars */
.top { padding-top: max(10px, env(safe-area-inset-top)); }
.app { padding-bottom: max(30px, env(safe-area-inset-bottom)); }
.modal .sheet { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
