/* ─────────────────────────────────────────────────────────────────────────
   福慧大富翁 Dashboard — 禪意水彩 reskin (part 1: shell · topbar · players)
   Soft mint→cream washes, rounded cards, pastel gradient accents,
   warm-ink type, golden-star achievement motif. Mirrors the board art.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Paper / surfaces */
  --paper:        #EFF2E9;   /* page wash base */
  --paper-2:      #E6EADD;   /* inset / progress track */
  --surface:      #FCFBF6;   /* cards */
  --surface-2:    #F8F6EE;   /* soft inset surface */
  --surface-soft: #F4F2E8;

  /* Hairlines (used sparingly; shadows do most of the work) */
  --line:         #E7E3D4;
  --line-strong:  #D6D1BF;

  /* Ink — warm dark sage, never pure black (matches board lettering) */
  --ink:          #39413A;
  --ink-dim:      #6B7268;
  --ink-mute:     #6E736A;   /* darkened for WCAG: 2.36:1 -> 4.69:1 on surface */

  /* Core stats — soft pastels, shared lightness/chroma, varied hue */
  --fortune:      #D8A94E;   /* 福報 · warm gold (the star) */
  --fortune-soft: #F3E6C5;
  --fortune-tint: #FAF3DF;
  --wisdom:       #6FB3AC;   /* 智慧 · calm teal */
  --wisdom-soft:  #D5Eae6;
  --wisdom-tint:  #E9F4F1;
  --civ:          #84B377;   /* 文明 · sprout green */
  --civ-soft:     #DCEBD3;
  --civ-tint:     #EDF4E6;
  /* Darker accent variants for when the hue is used as readable TEXT (the soft
     pastels above fail WCAG as text). Pass >=4.5:1 on surface and their tints. */
  --fortune-ink:  #876718;
  --wisdom-ink:   #2E756D;

  /* Category accents (board card families) */
  --c-teal:   #7FC2BB;
  --c-green:  #93C589;
  --c-gold:   #E6C36C;
  --c-orange: #E7B17E;
  --c-rose:   #E5A39C;

  /* Signals */
  --primary:      #7BAE73;   /* soft sage — primary action */
  --primary-deep: #689A61;
  --warn:         #D69A52;
  --danger:       #CC7E6E;
  --danger-deep:  #B5634F;

  /* Radii — rounded, friendly */
  --r-card:  22px;
  --r-md:    16px;
  --r-sm:    12px;
  --r-pill:  999px;

  /* Soft diffuse shadows (green-gray, low opacity) */
  --shadow-sm: 0 1px 3px rgba(90,104,84,0.06), 0 2px 8px rgba(90,104,84,0.05);
  --shadow:    0 4px 18px rgba(90,104,84,0.10), 0 1px 4px rgba(90,104,84,0.06);
  --shadow-lg: 0 18px 48px rgba(70,86,66,0.18), 0 6px 18px rgba(70,86,66,0.10);
  --glow-gold: 0 0 0 4px rgba(216,169,78,0.16), 0 8px 28px rgba(216,169,78,0.28);

  /* Stat row column template */
  --stat-cols: 56px 1fr 44px 64px 44px;
}

* { box-sizing: border-box; }
/* body must NOT get height:100% — it would cap the topbar's sticky range at
   one viewport (sticky can't escape its parent's box). min-height on body
   below keeps the full-height wash. */
html, body { margin: 0; padding: 0; }
html { font-size: 16px; height: 100%; }

