/* ---------- tokens ---------- */
:root {
  --bg: #f7f6f1;
  --fg: #0f1115;
  --muted: #5a6068;
  --card: #ffffff;
  --card-border: #e6e4dc;
  --shadow: 0 1px 3px rgba(15,17,21,.04), 0 14px 40px rgba(15,17,21,.06);
  --bar-label-fg: rgba(15,17,21,.7);

  /* Period semantic — calmer/more saturated than v1 */
  --off-fg:  #0d4a26;
  --off-bg:  #c4f4d8;
  --off-ink: #0b1f12;
  --mid-fg:  #5a3a00;
  --mid-bg:  #fde6a3;
  --mid-ink: #261a00;
  --on-fg:   #7a1414;
  --on-bg:   #ffc8c0;
  --on-ink:  #2c0707;

  --accent: #2563eb;          /* fallback */
  --glow: 540px;                /* period glow radius */

  /* Type scale */
  --fz-eyebrow: 11px;
  --fz-secondary: 14px;
  --fz-muted: 13px;
  --fz-hero-num: clamp(72px, 16vw, 128px);
  --fz-period-name: clamp(14px, 2.6vw, 16px);

  --tr-1: cubic-bezier(.22,.61,.36,1);
  --tr-2: cubic-bezier(.6,.1,.2,1);
}

[data-theme="dark"] {
  --bg: #0a0c10;
  --fg: #ecedef;
  --muted: #8b949e;
  --card: #14171d;
  --card-border: #23272f;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 14px 40px rgba(0,0,0,.4);
  --bar-label-fg: rgba(255,255,255,.78);

  --off-fg:  #8ee0ad;
  --off-bg:  #14331f;
  --off-ink: #e9fbef;
  --mid-fg:  #f7c97a;
  --mid-bg:  #3b2a00;
  --mid-ink: #fbe7b6;
  --on-fg:   #ff9a92;
  --on-bg:   #3b1313;
  --on-ink:  #ffd9d4;

  --accent: #6aa3ff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0a0c10;
    --fg: #ecedef;
    --muted: #8b949e;
    --card: #14171d;
    --card-border: #23272f;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 14px 40px rgba(0,0,0,.4);
    --off-fg: #8ee0ad;  --off-bg: #14331f;  --off-ink: #e9fbef;
    --mid-fg: #f7c97a;  --mid-bg: #3b2a00;  --mid-ink: #fbe7b6;
    --on-fg:  #ff9a92;  --on-bg:  #3b1313;  --on-ink:  #ffd9d4;
    --accent: #6aa3ff;
  }
}

/* Period-coded background glow (the canvas breathes with the rate) */
body[data-period="off"]::before { background: radial-gradient(circle at 50% 18%, var(--off-bg) 0%, transparent var(--glow)); }
body[data-period="mid"]::before { background: radial-gradient(circle at 50% 18%, var(--mid-bg) 0%, transparent var(--glow)); }
body[data-period="on"]::before  { background: radial-gradient(circle at 50% 18%, var(--on-bg)  0%, transparent var(--glow)); }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  min-height: 100dvh;
  color: var(--fg);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  transition: background .35s var(--tr-1), color .25s ease;
  position: relative;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .55;
  transition: background .6s var(--tr-1), opacity .35s ease;
}
@media (prefers-color-scheme: dark) {
  body::before { opacity: .35; }
}
body > * { position: relative; z-index: 1; }

a { color: inherit; }
code { font: 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--card); padding: 1px 6px; border-radius: 4px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--fg); color: var(--bg); padding: 8px 12px; border-radius: 6px;
}
.skip:focus { left: 12px; top: 12px; z-index: 100; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--card-border);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--fg);
}
.brand-mark { width: 22px; height: 22px; display: block; color: var(--fg); }
.brand h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.02em; }

