/* COZY · the item bar and the bag, in COZYART's look B: a string of paper chōchin (their preview/itembar; Derek's
   working default, so a pick of A or C is a re-skin). On the kit's tokens: load after ui/kit.css.
   Each cell's .ib-face is what moves (lifted, pressed, swung on its string), so the row's layout never shifts; .ib-hl,
   the lantern light, slides along the string to the picked one. --s the cell, --g the gap (CSS px). */
.ib { --s: 56px; --g: 8px; position: fixed; left: 50%; bottom: max(6px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  display: flex; align-items: flex-end; gap: 6px; -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; }
.ib[hidden] { display: none; }
.ib.phone { --s: 44px; --g: 6px; }
@media (max-width: 359px) { .ib.phone { --s: 40px; --g: 5px; } }   /* (the one accepted exception: 320 px phones) */
.ib-strip { position: relative; touch-action: pan-y; }
.ib.paged .ib-strip { overflow-x: clip; overflow-y: visible; }   /* (a phone's page of the string: the rest off to the side) */
.ib-row { position: relative; display: flex; gap: var(--g); padding: 18px 12px 24px; will-change: transform; }
.ib-cell { position: relative; width: var(--s); height: var(--s); flex: none; padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; }
.ib-cell:focus-visible { outline: 3px solid var(--ck-focus); outline-offset: 2px; border-radius: 12px; }
.ib-face { position: absolute; inset: 4px 4px 0; display: grid; place-items: center; transform-origin: 50% -6px; border-radius: 44% / 32%;
  background: repeating-linear-gradient(180deg, rgba(var(--ck-shade), .13) 0 1.2px, transparent 1.2px 7px),
              radial-gradient(ellipse at 50% 42%, #fffaf0 0%, var(--ck-paper) 50%, var(--ck-paper-deep) 100%);
  box-shadow: inset 0 0 0 1.5px rgba(var(--ck-shade), .2), 0 9px 14px -9px rgba(var(--ck-shade), .75); }
.ib-face::before, .ib-face::after { content: ""; position: absolute; left: 20%; right: 20%; height: 6px; border-radius: 3px; background: var(--ck-sumi); z-index: 3; }
.ib-face::before { top: -3px; }
.ib-face::after { bottom: -3px; }
.ib-face canvas { width: calc(var(--s) * .62); height: calc(var(--s) * .62); position: relative; z-index: 2; pointer-events: none; }
.ib-lit { position: absolute; inset: 0; border-radius: inherit; opacity: 0; z-index: 1;
  background: repeating-linear-gradient(180deg, rgba(160, 80, 20, .14) 0 1.2px, transparent 1.2px 7px),
              radial-gradient(ellipse at 50% 45%, #fff8e2 0%, var(--ck-lantern-soft) 34%, var(--ck-lantern-glow) 70%, var(--ck-lantern) 100%);
  box-shadow: 0 0 22px 8px rgba(255, 207, 110, .7); }
.ib-cell[aria-pressed="true"] .ib-lit { opacity: 1; }
.ib-string { position: absolute; left: 50%; top: -14px; width: 1.5px; height: 18px; background: var(--ck-timber); }
.ib-count { position: absolute; right: 50%; bottom: -20px; transform: translateX(50%); z-index: 4; min-width: 18px; height: 18px; padding: 0 5px;   /* (hung below the lantern's cap) */
  border-radius: 2px 2px 5px 5px; color: var(--ck-sumi); background: linear-gradient(#f0d2a0, #d9ad74); text-align: center;
  font: 700 12px/18px var(--ck-font-ui); box-shadow: 0 2px 3px rgba(var(--ck-shade), .45); pointer-events: none; }
.ib.phone .ib-count { min-width: 16px; height: 16px; font-size: 11px; line-height: 16px; padding: 0 4px; bottom: -18px; }
.ib-key { position: absolute; left: 50%; top: -30px; transform: translateX(-50%); z-index: 3; font: 700 10px/1 var(--ck-font-ui);
  color: var(--ck-cream-text); text-shadow: 0 1px 2px rgba(var(--ck-shade), .9); opacity: .85; pointer-events: none; }
.ib.phone .ib-key { display: none; }
.ib-water { position: absolute; inset: -4px; z-index: 1; width: calc(100% + 8px); height: calc(100% + 8px); pointer-events: none; }
.ib-water circle { fill: none; stroke: var(--ck-river); stroke-width: 3.5; stroke-linecap: round; transition: stroke-dasharray .9s ease-in-out; }
.ib-water .back { stroke: rgba(var(--ck-shade), .14); }
.ib-band { position: absolute; left: 6px; right: 6px; top: 2px; height: 22px; overflow: visible; pointer-events: none; }
.ib-band path { fill: none; stroke: var(--ck-timber); stroke-width: 2.5; }
.ib-band circle { fill: var(--ck-hinoki-deep); }
.ib-hl { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; width: calc(var(--s) * 2.2); height: calc(var(--s) * 1.6);
  margin: calc(var(--s) * -.3) 0 0 calc(var(--s) * -.6); background: radial-gradient(closest-side, rgba(255, 207, 110, .55), rgba(255, 207, 110, 0)); }
.ib-pill { position: absolute; left: 0; top: -40px; white-space: nowrap; z-index: 30; padding: 6px 14px 7px; border-radius: 999px; opacity: 0;
  font: 700 15px/1 var(--ck-font-ui); color: var(--ck-ink); background: radial-gradient(ellipse at 50% 40%, #fffaf0, var(--ck-lantern-soft));
  box-shadow: 0 0 0 1.5px var(--ck-sumi), 0 0 16px 4px rgba(255, 207, 110, .6); pointer-events: none; }
.ib-pill b { font: 500 16px/1 var(--ck-font-display); margin-right: 4px; }
.ib-plus { position: absolute; z-index: 31; font: 700 15px/1 var(--ck-font-display); color: var(--ck-cream-text); pointer-events: none;
  text-shadow: 0 1px 0 rgba(var(--ck-shade), .6), 0 0 8px rgba(var(--ck-shade), .5); }
.ib-fly { position: fixed; left: 0; top: 0; z-index: 40; width: 40px; height: 40px; pointer-events: none; }
.ib-pages { position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%); display: flex; gap: 6px; pointer-events: none; }
.ib-pages i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255, 250, 240, .55); box-shadow: 0 1px 2px rgba(var(--ck-shade), .5); }
.ib-pages i.on { width: 16px; background: var(--ck-lantern-glow); }
.ib .stamp { position: absolute; z-index: 32; right: -8px; top: -10px; transform: rotate(-12deg); padding: 2px 5px; border-radius: 4px;
  font: 500 11px/1.2 var(--ck-font-display); color: var(--ck-cream-text); background: var(--ck-vermilion);
  box-shadow: 0 0 0 1.5px var(--ck-cream-text) inset, 0 3px 6px -2px rgba(var(--ck-shade), .6); pointer-events: none; }
.ib-cell.nudge .ib-face { box-shadow: inset 0 0 0 1.5px rgba(var(--ck-shade), .2), 0 0 0 3px var(--ck-lantern-glow), 0 0 18px 6px rgba(255, 207, 110, .7); }
/* the bag's own lantern at the string's end: opens the bag (B or I) */
.ib-bag { position: relative; width: var(--s); height: var(--s); margin-bottom: 18px; flex: none; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, var(--ck-stone-light), var(--ck-stone));
  box-shadow: 0 3px 0 rgba(var(--ck-shade), .25), 0 8px 12px -8px rgba(var(--ck-shade), .6); -webkit-tap-highlight-color: transparent; }
.ib-bag canvas { width: calc(var(--s) * .62); height: calc(var(--s) * .62); pointer-events: none; }
.ib-bag .n { position: absolute; right: -2px; bottom: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font: 700 11.5px/18px var(--ck-font-ui);
  color: var(--ck-cream-text); background: var(--ck-sumi); text-align: center; }
.ib-bag.bump { animation: bump .35s; }
/* at night every lantern glows a little (as the andon clock does) */
.ib.night .ib-face { background: repeating-linear-gradient(180deg, rgba(160, 80, 20, .12) 0 1.2px, transparent 1.2px 7px),
  radial-gradient(ellipse at 50% 42%, #fff1cf 0%, #f6dca8 55%, #e9b871 100%); box-shadow: 0 0 12px 2px rgba(255, 207, 110, .35); }

/* ── the bag: a grid, the item bar its bottom row; drag (or tap one, then where it goes) ───────────────────────────── */
.bag { display: flex; gap: 16px; }
.bag-grid { --s: 52px; --g: 8px; display: grid; grid-template-columns: repeat(var(--cols, 10), var(--s)); gap: var(--g); touch-action: none;
  align-content: start; align-self: start; padding-bottom: 12px; }
#panel.wide { max-width: min(900px, calc(100vw - 20px)); }   /* (the bag's grid and its card side by side) */
#panel.wide .dbody { max-height: min(76vh, 640px); }
.bag.phone .bag-grid { --s: 50px; touch-action: pan-y; }   /* (a thumb can scroll it where it can't all fit) */
@media (max-width: 359px), (max-height: 740px) { .bag.phone .bag-grid { --s: 46px; --g: 6px; } }
@media (max-width: 359px) and (max-height: 600px) { .bag.phone .bag-grid { --s: 40px; --g: 5px; } }   /* (40 px only under 360 px wide) */
/* a phone's bag: the panel as tall as the screen allows, so the grid and the bar's row both show */
#panel.bagp .dbody { max-height: calc(100vh - 152px); max-height: calc(100dvh - 152px); }
.bag-cell { position: relative; width: var(--s); height: var(--s); padding: 0; margin: 0; border: 0; background: none; cursor: grab; -webkit-tap-highlight-color: transparent; }
.bag-cell:focus-visible { outline: 3px solid var(--ck-focus); outline-offset: 2px; border-radius: 12px; }
.bag-cell .ib-face { inset: 2px; border-radius: 10px; background: rgba(226, 207, 172, .35); box-shadow: inset 0 2px 4px rgba(var(--ck-shade), .18); transform-origin: 50% 50%; }
.bag-cell .ib-face::before, .bag-cell .ib-face::after { display: none; }
.bag-cell.inbar .ib-face { inset: 4px 4px 0; border-radius: 44% / 32%; transform-origin: 50% -6px;
  background: radial-gradient(ellipse at 50% 42%, #fffaf0 0%, var(--ck-paper) 50%, var(--ck-paper-deep) 100%);
  box-shadow: inset 0 0 0 1.5px rgba(var(--ck-shade), .2), 0 6px 10px -7px rgba(var(--ck-shade), .7); }
.bag-cell.inbar .ib-face::before, .bag-cell.inbar .ib-face::after { display: block; }
.bag-cell .ib-count { right: -3px; bottom: -3px; transform: none; }
.bag-cell.inbar .ib-count { right: 50%; bottom: -12px; transform: translateX(50%); }
.bag-cell[aria-selected="true"] .ib-face { box-shadow: 0 0 0 3px var(--ck-lantern), 0 0 16px 4px rgba(255, 207, 110, .7); }
.bag-cell.held .ib-face { opacity: .35; }
.bag-cell.over .ib-face { box-shadow: 0 0 0 3px var(--ck-lantern), 0 0 18px 6px rgba(255, 207, 110, .75); }
.bag-row { display: contents; }   /* (a row of the bag's grid for assistive tech: its cells lay out in the grid itself) */
.bag-sep { grid-column: 1 / -1; height: 10px; margin: 4px 0 2px; position: relative; border-top: 2px solid var(--ck-timber); }
.bag-sep span { position: absolute; left: 0; top: 4px; font: 700 11px/1 var(--ck-font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ck-ink-soft); }
.bag-lift { position: fixed; left: 0; top: 0; z-index: 60; width: 52px; height: 52px; pointer-events: none; filter: drop-shadow(0 14px 10px rgba(53, 40, 30, .45)); }
.bag-lift .ib-face { inset: 0; border-radius: 12px; background: var(--ck-paper); }
.bag-card { width: 220px; flex: none; padding: 14px; border-radius: 12px; display: flex; flex-direction: column; gap: 8px; color: var(--ck-ink);
  background: var(--ck-paper-deep); box-shadow: 0 0 0 1px var(--ck-paper-edge), 0 8px 16px -10px rgba(var(--ck-shade), .7); }
.bag-card .pic { width: 112px; height: 112px; align-self: center; object-fit: contain; }
.bag-card h3 { margin: 0; font: 500 20px/1.15 var(--ck-font-display); }
.bag-card p { margin: 0; font: 500 14px/1.4 var(--ck-font-ui); }
.bag-card .price { display: flex; align-items: center; gap: 6px; font: 700 15px/1.2 var(--ck-font-ui); }
.bag-card .price small { font-weight: 500; opacity: .75; }
.bag-card .bag-empty { color: var(--ck-ink-soft); }
.bag-hint { margin: 8px 0 0; font: 600 13px/1.35 var(--ck-font-ui); color: var(--ck-ink-soft); }
.bag.phone { flex-direction: column; gap: 10px; }
.bag.phone .bag-grid { margin: 0 auto; }
.bag.phone .bag-card { order: -1; }   /* (above the grid: what you tapped, without a scroll) */
.bag.phone .bag-card { width: auto; display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 2px 12px; padding: 10px; }
.bag.phone .bag-card .pic { width: 56px; height: 56px; grid-row: 1 / span 3; }
.bag.phone .bag-card > .bag-hint, .bag.phone .bag-card > .bag-empty { grid-column: 1 / -1; }   /* (across the card, not down the picture's column) */
.bag.phone .bag-card > .btn { grid-column: 2; justify-self: start; }
@media (max-height: 740px) { .bag.phone .bag-card { padding: 8px 10px; grid-template-columns: 44px 1fr; } .bag.phone .bag-card .pic { width: 44px; height: 44px; } }
.bag.phone .bag-cell.inbar .ib-count { right: -3px; bottom: -3px; transform: none; }   /* (the bar's two rows sit close: its counts in the corner) */
.bag.phone .bag-card h3 { font-size: 17px; }
.bag.phone .bag-card p { font-size: 12.5px; line-height: 1.3; }

/* a still page (reduced motion, Capture Mode): no swing, no bounce; the light and the lift are there at once */
html.still .ib-row, html[data-capture-mode="1"] .ib-row { transition: none; }
html.still .ib-water circle, html[data-capture-mode="1"] .ib-water circle { transition: none; }
html[data-capture-mode="1"] .ib-bag.bump, html.still .ib-bag.bump { animation: none; }
@media (prefers-reduced-motion: reduce) { .ib-row, .ib-water circle { transition: none; } .ib-bag.bump { animation: none; } }

/* ── the tutorial: its line in the hint pill (key caps), a little Skip; Sakura's line in a card under the HUD ─────── */
.hint.tut { display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.hint.tut kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; margin: 0 1px; border-radius: 6px; text-align: center;
  font: 700 .92em/1.35 var(--ck-font-ui); color: var(--ck-ink); background: var(--ck-paper); box-shadow: 0 2px 0 var(--ck-paper-edge), inset 0 0 0 1px var(--ck-paper-edge); }
.hint.tut .skip { flex: none; border: 0; padding: 4px 10px; border-radius: 999px; cursor: pointer; font: 700 12px/1.2 var(--ck-font-ui);
  color: var(--ck-cream-text); background: rgba(255, 250, 240, .16); }
.hint.tut .skip:focus-visible { outline: 3px solid var(--ck-focus); outline-offset: 2px; }
#guide { position: fixed; left: 50%; top: calc(max(8px, env(safe-area-inset-top)) + 116px);   /* (under the hint pill) */ transform: translateX(-50%); z-index: 21; max-width: min(460px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 16px; pointer-events: none;
  background: url(img/washi.png) 0 0 / 128px 128px, var(--ck-paper); color: var(--ck-ink); box-shadow: 0 0 0 1.5px var(--ck-noren-sakura), 0 10px 20px -10px rgba(var(--ck-shade), .7); }
#guide[hidden] { display: none; }
#guide .gf { flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--ck-sakura-soft); box-shadow: 0 0 0 2px var(--ck-noren-sakura); }
#guide .gf canvas { width: 100%; height: 100%; }
#guide .gl { display: flex; flex-direction: column; gap: 1px; font: 500 14px/1.35 var(--ck-font-ui); }
#guide .gl b { font: 500 13px/1.2 var(--ck-font-display); color: var(--ck-noren-sakura); }

/* ── the day's tally (the feel spec §3.3): each line counts up in turn, then the day's pebbles pour in ─────────── */
.tally { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 12px; }
.tline { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 10px; padding: 6px 10px; border-radius: 10px; background: rgba(226, 207, 172, .3); }
.tline .tlab { font: 700 13px/1.3 var(--ck-font-ui); color: var(--ck-ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.tline .tx { font: 500 14px/1.35 var(--ck-font-ui); color: var(--ck-ink); }
.tline .tn, .ttotal b { font: 500 17px/1.2 var(--ck-font-display); color: var(--ck-jade-ink); white-space: nowrap; }
.ttotal { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 10px; border-top: 2px solid var(--ck-timber); margin-top: 2px; }
.ttotal span { font: 700 14px/1.3 var(--ck-font-ui); color: var(--ck-ink); }
.ttotal b { font-size: 21px; color: var(--ck-lantern); text-shadow: 0 1px 0 rgba(var(--ck-shade), .25); }
