* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #142b31; color: #f2e9d6; font: 14px system-ui; overscroll-behavior: none; }
main { height: 100dvh; max-width: 760px; margin: auto; padding: 12px; display: grid; grid-template-rows: auto minmax(0,1fr) auto; gap: 8px; }
header { position: relative; padding-right: 48px; }
small { font-size: 10px; color: #a2cdc0; letter-spacing: 1px; }
h1 { font-size: clamp(20px,5vw,28px); margin: 4px 0; }
p { margin: 6px 0; }
#message { font-size: 12px; min-height: 30px; }
#clock { position: absolute; top: 24px; right: 0; font-size: 24px; color: #efd195; }
#stage { position: relative; min-height: 0; border-radius: 24px; overflow: hidden; border: 1px solid #597975; background: radial-gradient(ellipse at top,#48676b,#1b373e); }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#weather { position: absolute; top: 10px; left: 4px; right: 4px; text-align: center; font-size: 11px; pointer-events: none; }
#labels { position: absolute; inset: 0; pointer-events: none; }
.tag { position: absolute; transform: translate(-50%,-50%); font-size: 11px; padding: 2px 4px; border-radius: 5px; background: #183139dc; color: #f9e3b5; white-space: nowrap; }
.controls { display: flex; gap: 8px; }
button { min-width: 44px; min-height: 44px; flex: 1; border: 0; border-radius: 12px; background: #b9dfca; color: #173c3c; font: 700 13px system-ui; touch-action: manipulation; }
button:focus-visible, canvas:focus-visible { outline: 3px solid #ffe0a0; outline-offset: -3px; }
button:disabled { opacity: .5; }
#help { font-size: 11px; line-height: 1.5; color: #bbd0cc; }
#count, #payoff { font-size: 12px; color: #efd195; }
#payoff:empty { display: none; }
@media (orientation: landscape) {
  main { max-width: none; grid-template-columns: 156px minmax(0,1fr) 156px; grid-template-rows: minmax(0,1fr); }
  header, footer { align-self: center; } header { padding: 0; } #clock { position: static; }
  h1 { font-size: 22px; } .controls { flex-direction: column; }
}
@media (max-width: 350px) { main { padding: 6px; gap: 4px; } #help { font-size: 10px; } h1 { margin: 2px 0; } p { margin: 4px 0; } }

.catalog { display:inline-flex; align-items:center; min-width:44px; min-height:44px; color:#efd195; }
header small { display:block; }
.controls { flex-wrap:wrap; gap:4px; }
.controls button { flex:1 1 28%; }
#storage { font-size:11px; }
dialog { max-width:min(360px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto; border:1px solid #efd195; border-radius:20px; background:#183139; color:#f2e9d6; }
dialog::backdrop { background:#071b24aa; }
dialog button { display:block; width:100%; margin:8px 0; }
#fallback:not([hidden]) { position:fixed; inset:20%; background:#183139; padding:20px; z-index:10; }
@media (orientation:landscape) { .controls { flex-direction:row; } .controls button { flex-basis:45%; } main { grid-template-columns:156px minmax(0,1fr) 170px; } }
@media (max-height:600px) and (orientation:portrait) { header .catalog { float:left; margin-right:8px; } small { display:none; } #help { line-height:1.2; } }
@media (prefers-reduced-motion:reduce) { * { scroll-behavior:auto; } }
