/* ==========================================================================
   Dean's Games — design system
   Clean white paper, ink outlines, a gentle wobble. Two crayons: blue + green.
   Light/dark via light-dark() + color-scheme. Force with <html data-theme>.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap");

/* ---------- 1. Tokens ---------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Paper */
  --paper:      light-dark(#ffffff, #121418);
  --paper-2:    light-dark(#f4f6f9, #181b21); /* grouped backgrounds */
  --card:       light-dark(#ffffff, #1c1f26);
  --card-2:     light-dark(#f0f3f7, #262a33); /* wells, empty states */
  --line-soft:  light-dark(#e5e9f0, #2d323c); /* separators */

  /* Ink */
  --ink:        light-dark(#1d2433, #e9edf4);
  --ink-soft:   light-dark(#687083, #98a1b3);
  --ink-faint:  light-dark(#c2c9d5, #4a5160);
  --shadow-ink: light-dark(#dde3ec, #000000);

  /* The two crayons */
  --blue:       light-dark(#2f7cf6, #5c9cff);
  --blue-2:     light-dark(#a9cbff, #2f5ea8); /* lighter companion for charts */
  --blue-tint:  light-dark(#edf4ff, #172338);
  --blue-ink:   light-dark(#1a5fd0, #94bcff);
  --green:      light-dark(#1fa855, #34c76f);
  --green-2:    light-dark(#a6e4bd, #1f6b40);
  --green-tint: light-dark(#e9f8ef, #142c1f);
  --green-ink:  light-dark(#137a3b, #83e0a8);
  --on-blue:    #ffffff;
  --on-green:   light-dark(#ffffff, #0b2014);

  /* Semantic only — never decorative */
  --red:       light-dark(#ec4f4c, #ff6f6c); /* hearts, destructive, counts */
  --red-tint:  light-dark(#fdecec, #3a1d1f);
  --gold:      light-dark(#f2b100, #ffc83a); /* achievements */
  --gold-tint: light-dark(#fff6d9, #3a3016);
  --bronze:    #c26b3c;  /* coppery */
  --silver:    #c3ccd8;
  --platinum:  #a9d7ff;

  /* Achievement popups are always "game overlay" dark */
  --pop-bg:   #14171d;
  --pop-ink:  #f3f5f9;
  --pop-soft: #9aa3b5;
  --pop-line: #2c323d;

  /* Type */
  --font-hand:    "Comic Neue", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;
  --font-display: "Comic Neue", var(--font-hand);  /* used at weight 700 */
  --fs-xs:  0.8rem;
  --fs-sm:  0.92rem;
  --fs-md:  1.1rem;
  --fs-lg:  1.5rem;
  --fs-xl:  2.2rem;
  --fs-xxl: 3rem;

  /* Shapes: asymmetric radii fake a hand-drawn outline */
  --bw: 2px;
  /* Soft light: clean, even corners */
  --r-blob:   999px;
  --r-widget: 26px;
  --r-card:   20px;
  --r-sm:     10px;
  --r-round:  50%;
  --r-pill:   999px;
  --r-app:    18px;
  --edge:     color-mix(in srgb, var(--ink) 12%, transparent);  /* hairline for every box */

  /* Thermometer body (flat, no glass effects) */
  --glass-edge: light-dark(color-mix(in srgb, #1d2433 35%, transparent), rgb(255 255 255 / .16));
  --channel:    light-dark(#f4f6f9, #262a33);

  /* Soft offset shadows (paper layered on paper) */
  /* Soft, diffuse shadows (big blur, low opacity) */
  /* reach stays inside the usual 16–20px gaps so neighbours never cover it */
  --shadow-sm: 0 3px 10px -4px light-dark(rgb(16 20 30 / .16), rgb(0 0 0 / .5));
  --shadow:    0 10px 28px -14px light-dark(rgb(16 20 30 / .28), rgb(0 0 0 / .6));
  --shadow-lg: 0 18px 44px -18px light-dark(rgb(16 20 30 / .34), rgb(0 0 0 / .7));

  /* Hover: interactive things lift and tilt; static things stay still */
  --lift:    translateY(-3px) rotate(-1.2deg);   /* standalone: buttons, cards, tiles */
  --lift-sm: translateY(-1px) rotate(-.5deg);    /* items inside a group: rows, segments */
  --press:   translateY(0) scale(.97);

  /* Motion — entrances ease out, things that travel ease in-out,
     rewards pop with a little overshoot, exits ease in. */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);  /* pop: badges, dots, rewards */
  --ease-out:    cubic-bezier(0.2, 0.8, 0.3, 1);     /* entrances, fades in */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);     /* drawing lines, sliding values */
  --ease-in:     cubic-bezier(0.5, 0, 0.75, 0);      /* exits */
  --dur-quick: 180ms;
  --dur-base:  420ms;
  --dur-slow:  900ms;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* ---------- 2. Base ------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.4em;
}
p { margin: 0 0 0.8em; }

a {
  color: inherit;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

code {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.78em;
  background: var(--card-2);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

::selection { background: var(--blue-2); color: var(--ink); }
:focus-visible { outline: 3px dashed var(--blue); outline-offset: 3px; }

.squiggle { text-decoration: underline wavy var(--blue); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.marker   { background: linear-gradient(transparent 58%, var(--green-2) 58% 92%, transparent 92%); padding: 0 0.1em; }
.muted    { color: var(--ink-soft); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Icons ----------------------------------------------------- */

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.15em;
}

/* ---------- 4. Buttons --------------------------------------------------- */

.btn {
  --btn-bg: var(--card);
  --btn-fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font: inherit;
  font-size: var(--fs-md);
  line-height: 1.2;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  padding: 0.45em 1.2em;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s var(--ease-bounce), box-shadow 0.15s, background 0.15s;
}

.btn--primary { --btn-bg: var(--blue);      --btn-fg: var(--on-blue); }
.btn--green   { --btn-bg: var(--green);     --btn-fg: var(--on-green); }
.btn--tinted  { --btn-bg: var(--blue-tint); --btn-fg: var(--blue-ink); }
.btn--danger  { --btn-fg: var(--red); }
.btn--ghost   { --btn-bg: transparent; border-style: dashed; box-shadow: none; }
.btn--ghost:hover { box-shadow: none; background: var(--card-2); }
.btn--plain   { --btn-bg: transparent; --btn-fg: var(--blue); border-color: transparent; box-shadow: none; padding-inline: 0.4em; }
.btn--plain:hover { box-shadow: none; transform: none; text-decoration: underline; }

.btn--sm    { font-size: var(--fs-sm); padding: 0.2em 0.85em; }
.btn--lg    { font-size: 1.35rem; padding: 0.55em 1.5em; }
.btn--icon  { padding: 0.45em; border-radius: var(--r-round); }
.btn--block { width: 100%; }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm);
}

/* ---------- 5. Segmented control ---------------------------------------- */

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--card-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
}
.segmented button {
  font: inherit;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--ink-soft);
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  padding: 0.15em 0.9em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.2s var(--ease-bounce);
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--card);
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.segmented--sm { padding: 2px; }
.segmented--sm button { font-size: 0.85rem; padding: 0 0.55em; }
.segmented--block { display: flex; }
.segmented--block button { flex: 1; }

/* ---------- 6. Switch, stepper, slider ---------------------------------- */

.switch { display: inline-flex; align-items: center; gap: 0.6em; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
  position: relative;
  flex: none;
  width: 50px;
  height: 30px;
  background: var(--card-2);
  border: 1px solid var(--edge);
  border-radius: 20px 16px 18px 15px;
  transition: background 0.2s;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-round);
  transition: transform 0.3s var(--ease-bounce);
}
.switch input:checked + .switch__track { background: var(--green); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { outline: 3px dashed var(--blue); outline-offset: 3px; }

/* <div class="stepper" data-min="0" data-max="10"><button data-step="-1">…<output>3</output>… */
.stepper {
  display: inline-flex;
  align-items: stretch;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  overflow: hidden;
}
.stepper button {
  display: grid;
  place-items: center;
  width: 42px;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.stepper button:hover  { background: var(--card-2); }
.stepper button:active { background: var(--blue-tint); }
.stepper output {
  min-width: 46px;
  padding: 0 6px;
  text-align: center;
  line-height: 36px;
  font-size: var(--fs-md);
  border-inline: 2px solid var(--line-soft);
}

/* <input type="range" class="range"> — JS keeps --p in sync */
.range {
  --p: 50;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 30px;
  background: transparent;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 10px;
  border: 1px solid var(--edge);
  border-radius: 8px 6px 8px 5px;
  background: linear-gradient(90deg, var(--blue) calc(var(--p) * 1%), var(--card-2) 0);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -10px;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-round);
  box-shadow: var(--shadow-sm);
}
.range::-moz-range-track    { height: 6px; background: var(--card-2); border: 1px solid var(--edge); border-radius: 8px; }
.range::-moz-range-progress { height: 6px; background: var(--blue); border-radius: 8px; }
.range::-moz-range-thumb    { width: 22px; height: 22px; background: var(--card); border: 1px solid var(--edge); border-radius: 50%; }

/* ---------- 7. Inputs ---------------------------------------------------- */

.field { display: grid; gap: 0.25em; }
.field__label { font-size: var(--fs-sm); color: var(--ink-soft); }
.input {
  width: 100%;
  font: inherit;
  font-size: var(--fs-md);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  padding: 0.4em 0.8em;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus { outline: none; box-shadow: 0 0 0 3px var(--blue-2); }

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  color: var(--ink-soft);
  background: var(--card-2);
  border-radius: 12px 10px 13px 9px / 9px 13px 10px 12px;
}
.search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
}
.search input::placeholder { color: var(--ink-soft); }
.search:focus-within { box-shadow: 0 0 0 3px var(--blue-2); }

/* ---------- 8. Chips, counts, cards ------------------------------------- */

.chip {
  --chip-bg: var(--card);
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: var(--fs-sm);
  line-height: 1.3;
  padding: 0.05em 0.7em;
  color: var(--ink);
  background: var(--chip-bg);
  border: 1px solid var(--edge);
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.chip--blue  { --chip-bg: var(--blue-tint); }
.chip--green { --chip-bg: var(--green-tint); }
.chip--red   { --chip-bg: var(--red-tint); }
.chip--gold  { --chip-bg: var(--gold-tint); }
.chip--blue  .icon { color: var(--blue); }
.chip--green .icon { color: var(--green); }
.chip--red   .icon { color: var(--red); }

/* notification count (red dot with number) */
.count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: 0.82rem;
  line-height: 1;
  color: #fff;
  background: var(--red);
  border: 2px solid var(--card);
  border-radius: 999px;
}

.card {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.3rem;
}

/* ---------- 9. Lists & menus (iOS Settings style) ----------------------- */

.list-header {
  margin: 20px 16px 6px;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.list-footer { margin: 6px 16px 0; font-size: var(--fs-xs); line-height: 1.3; color: var(--ink-soft); }

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
}
.list__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 14px;
  color: inherit;
  text-decoration: none;
  background: transparent;
  border: 0;
  width: 100%;
  font: inherit;
  text-align: left;
}
.list > li + li > .list__row::before,
.list > .list__row + .list__row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 56px;
  border-top: 1.5px solid var(--line-soft);
}
a.list__row, button.list__row { cursor: pointer; }
a.list__row:hover, button.list__row:hover { background: var(--card-2); }
.list__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  color: #fff;
  background: var(--c, var(--blue));
  border: 1px solid var(--edge);
  border-radius: 9px 7px 10px 7px / 7px 10px 7px 9px;
}
.list__icon .icon { width: 18px; height: 18px; }
.list__label { flex: 1; min-width: 0; line-height: 1.2; }
.list__label small { display: block; font-size: var(--fs-xs); color: var(--ink-soft); }
.list__value { color: var(--ink-soft); white-space: nowrap; }
.list__chev  { color: var(--ink-faint); width: 18px; height: 18px; }
.list__row.is-danger { color: var(--red); justify-content: center; }

/* Large-title navigation bar */
.navbar { display: flex; align-items: center; justify-content: space-between; min-height: 36px; }
.navbar a, .navbar button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font: inherit;
  color: var(--blue);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.navbar__title { font-size: var(--fs-md); }
.large-title { font-family: var(--font-display); font-size: 2rem; line-height: 1.1; margin: 2px 2px 12px; }

/* Tab bar */
.tabbar {
  display: grid;
  grid-template-columns: repeat(var(--tabs, 4), 1fr);
  padding: 8px 6px 12px;
  background: var(--card);
  border-top: 1px solid var(--edge);
}
.tab {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-decoration: none;
}
.tab .icon { width: 25px; height: 25px; }
.tab.is-active { color: var(--blue); }
.tab .count { position: absolute; top: -6px; left: calc(50% + 6px); min-width: 20px; height: 20px; font-size: 0.72rem; }

/* Context menu / action menu */
.menu {
  min-width: 230px;
  padding: 4px 0;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 8px 16px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
}
.menu button:hover { background: var(--blue-tint); }
.menu button .icon { color: var(--ink-soft); }
.menu button.is-danger, .menu button.is-danger .icon { color: var(--red); }
.menu button.is-danger:hover { background: var(--red-tint); }
.menu hr { margin: 4px 0; border: 0; border-top: 6px solid var(--paper-2); }
.menu__title { padding: 6px 16px 4px; font-size: var(--fs-xs); color: var(--ink-soft); }

/* App icon grid (home screen / tool launcher) */
.appgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 18px 10px; }
.app {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  font-size: 0.85rem;
  line-height: 1.1;
  text-align: center;
  color: inherit;
  text-decoration: none;
}
.app__icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  color: var(--fg, var(--ink));
  background: var(--c, var(--card));
  border: 1px solid var(--edge);
  border-radius: var(--r-app);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease-bounce);
}
.app__icon .icon { width: 30px; height: 30px; }
.app--blue  { --c: var(--blue);  --fg: var(--on-blue); }
.app--green { --c: var(--green); --fg: var(--on-green); }
.app .count { position: absolute; top: -7px; left: calc(50% + 20px); }

/* ---------- 10. Progress ------------------------------------------------- */

/* <div class="segbar" data-segments="10" data-value="6"></div> — JS fills it */
.segbar {
  --seg: var(--blue);
  display: flex;
  gap: 3px;
  width: 100%;
  height: 14px;
}
.segbar > i {
  flex: 1;
  min-width: 0;
  background: var(--card-2);
  border: 1px solid var(--edge);
  border-radius: 5px 3px 6px 3px / 3px 6px 3px 5px;
  transition: background 0.3s, transform 0.3s var(--ease-bounce);
}
.segbar > i.on   { background: var(--seg); }
.segbar > i.half { background: linear-gradient(90deg, var(--seg) 50%, var(--card-2) 50%); }
.segbar > i.pop  { animation: seg-pop 0.35s var(--ease-bounce); }
.segbar--thin   { height: 9px; gap: 2px; }
.segbar--thin > i { border-width: 1.5px; border-radius: 3px; }
.segbar--chunky { height: 24px; gap: 5px; }
.segbar--duo > i.on:nth-child(even) { background: var(--green); }
@keyframes seg-pop { 50% { transform: scaleY(1.45); } }

/* Storage-style stacked bar:
   <div class="stackbar"><span style="--w:40;--c:var(--blue)"></span>…</div> */
.stackbar {
  display: flex;
  height: 22px;
  background: var(--card-2);
  border: 1px solid var(--edge);
  border-radius: 9px 7px 10px 6px / 6px 10px 7px 9px;
  overflow: hidden;
}
.stackbar > span {
  width: calc(var(--w) * 1%);
  background: var(--c, var(--blue));
  border-right: 2px solid var(--w-bg, var(--card));
  transform-origin: left;
  animation: stack-grow 0.7s var(--ease-out) both;
}
.stackbar > span:nth-child(2) { animation-delay: 0.08s; }
.stackbar > span:nth-child(3) { animation-delay: 0.16s; }
.stackbar > span:nth-child(4) { animation-delay: 0.24s; }
.stackbar--lg { height: 30px; }
@keyframes stack-grow { from { transform: scaleX(0); } }

/* <div class="bar" style="--p:60"><span></span></div> */
.bar {
  height: 16px;
  background: var(--card-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-blob);
}
.bar > span {
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 1%);
  background-color: var(--bar, var(--blue));
  background-image: repeating-linear-gradient(-45deg, transparent 0 6px, rgb(255 255 255 / 0.25) 6px 12px);
  border-right: 0;
  transition: width 0.6s var(--ease-out);
}

/* Rings: <circle class="ring" pathLength="100" style="--p:70"> */
.rings { display: block; width: 100%; height: auto; overflow: visible; }
.ring-track { fill: none; stroke: var(--card-2); stroke-width: 9; }
.ring {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: var(--p) 100;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dasharray 0.8s var(--ease-out);
}

/* Legend dots */
.legend { display: inline-flex; align-items: center; gap: 0.35em; font-size: var(--fs-sm); color: var(--ink-soft); white-space: nowrap; }
.legend i { width: 12px; height: 12px; border: 1px solid var(--edge); border-radius: var(--r-round); background: var(--c); }
.legend b { font-weight: 400; color: var(--ink); }
.legend-row { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; }

/* ---------- 11. Widgets (iOS-style tiles) -------------------------------- */

.widget-grid {
  --cell: 160px;
  --gap: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--cell));
  grid-auto-rows: var(--cell);
  grid-auto-flow: dense;
  gap: var(--gap);
}
@media (max-width: 480px) {
  .widget-grid { --gap: 14px; --cell: calc((100vw - 32px - var(--gap)) / 2); }
}

.widget {
  --w-bg: var(--card);
  --w-accent: var(--blue);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px 16px;
  color: var(--ink);
  background: var(--w-bg);
  border: 1px solid var(--edge);
  border-radius: var(--r-widget);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.25s var(--ease-bounce), box-shadow 0.25s;
}

.widget--md { grid-column: span 2; }
.widget--lg { grid-column: span 2; grid-row: span 2; }

.widget--blue  { --w-bg: var(--blue-tint);  --w-accent: var(--blue); }
.widget--green { --w-bg: var(--green-tint); --w-accent: var(--green); }
.widget--fill {
  --w-bg: var(--w-accent);
  --ink-soft: color-mix(in srgb, var(--on-blue) 78%, transparent);
  color: var(--on-blue);
}
.widget--fill .w-label .icon { color: inherit; }
/* StandBy-style: always dark, whatever the theme */
.widget--night {
  --w-bg: #101217;
  --card-2: #1d2129;
  --ink: #f1f3f7;
  --ink-soft: #8b93a5;
  --w-accent: #5c9cff;
  color: var(--ink);
  border-color: light-dark(#1d2433, #e9edf4);
}

.w-label {
  display: flex;
  align-items: center;
  gap: 0.35em;
  font-size: var(--fs-sm);
  line-height: 1.15;
  color: var(--ink-soft);
  min-width: 0;
}
.w-label .icon { color: var(--w-accent); width: 1.15em; height: 1.15em; }
.w-title  { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.1; }
.w-big    { font-size: var(--fs-xxl); line-height: 0.95; letter-spacing: -0.01em; }
.w-unit   { font-size: 1.05rem; color: var(--ink-soft); }
.w-sub    { font-size: var(--fs-sm); line-height: 1.2; color: var(--ink-soft); }
.w-spacer { flex: 1; }
.w-row    { display: flex; align-items: center; gap: 10px; }
.w-row--between { justify-content: space-between; }

/* Labelled stack of segment bars */
.seglist { display: grid; gap: 9px; }
.seglist__row {
  display: grid;
  grid-template-columns: 70px 1fr 34px;
  align-items: center;
  gap: 10px;
  font-size: 0.98rem;
  line-height: 1;
}
.seglist__row b { font-weight: 400; text-align: right; color: var(--ink-soft); }

/* Week dots (streaks) */
.dots { display: flex; justify-content: space-between; }
.dots > span { display: grid; justify-items: center; gap: 2px; font-size: 0.72rem; color: var(--ink-soft); }
.dots i { width: 14px; height: 14px; border: 1px solid var(--edge); border-radius: var(--r-round); }
.dots i.on { background: var(--w-accent); }

/* ---------- 12. Clocks & digit tiles ------------------------------------ */
/* <div class="clock" data-clock data-tz="Asia/Tokyo" data-label="TYO"></div>
   White face by day, dark face at night where that person is. */

.clock { --face: #ffffff; --hand: #1d2433; width: 100%; aspect-ratio: 1; }
.clock.is-night { --face: #1b1f27; --hand: #f1f3f7; }
.clock svg { display: block; width: 100%; height: 100%; overflow: visible; }
.clock .face  { fill: var(--face); stroke: var(--edge); stroke-width: 1.2; filter: drop-shadow(0 4px 10px rgb(16 20 30 / .18)); }
.clock .tick  { stroke: var(--hand); stroke-width: 2; stroke-linecap: round; opacity: 0.35; }
.clock .num   { fill: var(--hand); font-family: var(--font-hand); font-size: 12px; text-anchor: middle; dominant-baseline: central; }
.clock .clock-label { fill: var(--hand); opacity: 0.5; font-family: var(--font-hand); font-size: 9.5px; text-anchor: middle; letter-spacing: 0.08em; }
.clock .h   { stroke: var(--hand); stroke-width: 4.5; stroke-linecap: round; }
.clock .m   { stroke: var(--hand); stroke-width: 3; stroke-linecap: round; }
.clock .s   { stroke: #2f7cf6; stroke-width: 1.6; stroke-linecap: round; }
.clock .pin { fill: #2f7cf6; stroke: var(--hand); stroke-width: 1.2; }
.clock--mini .num, .clock--mini .clock-label { display: none; }
.clock--mini .tick { opacity: 0.75; stroke-width: 3; }

/* <div class="digits" data-tz-digits data-tz="Asia/Tokyo"></div> */
.digits {
  --d: 2.6rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--d);
  line-height: 1;
}
.digit {
  position: relative;
  display: grid;
  place-items: center;
  width: 0.8em;
  height: 1.12em;
  background: var(--card-2);
  border: 1px solid var(--edge);
  border-radius: var(--r-sm);
  font-variant-numeric: tabular-nums;
}
.digit::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 50%;
  border-top: 1.5px solid color-mix(in srgb, var(--ink) 14%, transparent);
}
.digit.flip { animation: digit-flip 0.4s var(--ease-out); }
.digits__colon { width: 0.28em; text-align: center; animation: blink 2s steps(1) infinite; }
@keyframes digit-flip { from { transform: rotateX(-80deg); } }
@keyframes blink { 50% { opacity: 0.25; } }

/* ---------- 13. Calendar ------------------------------------------------- */

.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px 2px;
  text-align: center;
  font-size: 0.98rem;
}
.cal__dow { font-size: var(--fs-xs); color: var(--ink-soft); padding-bottom: 2px; }
.cal__day {
  display: grid;
  place-items: center;
  height: 32px;
  border: 2px solid transparent;
  border-radius: var(--r-round);
}
.cal__day.is-muted    { color: var(--ink-faint); }
.cal__day.is-today    { border-color: var(--ink); border-style: dashed; }
.cal__day.is-together { background: var(--blue-tint); color: var(--blue-ink); }
.cal__day.is-visit    { background: var(--blue); color: var(--on-blue); border-color: var(--ink); }

/* ---------- 14. Badges & achievement tiers ------------------------------ */

.badge {
  --b: var(--blue);
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  color: #fff;
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--b) 45%, #fff), var(--b) 64%);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--ink) 14%, transparent),
    0 6px 16px -6px color-mix(in srgb, var(--b) 85%, transparent);
}
.badge .icon { width: 26px; height: 26px; stroke-width: 1.8; }
.badge--sm { width: 42px; height: 42px; }
.badge--sm .icon { width: 20px; height: 20px; }
.badge--lg { width: 84px; height: 84px; border-width: 3px; }
.badge--lg .icon { width: 40px; height: 40px; }
.tier-emoji { display: block; line-height: 1; font-size: 26px; }
.badge--sm .tier-emoji { font-size: 19px; }
.badge--lg .tier-emoji { font-size: 40px; }
.badge--green    { --b: var(--green); }
.badge--bronze   { --b: var(--bronze);   color: #3b2210; }
.badge--silver   { --b: var(--silver);   color: #262c36; }
.badge--gold     { --b: var(--gold);     color: #3a2a00; }
.badge--platinum { --b: var(--platinum); color: #0d2a44; }
.badge.is-locked {
  color: var(--ink-faint);
  background: var(--paper-2);
  border: 1.5px dashed var(--ink-faint);
  box-shadow: none;
}
@keyframes wiggle {
  25% { transform: rotate(-10deg) scale(1.08); }
  60% { transform: rotate(8deg) scale(1.08); }
}

.tier--bronze   { --tier: var(--bronze);   --tier-ink: #3b2210; }
.tier--silver   { --tier: var(--silver);   --tier-ink: #262c36; }
.tier--gold     { --tier: var(--gold);     --tier-ink: #3a2a00; }
.tier--platinum { --tier: var(--platinum); --tier-ink: #0d2a44; }

/* ---------- 15. Achievement popups (game-overlay style) ------------------ */
/* Built by LDT.achievementPopup(). Add .is-static to show one inline. */

.ach {
  position: fixed;
  z-index: 1100;
  color: var(--pop-ink);
  background: var(--pop-bg);
  border: 2px solid var(--pop-line);
  font-family: var(--font-hand);
  line-height: 1.2;
  box-shadow: 0 12px 34px rgb(0 0 0 / 0.32);
}
.ach .icon { stroke-width: 2.2; }
.ach-kicker { display: flex; align-items: center; gap: 0.3em; font-size: 0.85rem; color: var(--pop-soft); }
.ach-kicker .icon { width: 1em; height: 1em; color: var(--gold); }
.ach-title  { font-size: 1.2rem; color: var(--pop-ink); }
.ach-body   { font-size: 0.9rem; color: var(--pop-soft); }
.ach-meta   { margin-top: 4px; font-size: 0.8rem; color: var(--tier); }

/* 1. Pill — circle pops in, stretches into a pill, bottom centre */
.ach-pill {
  left: 0;
  right: 0;
  bottom: 28px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  width: 68px;
  height: 68px;
  border-radius: 999px;
}
.ach-pill__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  margin: 0 6px;
  color: #fff;
  background: var(--green);
  border: 2px solid rgb(255 255 255 / 0.85);
  border-radius: var(--r-round);
}
.ach-pill__icon .icon { width: 27px; height: 27px; }
.ach-pill__icon .tier-emoji, .ach-banner__cup .tier-emoji { font-size: 24px; }
.ach-corner__icon .tier-emoji { font-size: 32px; }
.ach-pill__text { flex: 1 1 auto; min-width: 0; overflow: hidden; padding: 0 28px 0 6px; white-space: nowrap; opacity: 0; }

/* 2. Corner — card slides up from the bottom right */
.ach-corner {
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(340px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 14px 11px 15px 10px / 10px 15px 11px 14px;
}
.ach-corner__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 64px;
  height: 64px;
  color: #fff;
  background: var(--blue);
  border: 2px solid rgb(255 255 255 / 0.85);
  border-radius: 12px 9px 13px 8px / 8px 13px 9px 12px;
}
.ach-corner__icon .icon { width: 34px; height: 34px; }
.ach-corner__text { min-width: 0; flex: 1; }
.ach-progress { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 0.8rem; color: var(--pop-soft); }
.ach-progress i { flex: 1; height: 6px; background: var(--pop-line); border-radius: 4px; overflow: hidden; }
.ach-progress i::before { content: ""; display: block; height: 100%; width: calc(var(--p) * 1%); background: var(--blue); border-radius: 4px; }

/* 3. Banner — compact, top left, coloured by achievement tier */
.ach-banner {
  left: 24px;
  top: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 48px);
  padding: 8px 20px 8px 8px;
  background: rgb(20 23 29 / 0.94);
  backdrop-filter: blur(8px);
  border-radius: 14px 12px 15px 11px / 11px 15px 12px 14px;
}
.ach-banner__cup {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  color: var(--tier-ink, #3b2210);
  background: var(--tier, var(--bronze));
  border: 2px solid rgb(255 255 255 / 0.85);
  border-radius: var(--r-round);
}
.ach-banner__cup .icon { width: 25px; height: 25px; }

@media (max-width: 480px) {
  .ach-corner { right: 16px; bottom: 16px; }
  .ach-banner { left: 16px; top: 16px; max-width: calc(100vw - 32px); }
}

/* inline previews */
.ach.is-static { position: relative; inset: auto; margin: 0; z-index: auto; }
.ach-pill.is-static { width: auto; display: inline-flex; }
.ach-pill.is-static .ach-pill__text { opacity: 1; }

/* ---------- 16. Toasts & confetti --------------------------------------- */

.toast-stack {
  position: fixed;
  left: 50%;
  top: 20px;
  z-index: 1000;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 10px;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  pointer-events: auto;
  cursor: pointer;
  animation: toast-in 0.45s var(--ease-bounce);
}
.toast.is-leaving { animation: toast-out 0.3s ease-in forwards; }
.toast__title { font-size: 1.1rem; line-height: 1.1; }
.toast__body  { font-size: var(--fs-sm); color: var(--ink-soft); line-height: 1.25; }
@keyframes toast-in  { from { transform: translateY(-130%); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-40%) scale(0.95); opacity: 0; } }

.confetti {
  position: fixed;
  z-index: 1001;
  width: 11px;
  height: 7px;
  background: var(--c);
  border: 1px solid var(--edge);
  border-radius: 2px;
  pointer-events: none;
  animation: confetti 1.1s var(--ease-out) forwards;
}
@keyframes confetti {
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; }
}

.screen-fade { position: fixed; inset: 0; z-index: 1050; background: var(--paper); pointer-events: none; opacity: 0; }

/* ---------- 17. App cards (home page launcher) -------------------------- */

.app-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 26px; }
.app-card {
  --art: var(--blue-tint);
  position: relative;
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: var(--r-widget);
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease-bounce), box-shadow 0.25s;
}
.app-card--green { --art: var(--green-tint); }
.app-card__art {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background: var(--art);
  border-bottom: 1px solid var(--edge);
}
.app-card__art > svg { width: 82%; height: auto; overflow: visible; }
.app-card__tag { position: absolute; top: 12px; right: 12px; }
.app-card__body { display: grid; gap: 4px; padding: 14px 18px 16px; }
.app-card__title { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.1; }
.app-card__sub { color: var(--ink-soft); line-height: 1.3; }
.app-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.app-card--soon { border-style: dashed; box-shadow: none; background: transparent; }
.app-card--soon .app-card__art { --art: transparent; border-bottom-style: dashed; color: var(--ink-faint); }
.app-card--soon .app-card__art .icon { width: 44px; height: 44px; }

/* doodle illustration helpers (inline SVG art) */
.art-ink   { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.art-fill  { fill: var(--card); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.art-blue  { fill: var(--blue); }
.art-green { fill: var(--green); }
.art-text  { font-family: var(--font-hand); fill: var(--ink); }
.art-rise  { transform-box: fill-box; transform-origin: bottom; transition: transform 0.6s var(--ease-bounce); }
a.app-card:hover .art-rise { transform: scaleY(1.35); }
.art-bob   { transform-box: fill-box; transform-origin: center; transition: transform 0.4s var(--ease-bounce); }
a.app-card:hover .art-bob { transform: translateY(-5px) rotate(-4deg); }

/* ---------- 18. Achievements view --------------------------------------- */

/* Continuous progress: <div class="progress" style="--p:42"><span></span></div> */
.progress {
  position: relative;
  height: 24px;
  background: var(--card-2);
  border: 1px solid var(--edge);
  border-radius: 12px 9px 13px 8px / 8px 13px 9px 12px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 1%);
  background-color: var(--bar, var(--gold));
  background-image: repeating-linear-gradient(-45deg, transparent 0 7px, rgb(255 255 255 / 0.28) 7px 14px);
  border-right: 0;
  transition: width 1.1s var(--ease-out);
}
.progress--empty > span { border-right: 0; }

/* Locked achievement rows (hint only) inside a .list */
.list > li.is-locked { transition: opacity 0.4s ease, transform 0.4s var(--ease-out); }
.list > li.is-out    { opacity: 0; transform: translateX(12px); }
.list__row.is-locked { background: var(--paper-2); }
.list__secret { display: block; color: var(--ink-soft); letter-spacing: 0.2em; }
.list__hint   { display: flex; gap: 0.35em; line-height: 1.25; }
.list__hint .icon { flex: none; color: var(--blue); margin-top: 0.15em; }

/* Shared small meta line: tier dot · points · app · date */
.ach-info { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 3px; font-size: var(--fs-xs); color: var(--ink-soft); }
.ach-info .legend { font-size: inherit; }
.dot-sep { opacity: .6; }
.ach-info .legend i { width: 10px; height: 10px; }

/* Unlocked list rows (inside .list) */
.list__row.is-new { animation: ach-new 1.6s var(--ease-out); }
@keyframes ach-new { 0%, 35% { background: var(--gold-tint); } }

/* ---------- 19. Charts (soft light) --------------------------------------- */
/* Built by LDT.chart.line() and LDT.chart.target(). Hairlines, a green
   accent, soft glows — and they animate in. Set --delay on the <svg> to
   wait (e.g. for a screen fade). */

.lc, .tc { --chart: var(--blue); --chart-ink: var(--blue-ink); display: block; height: auto; overflow: visible; }  /* accent: blue */
.lc { width: 100%; }
.tc { width: min(100%, 380px); }
.lc text, .tc text { font-family: var(--font-hand); font-variant-numeric: tabular-nums; }

.lc-grid  { stroke: var(--line-soft); stroke-width: .75; }
.lc-axis, .lc-x { font-size: 12px; fill: var(--ink-soft); letter-spacing: .08em; }
.lc-area  { opacity: 0; animation: ldt-fade .8s var(--ease-out) forwards; animation-delay: calc(var(--delay, 0s) + .6s); }
.lc-halo, .lc-line {
  fill: none; stroke: var(--chart); stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: ldt-draw 1.1s var(--ease-in-out) forwards; animation-delay: var(--delay, 0s);
}
.lc-halo  { stroke-opacity: .14; stroke-width: 7; }
.lc-line  { stroke-width: 2.2; }
.lc-marker { stroke: var(--ink-faint); stroke-width: .75; stroke-dasharray: 2 3; opacity: 0;
  animation: ldt-fade .4s var(--ease-out) forwards; animation-delay: calc(var(--delay, 0s) + 1s); }
.lc-label { font-size: 13px; fill: var(--ink-soft); opacity: 0; transform-box: fill-box;
  animation: ldt-rise .45s var(--ease-out) forwards; animation-delay: calc(var(--delay, 0s) + .25s + var(--i, 0) * .14s); }
.lc-label.is-last { font-size: 16px; fill: var(--chart-ink); }
.lc-glow  { fill: var(--chart); opacity: 0; transform-box: fill-box; transform-origin: center;
  animation: ldt-glow 1.4s var(--ease-out) forwards; animation-delay: calc(var(--delay, 0s) + 1.05s); }
.lc-end   { fill: var(--card); stroke: var(--chart); stroke-width: 2.4; transform-box: fill-box; transform-origin: center; transform: scale(0);
  animation: ldt-pop .5s var(--ease-bounce) forwards; animation-delay: calc(var(--delay, 0s) + 1.05s); }

.tc-rung  { transform: scale(0); animation: ldt-grow .75s var(--ease-bounce) forwards;
  animation-delay: calc(var(--delay, 0s) + var(--i, 0) * .1s); }
.tc-edge  { fill: none; stroke: color-mix(in srgb, var(--chart) 45%, transparent); stroke-width: 1; }
.tc-spoke { stroke: var(--paper); stroke-opacity: .75; stroke-width: 1; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: ldt-draw .5s var(--ease-out) forwards; animation-delay: calc(var(--delay, 0s) + .35s); }
.tc-ring-label { font-size: 12px; fill: var(--chart-ink); letter-spacing: .08em; opacity: 0;
  animation: ldt-fade .4s var(--ease-out) forwards; animation-delay: calc(var(--delay, 0s) + .55s); }
.tc-label { font-size: 15px; fill: var(--ink); letter-spacing: .03em; opacity: 0; transform-box: fill-box;
  animation: ldt-rise .4s var(--ease-out) forwards; animation-delay: calc(var(--delay, 0s) + .7s + var(--i, 0) * .12s); }
.tc-glow  { fill: var(--paper); opacity: 0;
  animation: ldt-fade-90 .5s var(--ease-out) forwards; animation-delay: calc(var(--delay, 0s) + 1.05s + var(--i, 0) * .12s); }
.tc-dot   { fill: var(--card); stroke: var(--chart-ink); stroke-width: 2.6; transform-box: fill-box; transform-origin: center;
  transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0;
  animation: ldt-fly .6s var(--ease-bounce) forwards; animation-delay: calc(var(--delay, 0s) + .7s + var(--i, 0) * .12s); }

/* Achievement rows sliding in */
.rise-in { opacity: 0; animation: ldt-rise .5s var(--ease-out) forwards; animation-delay: calc(var(--delay, 0s) + var(--i, 0) * 60ms); }

/* Soft list: hairline border, diffuse shadow (data & achievements) */
.list--soft { border: 1px solid var(--line-soft); box-shadow: 0 8px 28px -14px rgb(16 20 30 / .22); }

@keyframes ldt-draw   { to { stroke-dashoffset: 0; } }
@keyframes ldt-fade   { to { opacity: 1; } }
@keyframes ldt-fade-90 { to { opacity: .9; } }
@keyframes ldt-rise   { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ldt-pop    { to { transform: scale(1); } }
@keyframes ldt-grow   { to { transform: scale(1); } }
@keyframes ldt-fly    { to { transform: none; opacity: 1; } }
@keyframes ldt-glow   { 0% { opacity: 0; transform: scale(.4); } 45% { opacity: .65; transform: scale(1.35); } 100% { opacity: .4; transform: scale(1); } }


/* ---------- 20. Soft light refinements ---------------------------------- */
/* One box language everywhere: hairline edge, even radius, diffuse shadow.
   Colour shows up as gentle gradients and glows rather than outlines. */

.btn--primary, .btn--green { border-color: transparent; }
.btn--primary { background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 80%, #fff), var(--blue));
  box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--blue) 85%, transparent); }
.btn--green { background: linear-gradient(180deg, color-mix(in srgb, var(--green) 78%, #fff), var(--green));
  box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--green) 85%, transparent); }
.btn--ghost { border: 1px dashed var(--ink-faint); }
.btn--plain { border-color: transparent; }

.segmented { background: var(--paper-2); }
.segmented button[aria-pressed="true"] { border-color: transparent; }
.switch__track::after { border: 0; box-shadow: 0 2px 8px rgb(16 20 30 / .28); }
.switch input:checked + .switch__track { box-shadow: 0 0 16px -4px color-mix(in srgb, var(--green) 80%, transparent); }
.input, .search { box-shadow: none; }

.segbar > i { border: 0; border-radius: 4px; background: var(--card-2); }
.segbar > i.on { background: var(--seg); box-shadow: 0 0 12px -2px color-mix(in srgb, var(--seg) 85%, transparent); }
.bar > span { border-right: 0; background-image: none;
  box-shadow: 0 0 16px -2px color-mix(in srgb, var(--bar, var(--blue)) 80%, transparent); }
.stackbar { border-radius: 12px; }
.dots i { border: 1.5px solid var(--ink-faint); }
.dots i.on { border-color: transparent; box-shadow: 0 0 12px -1px color-mix(in srgb, var(--w-accent) 85%, transparent); }
.legend i { border: 0; box-shadow: inset 0 0 0 1px var(--edge); }
.ring { filter: drop-shadow(0 0 7px rgb(16 20 30 / .12)); }
.digit { background: linear-gradient(180deg, var(--card), var(--card-2)); box-shadow: var(--shadow-sm); }
.digit::after { border-top-color: var(--edge); }
.cal__day.is-today { border: 1.5px solid var(--blue); }
.cal__day.is-visit { border-color: transparent; box-shadow: 0 0 18px -3px color-mix(in srgb, var(--blue) 85%, transparent); }
.count { border-color: var(--paper); box-shadow: 0 0 12px -2px color-mix(in srgb, var(--red) 80%, transparent); }
.list__icon { border: 0; box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--c, var(--blue)) 80%, transparent); }
.app__icon { box-shadow: var(--shadow-sm); }
.app--blue, .app--green { border-color: transparent; box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--c) 85%, transparent); }

/* Widgets: soft panels with a whisper of their accent, gentle glows */
.widget { background: linear-gradient(165deg, var(--card), color-mix(in srgb, var(--card) 94%, var(--w-accent))); }
.widget--blue, .widget--green {
  background: radial-gradient(140% 120% at 0% 0%, color-mix(in srgb, var(--w-accent) 20%, var(--card)), var(--card) 72%); }
.w-label .icon { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--w-accent) 55%, transparent)); }
.widget--fill {
  background: radial-gradient(140% 120% at 0% 0%, color-mix(in srgb, var(--w-accent) 65%, #fff), var(--w-accent) 55%, color-mix(in srgb, var(--w-accent) 75%, #000));
  border-color: transparent;
  box-shadow: 0 18px 44px -18px color-mix(in srgb, var(--w-accent) 85%, transparent); }
/* Night: deep-blue console glow */
.widget--night {
  background: radial-gradient(120% 110% at 15% 0%, #2c54b8 0%, #10204f 45%, #070b1c 100%);
  border-color: rgb(255 255 255 / .08);
  box-shadow: 0 22px 56px -20px rgb(10 30 100 / .75), inset 0 1px 0 rgb(255 255 255 / .1); }
.widget--night .digit { background: rgb(255 255 255 / .06); border-color: rgb(255 255 255 / .12); box-shadow: inset 0 1px 0 rgb(255 255 255 / .08); }
.widget--night .digit::after { border-top-color: rgb(255 255 255 / .08); }
.widget--night .w-label .icon { color: #a9cbff; filter: drop-shadow(0 0 8px #5c9cff); }

/* Popups: dark glass */
.ach {
  background: rgb(14 18 30 / .86);
  backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgb(255 255 255 / .09);
  box-shadow: 0 26px 64px -22px rgb(0 0 0 / .6), inset 0 1px 0 rgb(255 255 255 / .07); }
.ach-pill__icon { background: radial-gradient(circle at 32% 28%, #5fe08f, var(--green) 65%); border: 2px solid rgb(255 255 255 / .9);
  border-radius: 50%; box-shadow: 0 0 24px -2px color-mix(in srgb, var(--green) 85%, transparent); }
.ach-corner__icon { background: radial-gradient(circle at 32% 28%, #7fb2ff, var(--blue) 65%); border-color: rgb(255 255 255 / .9);
  border-radius: 14px; box-shadow: 0 0 26px -4px color-mix(in srgb, var(--blue) 85%, transparent); }
.ach-banner__cup { border-radius: 50%; box-shadow: 0 0 22px -3px var(--tier, var(--bronze)); }
.ach-corner { border-radius: 18px; }
.ach-banner { border-radius: 18px; background: rgb(14 18 30 / .86); }

/* Achievement name flashes, then the explanation fades in underneath */
.ach-swap { display: grid; }
.ach-swap > * { grid-area: 1 / 1; }
.ach-title { transform-origin: left center; animation: ach-flash 1.2s var(--ease-out) var(--flash, .35s) both; }
.ach-body  { font-size: .88rem; color: var(--pop-soft); opacity: 0; animation: ldt-rise .5s var(--ease-out) var(--reveal, 1.35s) forwards; }
.ach-pill  { --flash: 1s; --reveal: 2.2s; }
.ach-pill .ach-swap .ach-kicker { animation: ach-out .35s var(--ease-in) 2s forwards; }
@keyframes ach-flash {
  0%   { opacity: 0; transform: scale(.9); text-shadow: none; }
  25%  { opacity: 1; transform: scale(1.08); text-shadow: 0 0 22px rgb(255 214 102 / .95), 0 0 6px #fff; }
  55%  { transform: scale(1); text-shadow: 0 0 14px rgb(255 214 102 / .6); }
  100% { opacity: 1; transform: none; text-shadow: none; }
}
@keyframes ach-out { to { opacity: 0; transform: translateY(-4px); } }

.toast { border-radius: 18px; }

/* ---------- 21. Hover standard ------------------------------------------- */
/* Anything you can press lifts and tilts (and comes forward so its shadow
   isn't covered); pressing squashes it a little. Nothing else moves. */
.btn, a.widget, .widget--tap, a.app-card, .app__icon, a.chip, .unit-card,
.segmented button, .list__row, .menu button, .tab, .switch__track {
  transition: transform .22s var(--ease-bounce), box-shadow .22s var(--ease-out), background .2s;
}
.btn:hover, a.widget:hover, .widget--tap:hover, a.app-card:hover, .app:hover .app__icon, a.chip:hover, .unit-card:hover {
  transform: var(--lift); box-shadow: var(--shadow-lg); position: relative; z-index: 2;
}
.btn--plain:hover, .btn--ghost:hover { box-shadow: none; }
.segmented button:hover, a.list__row:hover, button.list__row:hover, label.list__row:hover,
.menu button:hover, .tab:hover, .switch:hover .switch__track { transform: var(--lift-sm); position: relative; z-index: 1; }
.btn:active, a.widget:active, .widget--tap:active, a.app-card:active, .app:active .app__icon, a.chip:active, .unit-card:active,
.segmented button:active, .list__row:active, .menu button:active { transform: var(--press); }
.btn:disabled:hover, .btn[aria-disabled="true"]:hover { transform: none; box-shadow: var(--shadow-sm); }

/* Lists without overflow clipping: round the first/last row instead */
.list > li:first-child > .list__row, .list > .list__row:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.list > li:last-child > .list__row, .list > .list__row:last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }

/* App cards round their art panel instead of clipping (keeps glows) */
.app-card__art { border-top-left-radius: inherit; border-top-right-radius: inherit; }

/* Bars round their own fill instead of clipping it (keeps the glow) */
.bar > span { border-radius: inherit; }

/* Glowing tiles keep their glow within the grid gap */
.widget--fill { box-shadow: 0 12px 30px -14px color-mix(in srgb, var(--w-accent) 85%, transparent); }
.widget--night { box-shadow: 0 14px 34px -16px rgb(10 30 100 / .75), inset 0 1px 0 rgb(255 255 255 / .1); }

/* ---------- 22. Credit footer -------------------------------------------- */
.site-credit { display: block; padding: 28px 16px 36px; text-align: center; font-size: var(--fs-sm); color: var(--ink-soft); }

/* ---------- 23. Modal ----------------------------------------------------- */
.modal {
  width: min(400px, calc(100vw - 32px));
  padding: 24px 24px 20px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}
.modal[open] { animation: modal-in .4s var(--ease-bounce); }
.modal::backdrop { background: rgb(16 20 30 / .32); backdrop-filter: blur(8px); animation: ldt-fade .3s var(--ease-out) both; opacity: 0; }
.modal__title { font-size: 1.3rem; margin: 0 0 6px; }
.modal__body  { margin: 0 0 20px; color: var(--ink-soft); }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal__icon { font-size: 2.4rem; line-height: 1; margin-bottom: 8px; }
.modal__list { margin: -6px 0 20px; padding: 0; list-style: none; display: grid; gap: 8px; }
.modal__list li { position: relative; padding-left: 20px; line-height: 1.35; }
.modal__list li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 8px var(--blue); }

/* Challenge tiles (the art bible's filled tile) */
.challenge-grid { display: grid; grid-template-columns: repeat(auto-fill, 140px); gap: 16px; }
.challenge-tile { aspect-ratio: 1; padding: 12px; font: inherit; text-align: left; cursor: pointer; border-radius: 22px; }
.challenge-tile .badge { width: 32px; height: 32px; }
.challenge-tile .badge span { font-size: 16px; line-height: 1; }
.challenge-tile .w-title { font-size: .95rem; line-height: 1.15; }
.challenge-tile .w-sub { font-size: .78rem; }
.challenge-tile--light { color: #2b2300; --ink-soft: rgb(43 35 0 / .7); }
.btn--danger-fill { --btn-fg: #fff; border-color: transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--red) 80%, #fff), var(--red));
  box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--red) 85%, transparent); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
