:root {
  --paper: #f4e7c9;
  --surface: #fff8e8;
  --ink: #342721;
  --muted: #765d4d;
  --peach: #f2a44b;
  --rose: #ed6d88;
  --mint: #a9c8a0;
  --line: #342721;
}

html, body { background: var(--paper); }
body { overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
.route { min-height: 100dvh; padding: 12px 16px 16px; }
#game-shell { max-width: 740px; margin: 0 auto; }
.topbar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; min-height: 44px; }
.home-link, .topbar p, .result-kicker { font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.home-link { min-width: 52px; min-height: 48px; display: inline-grid; place-items: center; text-decoration: none; border-bottom: 2px solid var(--line); }
.topbar p { margin: 0; text-align: center; color: var(--muted); }
h1 { margin: 0; font-size: clamp(22px, 5vw, 38px); line-height: 1; letter-spacing: -.05em; text-align: right; }
.hud { display: flex; justify-content: center; gap: 20px; margin-top: 4px; font-size: 11px; letter-spacing: .1em; }
.hud strong { color: var(--rose); font-size: 17px; }
.instruction { margin: 8px auto 10px; text-align: center; color: var(--muted); font-size: 14px; }
.instruction[data-active="true"] { color: var(--rose); font-weight: 900; }
.playfield { display: grid; place-items: center; }
.art-wrapper { position: relative; width: min(76vw, 500px); aspect-ratio: 1; background: #e8d5ad; overflow: visible; }
.character-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; }
.targets { position: absolute; inset: 0; }
.target { position: absolute; transform: translate(-50%, -50%); width: clamp(50px, 13vw, 74px); aspect-ratio: 1; padding: 4px; border: 3px dashed currentColor; background: rgb(255 248 232 / .34); border-radius: 50%; cursor: pointer; touch-action: manipulation; }
.target[data-shape="heart"] { color: var(--rose); }
.target[data-shape="star"] { color: #c68b12; }
.target[data-shape="flower"] { color: #6f9b61; }
.target img { width: 100%; height: 100%; opacity: .23; pointer-events: none; }
.target.placed { border-style: solid; background: transparent; }
.target.placed img { opacity: 1; }
.floating-sticker { position: absolute; width: 62px; height: 62px; transform: translate(-50%, -50%); pointer-events: none; z-index: 4; }
.floating-sticker img { width: 100%; height: 100%; }
.tray-area { margin: 10px auto 0; max-width: 500px; }
.tray-area h2 { margin: 0 0 4px; font-size: 11px; letter-spacing: .14em; text-align: center; }
.sticker-tray { min-height: 74px; display: flex; justify-content: center; gap: 12px; }
.sticker-button { width: 72px; height: 72px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); cursor: grab; touch-action: none; }
.sticker-button img { width: 56px; height: 56px; pointer-events: none; }
.sticker-button[aria-pressed="true"] { background: #f6c9ae; border-color: var(--rose); outline: 4px solid rgba(229, 89, 91, .2); transform: scale(1.06); }
.targets.is-armed .target:not(.placed) { border-style: solid; background: rgba(255, 248, 232, .82); }
.sticker-button.placed { opacity: .24; cursor: default; }
.result-screen { position: fixed; inset: 0; z-index: 10; display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 360px); align-items: center; gap: clamp(12px, 4vw, 64px); padding: 24px max(20px, env(safe-area-inset-right)) 24px max(20px, env(safe-area-inset-left)); background: var(--paper); }
.result-art { position: relative; width: min(65vw, 600px); aspect-ratio: 1; justify-self: end; background: #e8d5ad; }
.result-art > img { width: 100%; height: 100%; object-fit: contain; }
.result-overlay { position: absolute; transform: translate(-50%, -50%); width: 12%; height: 12%; }
.result-overlay img { width: 100%; height: 100%; }
.result-copy { max-width: 340px; }
.result-kicker { color: var(--rose); }
.result-copy h2 { margin: 6px 0; font-size: clamp(32px, 6vw, 58px); line-height: .92; letter-spacing: -.06em; }
.result-copy p { color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.result-actions button { min-width: 120px; min-height: 52px; padding: 10px 18px; border: 2px solid var(--line); border-radius: 12px; background: var(--peach); font-weight: 900; cursor: pointer; }
.result-actions #result-secondary { background: var(--surface); }
[hidden] { display: none !important; }
@media (max-width: 560px) {
  .route { padding-top: 8px; }
  .topbar { grid-template-columns: auto 1fr; }
  .topbar p { grid-column: 2; grid-row: 1; text-align: right; }
  h1 { grid-column: 1 / -1; grid-row: 2; text-align: center; }
  .instruction { margin-top: 5px; }
  .art-wrapper { width: min(84vw, 420px); }
  .result-screen { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; gap: 6px; padding-top: 14px; padding-bottom: 14px; overflow: auto; }
  .result-art { width: min(72vw, 340px); justify-self: center; }
  .result-copy { max-width: 440px; width: 100%; margin: 0 auto; text-align: center; }
  .result-actions { justify-content: center; margin-top: 8px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .route { padding: 8px 14px; }
  .topbar { min-height: 32px; }
  .instruction { margin: 3px 0; }
  .art-wrapper { width: min(66vh, 330px); }
  .tray-area { position: absolute; right: 12px; top: 104px; width: 94px; }
  .sticker-tray { display: grid; grid-template-columns: 1fr; }
  .result-screen { grid-template-columns: minmax(0, 1fr) minmax(250px, 360px); padding: 12px 20px; }
  .result-art { width: min(46vh, 300px); }
  .result-copy { text-align: left; }
  .result-actions { justify-content: flex-start; margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .sticker-button, .result-actions button { transition: none; }
}
