/* Palette: Coolors "Slate, grey, red" #2b2d42 #8d99ae #edf2f4 #ef233c #d90429 */
:root {
  --bg: #edf2f4; --card: #ffffff; --ink: #2b2d42; --soft: #5d667a; --rule: #d3dae3;
  --accent: #2b2d42; --accent-ink: #edf2f4; --accent-text: #c4031f; --good: #d90429; --good-ink: #ffffff;
  --shelf: #8d99ae; --glass: rgb(255 255 255 / .7); --glass-edge: #b8c2cf; --ring: rgb(239 35 60 / .3);
  --coin-hi: #f3d9a0; --coin: #d9b45a; --coin-lo: #b08a2e; --coin-edge: #806218; --coin-ink: #2b2008;
  --danger: #c4031f;
  --font: "Sora", "Segoe UI", Roboto, system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box }
[hidden] { display: none !important }
html { -webkit-tap-highlight-color: transparent }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(16px, env(safe-area-inset-left, 0px)) }
main { max-width: 440px; margin: 0 auto; padding-block: 20px 40px; display: grid; gap: 22px }
button, input { font: inherit; color: inherit; touch-action: manipulation }
button { cursor: pointer; border: 0; background: none; padding: 0 }
:focus-visible { outline: 3px solid var(--good); outline-offset: 2px }
.num { font-variant-numeric: tabular-nums }
h1, h2 { margin: 0; text-wrap: balance }
h2 { font-size: 1rem; font-weight: 600 }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }

.head { display: flex; justify-content: space-between; align-items: end; gap: 12px }
.head p { margin: 0; color: var(--soft) }
.total { font-size: 2rem; font-weight: 700; color: var(--ink) !important; letter-spacing: -.02em }

.shelf { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 8px 16px 14px;
  border-bottom: 8px solid var(--shelf); box-shadow: 0 1px 0 var(--rule) }
.jar { flex: none; width: 96px; display: grid; justify-items: center; gap: 6px; padding: 6px 0; border-radius: 16px }
.glass { position: relative; width: 78px; height: 132px; border-radius: 14px 14px 22px 22px; border: 2px solid var(--glass-edge); background: var(--glass); overflow: hidden }
.glass::before { content: ""; position: absolute; top: -2px; left: 10px; right: 10px; height: 10px; border-radius: 0 0 6px 6px; background: var(--glass-edge) }
.liquid { position: absolute; inset: auto 0 0; height: 100%; background: var(--jc); transform-origin: bottom; transform: scaleY(var(--p));
  box-shadow: inset 6px 0 0 rgb(255 255 255 / .18) }
.jar-amt { position: absolute; inset: auto 0 10px; text-align: center; font-weight: 700; font-size: .9rem; color: var(--jt) }
.jar-amt.low { bottom: calc(20% + 6px); color: var(--ink) }
.full .glass::after { content: "Full"; position: absolute; top: 14px; left: 50%; transform: translateX(-50%); padding: 2px 8px; border-radius: 999px;
  background: var(--bg); color: var(--ink); font-size: .7rem; font-weight: 700 }
.jar-name { font-weight: 600; font-size: .9rem; max-width: 92px; text-align: center; overflow-wrap: break-word }
.jar-of { color: var(--soft); font-size: .8rem }
.jar[aria-pressed="true"] .glass { border-color: var(--ink); box-shadow: 0 0 0 4px var(--ring) }
.jar.add .glass { display: grid; place-items: center; border-style: dashed; font-size: 2rem; color: var(--soft) }
.first { display: grid; gap: 12px; justify-items: start; padding: 20px; border: 2px dashed var(--glass-edge); border-radius: 18px }
.first p { margin: 0; color: var(--soft) }

.status { margin: 0; color: var(--soft); min-height: 44px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap }
.status strong { color: var(--ink) }
.status button, .primary { min-height: 44px; padding: 0 18px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700 }
.status .bought { background: var(--good); color: var(--good-ink) }

.coins { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; justify-items: center }
.coin { width: min(60px, 100%); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--coin-hi), var(--coin) 60%, var(--coin-lo));
  color: var(--coin-ink); font-weight: 700; font-size: .85rem; box-shadow: inset 0 0 0 4px rgb(255 255 255 / .25), 0 3px 0 var(--coin-edge) }
.coin[aria-pressed="true"] { transform: translateY(-6px); box-shadow: inset 0 0 0 4px rgb(255 255 255 / .5), 0 0 0 3px var(--ink), 0 9px 0 var(--coin-edge) }
.coin.other { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--rule) }
.field { width: 100%; min-height: 50px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--rule); background: var(--card) }
.drop { width: 100%; min-height: 58px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1.05rem }
.drop:disabled { opacity: .4; cursor: default }

.log { list-style: none; margin: 0; padding: 0 }
.log button { width: 100%; display: flex; justify-content: space-between; gap: 12px; text-align: left; min-height: 52px; padding: 8px 0; border-bottom: 1px solid var(--rule) }
.log span:first-child { min-width: 0; overflow-wrap: break-word }
.log small { display: block; color: var(--soft) }
.log .amt { color: var(--accent-text); font-weight: 700; white-space: nowrap }
.empty { color: var(--soft); margin: 0 }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30;
  width: min(420px, calc(100% - 32px)); display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; min-height: 52px;
  border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: 0 10px 30px rgb(0 0 0 / .3) }
.toast span { flex: 1; min-width: 0 }
.toast button { min-height: 44px; padding: 0 14px; border-radius: 10px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px }

dialog { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 480px; max-height: 85dvh; border-radius: 20px 20px 0 0;
  background: var(--card); color: var(--ink); overscroll-behavior: contain }
dialog::backdrop { background: rgb(20 22 36 / .5) }
.sheet { display: grid; gap: 14px; padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px)) }
.sheet h2 { font-size: 1.2rem }
.sheet label { display: grid; gap: 6px; color: var(--soft); font-size: .95rem }
.sheet input { min-height: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); font-size: 1.05rem }
.sheet .err { color: var(--danger); margin: 0 }
.opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px }
.opt { min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--rule) }
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink) }
.acts { display: flex; gap: 8px; flex-wrap: wrap }
.acts .primary { flex: 1; min-height: 52px; border-radius: 14px }
.ghost { min-height: 52px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--rule) }
.nudge { width: 100%; min-height: 48px; padding: 8px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--good); color: var(--ink); font-weight: 600; text-align: left }
.foot { justify-self: center }
.sheet p { margin: 0 }
.danger { min-height: 52px; padding: 0 18px; color: var(--danger); font-weight: 600 }

@media (hover: hover) {
  .jar:hover .glass { border-color: var(--soft) }
  .coin:hover { filter: brightness(1.06) }
  .log button:hover { background: var(--card) }
  .primary:hover, .drop:not(:disabled):hover { background: #3a3d58 }
  .ghost:hover, .opt:hover { border-color: var(--soft) }
}

@media (prefers-reduced-motion: no-preference) {
  .liquid { transition: transform .6s cubic-bezier(.2, .8, .2, 1) }
  .coin { transition: transform .12s }
  .drop:active, .primary:active { transform: scale(.97) }
}
