:root { --ink: #3b2f25; --paper: #fffaf0; --gold: #d8a23c; --blue: #3a6cf0; --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9cc4e8; color: var(--ink); font-family: var(--serif); user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }

.round { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 250, 240, .82); color: var(--ink); box-shadow: 0 2px 10px rgba(40, 30, 20, .18); }
.round svg { width: 24px; height: 24px; }
.round.big { width: 58px; height: 58px; }
.round.big svg { width: 30px; height: 30px; }
.pill { min-width: 150px; padding: 13px 26px; border-radius: 30px; background: var(--paper); font-size: 20px; letter-spacing: .02em; box-shadow: 0 3px 14px rgba(40, 30, 20, .2); }
.pill.ghost { background: rgba(255, 250, 240, .55); }

/* the clock: a little sky with the sun or moon going round */
#hud { position: fixed; left: calc(12px + env(safe-area-inset-left)); top: calc(12px + env(safe-area-inset-top)); pointer-events: none; }
#clock { position: relative; width: 44px; height: 44px; filter: drop-shadow(0 2px 6px rgba(40, 30, 20, .2)); }
#dial { width: 44px; height: 44px; }
#day { position: absolute; right: -6px; bottom: -4px; min-width: 18px; padding: 0 4px; border-radius: 9px; background: var(--paper); font-size: 12px; text-align: center; line-height: 18px; }
#day:empty { display: none; }

/* the bag, and whatever you are holding */
#bag { position: fixed; right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); transition: opacity .3s; }
#bag.empty { opacity: .5; }
#bag.new { animation: pop .6s ease; }
@keyframes pop { 30% { transform: scale(1.18); } 60% { transform: scale(.95); } }
#held { position: fixed; right: calc(84px + env(safe-area-inset-right)); bottom: calc(23px + env(safe-area-inset-bottom)); background: var(--paper); box-shadow: 0 0 0 3px var(--gold), 0 2px 10px rgba(40, 30, 20, .2); animation: bob 1.6s ease-in-out infinite; }
#held img { width: 34px; height: 34px; }
@keyframes bob { 50% { transform: translateY(-3px); } }
img.fly { position: fixed; left: 0; top: 0; width: 64px; height: 64px; pointer-events: none; transition: transform .8s cubic-bezier(.5, 0, .3, 1), opacity .8s; z-index: 30; }

#tray { position: fixed; inset: 0; background: rgba(40, 30, 20, .25); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
#trayin { margin: 0 12px calc(88px + env(safe-area-inset-bottom)); padding: 12px; width: min(460px, 100%); border-radius: 22px; background: var(--paper); box-shadow: 0 8px 30px rgba(40, 30, 20, .3); animation: up .25s ease; }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }
#items { display: grid; gap: 8px; }
#items:empty::after { content: ''; display: block; height: 48px; }
.item { display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 8px 12px 8px 8px; border-radius: 16px; background: rgba(216, 162, 60, .1); text-align: left; }
.item.on { box-shadow: inset 0 0 0 2px var(--gold); }
.item img { grid-row: span 2; width: 56px; height: 56px; }
.item .nm { font-size: 17px; }
.item .ds { font-size: 14px; opacity: .7; }

/* speech: a bubble over whoever is talking; a note is a quiet caption */
#bubble { position: fixed; left: 0; top: 0; max-width: min(340px, calc(100vw - 20px)); padding: 10px 16px 12px; border-radius: 20px; background: var(--paper); box-shadow: 0 4px 18px rgba(40, 30, 20, .22); z-index: 10; cursor: pointer; --tail: 50%; }
#bubble::after { content: ''; position: absolute; left: var(--tail); bottom: -9px; width: 18px; height: 18px; margin-left: -9px; background: var(--paper); transform: rotate(45deg); border-radius: 0 0 4px 0; }
#bubble.tailoff::after { display: none; }
#bubble.in { animation: say .22s ease; }
@keyframes say { from { transform-origin: var(--tail) 100%; opacity: 0; } }
#bname { display: block; font-size: 13px; letter-spacing: .08em; text-transform: lowercase; color: #9a7a4a; margin-bottom: 1px; }
#bubble.me #bname { color: #a8761f; }
#bubble.note { background: rgba(255, 250, 240, .9); font-style: italic; }
#bubble.note #bname { display: none; }
#bubble p { margin: 0; font-size: 18px; line-height: 1.32; }
#brest { color: transparent; }

#choices { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(420px, calc(100vw - 24px)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 11; }
.choice { max-width: 100%; padding: 11px 18px; border-radius: 20px 20px 6px 20px; background: #fff3d6; box-shadow: 0 3px 12px rgba(40, 30, 20, .2), inset 0 0 0 2px rgba(216, 162, 60, .55); font-size: 18px; text-align: right; animation: up .25s ease both; }
.choice.act { font-style: italic; background: rgba(255, 250, 240, .92); box-shadow: 0 3px 12px rgba(40, 30, 20, .18); border-radius: 20px; }
.choice:active { transform: scale(.97); }

.bark { position: fixed; left: 0; top: 0; padding: 5px 11px; border-radius: 14px; background: rgba(255, 250, 240, .86); font-size: 15px; font-style: italic; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .35s; z-index: 5; }
.bark.in { opacity: 1; }

/* title and end */
#title { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; background: linear-gradient(rgba(255, 250, 240, .15), rgba(255, 250, 240, 0) 60%); z-index: 15; }
#mark { margin: -16vh 0 0; font-weight: 400; font-size: clamp(52px, 13vw, 96px); letter-spacing: .02em; color: var(--paper); text-shadow: 0 3px 18px rgba(40, 60, 90, .35); }
#tbtns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
#tsmall { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 12px; }
#snd.off .wave { opacity: 0; }
#done { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(14, 20, 46, .55); color: var(--paper); z-index: 16; animation: fade 1.2s ease; }
#done img { width: 120px; height: 120px; filter: drop-shadow(0 0 20px rgba(120, 170, 255, .7)); }
#done p { margin: 0 0 18px; font-size: 22px; font-style: italic; letter-spacing: .04em; }
@keyframes fade { from { opacity: 0; } }
