* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #3a2a20; color: #fff6e6; font-family: system-ui, -apple-system, "Hiragino Sans", sans-serif; }
body { touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
#app { position: relative; display: flex; flex-direction: column; height: 100vh; height: 100dvh; background: linear-gradient(#6b5242, #3a2a20); }
.top1 { display: flex; align-items: center; gap: 2px; height: 48px; flex: none; padding: 0 6px; width: 100%; max-width: 480px; margin: 0 auto; }
.top1 h1 { flex: 1; min-width: 0; text-align: center; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(20, 10, 4, .8); }
.top1 button { display: flex; align-items: center; justify-content: center; gap: 4px; height: 44px; flex: none; padding: 0 8px; }
.top1 [data-testid="btn-list"] { min-width: 66px; }
.top1 [data-testid="btn-lang"] { min-width: 60px; font-size: 13px; }
.top1 small { font-size: 12px; font-variant-numeric: tabular-nums; }
[data-testid="btn-mute"] .slash, [data-testid="btn-mute"][data-muted="1"] .waves { display: none; }
[data-testid="btn-mute"][data-muted="1"] .slash { display: inline; }
.top2 { height: 28px; flex: none; padding: 4px 56px 0 14px; width: 100%; max-width: 480px; margin: 0 auto; font-size: 16px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(20, 10, 4, .8); }
.top2 .over { color: #ffb257; }
button { font: inherit; color: #fff6e6; background: rgba(255, 246, 230, .12); border: 1px solid rgba(255, 246, 230, .35); border-radius: 14px; min-width: 44px; min-height: 44px; padding: 0 10px; cursor: pointer; touch-action: manipulation; }
button:active { transform: scale(.96); }
/* 上の button の指定が感想の吹き出し（部品のファイルは変えない）を 44px に広げ、窓枠にかかるので、部品の大きさ 30px に戻す */
button.dafb-btn.dafb-compact { min-width: 30px; min-height: 30px; width: 30px; height: 30px; padding: 7px; }
button:disabled { opacity: .55; }
button.primary { background: #f2a93b; border-color: #ffd488; color: #2b1b0e; font-weight: 700; }
button.icon { background: transparent; border-color: transparent; }
#stage { position: relative; flex: 1; min-height: 0; touch-action: none; cursor: crosshair; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#stage.enter canvas { animation: enter .35s ease-out; }
@keyframes enter { from { opacity: .15; transform: translateX(22px); } to { opacity: 1; transform: none; } }
#fx { pointer-events: none; }
#hint, #banner { position: absolute; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 16px); text-align: center; font-size: 15px; line-height: 1.35; background: rgba(43, 27, 14, .78); padding: 3px 14px; border-radius: 999px; pointer-events: none; }
#hint { bottom: 2px; }
#hint.warn { background: #f2a93b; color: #2b1b0e; font-weight: 700; animation: nudge .45s ease-in-out; }
@keyframes nudge { 0% { transform: translateX(-50%) scale(.85); } 55% { transform: translateX(-50%) scale(1.12); } 100% { transform: translateX(-50%) scale(1); } }
/* 窓の名札は景色に溶けないよう、塗りつぶして太字にする */
#banner { bottom: 1px; font-size: 16px; font-weight: 700; background: #2b1b0e; border: 1.5px solid #ffd488; color: #fff6e6; animation: banner 2.2s ease forwards; }
#banner.daily { border-radius: 16px; animation-duration: 3.4s; }
#banner span { display: block; font-size: 13px; font-weight: 600; color: #ffe3a8; }
.top2 { touch-action: none; } /* ここからも引き始められる（ui/input.js） */
/* 広い画面は帯を画面の幅にする（字の位置は同じ）。窓6 の斜めの1筆の始点は、480px の帯より外にある */
@media (min-width: 760px) and (min-height: 560px) { .top2 { max-width: none; padding-left: calc(50% - 226px); padding-right: calc(50% - 184px); } }
@keyframes banner { 0% { opacity: 0; } 6%, 90% { opacity: 1; } 100% { opacity: 0; } }
/* やり直し: 泡が上から 0.3秒で戻る */
#foam-return { position: absolute; pointer-events: none; background: radial-gradient(circle at 12% 8%, #fff 0 8px, rgba(196,212,219,.55) 17px, rgba(255,255,255,.85) 19px, transparent 26px), radial-gradient(circle at 47% 5%, #fff 0 5px, rgba(196,212,219,.55) 11px, rgba(255,255,255,.85) 13px, transparent 17px), radial-gradient(circle at 78% 11%, #fff 0 10px, rgba(196,212,219,.55) 20px, rgba(255,255,255,.85) 22px, transparent 31px), radial-gradient(circle at 30% 19%, #fff 0 4px, rgba(196,212,219,.55) 9px, rgba(255,255,255,.85) 11px, transparent 14px), radial-gradient(circle at 63% 24%, #fff 0 7px, rgba(196,212,219,.55) 14px, rgba(255,255,255,.85) 16px, transparent 22px), radial-gradient(circle at 91% 27%, #fff 0 6px, rgba(196,212,219,.55) 12px, rgba(255,255,255,.85) 14px, transparent 18px), radial-gradient(circle at 8% 33%, #fff 0 6px, rgba(196,212,219,.55) 13px, rgba(255,255,255,.85) 15px, transparent 20px), radial-gradient(circle at 42% 37%, #fff 0 11px, rgba(196,212,219,.55) 22px, rgba(255,255,255,.85) 24px, transparent 34px), radial-gradient(circle at 74% 41%, #fff 0 5px, rgba(196,212,219,.55) 10px, rgba(255,255,255,.85) 12px, transparent 15px), radial-gradient(circle at 22% 49%, #fff 0 9px, rgba(196,212,219,.55) 19px, rgba(255,255,255,.85) 21px, transparent 29px), radial-gradient(circle at 56% 53%, #fff 0 6px, rgba(196,212,219,.55) 12px, rgba(255,255,255,.85) 14px, transparent 19px), radial-gradient(circle at 87% 57%, #fff 0 9px, rgba(196,212,219,.55) 18px, rgba(255,255,255,.85) 20px, transparent 27px), radial-gradient(circle at 11% 64%, #fff 0 5px, rgba(196,212,219,.55) 10px, rgba(255,255,255,.85) 12px, transparent 16px), radial-gradient(circle at 38% 69%, #fff 0 8px, rgba(196,212,219,.55) 16px, rgba(255,255,255,.85) 18px, transparent 24px), radial-gradient(circle at 68% 72%, #fff 0 11px, rgba(196,212,219,.55) 22px, rgba(255,255,255,.85) 24px, transparent 33px), radial-gradient(circle at 93% 78%, #fff 0 4px, rgba(196,212,219,.55) 9px, rgba(255,255,255,.85) 11px, transparent 14px), radial-gradient(circle at 19% 83%, #fff 0 10px, rgba(196,212,219,.55) 20px, rgba(255,255,255,.85) 22px, transparent 30px), radial-gradient(circle at 51% 87%, #fff 0 6px, rgba(196,212,219,.55) 12px, rgba(255,255,255,.85) 14px, transparent 18px), radial-gradient(circle at 80% 91%, #fff 0 8px, rgba(196,212,219,.55) 16px, rgba(255,255,255,.85) 18px, transparent 25px), radial-gradient(circle at 33% 96%, #fff 0 7px, rgba(196,212,219,.55) 14px, rgba(255,255,255,.85) 16px, transparent 21px), linear-gradient(160deg, #fbfdfc, #e6eeef 55%, #f4f8f7); animation: foam-return .45s ease-out forwards; }
@keyframes foam-return { 0% { clip-path: inset(0 0 100% 0); opacity: .95; } 66% { clip-path: inset(0 0 0 0); opacity: .9; } 100% { clip-path: inset(0 0 0 0); opacity: 0; } }
.bottom { display: flex; gap: 10px; flex: none; height: calc(80px + env(safe-area-inset-bottom)); padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); width: 100%; max-width: 480px; margin: 0 auto; }
.bottom button { display: flex; align-items: center; justify-content: center; gap: 7px; height: 56px; font-size: 17px; line-height: 1.2; }
[data-testid="btn-retry"] { width: 112px; flex: none; }
.bottom [data-testid="btn-retry"] { font-size: 13px; gap: 5px; padding: 0 6px; }
[data-testid="btn-sunset"], [data-testid="btn-skip"] { flex: 1; }
[data-testid="btn-sunset"].pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255, 212, 136, .35); } }
#app[data-screen="sunset"] [data-testid="btn-retry"], #app[data-screen="sunset"] [data-testid="btn-sunset"] { visibility: hidden; }
#app[data-screen="sunset"] .top1, #app[data-screen="sunset"] .top2 { opacity: .0; pointer-events: none; transition: opacity .3s; }
#app[data-screen="result"] .top2 { visibility: hidden; }
#app[data-screen="sunset"] [data-testid="btn-skip"] { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(452px, 90%); }
#app[data-screen="result"] .bottom { display: none; }
@media (max-height: 700px) {
  .top1 { height: 44px; } .top2 { height: 32px; padding-top: 4px; } /* 感想の吹き出し（上から46px、高さ30px）を窓枠にかけない */
  .bottom { height: calc(72px + env(safe-area-inset-bottom)); padding-top: 6px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}
/* 低い横向き: 下の帯の2ボタンを窓の右へ縦に並べる */
@media (orientation: landscape) and (max-height: 559px) {
  #stage { margin-right: 150px; }
  .top2 { position: absolute; z-index: 1; left: 12px; top: 48px; width: auto; padding: 0; pointer-events: none; }
  .bottom { position: absolute; right: 8px; bottom: 8px; width: 138px; height: auto; flex-direction: column; padding: 0; }
  .bottom button, [data-testid="btn-retry"] { width: 100%; flex: none; }
  .bottom [data-testid="btn-sunset"] { flex-direction: column; gap: 0; font-size: 14px; white-space: nowrap; }
  #app[data-screen="sunset"] [data-testid="btn-skip"] { left: auto; right: 8px; transform: none; width: 138px; bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  #stage.enter canvas, #foam-return, [data-testid="btn-sunset"].pulse { animation-duration: .01s; animation-iteration-count: 1; }
}
.no-draw { margin: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }
