* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e9d8b4; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, "Noto Color Emoji"; color: #2b2116; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
.hidden { display: none !important; }
#top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; gap: 8px; padding: calc(env(safe-area-inset-top) + 8px) 10px 0; pointer-events: none; }
#top > * { pointer-events: auto; }
#clockBox { background: rgba(255, 250, 240, .86); border-radius: 14px; padding: 6px 12px 7px; display: flex; flex-direction: column; min-width: 92px; box-shadow: 0 2px 10px rgba(60, 40, 10, .15); }
#kicker { white-space: nowrap; font-size: 11px; letter-spacing: .08em; font-weight: 700; color: #8a6d45; }
#clock { font-size: 28px; line-height: 1.05; font-variant-numeric: tabular-nums; }
#clockSub { font-size: 12px; color: #6b5a44; }
#goals { flex: 1; min-width: 0; background: rgba(255, 250, 240, .78); border-radius: 14px; padding: 6px 10px; font-size: 13px; line-height: 1.45; box-shadow: 0 2px 10px rgba(60, 40, 10, .12); }
#goals:empty { visibility: hidden; }
#goals b { font-variant-numeric: tabular-nums; }
#goals .set { color: #b3361f; font-weight: 700; }
#topBtns { display: flex; gap: 6px; }
.icon { width: 46px; height: 46px; border-radius: 50%; background: rgba(255, 250, 240, .86); font-size: 19px; box-shadow: 0 2px 10px rgba(60, 40, 10, .15); }
#speed { font-weight: 800; font-size: 16px; }
#intro { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 84px); transform: translateX(-50%); width: min(92vw, 420px); background: rgba(255, 250, 240, .92); border-radius: 16px; padding: 12px 14px; font-size: 14px; line-height: 1.45; box-shadow: 0 4px 18px rgba(60, 40, 10, .18); pointer-events: none; transition: opacity .5s; }
#intro h1 { font-size: 20px; margin: 0 0 4px; }
#intro .find { margin-top: 6px; color: #5d4a30; }
#intro.gone { opacity: 0; }
#banner { position: fixed; left: 50%; top: 34%; transform: translate(-50%, -50%); background: rgba(255, 250, 240, .94); padding: 12px 20px; border-radius: 16px; font-size: 22px; font-weight: 800; text-align: center; box-shadow: 0 6px 24px rgba(0, 0, 0, .2); pointer-events: none; }
#banner small { display: block; font-size: 13px; font-weight: 500; color: #6b5a44; }
#dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 8px calc(env(safe-area-inset-bottom) + 8px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
#dock > * { pointer-events: auto; }
#bucketRow { display: flex; align-items: center; gap: 8px; font-size: 12px; background: rgba(255, 250, 240, .82); padding: 4px 10px; border-radius: 12px; }
#bucket { width: 140px; height: 10px; border-radius: 5px; background: rgba(120, 90, 50, .2); overflow: hidden; }
#bucketFill { display: block; height: 100%; width: 50%; background: linear-gradient(90deg, #c99a52, #e2bd7a); transition: width .15s; }
#bucketRow.low #bucketFill { background: #d0573a; }
#tools { display: flex; gap: 6px; background: rgba(255, 250, 240, .86); padding: 6px; border-radius: 18px; box-shadow: 0 3px 14px rgba(60, 40, 10, .18); }
#tools button { width: 58px; height: 58px; border-radius: 13px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
#tools button span { font-size: 24px; line-height: 1; }
#tools button small { font-size: 11px; margin-top: 3px; color: #5d4a30; }
#tools button.sel { background: #f6c66a; box-shadow: inset 0 0 0 2px #b9832d; }
#tools button.used { opacity: .4; }
#tools em { position: absolute; top: 2px; right: 4px; font-style: normal; font-size: 10px; font-weight: 700; color: #8a6d45; }
#actions { display: flex; gap: 8px; }
#actions button { height: 46px; border-radius: 23px; background: rgba(255, 250, 240, .9); padding: 0 16px; font-weight: 700; box-shadow: 0 2px 10px rgba(60, 40, 10, .15); }
#undo { width: 46px; padding: 0 !important; font-size: 20px; }
#tideBtn { background: #2d7f9a !important; color: #fff; }
body.tide #dock { display: none; }
body.film #top, body.film #dock { display: none; }
#sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100vw, 440px); max-height: 92vh; overflow-y: auto; background: #fffaf0; border-radius: 22px 22px 0 0; padding: 16px 18px calc(env(safe-area-inset-bottom) + 14px); box-shadow: 0 -6px 30px rgba(40, 25, 5, .25); text-align: center; }
.kicker { font-size: 12px; letter-spacing: .06em; color: #8a6d45; }
#sheet h2 { font-size: 46px; margin: 2px 0 2px; font-variant-numeric: tabular-nums; }
#sBody { font-size: 15px; line-height: 1.5; }
#sBody .line { font-family: ui-monospace, Menlo, monospace, "Noto Color Emoji"; background: #f3ead8; border-radius: 8px; padding: 6px 8px; margin: 8px 0; font-size: 14px; }
.new { background: #e8443a; color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 12px; font-weight: 800; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 6px; }
.btns button { min-height: 46px; padding: 0 16px; border-radius: 23px; background: #efe3cb; font-weight: 700; }
.btns button.primary { background: #2d7f9a; color: #fff; }
.note { font-size: 13px; color: #6b5a44; margin: 6px 0; }
#sAsk .q { font-weight: 700; margin: 12px 0 6px; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chips button, #door button { min-height: 44px; padding: 0 12px; border-radius: 22px; background: #f3ead8; font-size: 13px; }
#door { margin-top: 10px; }
.foot { font-size: 12px; color: #8a7a62; margin: 12px 0 0; line-height: 1.6; }
.foot a, #sAsk a { color: #2d7f9a; }
#filmCap { position: fixed; top: calc(env(safe-area-inset-top) + 14px); left: 50%; transform: translateX(-50%); background: rgba(20, 30, 40, .55); color: #fff; padding: 8px 16px; border-radius: 14px; font-weight: 700; font-size: 17px; text-align: center; pointer-events: none; }
#filmCap small { display: block; font-weight: 500; font-size: 12px; opacity: .85; }
#toast { position: fixed; left: 50%; bottom: 190px; transform: translateX(-50%); background: rgba(30, 25, 15, .85); color: #fff; padding: 9px 14px; border-radius: 12px; font-size: 14px; max-width: 90vw; text-align: center; pointer-events: none; }
#skip { position: fixed; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 14px); }
.touch .desk, body:not(.touch) .tch { display: none; }
@media (pointer: fine) and (min-width: 900px) {
  #top { padding: 14px 18px 0; }
  #goals { flex: 0 1 420px; margin-left: auto; margin-right: auto; }
  #dock { flex-direction: row; justify-content: center; align-items: flex-end; gap: 14px; padding-bottom: 16px; }
  #bucketRow { flex-direction: column; padding: 8px 12px; }
  #sheet { bottom: 50%; transform: translate(-50%, 50%); border-radius: 22px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #intro { top: 70px; font-size: 12px; }
  #tools button { width: 48px; height: 48px; }
  #sheet { max-height: 100vh; }
  #sheet h2 { font-size: 32px; }
}