body {
  min-height: 100vh;
  font-family: "PingFang TC", "PingFang SC", "Noto Sans TC",
    "Microsoft JhengHei", "Helvetica Neue", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 12% -8%, #EAF2E6 0%, rgba(234,242,230,0) 55%),
    radial-gradient(110% 70% at 92% 4%, #F6EFDD 0%, rgba(246,239,221,0) 50%),
    linear-gradient(168deg, #EBF1E6 0%, #F2EFE6 48%, #F6F3EA 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
  /* clip, not hidden: hidden turns body into a scroll container, which breaks
     the topbar's position:sticky (it would stick to body, which never scrolls) */
  overflow-x: clip;
  letter-spacing: 0.01em;
}

button { font-family: inherit; }

/* Visible keyboard focus on every interactive element (buttons previously had
   none). Only shows for keyboard/AT focus, not mouse clicks. */
:focus-visible { outline: 2px solid var(--wisdom); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ───────────── Top bar ───────────── */

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  /* iPad/iPhone standalone PWA: status bar is translucent (viewport-fit=cover),
     so pad the topbar by the safe-area insets or the clock/battery overlap the
     logo and action buttons. Insets are 0 in normal browsers, so this is a no-op
     there. Defined as vars so the responsive padding overrides can reuse them. */
  --sa-top: env(safe-area-inset-top);
  --sa-left: env(safe-area-inset-left);
  --sa-right: env(safe-area-inset-right);
  padding:
    calc(16px + var(--sa-top))
    calc(30px + var(--sa-right))
    16px
    calc(30px + var(--sa-left));
  background: rgba(252,251,246,0.86);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid rgba(231,227,212,0.8);
  box-shadow: 0 6px 22px rgba(90,104,84,0.06);
  position: sticky; top: 0; z-index: 50;
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 36%, #FFFDF6 0%, #F3F6EE 70%);
  box-shadow:
    inset 0 0 0 1.5px rgba(214,209,191,0.7),
    0 4px 14px rgba(132,179,119,0.20);
  line-height: 0;
  overflow: hidden;
}
.logo svg { width: 34px; height: 34px; display: block; }
/* legacy glyph logos fall back gracefully */
.logo:not(:has(svg)) { font-size: 22px; line-height: 1; }

.brand-text .title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink);
}
.brand-text .subtitle {
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  margin-top: 3px;
}

