* { box-sizing: border-box; margin: 0; padding: 0; }
:root { --ink: #2b1d14; --paper: #fbf3e0; --gold: #f5b82e; --red: #d62839; --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  background: #f6e7c8; color: var(--ink); overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#wrap { position: fixed; inset: 0; touch-action: none; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#hud {
  position: absolute; left: 0; right: 0; top: 0; pointer-events: none;
  padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left));
  display: flex; justify-content: space-between; align-items: flex-start;
}
#scoreBox { background: var(--paper); border: 2.5px solid var(--ink); border-radius: 14px; padding: 6px 14px 7px; box-shadow: 3px 4px 0 var(--ink); transform: rotate(-1.5deg); }
#score { font-family: var(--serif); font-size: clamp(32px, 9vw, 48px); font-weight: 900; line-height: 1; }
#meta { font-weight: 800; font-size: 13px; letter-spacing: .05em; margin-top: 2px; }
#combo { color: #a86d00; margin-left: 8px; }
#bestBox { font-weight: 900; font-size: 13px; letter-spacing: .08em; background: var(--paper); border: 2px solid var(--ink); box-shadow: 2px 3px 0 var(--ink); padding: 6px 10px; border-radius: 999px; margin-right: 96px; margin-top: 4px; }

#cornerBtns {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right));
  display: flex; gap: 8px;
}
#cornerBtns button {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); box-shadow: 2px 3px 0 var(--ink);
  background: var(--paper); color: var(--ink); font: 900 17px var(--serif); cursor: pointer;
}
#cornerBtns button:active { transform: translate(2px, 3px); box-shadow: none; }

.card {
  position: absolute; left: 50%; top: 36%; transform: translate(-50%, 0);
  text-align: center; pointer-events: none; width: min(88vw, 440px);
}
.card h1 { font-family: var(--serif); font-size: clamp(46px, 14vw, 78px); font-weight: 900; line-height: .95; color: var(--ink);
  text-shadow: 3px 3px 0 var(--paper), -2px -2px 0 var(--paper), 2px -2px 0 var(--paper), -2px 2px 0 var(--paper), 5px 6px 0 rgba(43,29,20,.25); }
.card h1 span { color: var(--gold); -webkit-text-stroke: 2px var(--ink); }
.card h2 { font-family: var(--serif); font-size: clamp(30px, 9vw, 46px); font-weight: 900; letter-spacing: .03em; }
.card .tag { margin-top: 14px; font-size: clamp(15px, 4.3vw, 19px); font-weight: 700; line-height: 1.4; display: inline-block;
  background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 3px 4px 0 var(--ink); padding: 10px 16px; border-radius: 14px; transform: rotate(1deg); }
.card .tag b { color: #a86d00; } .card .tag i { color: var(--red); font-style: normal; font-weight: 900; }
.card .cta { margin-top: 18px; font-size: 14px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--ink);
  display: inline-block; background: var(--gold); border: 2px solid var(--ink); border-radius: 999px; padding: 6px 14px; animation: pulse 1.2s ease-in-out infinite; }
.card .big { font-family: var(--serif); font-size: clamp(48px, 14vw, 78px); font-weight: 900; line-height: 1; margin-top: 6px; }
.card .sub { font-weight: 800; margin-top: 6px; }
#newBest { color: #a86d00; font-weight: 900; letter-spacing: .1em; margin-top: 8px; }
#overCard { top: 24%; background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 20px 16px; box-shadow: 5px 6px 0 var(--ink); transform: translate(-50%, 0) rotate(-1.5deg); width: min(78vw, 360px); }
#pauseCard { top: 40%; background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 16px; box-shadow: 5px 6px 0 var(--ink); width: min(70vw, 300px); }
@keyframes pulse { 0%,100% { opacity: .7; } 50% { opacity: 1; } }

#hint {
  position: absolute; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  font-weight: 900; font-size: clamp(15px, 4.4vw, 18px); letter-spacing: .04em; white-space: nowrap; color: var(--ink);
  background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 3px 4px 0 var(--ink); padding: 9px 16px; border-radius: 999px;
  pointer-events: none; animation: pulse 1.1s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .card .cta, #hint { animation: none; } }
