/* 禁煙カウンター v3 — light "Liquid Glass" */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans CJK JP", "Noto Sans JP", system-ui, sans-serif;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, "Hiragino Maru Gothic ProN", var(--font);
  --ink: #0B1324;
  --ink2: rgba(28, 36, 58, .64);
  --ink3: rgba(28, 36, 58, .40);
  --hair: rgba(20, 30, 60, .10);
  --blue: #007AFF;
  --red: #FF3B30;
  --green: #1FB954;
  --spring: cubic-bezier(.34, 1.36, .64, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --clarity: .4;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: #F3F6FB; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); font-family: var(--font);
  font-feature-settings: "palt" 1; -webkit-font-smoothing: antialiased; overflow-x: hidden; letter-spacing: .01em;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }

/* ---------- Liquid Glass material ---------- */
.glass {
  position: relative; isolation: isolate;
  background: linear-gradient(140deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .26) 55%, rgba(255, 255, 255, .40));
  -webkit-backdrop-filter: blur(16px) saturate(190%) brightness(1.05); backdrop-filter: blur(16px) saturate(190%) brightness(1.05);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, .95),
    inset 0 -1px 1px rgba(255, 255, 255, .45),
    inset 1px 0 0 rgba(255, 220, 240, .25),
    inset -1px 0 0 rgba(200, 235, 255, .30),
    0 12px 34px -14px rgba(36, 56, 110, .30),
    0 2px 6px rgba(36, 56, 110, .06);
}
/* specular rim: bright on top-left and bottom-right edges */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: -1;
  background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, .15) 32%, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, .85));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
/* soft caustic sheen inside the glass */
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(120% 70% at 18% -10%, rgba(255, 255, 255, .75), transparent 55%),
              radial-gradient(80% 60% at 100% 120%, rgba(255, 255, 255, .45), transparent 60%);
  opacity: .7;
}

/* ---------- Background ---------- */
.bg-fallback, #bg, #smoke { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bg-fallback {
  z-index: -3;
  background:
    radial-gradient(70% 45% at 15% 12%, rgba(178, 240, 222, calc(.45 + .45 * var(--clarity))), transparent 70%),
    radial-gradient(60% 45% at 92% 28%, rgba(220, 208, 255, calc(.45 + .4 * var(--clarity))), transparent 70%),
    radial-gradient(70% 50% at 70% 95%, rgba(255, 220, 208, .55), transparent 70%),
    radial-gradient(70% 50% at 0% 80%, rgba(190, 218, 255, .6), transparent 70%),
    #F3F6FB;
  background-size: 160% 160%;
  animation: drift 30s ease-in-out infinite alternate;
}
@keyframes drift { from { background-position: 0% 0%; } to { background-position: 100% 70%; } }
#bg { z-index: -2; }
#smoke { z-index: -1; opacity: .8; }
html[data-renderer="webgpu"] .bg-fallback, html[data-renderer="webgl2"] .bg-fallback { animation: none; }

/* ---------- Floating top bar ---------- */
.topbar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0; pointer-events: none;
  padding: calc(var(--sat) + 8px) 14px 0; display: flex; justify-content: flex-end; align-items: center; height: calc(var(--sat) + 60px);
}
.topbar > * { pointer-events: auto; }
.title-pill {
  position: absolute; left: 50%; top: calc(var(--sat) + 10px); height: 40px; padding: 0 18px; border-radius: 999px;
  display: flex; align-items: center; font-size: 15px; font-weight: 600; white-space: nowrap;
  opacity: 0; transform: translate(-50%, -12px) scale(.9); transition: opacity .3s, transform .5s var(--spring); pointer-events: none;
}
.topbar.scrolled .title-pill { opacity: 1; transform: translate(-50%, 0) scale(1); }
.round-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--ink);
  transition: transform .35s var(--spring);
}
.round-btn:active { transform: scale(.86); }
.round-btn.primary { background: var(--blue); color: #fff; box-shadow: 0 8px 20px -8px rgba(0, 122, 255, .7), inset 0 1px 1px rgba(255, 255, 255, .5); }

/* ---------- Layout ---------- */
.content { max-width: 480px; margin: 0 auto; padding: calc(var(--sat) + 62px) 22px calc(48px + var(--sab)); }
.large-title { padding: 0 2px 4px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--ink2); letter-spacing: .04em; }
.large-title h1 { margin: 2px 0 0; font-size: 34px; line-height: 1.15; font-weight: 800; letter-spacing: .005em; }