.meta {
  display: flex;
  gap: 0;
  justify-content: center;
  /* nowrap in the wide one-row layout: wrapping here let the timer flip between
     rows on every per-second re-render when the strip was near the edge. The
     narrow layout below switches the whole strip to its own row instead. */
  flex-wrap: nowrap;
}
.meta-item {
  display: flex; flex-direction: column; align-items: center;
  min-width: 96px;
  padding: 2px 22px;
  position: relative;
}
.meta-item + .meta-item::before {
  content: ""; position: absolute; left: 0; top: 18%; bottom: 18%;
  width: 1px; background: var(--line);
}
.meta-item label {
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.26em;
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.meta-item label .dot { width: 7px; height: 7px; margin-right: 6px; }
.meta-value {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.meta-value strong { font-variant-numeric: tabular-nums; font-weight: 700; }
.meta-sep { color: var(--ink-mute); margin: 0 5px; font-weight: 300; }
.meta-cap { font-size: 12px; color: var(--ink-mute); font-weight: 400; margin-left: 6px; }

.timer.warn strong   { color: var(--warn); }
.timer.sprint strong { color: var(--danger); }
.timer.over strong   { color: var(--danger-deep); animation: pulse 1.4s ease-in-out infinite; }

/* Final-15-minute sprint banner — 無常與恩典齊發 */
.sprint-banner {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
  padding: 11px 18px;
  background: linear-gradient(90deg, var(--fortune-tint), #FBEFE6, var(--fortune-tint));
  border-bottom: 1px solid var(--fortune-soft);
  text-align: center;
}
.sprint-banner.hidden { display: none; }
.sprint-banner-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--danger-deep);
}
.sprint-banner-sub {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}

.actions { display: flex; gap: 8px; }

/* ───────────── Buttons ───────────── */

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  min-height: 44px;
  box-shadow: var(--shadow-sm);
}
.btn:hover  { background: var(--surface-2); border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.btn-primary {
  background: linear-gradient(165deg, #8BBB82, var(--primary));
  border-color: transparent;
  color: #243024;   /* dark ink keeps the pastel green but passes WCAG (was #FFF = 2.58:1) */
  box-shadow: 0 6px 18px rgba(123,174,115,0.34);
}
.btn-primary:hover { background: linear-gradient(165deg, #82B479, var(--primary-deep)); box-shadow: 0 8px 22px rgba(104,154,97,0.40); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-dim);
  box-shadow: none;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.7);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.btn-warn {
  background: var(--surface);
  border-color: var(--danger);
  color: var(--danger-deep);
}
.btn-warn:hover { background: #FBEEEA; border-color: var(--danger); }

.btn-block { display: block; width: 100%; margin-top: 12px; }

.icon-btn {
  background: transparent; border: none; color: var(--ink-dim);
  font-size: 18px; cursor: pointer; padding: 8px 12px;
  border-radius: var(--r-sm);
  min-width: 44px; min-height: 44px;
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }

/* ───────────── Civ progress bar ───────────── */

.civ-progress { padding: 22px 32px 4px; max-width: 1600px; margin: 0 auto; }
.civ-bar {
  position: relative;
  height: 10px;
  background: var(--paper-2);
  border-radius: var(--r-pill);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(90,104,84,0.10);
}
.civ-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--civ), #A7CF7E 55%, var(--fortune));
  border-radius: var(--r-pill);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.civ-progress-label {
  font-size: 10px;
  color: var(--ink-mute);
  text-align: center;
  margin-top: 11px;
  letter-spacing: 0.28em;
}

/* Goal reached = victory — the bar goes full gold with the graduation glow */
.civ-bar.reached {
  box-shadow: inset 0 1px 2px rgba(90,104,84,0.10), var(--glow-gold);
}
.civ-bar.reached .civ-bar-fill {
  background: linear-gradient(90deg, #E9C877, var(--fortune) 55%, #EBCB78);
}
.civ-progress-label.reached { color: var(--fortune-ink); font-weight: 700; }

/* ───────────── Layout ───────────── */

.dashboard {
  display: grid;
  grid-template-columns: 1fr 332px;
  gap: 26px;
  padding: 22px 32px 48px;
  max-width: 1600px;
  margin: 0 auto;
}
/* Two-row topbar: brand + actions on top, the meta strip on its own full row.
   Kicks in while there's still comfortable room (the meta needs ~1200px to share
   a row with brand+actions), so the strip never sits at the wrap boundary where
   the timer jittered between rows. */
@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand actions" "meta meta";
    gap: 10px 16px;
  }
  .brand   { grid-area: brand; }
  .actions { grid-area: actions; }
  .meta    { grid-area: meta; justify-content: space-between; flex-wrap: wrap; }
  .meta-item { min-width: 96px; padding: 2px 16px; }
  .meta-value { font-size: 19px; }
}

@media (max-width: 1024px) {
  .dashboard { grid-template-columns: 1fr; padding: 20px; }
}

.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px;
  padding: 0 4px;
}
.section-head h2 {
  font-size: 12px; margin: 0; font-weight: 700;
  color: var(--ink-dim); letter-spacing: 0.3em;
}
.legend { display: flex; gap: 16px; font-size: 11px; color: var(--ink-dim); letter-spacing: 0.06em; align-items: center; }
.dot {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; margin-right: 6px; vertical-align: middle;
}
.dot-fortune { background: var(--fortune); }
.dot-wisdom  { background: var(--wisdom);  }
.dot-civ     { background: var(--civ);     }

/* ───────────── Empty state ───────────── */

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 76px 24px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.empty-icon {
  margin: 0 auto 18px;
  line-height: 0;
}
.empty-icon svg { width: 116px; height: auto; }
.empty-state h3 { margin: 8px 0; font-size: 19px; font-weight: 700; letter-spacing: 0.06em; }
.empty-state p { color: var(--ink-dim); margin: 8px 0 24px; font-size: 14px; }

/* ───────────── Players grid ───────────── */

.players-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), 1fr);
  gap: 18px;
}
@media (max-width: 1100px) { .players-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .players-grid { grid-template-columns: 1fr; } }

/* ───────────── Player card ───────────── */

.player-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--r-card);
  padding: 22px 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