.theme-switch {
  display: inline-flex; border: 1px solid var(--card-border); border-radius: 8px; overflow: hidden;
  background: var(--card);
}
.theme-switch button {
  background: transparent; border: 0; padding: 6px 12px;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
  border-right: 1px solid var(--card-border);
  transition: color .15s ease, background .15s ease;
}
.theme-switch button:last-child { border-right: 0; }
.theme-switch button:hover { color: var(--fg); }
.theme-switch button[aria-pressed="true"] {
  background: var(--fg); color: var(--bg);
}

/* ---------- layout ---------- */
main {
  max-width: 760px; margin: 0 auto; padding: 36px 22px 56px;
  display: flex; flex-direction: column; gap: 22px;
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  padding: 36px 28px 28px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
.hero::after {
  /* subtle period-tinted gradient at the very top of the card */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px;
  transition: background .5s var(--tr-1);
}
.hero[data-period="off"]::after { background: linear-gradient(90deg, transparent 0%, var(--off-fg) 50%, transparent 100%); }
.hero[data-period="mid"]::after { background: linear-gradient(90deg, transparent 0%, var(--mid-fg) 50%, transparent 100%); }
.hero[data-period="on"]::after  { background: linear-gradient(90deg, transparent 0%, var(--on-fg)  50%, transparent 100%); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 18px;
  font-size: var(--fz-eyebrow);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); }
  50%      { box-shadow: 0 0 0 8px color-mix(in srgb, currentColor 6%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .eyebrow-dot { animation: none; }
}

.period-name {
  margin: 0 0 6px;
  font-size: var(--fz-period-name);
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: color .4s var(--tr-1);
}
.hero[data-period="off"] .period-label { color: var(--off-fg); }
.hero[data-period="mid"] .period-label { color: var(--mid-fg); }
.hero[data-period="on"]  .period-label { color: var(--on-fg);  }

.rate {
  display: flex; align-items: baseline; gap: 8px; justify-content: center;
  margin: 4px 0 8px;
  font-feature-settings: "tnum", "lnum";
}
.rate-amount {
  font-size: var(--fz-hero-num);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--fg);
}
.rate-unit {
  font-size: 18px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.01em;
}
.hero-secondary {
  margin: 0;
  color: var(--muted);
  font-size: var(--fz-secondary);
  display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: center;
}
.hero-secondary .next { color: var(--fg); font-weight: 500; }
.dot-sep { opacity: .35; }
.hero-secondary .delta {
  display: inline-flex; align-items: center; gap: 4px;
}
.hero-secondary .delta[data-delta="up"]::before   { content: "↑"; color: var(--on-fg);  }
.hero-secondary .delta[data-delta="down"]::before { content: "↓"; color: var(--off-fg); }
.hero-secondary .delta[data-delta="flat"]::before { content: "="; color: var(--muted);  }

/* ---------- TIP ---------- */
.tip {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.45;
  transition: border-color .35s ease, background .35s ease, color .35s ease;
}
.tip p { margin: 0; }
.tip-icon { width: 22px; height: 22px; flex: none; opacity: .9; }
.tip[data-period="off"] { background: color-mix(in srgb, var(--off-bg) 35%, var(--card)); border-color: color-mix(in srgb, var(--off-fg) 30%, var(--card-border)); color: var(--off-fg); }
.tip[data-period="mid"] { background: color-mix(in srgb, var(--mid-bg) 35%, var(--card)); border-color: color-mix(in srgb, var(--mid-fg) 30%, var(--card-border)); color: var(--mid-fg); }
.tip[data-period="on"]  { background: color-mix(in srgb, var(--on-bg)  35%, var(--card)); border-color: color-mix(in srgb, var(--on-fg)  30%, var(--card-border)); color: var(--on-fg); }
.tip[data-period="off"] .tip-icon { color: var(--off-fg); }
.tip[data-period="mid"] .tip-icon { color: var(--mid-fg); }
.tip[data-period="on"]  .tip-icon { color: var(--on-fg); }
/* Keep tip text legible against its tinted background */
.tip p { color: var(--fg); }

