* { box-sizing: border-box; }
html, body { margin: 0; background: #14161f; color: #eceff4; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
body { min-height: 100vh; min-height: 100dvh; display: flex; justify-content: center; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
main, #hs-view { width: 100%; max-width: 680px; padding: 8px; }
[hidden] { display: none !important; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.stat { background: #1f2330; border-radius: 8px; padding: 4px 12px; text-align: center; min-width: 80px; }
.stat span { display: block; font-size: 11px; color: #8d94a8; text-transform: uppercase; letter-spacing: .05em; }
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stat.sel { flex: 1; }
.stat.sel b { font-size: 16px; }

#boardwrap { position: relative; width: min(100%, calc(100vh - 230px), calc(100dvh - 230px)); min-width: 200px; margin: 0 auto; aspect-ratio: 1; }
#board { width: 100%; height: 100%; display: block; background: #0c0e14; border-radius: 10px; touch-action: none; }
#gameover { position: absolute; left: 0; right: 0; top: 24%; transform: translateY(-50%); text-align: center; pointer-events: none; }
#gameover .go-title { font-size: clamp(34px, 11vw, 72px); font-weight: 800; letter-spacing: .04em; color: #ff6b6b; text-shadow: 0 3px 14px rgba(0,0,0,.9), 0 0 3px #000; }
#gameover .go-score { margin-top: 6px; font-size: clamp(18px, 5vw, 28px); font-weight: 700; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.9); }
#boardwrap.over #board { opacity: .3; }
.stat.sel b.over { color: #ff6b6b; }
#banner { position: absolute; left: 8%; right: 8%; top: 38%; background: rgba(20,22,31,.94); border: 2px solid #5b8cff; border-radius: 12px; padding: 14px; text-align: center; font-size: 18px; }
#banner button { margin: 8px 4px 0; }
.moregames { display: block; width: fit-content; margin: 0 auto 12px; padding: 9px 16px; border: 1px solid #5b8cff; border-radius: 10px; color: #eceff4; background: #232a3d; text-decoration: none; font-size: 14px; }
.moregames[hidden] { display: none; }

/* "Today's best" line; the news ticker runs over it (same spot, below the board) while a message is showing */
.todaywrap { position: relative; min-height: 26px; margin: 8px 0 18px; }
.today { text-align: center; font-size: 13px; color: #8cb4ff; line-height: 26px; margin: 0; }
.buttons button { position: relative; width: 52px; height: 46px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.buttons svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
#btn-new[data-count]:not([data-count=""])::after { content: attr(data-count); position: absolute; right: 3px; bottom: 2px; font-size: 11px; font-weight: 700; line-height: 1; background: #5b8cff; color: #fff; border-radius: 8px; padding: 2px 5px; }
/* Undo / Helium / Joker belong together: a subtle pill around them with some air before and after */
.btn-group { display: flex; gap: 4px; padding: 4px; margin: 0 12px; background: #1a1e2b; border: 1px solid #323a5a; border-radius: 14px; }
@media (max-width: 440px) {   /* two groups + new game must fit on one row of a ~380px phone */
  .buttons button, #btn-back { width: 42px; height: 40px; }
  .buttons svg, #btn-back svg { width: 22px; height: 22px; }
  .buttons { gap: 4px; }
  .btn-group { gap: 3px; padding: 3px; margin: 0 2px; }
}
.buttons button.flash { background: #2e7d32; }
#btn-back { width: 52px; height: 46px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
#btn-back svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.buttons { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
button { background: #2c3350; color: #eceff4; border: 0; border-radius: 8px; padding: 10px 14px; font-size: 15px; cursor: pointer; }
button:hover:not(:disabled) { background: #3a4570; }
button:disabled { opacity: .4; cursor: default; }
button.active { background: #5b8cff; }
button.small { padding: 6px 10px; font-size: 12px; background: #3a2c34; }

.settings { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: center; font-size: 14px; }
.settings input { -webkit-user-select: text; user-select: text; background: #1f2330; color: #eceff4; border: 1px solid #3a4570; border-radius: 6px; padding: 6px 8px; font-size: 16px; width: 150px; }
.local { color: #8d94a8; }

#ticker { position: absolute; inset: 0; z-index: 5; background: #5b8cff; color: #fff; border-radius: 8px; overflow: hidden; white-space: nowrap; line-height: 26px; font-weight: 600; }
#ticker span { display: inline-block; padding-left: 100%; animation: tick 14s linear forwards; }
@keyframes tick { to { transform: translateX(-100%); } }
h2 { margin: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1; }
.tabs button.on { background: #5b8cff; }
#hs-table { width: 100%; border-collapse: collapse; }
#hs-table th, #hs-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid #262b3b; }
#hs-table td:nth-child(3), #hs-table th:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
#hs-table td:nth-child(4), #hs-table th:nth-child(4) { padding-left: 32px; }   /* more room between score and date */
#hs-table tr.me td { color: #ffd54a; font-weight: 600; }
#hs-result { background: #1f2a1f; border: 1px solid #4caf50; border-radius: 8px; padding: 10px; margin-bottom: 10px; text-align: center; }
button.blink { animation: blink 0.8s ease-in-out infinite; }
@keyframes blink { 50% { background: #ffd54a; color: #14161f; } }
