* { box-sizing: border-box; }
html,body { margin:0; height:100%; overflow:hidden; background:#0f4a56; color:#f4f8f2; font:14px system-ui; overscroll-behavior:none; }
main { height:100dvh; max-width:760px; margin:auto; padding:10px; display:grid; grid-template-rows:auto minmax(0,1fr) auto; gap:8px; }
header { position:relative; padding-right:60px; } small { font-size:9px; letter-spacing:1px; color:#ffd36b; }
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:#ffd36b; }
#stage { position:relative; min-height:0; overflow:hidden; border:1px solid #8fd6d6; border-radius:24px; background:#bfe7f2; touch-action:none; }
canvas { display:block; width:100%; height:100%; touch-action:none; }
#weather { position:absolute; top:9px; left:0; right:0; text-align:center; font-size:11px; color:#10343c; text-shadow:0 1px 0 #ffffffaa; pointer-events:none; }
.controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; }
button { min-width:44px; min-height:44px; flex:1; border:0; border-radius:12px; background:#f6f1d8; color:#10343c; font:700 13px system-ui; touch-action:manipulation; }
:focus-visible { outline:3px solid #ffd36b; outline-offset:-3px; } #help { font-size:11px; line-height:1.4; color:#d8ecef; } #count { font-size:12px; color:#ffd36b; }
.catalog { display:inline-flex; align-items:center; justify-content:center; min-height:44px; min-width:44px; color:#ffe08a; font-weight:700; }
header .catalog { margin-right:10px; }
#storage { font-size:11px; margin:3px 0; } #storage:empty { display:none; }
dialog { max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); width:350px; border:1px solid #8fd6d6; border-radius:20px; padding:18px; background:#124a56; color:#f4f8f2; }
dialog::backdrop { background:#041a20cc; } dialog button { padding:8px 14px; margin:4px 0; } dialog h2 { margin:0 0 10px; font-size:22px; }
#fallback:not([hidden]) { position:fixed; inset:20px; z-index:5; background:#124a56; border:2px solid #f6f1d8; border-radius:20px; padding:24px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px; }
#fallback button { flex:0; padding:10px 24px; }
#shelf { position:absolute; left:8px; right:8px; bottom:8px; display:flex; gap:5px; z-index:2; }
#shelf button { height:56px; flex:1; padding:2px; font-size:11px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; background:#fff8e6e6; user-select:none; -webkit-user-select:none; }
#shelf button i { width:18px; height:22px; border-radius:6px 6px 4px 4px; border:2px solid #10343c; } #shelf button.on { outline:3px solid #ffd36b; background:#fff; } #shelf button:disabled { opacity:.5; }
#ticket { position:absolute; left:8px; top:30px; z-index:2; display:flex; gap:6px; padding:6px; border-radius:10px; background:#10343ccc; color:#fff8e6; font-size:11px; width:min(150px,44%); height:min(150px,26%); pointer-events:none; }
#ticket .stack { flex:0 0 22px; display:flex; flex-direction:column; border:2px solid #fff8e6; border-radius:4px 4px 8px 8px; overflow:hidden; } #ticket .stack i { display:block; }
#ticket ol { margin:0; padding:0; list-style:none; display:flex; flex-direction:column; flex:1; } #ticket li { display:flex; align-items:center; min-height:12px; line-height:1; }
#lever { position:absolute; right:10px; top:44px; bottom:84px; width:64px; z-index:2; border-radius:32px; background:#10343c99; border:2px solid #fff8e6; touch-action:none; user-select:none; -webkit-user-select:none; }
#lever span { position:absolute; left:0; right:0; top:50%; text-align:center; font-size:11px; color:#fff8e6; pointer-events:none; }
#lever i { position:absolute; left:50%; top:0; width:52px; height:52px; margin:0 0 0 -26px; transform:translateY(-1px); border-radius:50%; background:#ffd36b; box-shadow:0 3px 0 #a8742a; pointer-events:none; } #lever.fast i { background:#e8604d; }
@media (orientation:landscape) { main { max-width:none; grid-template-columns:165px minmax(0,1fr) 190px; grid-template-rows:minmax(0,1fr); } header,footer { align-self:center; } header { padding:0; } #clock { position:static; } .controls { grid-template-columns:1fr 1fr; } #help { font-size:10px; } #ticket { height:min(120px,34%); } #lever { top:30px; } }
@media (max-width:350px) { main { padding:6px; gap:4px; } small { display:none; } #help { display:none; } header .catalog { font-size:12px; } #message { margin:3px 0; } h1 { margin:0; } }
@media (max-width:350px) and (orientation:portrait) {
  header { display:flex; flex-wrap:wrap; align-items:center; padding-right:56px; } header h1 { font-size:18px; margin:0; }
  #message { flex-basis:100%; font-size:11px; min-height:0; margin:2px 0; line-height:1.2; } #clock { top:6px; font-size:20px; }
  .controls { display:flex; gap:3px; } .controls button { min-width:44px; padding:0 1px; font-size:10px; line-height:1.05; } #count { margin:2px 0; font-size:11px; }
  #shelf button { height:48px; font-size:10px; } #ticket { font-size:10px; } #lever { width:56px; top:40px; }
}