/* ---------- share button (inline inside hero-secondary) ---------- */
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--card-border);
  background: color-mix(in srgb, var(--card) 80%, transparent);
  color: var(--fg);
  font: 600 12px/1 inherit;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: 999px;
  cursor: pointer;
  vertical-align: middle;
  transition: transform .12s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.share-btn svg { width: 14px; height: 14px; opacity: .75; }
.share-btn:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.share-btn:hover svg { opacity: 1; }
.share-btn:active { transform: scale(.97); }
.share-btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.share-btn.is-copied {
  background: var(--off-bg); border-color: var(--off-fg); color: var(--off-fg);
  animation: share-flash 1.6s ease forwards;
}
@keyframes share-flash {
  0%, 60% { transform: scale(1); }
  20%     { transform: scale(1.04); }
}

/* ---------- notify button (mirror of share-btn) ---------- */
.notify-group {
  display: inline-flex; align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}
.notify-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--card-border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  background: transparent;
  color: var(--muted);
  font: 600 11px/1 ui-sans-serif, system-ui, -apple-system, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .12s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.notify-btn svg { width: 14px; height: 14px; opacity: .75; }
.notify-btn:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.notify-btn:hover svg { opacity: 1; }
.notify-btn:active { transform: scale(.97); }
.notify-btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.notify-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--mid-bg) 40%, var(--card));
  border-color: var(--mid-fg);
  color: var(--mid-fg);
}
.notify-btn[aria-pressed="true"] svg { opacity: 1; }
.notify-btn.is-denied {
  opacity: .6; cursor: not-allowed;
}
.notify-btn.is-denied:hover { background: transparent; color: var(--muted); border-color: var(--card-border); }

/* bell sub-button: attached to the right of notify-btn, separate but coupled */
.notify-bell {
  display: inline-grid; place-items: center;
  width: 28px; height: 26px;
  border: 1px solid var(--card-border);
  border-left: 1px solid var(--card-border);
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: transform .12s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.notify-bell svg { width: 14px; height: 14px; opacity: .7; }
.notify-bell:hover { color: var(--fg); border-color: var(--fg); }
.notify-bell:active { transform: scale(.94); }
.notify-bell:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.notify-bell:disabled {
  cursor: not-allowed;
  opacity: .35;
}
.notify-bell:disabled:hover { color: var(--muted); border-color: var(--card-border); }
.notify-bell[aria-pressed="true"] {
  background: color-mix(in srgb, var(--mid-bg) 40%, var(--card));
  border-color: var(--mid-fg);
  color: var(--mid-fg);
}
.notify-bell[aria-pressed="true"] svg { opacity: 1; }
.notify-bell[aria-pressed="true"] #bell-sound-waves { display: block !important; }
.notify-bell.chime-preview { animation: chime-preview-ring .8s ease-out; }
@keyframes chime-preview-ring {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ---------- toast (in-app period-change alert) ---------- */
.toast-stack {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 10px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--toast-accent);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15), 0 2px 6px rgba(0, 0, 0, .08);
  font: 500 13px/1.4 ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--fg);
  opacity: 0;
  transform: translateY(20px) scale(.98);
  transition: opacity .25s ease, transform .35s cubic-bezier(.22, .61, .36, 1);
}
.toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.toast.is-leaving { opacity: 0; transform: translateY(-10px) scale(.98); }
.toast .toast-icon {
  flex: none; width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--toast-icon-bg);
  color: var(--toast-accent);
  border-radius: 8px;
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em;
}
.toast .toast-body { flex: 1; min-width: 0; }
.toast .toast-title { font-weight: 700; font-size: 14px; color: var(--toast-accent); margin: 0 0 2px; }
.toast .toast-message { color: var(--fg); opacity: .85; margin: 0; }
.toast .toast-close {
  flex: none; border: 0; background: transparent; color: var(--muted);
  cursor: pointer; padding: 4px; border-radius: 6px; align-self: flex-start;
  font-size: 16px; line-height: 1;
}
.toast .toast-close:hover { color: var(--fg); background: var(--card-border); }

