:root {
  color-scheme: light;
  --ink: #402f3d;
  --cream: #fff8e8;
  --peach: #f6b8a8;
  --red: #e85158;
  font-family: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%; height: 100%; margin: 0; overflow: hidden; background: #d8c7df;
  overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
body { color: var(--ink); }
button { font: inherit; }
#game-shell { position: fixed; inset: 0; overflow: hidden; background: #eaddeb; isolation: isolate; touch-action: none; -webkit-user-select: none; user-select: none; }
canvas { display: block; width: 100%; height: 100%; cursor: none; touch-action: none; }
.hidden { opacity: 0 !important; pointer-events: none !important; visibility: hidden; }
.panel {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 24px;
  background: radial-gradient(circle at 50% 45%, rgba(255,248,232,.78), rgba(242,196,190,.9));
  transition: opacity .32s ease, visibility .32s;
}
.panel h1, .panel h2 { margin: 6px 0 12px; line-height: .88; letter-spacing: -.055em; text-shadow: 0 4px 0 rgba(255,255,255,.65); }
.panel h1 { font-size: clamp(45px, 9vw, 104px); }
.panel h2 { font-size: clamp(32px, 6vw, 72px); }
#game-over h2 { line-height: 1.08; }
.panel em { color: var(--red); font-style: normal; }
.panel > p:not(.eyebrow,.record) { font-weight: 700; line-height: 1.4; margin: 5px 0 22px; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .2em; font-size: 12px; font-weight: 900; opacity: .65; }
.primary, .secondary, .icon-button {
  border: 0; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, box-shadow .12s ease;
}
.primary {
  padding: 16px 25px; border-radius: 18px; background: #f8d264; font-weight: 1000; font-size: clamp(17px, 3vw, 24px);
  box-shadow: 0 7px 0 #c78e44, 0 12px 24px rgba(70,42,44,.18);
}
.primary:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: 0 9px 0 #c78e44, 0 15px 26px rgba(70,42,44,.18); }
.primary:active { transform: translateY(5px); box-shadow: 0 2px 0 #c78e44; }
.mode-buttons { display: flex; gap: 16px; align-items: stretch; justify-content: center; }
.mode-button { min-width: 190px; display: flex; flex-direction: column; align-items: center; }
.mode-button span { font-size: 1em; text-transform: uppercase; }
.mode-button small { margin: 4px 0 0; font-size: 11px; opacity: .62; text-transform: lowercase; }
.risky-button { color: #f8eaf1; background: #4a3d59; box-shadow: 0 7px 0 #251f31, 0 12px 24px rgba(40,25,48,.28); }
.risky-button:hover { box-shadow: 0 9px 0 #251f31, 0 15px 26px rgba(40,25,48,.32); }
.risky-button:active { box-shadow: 0 2px 0 #251f31; }
.secondary { background: transparent; padding: 13px; font-size: 12px; font-weight: 900; text-decoration: underline; opacity: .65; }
.panel small { margin-top: 22px; opacity: .58; font-weight: 700; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.results { display: flex; gap: 26px; margin: 10px 0 14px; }
.results p { margin: 0; font-size: 13px; font-weight: 900; }
.results strong { display: block; font-size: 27px; }
.record { color: var(--red); font-weight: 1000; animation: pop .55s infinite alternate; margin: 0 0 12px; }
.win-panel { background: radial-gradient(circle at 50% 46%, rgba(255,248,232,.76), rgba(240,178,190,.91)); }
.win-panel h2 { line-height: 1.02; margin-bottom: 15px; }
.win-stats { display: flex; justify-content: center; gap: clamp(12px,3vw,32px); margin: 5px 0 11px; }
.win-stats p { margin: 0; font-size: 11px; font-weight: 1000; letter-spacing: .06em; }
.win-stats strong { display: block; font-size: clamp(19px,3vw,27px); letter-spacing: 0; }
.kitty-love { margin: 2px 0 16px !important; color: #e85170; font-size: 18px; letter-spacing: .06em; }
.win-panel .primary { font-size: clamp(14px,2.5vw,20px); }
#hud { position: absolute; z-index: 3; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 17px; transition: opacity .25s; pointer-events: none; }
#hud > div:not(#multiplier) { min-width: 82px; text-align: center; background: rgba(255,248,232,.72); backdrop-filter: blur(7px); padding: 7px 12px; border-radius: 15px; box-shadow: 0 3px 0 rgba(64,47,61,.12); }
#hud span { display: block; font-size: 9px; letter-spacing: .14em; font-weight: 1000; opacity: .6; }
#hud strong { font-size: 22px; }
#multiplier { min-width: 44px; color: var(--red); font-size: 25px; font-weight: 1000; text-shadow: 0 2px var(--cream); transform: rotate(-5deg); }
.icon-button { position: absolute; z-index: 10; right: max(14px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top)); width: 43px; height: 43px; border-radius: 50%; background: rgba(255,248,232,.75); box-shadow: 0 3px 0 rgba(64,47,61,.16); font-size: 19px; }
.icon-button:active { transform: translateY(3px); box-shadow: none; }
.pause { position: absolute; z-index: 20; inset: 0; display: grid; place-content: center; text-align: center; background: rgba(64,47,61,.48); color: white; font-size: 44px; font-weight: 1000; letter-spacing: .06em; transition: opacity .2s; }
.pause small { font-size: 14px; }
#rotate-hint { display: none; }
@keyframes pop { to { transform: scale(1.09) rotate(-2deg); } }
@media (max-height: 500px) {
  .panel { justify-content: center; padding: 12px; }
  .panel h1 { font-size: clamp(38px, 11vh, 68px); }
  .panel h2 { font-size: clamp(26px, 9vh, 48px); }
  .panel > p:not(.eyebrow,.record) { margin-bottom: 10px; }
  .panel small { margin-top: 12px; }
  .primary { padding: 11px 20px; }
}
@media (max-width: 370px) { #hud { left: 12px; transform: none; gap: 6px; } #hud > div:not(#multiplier) { min-width: 63px; padding: 6px; } }
@media (max-width: 520px) { .mode-buttons { width: min(100%, 330px); flex-direction: column; gap: 11px; } .mode-button { width: 100%; min-width: 0; padding: 13px 18px; } }
@media (prefers-reduced-motion: reduce) { .panel, button { transition-duration: .01ms !important; } }