.reveal { opacity: 0; transform: translateY(18px); }
.ready .reveal { animation: rise .9s var(--spring) forwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { to { opacity: 1; transform: none; } }

.kicker { font-size: 13px; font-weight: 700; color: var(--ink2); display: flex; align-items: center; gap: 7px; letter-spacing: .03em; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.sub { margin-top: 8px; font-size: 13px; color: var(--ink2); line-height: 1.55; }
.sub b { color: var(--ink); font-weight: 700; }

/* ---------- Hero ---------- */
.hero { display: flex; flex-direction: column; align-items: center; padding-top: 6px; }
.rings-wrap { position: relative; width: 284px; height: 284px; cursor: pointer; }
.rings-halo {
  position: absolute; inset: 18%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .85), rgba(255, 255, 255, 0) 70%); filter: blur(6px);
}
.rings { position: relative; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.rings circle { fill: none; }
.ring-track { opacity: .14; }
.ring-arc { transition: stroke-dashoffset 1.8s var(--spring); filter: drop-shadow(0 2px 6px var(--glow)); }
.rings-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.day-num { font-family: var(--round); font-weight: 800; font-size: 76px; line-height: .95; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.day-num.d3 { font-size: 60px; } .day-num.d4 { font-size: 46px; }
.day-unit { font-size: 15px; font-weight: 700; color: var(--ink2); margin-top: 4px; letter-spacing: .12em; }

.elapsed { margin: 10px 0 0; font-family: var(--round); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.elapsed span { font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--ink2); margin: 0 6px 0 2px; }
.elapsed .tail { margin: 0 0 0 4px; }

.ring-legend { margin-top: 22px; width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.ring-legend > div { padding: 0 4px; }
.ring-legend > div + div { border-left: .5px solid var(--hair); }
.ring-legend .lval { font-family: var(--round); font-size: 28px; font-weight: 800; color: var(--c); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ring-legend .lval small { font-size: 15px; }
.ring-legend .lname { font-size: 12px; font-weight: 700; margin-top: 2px; }
.ring-legend .lsub { font-size: 11px; color: var(--ink2); margin-top: 1px; }

/* ---------- Money / duo ---------- */
.money-block { margin-top: 56px; }
.money { margin-top: 4px; font-family: var(--round); font-weight: 800; font-size: 72px; line-height: 1.05; letter-spacing: -.035em; display: flex; align-items: baseline; font-variant-numeric: tabular-nums; }
.money .yen { font-size: 36px; margin-right: 4px; color: #E09400; letter-spacing: 0; }
.duo { margin-top: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.duo-item { min-width: 0; }
.big { margin-top: 6px; font-family: var(--round); font-weight: 800; font-size: 38px; line-height: 1.1; display: flex; align-items: baseline; white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.big .unit, .tsmall { font-family: var(--font); font-size: 14px; color: var(--ink2); margin: 0 4px 0 3px; font-weight: 700; letter-spacing: 0; }
.capsule-bar { margin-top: 10px; height: 6px; border-radius: 99px; background: rgba(20, 30, 60, .08); overflow: hidden; }
.capsule-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #FFB340, #FF7A1A); transition: width .9s var(--ease); }

/* odometer */
.odo { display: inline-flex; overflow: hidden; }
.digit { display: inline-block; height: 1.12em; line-height: 1.12em; overflow: hidden; }
.digit-strip { display: flex; flex-direction: column; transition: transform .9s var(--spring); will-change: transform; }
.digit-strip span { height: 1.12em; line-height: 1.12em; text-align: center; }
.odo .sym { height: 1.12em; line-height: 1.12em; }

/* ---------- Next milestone capsule ---------- */
.next { margin-top: 52px; }
.next-pill { display: flex; align-items: center; gap: 16px; padding: 12px 22px 12px 12px; border-radius: 999px; }
.next-ring { position: relative; flex: none; width: 76px; height: 76px; display: grid; place-items: center; }
.next-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.next-ring circle { fill: none; stroke-width: 7; }
.next-ring .trk { stroke: var(--nc); opacity: .16; }
.next-ring .arc { stroke: var(--nc); stroke-linecap: round; transition: stroke-dashoffset 1.6s var(--spring); }
.next-ring span { font-size: 30px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .15)); }
.next-text { min-width: 0; }
.next-kicker { font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--nck, var(--nc)); }
.next-title { font-size: 16px; font-weight: 800; margin-top: 2px; line-height: 1.3; }
.countdown { margin-top: 4px; font-family: var(--round); font-variant-numeric: tabular-nums; display: flex; align-items: baseline; flex-wrap: wrap; }
.countdown .pre { font-family: var(--font); font-size: 12px; font-weight: 700; color: var(--ink2); margin-right: 5px; }
.countdown b { font-size: 22px; font-weight: 800; }
.countdown span { font-family: var(--font); font-size: 12px; color: var(--ink2); font-weight: 700; margin: 0 6px 0 2px; }
.next-foot { margin: 14px 8px 0; font-size: 13px; color: var(--ink2); line-height: 1.6; }

/* ---------- Sections ---------- */
.section { margin-top: 60px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px 14px; }
.section-head h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: .005em; }
.badge { font-size: 13px; font-weight: 700; color: var(--ink2); }
.badge b { color: var(--green); font-family: var(--round); font-size: 17px; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 999px; margin-bottom: 26px; }
.segmented button { position: relative; z-index: 1; height: 34px; font-size: 14px; font-weight: 700; color: var(--ink2); transition: color .25s; border-radius: 999px; }
.segmented button.on { color: var(--ink); }
.seg-pill {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 999px;
  background: rgba(255, 255, 255, .95); box-shadow: 0 4px 14px -4px rgba(36, 56, 110, .28), inset 0 -1px 1px rgba(0, 0, 0, .04);
  transition: transform .5s var(--spring);
}

/* health rows: grouped by spacing, no frames */
.health-list { display: grid; gap: 26px; }
.h-row { display: grid; grid-template-columns: 58px 1fr auto; column-gap: 14px; align-items: center; }
.h-row.hide { display: none; }
.h-ring { position: relative; width: 58px; height: 58px; display: grid; place-items: center; }
.h-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.h-ring circle { fill: none; stroke-width: 5.5; stroke-linecap: round; }
.h-ring .arc { transition: stroke-dashoffset 1.6s var(--spring); }
.h-ring .em { font-size: 24px; }
.h-row.done .h-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: color-mix(in srgb, var(--c) 16%, transparent); }
.h-title { font-size: 15.5px; font-weight: 700; line-height: 1.35; }
.h-meta { font-size: 12px; color: var(--ink2); margin-top: 2px; font-weight: 600; }
.h-pct { font-family: var(--round); font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ck); letter-spacing: -.02em; text-align: right; min-width: 56px; }
.h-pct small { font-size: 13px; }
.h-pct .ok { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; box-shadow: 0 6px 14px -6px var(--green); }
.h-pct .ok svg { width: 18px; height: 18px; }
.h-desc { grid-column: 2 / -1; margin: 6px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink2); }
.h-desc .src { color: var(--ink3); }
.h-state { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 99px; margin-left: 6px; vertical-align: 2px; }
.h-state.soon { background: rgba(0, 122, 255, .12); color: #0061D6; }

.note { margin: 30px 2px 0; font-size: 12px; line-height: 1.75; color: var(--ink2); }
.note b { color: var(--ink); }

/* buyables: glass bubbles */
.bubbles {
  display: grid; grid-auto-flow: column; grid-auto-columns: 104px; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 10px 22px 16px; margin: 0 -22px; scrollbar-width: none; scroll-padding: 22px;
}
.bubbles::-webkit-scrollbar { display: none; }
.bubble { scroll-snap-align: start; text-align: center; }
.bubble .orb { width: 96px; height: 96px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 42px; }
.bubble .orb .ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); }
.bubble .orb .ring circle { fill: none; stroke-width: 3; stroke-linecap: round; }
.bubble .n { margin-top: 10px; font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.bubble .p { font-size: 11px; color: var(--ink2); margin-top: 1px; }
.bubble .q { margin-top: 3px; font-family: var(--round); font-size: 17px; font-weight: 800; color: #D98600; }
.bubble .q small { font-size: 11px; font-family: var(--font); color: var(--ink2); margin-left: 1px; }
.bubble .left { margin-top: 3px; font-size: 11.5px; color: var(--ink2); font-weight: 600; }
.bubble.locked .orb span { filter: grayscale(.5) opacity(.75); }

.closing { margin-top: 48px; }
.sources summary {
  list-style: none; display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.sources summary::-webkit-details-marker { display: none; }
.sources .chev { color: var(--ink3); font-size: 18px; line-height: 1; transition: transform .3s var(--spring); }
.sources[open] .chev { transform: rotate(90deg); }
.sources ul { margin: 14px 4px 0; padding-left: 18px; font-size: 12.5px; line-height: 1.85; color: var(--ink2); }
.sources a { color: #0061D6; text-decoration: none; word-break: break-all; }
.footer { text-align: center; font-size: 12.5px; color: var(--ink3); line-height: 1.8; margin: 44px 0 0; }

/* ---------- Floating Liquid Glass sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(30, 40, 70, .18); opacity: 0; transition: opacity .35s var(--ease); }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 41; left: 8px; right: 8px; bottom: calc(8px + var(--sab)); margin: 0 auto; max-width: 520px;
  max-height: calc(100dvh - var(--sat) - 40px); display: flex; flex-direction: column;
  border-radius: 38px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .80), rgba(246, 248, 252, .66));
  -webkit-backdrop-filter: blur(30px) saturate(190%); backdrop-filter: blur(30px) saturate(190%);
  box-shadow: inset 0 1px 1px #fff, inset 0 0 0 .5px rgba(255, 255, 255, .8), 0 30px 80px -20px rgba(30, 45, 90, .45);
  transform: translateY(calc(100% + 30px)); transition: transform .55s cubic-bezier(.32, .72, 0, 1);
  touch-action: none;
}
.sheet.open { transform: translateY(0); }
.sheet.dragging { transition: none; }
.grabber { padding: 8px 0 0; display: grid; place-items: center; cursor: grab; }
.grabber i { width: 38px; height: 5px; border-radius: 3px; background: rgba(20, 30, 60, .2); }
.sheet-bar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 6px 14px 6px; }
.sheet-bar h3 { margin: 0; text-align: center; font-size: 17px; font-weight: 700; }
.sheet-body { overflow-y: auto; padding: 0 16px 22px; touch-action: pan-y; overscroll-behavior: contain; }
.group-label { font-size: 13px; color: var(--ink2); font-weight: 600; padding: 16px 18px 7px; }
.group { border-radius: 26px; background: rgba(255, 255, 255, .78); box-shadow: 0 1px 2px rgba(30, 45, 90, .05); overflow: hidden; }
.group + .group { margin-top: 14px; }
.group-foot { font-size: 12.5px; color: var(--ink2); padding: 8px 18px 0; line-height: 1.6; }
.row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 6px 18px; font-size: 16px; width: 100%; text-align: left; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 18px; right: 18px; border-top: .5px solid var(--hair); }
.row-btn:active { background: rgba(0, 0, 0, .04); }
.accent { color: var(--blue); font-weight: 600; }
.danger { color: var(--red); font-weight: 600; }
.muted { color: var(--ink2); }
.row input[type="datetime-local"] {
  background: rgba(118, 118, 128, .12); border: 0; border-radius: 999px; padding: 7px 14px; font-size: 15px;
  min-width: 0; max-width: 62%; text-align: right; color-scheme: light;
}
.stepper { display: flex; align-items: center; background: rgba(118, 118, 128, .12); border-radius: 999px; overflow: hidden; }
.stepper button { width: 40px; height: 34px; font-size: 19px; font-weight: 600; transition: background .15s; }
.stepper button:active { background: rgba(0, 0, 0, .08); }
.stepper input, .field-yen input {
  width: 42px; height: 34px; text-align: center; background: transparent; border: 0; font-size: 16px; font-weight: 700;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.field-yen { display: flex; align-items: center; gap: 4px; background: rgba(118, 118, 128, .12); border-radius: 999px; padding: 0 16px; color: var(--ink2); }
.field-yen input { width: 70px; text-align: right; color: var(--ink); }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:focus { outline: none; }
.stepper:focus-within, .field-yen:focus-within { box-shadow: inset 0 0 0 2px rgba(0, 122, 255, .55); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--sab)); z-index: 60; transform: translate(-50%, 160%);
  padding: 12px 20px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap;
  visibility: hidden; opacity: 0; transition: transform .5s var(--spring), opacity .3s, visibility 0s .5s;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; opacity: 1; transition: transform .5s var(--spring), opacity .2s; }

body.sheet-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  #smoke { display: none; }
}