/* pastel gradient top strip — rotates hue per card via :nth-child */
.player-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--c-teal), var(--c-green));
}
.players-grid .player-card:nth-child(6n+2)::before { background: linear-gradient(90deg, var(--c-rose), var(--c-orange)); }
.players-grid .player-card:nth-child(6n+3)::before { background: linear-gradient(90deg, var(--c-gold), var(--c-orange)); }
.players-grid .player-card:nth-child(6n+4)::before { background: linear-gradient(90deg, var(--c-green), var(--c-teal)); }
.players-grid .player-card:nth-child(6n+5)::before { background: linear-gradient(90deg, var(--c-orange), var(--c-rose)); }
.players-grid .player-card:nth-child(6n+6)::before { background: linear-gradient(90deg, var(--wisdom), var(--c-green)); }
.player-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.player-card.graduated {
  background:
    radial-gradient(120% 80% at 50% -10%, var(--fortune-tint) 0%, rgba(250,243,223,0) 60%),
    var(--surface);
  box-shadow: var(--glow-gold), var(--shadow);
}
.player-card.graduated::before { background: linear-gradient(90deg, #EBCB78, var(--fortune), #EBCB78); height: 6px; }
.player-card.pulse { animation: cardPulse 1.2s ease-out; }
.player-card.grad  { animation: gradPulse 1.4s ease-out; }
@keyframes cardPulse {
  0%   { box-shadow: 0 0 0 0 rgba(127,194,187,0.45), var(--shadow); }
  100% { box-shadow: 0 0 0 14px rgba(127,194,187,0), var(--shadow); }
}
@keyframes gradPulse {
  0%   { box-shadow: 0 0 0 0 rgba(216,169,78,0.50), var(--shadow); }
  100% { box-shadow: 0 0 0 18px rgba(216,169,78,0), var(--shadow); }
}

/* Player card header */
.pc-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.pc-name {
  font-size: 19px; font-weight: 700;
  flex: 1; min-width: 0;
  background: transparent; border: none;
  color: var(--ink);
  padding: 4px 8px; margin: -4px -8px;
  border-radius: var(--r-sm);
  letter-spacing: 0.04em;
}
.pc-name:focus { background: var(--surface-2); outline: 2px solid var(--wisdom-soft); }
.pc-name::placeholder { color: var(--ink-mute); font-weight: 500; }

.pc-hat {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #8A6A1E;
  background: linear-gradient(165deg, #FBEFCB, var(--fortune-soft));
  padding: 5px 11px 5px 26px;
  border-radius: var(--r-pill);
  font-weight: 700;
  position: relative;
  opacity: 0; transform: translateY(-2px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(216,169,78,0.28);
}
.pc-hat::before {
  content: "★"; position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--fortune); font-size: 13px;
}
.player-card.graduated .pc-hat { opacity: 1; transform: translateY(0) scale(1); }

/* Secondary readout: raw 福報+智慧 sum (used by 文明高度設定 / 命運「忘失初心」).
   Kept smaller/muted so it doesn't compete with the 綜合 headline. */
.pc-fw {
  font-size: 9px; color: var(--ink-mute);
  display: flex; flex-direction: column; align-items: flex-end;
  line-height: 1.1;
  letter-spacing: 0.16em;
}
.pc-fw strong {
  font-size: 16px; color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0;
  margin-top: 3px;
}
.pc-total {
  font-size: 9px; color: var(--ink-mute);
  display: flex; flex-direction: column; align-items: flex-end;
  line-height: 1.1;
  letter-spacing: 0.22em;
}
.pc-total strong {
  font-size: 24px; color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0;
  margin-top: 3px;
}

/* Stat row */
.stat-row {
  display: grid;
  grid-template-columns: var(--stat-cols);
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  position: relative;
}
.stat-row + .stat-row { border-top: 1px solid var(--line); }

.stat-row .stat-label {
  font-size: 13px; color: var(--ink-dim); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  letter-spacing: 0.1em;
}
.stat-row .stat-label::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
}
.stat-row.stat-fortune .stat-label::before { background: var(--fortune); box-shadow: 0 0 0 3px var(--fortune-tint); }
.stat-row.stat-wisdom  .stat-label::before { background: var(--wisdom);  box-shadow: 0 0 0 3px var(--wisdom-tint); }
.stat-row.stat-civ     .stat-label::before { background: var(--civ);     box-shadow: 0 0 0 3px var(--civ-tint); }

.stat-row .stat-num {
  font-size: 27px; font-weight: 600;
  text-align: center; min-width: 64px;
  font-variant-numeric: tabular-nums;
  background: transparent; border: none; color: var(--ink);
  padding: 2px 0; border-radius: var(--r-sm);
  -moz-appearance: textfield;
  letter-spacing: 0;
}
.stat-row .stat-num::-webkit-outer-spin-button,
.stat-row .stat-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stat-row .stat-num:focus { background: var(--surface-2); outline: 2px solid var(--wisdom-soft); }

.stat-row .stat-bar {
  height: 7px; background: var(--paper-2);
  border-radius: var(--r-pill); position: relative;
  box-shadow: inset 0 1px 2px rgba(90,104,84,0.08);
}
.stat-row .stat-bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  border-radius: var(--r-pill);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-fortune .stat-bar-fill { background: linear-gradient(90deg, #E9C877, var(--fortune)); }
.stat-wisdom  .stat-bar-fill { background: linear-gradient(90deg, #8FCBC4, var(--wisdom));  }
.stat-civ     .stat-bar-fill { background: linear-gradient(90deg, #A4CF93, var(--civ));     }

.stat-row .stat-mark {
  position: absolute; top: -2px; bottom: -2px;
  width: 2px; background: rgba(162,168,153,0.55); border-radius: 2px;
}
.stat-row .stat-mark.reached { background: #FFFFFF; box-shadow: 0 0 0 1px rgba(57,65,58,0.25); }

/* Tap button — soft round */
.tap {
  width: 44px; height: 44px; line-height: 1;
  border-radius: 50%;
  padding: 0;
  font-size: 19px; font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  -webkit-touch-callout: none;
  user-select: none;
  box-shadow: var(--shadow-sm);
}
.tap:hover  { background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.tap:active { transform: scale(0.92); }
.stat-fortune .tap:hover { border-color: var(--fortune); color: var(--fortune); }
.stat-wisdom  .tap:hover { border-color: var(--wisdom);  color: var(--wisdom); }
.stat-civ     .tap:hover { border-color: var(--civ);     color: var(--civ); }

/* Card footer */
.pc-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--ink-mute);
  padding-top: 12px; margin-top: 6px;
  border-top: 1px solid var(--line);
  letter-spacing: 0.06em;
}
.pc-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--ink-dim);
  background: var(--surface-2);
  border-radius: var(--r-pill);
}
.player-card.graduated .pc-status {
  color: #8A6A1E; background: var(--fortune-tint); font-weight: 600;
}
.pc-remove {
  background: transparent; border: none;
  color: var(--ink-mute); cursor: pointer;
  font-size: 11px; padding: 4px 8px;
  border-radius: var(--r-sm);
  min-height: 28px;
  letter-spacing: 0.1em;
}
.pc-remove:hover { color: var(--danger-deep); background: #FBEEEA; }

@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.55;} }

/* ───────────── Tools sidebar ───────────── */

.tools { display: flex; flex-direction: column; gap: 18px; }

.tool-card {
  background: var(--surface);
  border-radius: var(--r-card);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.tool-card h3 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.26em;
  color: var(--ink-dim);
}
.tool-hint { margin: 0 0 14px; font-size: 12px; color: var(--ink-mute); line-height: 1.65; }

.milestone-log {
  list-style: none; padding: 0; margin: 0;
  max-height: 320px; overflow-y: auto;
  display: flex; flex-direction: column;
}
.milestone-log li {
  font-size: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  line-height: 1.55;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
  color: var(--ink);
}
.milestone-log li:first-child { border-top: none; padding-top: 4px; }
.milestone-log li.empty {
  color: var(--ink-mute); text-align: center;
  border-top: none; padding: 18px 0 8px;
  letter-spacing: 0.14em; font-size: 11px;
}
.milestone-log li.grad { color: #7E6520; font-weight: 600; }
.milestone-log li.grad::before { content: "★"; margin-right: 7px; color: var(--fortune); }
.milestone-log li.milestone::before { content: "○"; margin-right: 7px; color: var(--wisdom); }
.milestone-log .ml-time {
  color: var(--ink-mute); font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em; flex-shrink: 0;
}

.danger-card { background: var(--surface); }

@keyframes toastIn {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}

/* Respect users who ask for less motion: neutralise CSS animation/transition
   globally (the JS-driven dice already checks this separately). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
