:root {
  --ink: #18211b;
  --forest: #24462f;
  --red: #c94f35;
  --mustard: #f0b43c;
  --paper: #fbf7ed;
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--paper); color: var(--ink); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
button, a { font: inherit; }
button { touch-action: manipulation; cursor: pointer; }

.app { width: min(480px, 100%); margin: 0 auto; padding: 8px 10px 0; }
.bar { display: flex; align-items: center; gap: 8px; }
.back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #fff; color: var(--forest); text-decoration: none; font-weight: 800; border: 1px solid rgba(0,0,0,.08); flex: none; }
.bar h1 { flex: 1; min-width: 0; margin: 0; font-size: clamp(17px, 5vw, 22px); line-height: 1.1; font-weight: 800; color: var(--forest); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-tools { display: flex; gap: 6px; flex: none; }
.icon-btn { width: 40px; height: 40px; border: 1px solid rgba(0,0,0,.08); border-radius: 12px; background: #fff; font-size: 18px; }
.icon-btn[aria-pressed="false"] { opacity: .55; }

.lang-switch { display: flex; gap: 4px; width: fit-content; margin: 8px auto; padding: 4px; border-radius: 999px; background: #fff; border: 1px solid rgba(0,0,0,.08); }
.lang-switch button { min-width: 64px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: #4a574d; font-weight: 800; font-size: 14px; }
.lang-switch button[aria-pressed="true"] { background: var(--forest); color: #fff; }

.stage { position: relative; width: 100%; border-radius: 22px; overflow: hidden; box-shadow: 0 14px 34px rgba(36,70,47,.22); background: #7cc7f2; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#game { display: block; width: 100%; height: auto; }

.hud { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.hud-box { min-width: 0; flex: 1; padding: 5px 8px; border-radius: 14px; background: rgba(255,255,255,.86); text-align: center; box-shadow: 0 3px 0 rgba(0,0,0,.08); }
.hud-box span { display: block; font-size: 11px; font-weight: 700; color: #57655a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-box b { display: block; font-size: 22px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.hud-box.combo b { color: var(--red); }
.hud-box.combo.hot { background: #fff1c9; }
.hud-box.combo.pop b { animation: pop .25s ease; }
@keyframes pop { 50% { transform: scale(1.35); } }

.hint { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); padding: 12px 18px; border-radius: 18px; background: rgba(24,33,27,.78); color: #fff; text-align: center; pointer-events: none; width: max-content; max-width: 86%; }
.hint span { display: block; font-size: 19px; font-weight: 800; }
.hint small { display: block; margin-top: 3px; font-size: 13px; opacity: .85; }
.hint[hidden] { display: none; }

.modal { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; background: rgba(20,40,28,.45); backdrop-filter: blur(3px); }
.modal[hidden] { display: none; }
.card { width: 100%; max-width: 360px; max-height: 100%; overflow-y: auto; padding: 18px 16px; border-radius: 22px; background: #fff; text-align: center; box-shadow: 0 18px 40px rgba(0,0,0,.25); }
.card h2 { margin: 0; font-size: 24px; color: var(--forest); }
.big-score { margin: 4px 0 2px; font-size: 54px; font-weight: 800; color: var(--red); line-height: 1; font-variant-numeric: tabular-nums; }
.sub { margin: 4px 0 12px; color: #57655a; font-size: 14px; }
.btn-col { display: grid; gap: 8px; }
.btn { min-height: 46px; border: 0; border-radius: 14px; background: #eef4ef; color: var(--forest); font-weight: 800; font-size: 16px; }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 4px 0 #9b3a26; }
.btn:disabled { opacity: .55; cursor: default; }
.share-row { display: flex; gap: 6px; margin-top: 10px; }
.share-row[hidden] { display: none; }
.share { flex: 1; display: grid; place-items: center; min-height: 42px; padding: 0 6px; border: 0; border-radius: 12px; color: #fff; font-weight: 800; font-size: 13px; text-decoration: none; text-align: center; line-height: 1.15; }
.share.wa { background: #25a35a; }
.share.fb { background: #2f62c9; }
.share.ig { background: linear-gradient(135deg, #f58529, #dd2a7b 55%, #8134af); }

.board { margin-top: 12px; text-align: left; }
.board[hidden] { display: none; }
.board h3 { margin: 10px 0 6px; font-size: 15px; color: var(--forest); }
.board ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.board li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 12px; background: #f6f8f6; font-size: 14px; }
.board li.me { background: #fff1c9; outline: 2px solid var(--mustard); }
.board li .rk { width: 26px; text-align: center; font-weight: 800; }
.board li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4a574d; }
.board li .sc { font-weight: 800; font-variant-numeric: tabular-nums; }
.board .empty, .fine { color: #6b776e; font-size: 13px; }
.board .stat { margin: 6px 0 0; padding: 8px 10px; border-radius: 12px; background: #eef4ef; font-weight: 700; font-size: 14px; color: var(--forest); }
#board-modal .btn { width: 100%; margin-top: 10px; }

.note { margin: 10px 4px 0; color: #6b776e; font-size: 12px; text-align: center; }
.ad-section { width: min(480px, calc(100% - 20px)); min-height: 100px; margin: 14px auto 0; padding: 10px; border-radius: 16px; background: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.06); text-align: center; }
.ad-label { display: block; color: #7a857c; font-size: 11px; letter-spacing: .12em; }
.foot { display: flex; justify-content: center; gap: 18px; padding: 14px 10px 26px; font-size: 14px; }
.foot a { color: var(--forest); font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 10px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; z-index: 20; }
.toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) { .hud-box.combo.pop b { animation: none; } }