/* ---------- rates-freshness notice ---------- */
.rates-freshness {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--mid-fg) 30%, var(--card-border));
  background: color-mix(in srgb, var(--mid-bg) 30%, var(--card));
  color: var(--mid-fg);
  font: 500 13px/1.4 ui-sans-serif, system-ui, sans-serif;
  display: flex; align-items: center; gap: 10px;
}
.rates-freshness[hidden] { display: none; }
.rates-freshness svg { width: 16px; height: 16px; flex: none; }
.rates-freshness strong { color: var(--fg); font-weight: 700; }
.rates-freshness code { font: 600 12px/1 ui-monospace, monospace; }

/* ---------- chart (unchanged from v1, with patterns) ---------- */
.chart-wrap {
  background: var(--card); border: 1px solid var(--card-border); border-radius: 16px;
  padding: 20px 20px 16px; box-shadow: var(--shadow);
}
.chart-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.chart-head h2 { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.chart-head .tz { color: var(--muted); font: 600 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; display: inline-flex; align-items: baseline; gap: 6px; }
.chart-head .tz-city { color: var(--fg); font-weight: 700; letter-spacing: .02em; }
.chart-head .tz-zone { font-size: 11px; opacity: .75; }
#now-time { color: var(--fg); font-feature-settings: "tnum"; }

.chart-wrap { overflow: visible; }
.chart {
  position: relative;
  height: 64px;
  border-radius: 10px;
  display: flex;
  border: 1px solid var(--card-border);
  background: var(--off-bg);
  margin-top: 18px; /* room for the "Now" badge above (when present) */
}
/* Keep the bars contained while letting the now-badge escape. */
.chart > .bar:first-child { border-top-left-radius: 9px; border-bottom-left-radius: 9px; }
.chart > .bar:last-child  { border-top-right-radius: 9px; border-bottom-right-radius: 9px; overflow: hidden; }
.bar {
  height: 100%;
  position: relative; /* containing block for the .bar-label span */
  transition: filter .25s ease;
}
.bar.off {
  background:
    radial-gradient(circle at 8px 8px, color-mix(in srgb, var(--off-fg) 30%, transparent) 1.2px, transparent 1.6px) 0 0/14px 14px,
    var(--off-bg);
}
.bar.mid {
  background:
    repeating-linear-gradient(
      135deg,
      var(--mid-bg) 0 8px,
      color-mix(in srgb, var(--mid-fg) 22%, var(--mid-bg)) 8px 14px
    );
}
.bar.on {
  background: var(--on-bg);
}

/* On-chart period label, centered inside each band */
.bar-label {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 1;
  /* Default contrast: dark text on light bands, light text on dark/saturated bands. */
  color: rgba(15,17,21,.78);
}
.bar.off .bar-label { color: #0a3a1e; opacity: .95; font-weight: 800; letter-spacing: .12em; }
.bar.mid .bar-label { color: #6b4500; opacity: .95; font-weight: 800; letter-spacing: .12em; }
.bar.on  .bar-label { color: #ffffff; opacity: 1; font-weight: 800; letter-spacing: .12em; text-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* Dark theme: bands are saturated/dark, so labels need lighter contrast */
[data-theme="dark"] .bar.off .bar-label { color: #d6f5e0; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
[data-theme="dark"] .bar.mid .bar-label { color: #ffe7a8; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
[data-theme="dark"] .bar.on  .bar-label { color: #ffffff; }

/* Cursor + hover affordance — the bar's title attr gives the tooltip on desktop */
.bar { cursor: help; }

.now-line {
  position: absolute; top: -4px; bottom: -4px; width: 2px;
  background: var(--fg);
  box-shadow: 0 0 0 1px var(--card);
  transition: left .9s linear;
  pointer-events: none;
  z-index: 2;
}
.now-badge {
  position: absolute;
  bottom: -22px;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 4px 6px;
  border-radius: 6px;
  white-space: nowrap;
  transition: left .9s linear;
  letter-spacing: .04em;
  z-index: 3;
}
.now-badge::before {
  content: "";
  position: absolute; left: 50%; bottom: 100%;
  transform: translateX(-50%);
  border: 4px solid transparent; border-bottom-color: var(--fg);
}

.chart-axis {
  display: flex; justify-content: space-between;
  margin-top: 22px; color: var(--muted); font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.legend { display: flex; gap: 18px; justify-content: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg-sw {
  width: 16px; height: 12px; border-radius: 3px; display: inline-block;
  border: 1px solid var(--card-border);
}
.lg-sw[data-pattern="solid"] { background: var(--on-bg); }
.lg-sw[data-pattern="stripe"] {
  background: repeating-linear-gradient(135deg, var(--mid-bg) 0 5px, color-mix(in srgb, var(--mid-fg) 28%, var(--mid-bg)) 5px 9px);
}
.lg-sw[data-pattern="dot"] {
  background:
    radial-gradient(circle at 4px 4px, color-mix(in srgb, var(--off-fg) 38%, transparent) 1px, transparent 1.3px) 0 0/8px 8px,
    var(--off-bg);
}

/* ---------- info + footer ---------- */
.info h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.info p  { margin: 0 0 12px; color: var(--fg); }
.info .scope-note {
  margin: -4px 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--card-border);
  background: color-mix(in srgb, var(--card) 60%, transparent);
  font-size: 13px;
  color: var(--muted);
}
.info .scope-note strong { color: var(--fg); font-weight: 600; }
.info details { background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.info details summary { cursor: pointer; font-weight: 600; }
.info table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.info th, .info td { padding: 8px 6px; border-bottom: 1px solid var(--card-border); text-align: left; vertical-align: top; }
.info th { font-weight: 600; color: var(--muted); }
.info small { color: var(--muted); font-weight: 400; }
.muted { color: var(--muted); font-size: 13px; }

footer {
  border-top: 1px solid var(--card-border); padding: 18px 22px;
  display: flex; gap: 8px; justify-content: center; color: var(--muted); font-size: 13px;
}
footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- period-flip celebration ---------- */
/* One-shot keyframe, run only when body has .period-flipped (added/removed by JS). */
@keyframes hero-pulse {
  0%   { transform: scale(1);    filter: brightness(1); }
  35%  { transform: scale(1.012); filter: brightness(1.06); }
  100% { transform: scale(1);    filter: brightness(1); }
}
@keyframes tip-glow {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  30%      { box-shadow: 0 0 0 8px color-mix(in srgb, currentColor 24%, transparent); }
}
@keyframes ring-expand {
  0%   { opacity: .55; transform: scale(.985); }
  100% { opacity: 0;  transform: scale(1.04); }
}
body.period-flipped .hero         { animation: hero-pulse 700ms var(--tr-1); }
body.period-flipped .tip          { animation: tip-glow 700ms var(--tr-1); }
body.period-flipped .hero::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: ring-expand 700ms var(--tr-1);
}

/* ---------- accessibility: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  body.period-flipped .hero,
  body.period-flipped .tip,
  body.period-flipped .hero::before { animation: none; }
  .eyebrow-dot { animation: none; }
  .now-line, .now-badge { transition: none; }
  .share-btn.is-copied { animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 540px) {
  main { padding: 24px 16px 48px; gap: 18px; }
  .topbar { padding: 14px 16px; }
  .hero { padding: 28px 18px 22px; border-radius: 18px; }
  .hero-secondary { font-size: 13px; }
  .theme-switch button { padding: 6px 10px; }
  .info table { font-size: 12.5px; }
  .info th small { display: none; }
}
