/* ==========================================================================
   LunaLocal v2 — animated, privacy-first period tracker.
   Motion rules: transform/opacity only (60fps), prefers-reduced-motion
   fully respected, all motion is delightful, never gaudy.
   ========================================================================== */

:root {
  --plum-950: #1b1020;
  --plum-900: #241527;
  --plum-800: #2f1b33;
  --plum-700: #3d2344;
  --plum-600: #57335f;
  --plum-400: #a06aa8;
  --plum-300: #c394c9;
  --plum-200: #e0c3e3;
  --rose-400: #f07f9e;
  --rose-500: #e4567f;
  --rose-300: #f8a8bc;
  --gold-300: #f4cf8b;
  --teal-300: #8fd8cc;
  --ink: #f7f0f6;
  --ink-dim: #c9b3c9;
  --ink-faint: #9c84a0;
  --ok: #7fd6a4;
  --warn: #f4cf8b;
  --error: #f08a8a;
  --card: rgba(47, 27, 51, 0.72);
  --card-border: rgba(224, 195, 227, 0.14);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--plum-950);
  min-height: 100dvh;
  line-height: 1.55;
  overflow-x: hidden;
}

/* Animated ambient background (transform/opacity only, GPU-friendly) */
.bg-scene {
  position: fixed;
  inset: -20%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bg-scene .blob {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.bg-scene .blob-a {
  left: -15vmax; top: -15vmax;
  background: radial-gradient(circle, #5b2d63 0%, transparent 65%);
  animation: drift-a 26s ease-in-out infinite alternate;
}
.bg-scene .blob-b {
  right: -18vmax; top: 30vmax;
  background: radial-gradient(circle, #7a2c4b 0%, transparent 65%);
  animation: drift-b 32s ease-in-out infinite alternate;
}
.bg-scene .blob-c {
  left: 10vmax; bottom: -20vmax;
  background: radial-gradient(circle, #2c4a63 0%, transparent 65%);
  opacity: 0.35;
  animation: drift-c 38s ease-in-out infinite alternate;
}
@keyframes drift-a { from { transform: translate(0, 0) scale(1); } to { transform: translate(12vmax, 9vmax) scale(1.15); } }
@keyframes drift-b { from { transform: translate(0, 0) scale(1.1); } to { transform: translate(-10vmax, -8vmax) scale(0.95); } }
@keyframes drift-c { from { transform: translate(0, 0) scale(1); } to { transform: translate(8vmax, -10vmax) scale(1.2); } }

::selection { background: rgba(228, 86, 127, 0.4); }

:focus-visible {
  outline: 2px solid var(--rose-300);
  outline-offset: 3px;
  border-radius: 8px;
}

.skip {
  position: absolute;
  left: 1rem; top: -4rem;
  background: var(--plum-700);
  color: var(--ink);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  z-index: 100;
  transition: top 0.25s var(--ease-out);
}
.skip:focus { top: 1rem; }

/* ------------------------------------------------------------------ layout */
.shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 1.75rem) 6.5rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(27, 16, 32, 0.72);
  border-bottom: 1px solid var(--card-border);
}
.header-inner {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 0.8rem clamp(1rem, 4vw, 1.75rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}
.brand-moon {
  width: 30px; height: 30px;
  animation: moon-sway 7s ease-in-out infinite;
  transform-origin: 50% 50%;
}
@keyframes moon-sway {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: 0.01em; }
.brand-tag {
  font-size: 0.7rem;
  color: var(--ink-faint);
  border: 1px solid var(--card-border);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.header-link {
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.header-link:hover { color: var(--ink); border-color: var(--card-border); background: rgba(255,255,255,0.04); }

/* ------------------------------------------------------------------ hero */
.hero {
  padding: clamp(1.4rem, 5vw, 2.4rem) 0 1.2rem;
  animation: hero-in 0.7s var(--ease-out) both;
}
@keyframes hero-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal-300);
  background: rgba(143, 216, 204, 0.08);
  border: 1px solid rgba(143, 216, 204, 0.25);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  margin-bottom: 0.8rem;
}
.hero-kicker .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0.55; } }
.hero h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.hero h1 .accent {
  background: linear-gradient(100deg, var(--rose-300), var(--gold-300));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { margin: 0; color: var(--ink-dim); max-width: 42ch; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1rem, 4vw, 1.5rem);
  margin-top: 1rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.card > h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}
.card .sub { margin: 0 0 1rem; color: var(--ink-faint); font-size: 0.88rem; }

/* Staggered entrance for cards (set style="--i:n" on each) */
.stagger {
  opacity: 0;
  animation: rise-in 0.55s var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes rise-in {
  from { opacity: 0; transform: translateY(22px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ------------------------------------------------------------------ cycle ring */
.ring-wrap {
  display: flex;
  gap: clamp(1rem, 4vw, 2rem);
  align-items: center;
  flex-wrap: wrap;
}
.ring {
  position: relative;
  width: clamp(150px, 40vw, 190px);
  height: clamp(150px, 40vw, 190px);
  flex: none;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-track { stroke: rgba(224, 195, 227, 0.14); }
.ring .ring-fill {
  stroke: url(#ringGrad);
  stroke-linecap: round;
  transition: stroke-dashoffset 1.1s var(--ease-out);
  filter: drop-shadow(0 0 10px rgba(228, 86, 127, 0.55));
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ring-num {
  font-size: clamp(2rem, 9vw, 2.7rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ring-label { font-size: 0.75rem; color: var(--ink-faint); margin-top: 0.3rem; max-width: 14ch; }
.ring-meta { flex: 1; min-width: 200px; }
.ring-meta h3 { margin: 0 0 0.5rem; font-size: 1.02rem; }
.pill-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0; }
.pill {
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.03);
  transition: transform 0.18s var(--ease-spring), background 0.18s;
}
.pill:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.07); }
.pill.period { border-color: rgba(228, 86, 127, 0.5); color: var(--rose-300); }
.pill.fertile { border-color: rgba(244, 207, 139, 0.5); color: var(--gold-300); }
.pill.today-pill { border-color: rgba(143, 216, 204, 0.5); color: var(--teal-300); }
.big-cta-row { display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------ buttons */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  color: #2a1120;
  background: linear-gradient(135deg, var(--rose-300), var(--rose-500));
  box-shadow: 0 8px 24px rgba(228, 86, 127, 0.35);
  transition: transform 0.16s var(--ease-spring), box-shadow 0.2s, filter 0.2s;
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 12px 30px rgba(228, 86, 127, 0.45); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border-color: var(--card-border);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.1); box-shadow: none; }
.btn.danger {
  background: linear-gradient(135deg, #f08a8a, #c0392b);
  color: #fff;
  box-shadow: 0 8px 24px rgba(192, 57, 43, 0.35);
}
.btn.small { min-height: 40px; padding: 0.45rem 1rem; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
/* ripple */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(255,255,255,0.45) 0%, transparent 60%);
  opacity: 0;
  transform: scale(0.4);
  pointer-events: none;
}
.btn:not([disabled]):active::after {
  animation: ripple 0.5s var(--ease-out);
}
@keyframes ripple {
  0% { opacity: 1; transform: scale(0.4); }
  100% { opacity: 0; transform: scale(1.6); }
}

/* ------------------------------------------------------------------ quick log */
.flow-row { display: flex; gap: 0.55rem; flex-wrap: wrap; margin: 0.4rem 0 0.2rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 48px;
  padding: 0.6rem 1.05rem;
  border-radius: 999px;
  border: 1.5px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s var(--ease-spring), border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
  will-change: transform;
}
.chip:hover { transform: translateY(-2px); border-color: var(--plum-300); color: var(--ink); }
.chip:active { transform: scale(0.95); }
.chip[aria-pressed="true"] {
  border-color: var(--rose-400);
  background: rgba(228, 86, 127, 0.16);
  color: var(--ink);
  box-shadow: 0 0 0 3px rgba(228, 86, 127, 0.18), 0 6px 18px rgba(228, 86, 127, 0.25);
  animation: chip-pop 0.32s var(--ease-spring);
}
@keyframes chip-pop {
  0% { transform: scale(0.88); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.chip .swatch { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.field-label { display: block; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); margin: 1rem 0 0.35rem; }
.field-label:first-child { margin-top: 0; }

textarea.notes {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.7rem 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea.notes:focus { border-color: var(--rose-400); box-shadow: 0 0 0 3px rgba(228, 86, 127, 0.2); outline: none; }
textarea.notes::placeholder { color: var(--ink-faint); }

/* ------------------------------------------------------------------ calendar */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.cal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  min-width: 0;
}
.cal-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), background 0.2s, border-color 0.2s;
}
.cal-nav-btn:hover { background: rgba(255, 255, 255, 0.1); transform: scale(1.08); }
.cal-nav-btn:active { transform: scale(0.92); }
.cal-nav-btn svg { width: 18px; height: 18px; }

.cal-viewport { overflow: hidden; border-radius: 12px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  will-change: transform, opacity;
}
.cal-grid.slide-left { animation: slide-from-right 0.38s var(--ease-out); }
.cal-grid.slide-right { animation: slide-from-left 0.38s var(--ease-out); }
@keyframes slide-from-right {
  from { opacity: 0; transform: translateX(60px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slide-from-left {
  from { opacity: 0; transform: translateX(-60px); }
  to { opacity: 1; transform: translateX(0); }
}
.cal-dow {
  text-align: center;
  font-size: 0.72rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0;
}
.day {
  position: relative;
  aspect-ratio: 1;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s var(--ease-spring), background 0.2s, border-color 0.2s, color 0.2s;
  font-variant-numeric: tabular-nums;
  animation: day-in 0.35s var(--ease-out) both;
  animation-delay: calc(var(--di, 0) * 8ms);
}
@keyframes day-in {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}
.day:hover { transform: scale(1.1); background: rgba(255, 255, 255, 0.08); color: var(--ink); z-index: 2; }
.day:active { transform: scale(0.95); }
.day.outside { opacity: 0.28; pointer-events: none; }
.day.is-today {
  border-color: var(--teal-300);
  color: var(--teal-300);
  box-shadow: 0 0 0 2px rgba(143, 216, 204, 0.25);
}
.day.has-log { background: rgba(228, 86, 127, 0.22); color: var(--ink); border-color: rgba(228, 86, 127, 0.45); }
.day.pred-period {
  background: rgba(228, 86, 127, 0.08);
  border: 1px dashed rgba(228, 86, 127, 0.55);
  color: var(--rose-300);
}
.day.pred-fertile {
  background: rgba(244, 207, 139, 0.08);
  border: 1px dashed rgba(244, 207, 139, 0.55);
  color: var(--gold-300);
}
.day.is-selected {
  border-color: var(--rose-300);
  box-shadow: 0 0 0 3px rgba(240, 127, 158, 0.35);
  animation: day-select 0.35s var(--ease-spring);
}
@keyframes day-select {
  0% { transform: scale(0.82); }
  60% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
.day .dot {
  position: absolute;
  bottom: 5px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--rose-300);
}
.day .dot.fert { background: var(--gold-300); }
.day.flow-light { box-shadow: inset 0 -4px 0 -1px rgba(240,127,158,0.5); }
.day.flow-medium { box-shadow: inset 0 -4px 0 -1px rgba(228,86,127,0.75); }
.day.flow-heavy { box-shadow: inset 0 -5px 0 -1px var(--rose-500); }
.day.flow-spotting { box-shadow: inset 0 -4px 0 -1px rgba(196,148,201,0.7); }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.9rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.cal-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend-swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* day detail sheet */
.sheet {
  margin-top: 1rem;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem;
  animation: sheet-in 0.4s var(--ease-out);
}
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.sheet h3 { margin: 0 0 0.2rem; font-size: 1rem; }
.sheet .sheet-sub { margin: 0 0 0.5rem; font-size: 0.82rem; color: var(--ink-faint); }
.sheet-actions { display: flex; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------ stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 0.8rem;
}
.stat {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  transition: transform 0.2s var(--ease-spring), border-color 0.2s;
}
.stat:hover { transform: translateY(-3px); border-color: rgba(240, 127, 158, 0.4); }
.stat .stat-num {
  font-size: 1.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat .stat-num .unit { font-size: 0.85rem; font-weight: 600; color: var(--ink-faint); }
.stat .stat-label { font-size: 0.76rem; color: var(--ink-faint); margin-top: 0.15rem; }
.stat.highlight .stat-num { color: var(--rose-300); }
.stat.gold .stat-num { color: var(--gold-300); }
.stat.teal .stat-num { color: var(--teal-300); }

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-faint);
  font-size: 0.92rem;
}
.empty-state .big { font-size: 2.4rem; display: block; margin-bottom: 0.6rem; }

/* ------------------------------------------------------------------ charts */
.chart-wrap { margin-top: 0.6rem; }
.chart {
  width: 100%;
  height: auto;
  display: block;
}
.chart .bar {
  fill: url(#barGrad);
  rx: 6;
  transform-origin: bottom;
  transform-box: fill-box;
  animation: bar-rise 0.7s var(--ease-out) both;
  animation-delay: calc(var(--bi, 0) * 70ms);
}
@keyframes bar-rise {
  from { transform: scaleY(0); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}
.chart .bar.irregular { fill: url(#barGradWarn); }
.chart .bar-label { fill: var(--ink-faint); font-size: 10px; text-anchor: middle; }
.chart .bar-value { fill: var(--ink); font-size: 11px; font-weight: 700; text-anchor: middle; }
.chart .avg-line { stroke: var(--gold-300); stroke-width: 1.6; stroke-dasharray: 7 5; animation: dash-flow 1.2s linear infinite; }
@keyframes dash-flow { to { stroke-dashoffset: -12; } }
.chart .avg-label { fill: var(--gold-300); font-size: 10px; }
.chart .trend-line {
  fill: none;
  stroke: var(--teal-300);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 6px rgba(143, 216, 204, 0.4));
}
.chart .trend-dot { fill: var(--teal-300); }
.methodology {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--ink-dim);
  border-left: 3px solid var(--plum-400);
  padding-left: 0.9rem;
}
.methodology strong { color: var(--ink); }

/* ------------------------------------------------------------------ history */
.history-list { display: grid; gap: 0.7rem; margin-top: 0.8rem; }
.hist-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 0.9rem 1.1rem;
  transition: transform 0.2s var(--ease-spring), border-color 0.2s, background 0.2s;
}
.hist-card:hover { transform: translateX(4px); border-color: rgba(240, 127, 158, 0.4); background: rgba(255,255,255,0.06); }
.hist-card .cyc-num {
  flex: none;
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  background: conic-gradient(from 0deg, var(--rose-500), var(--plum-400), var(--rose-500));
  color: #fff;
  box-shadow: 0 6px 16px rgba(228, 86, 127, 0.3);
  font-variant-numeric: tabular-nums;
}
.hist-card .cyc-main { flex: 1; min-width: 0; }
.hist-card .cyc-main .d { font-weight: 700; font-size: 0.95rem; }
.hist-card .cyc-main .m { font-size: 0.8rem; color: var(--ink-faint); }
.hist-card .cyc-flag {
  font-size: 0.72rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(244, 207, 139, 0.5);
  color: var(--gold-300);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ data / backup */
.data-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--card-border);
}
.data-row:first-of-type { border-top: none; padding-top: 0.4rem; }
.data-row .icon {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  transition: transform 0.2s var(--ease-spring);
}
.data-row:hover .icon { transform: scale(1.08) rotate(-4deg); }
.data-row .icon svg { width: 22px; height: 22px; }
.data-row .body { flex: 1; min-width: 0; }
.data-row .body h3 { margin: 0 0 0.2rem; font-size: 0.98rem; }
.data-row .body p { margin: 0 0 0.7rem; font-size: 0.85rem; color: var(--ink-dim); }

.passphrase {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.6rem 0;
}
.passphrase input[type="password"],
.passphrase input[type="text"] {
  flex: 1;
  min-width: 200px;
  min-height: 48px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.passphrase input:focus { border-color: var(--rose-400); box-shadow: 0 0 0 3px rgba(228, 86, 127, 0.2); outline: none; }
.hint { font-size: 0.78rem; color: var(--ink-faint); margin: 0.4rem 0 0; }
.hint.warn { color: var(--warn); }
.file-input-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: 1.5px dashed var(--card-border);
  color: var(--ink-dim);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.16s var(--ease-spring), border-color 0.2s, color 0.2s;
}
.file-input-label:hover { transform: translateY(-2px); border-color: var(--plum-300); color: var(--ink); }
input[type="file"].visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  margin-top: 0.7rem;
}
.progress .bar {
  height: 100%;
  width: 30%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose-400), var(--gold-300));
  animation: indeterminate 1.1s var(--ease-out) infinite;
}
@keyframes indeterminate {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(380%); }
}

/* ------------------------------------------------------------------ toast */
.toast-zone {
  position: fixed;
  left: 50%;
  bottom: 5.6rem;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  width: min(92vw, 480px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(45, 26, 50, 0.96);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toast-in 0.45s var(--ease-spring), toast-out 0.3s ease-in 2.6s forwards;
  max-width: 100%;
}
.toast .t-icon {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(127, 214, 164, 0.2);
  color: var(--ok);
}
.toast.error .t-icon { background: rgba(240, 138, 138, 0.2); color: var(--error); }
.toast .t-icon svg { width: 14px; height: 14px; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(24px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(12px) scale(0.94); }
}

/* ------------------------------------------------------------------ tabs */
.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(0.9rem, env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  gap: 0.25rem;
  padding: 0.4rem;
  border-radius: 999px;
  background: rgba(36, 21, 39, 0.92);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  max-width: calc(100vw - 2rem);
  overflow-x: auto;
}
.tab {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 64px;
  padding: 0.55rem 0.7rem 0.45rem;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, transform 0.16s var(--ease-spring);
  white-space: nowrap;
}
.tab svg { width: 20px; height: 20px; }
.tab:hover { color: var(--ink); transform: translateY(-2px); }
.tab:active { transform: scale(0.93); }
.tab[aria-selected="true"] {
  color: var(--ink);
  background: linear-gradient(135deg, rgba(228, 86, 127, 0.28), rgba(160, 106, 168, 0.28));
  box-shadow: inset 0 0 0 1px rgba(240, 127, 158, 0.4);
  animation: tab-pop 0.3s var(--ease-spring);
}
@keyframes tab-pop {
  0% { transform: scale(0.88); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.view { display: none; }
.view.active { display: block; animation: view-in 0.45s var(--ease-out); }
@keyframes view-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------ skeleton */
.skel {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  min-height: 1.2em;
}
.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.09) 50%, transparent 80%);
  animation: shimmer 1.4s ease-in-out infinite;
  transform: translateX(-100%);
}
@keyframes shimmer {
  to { transform: translateX(100%); }
}

/* ------------------------------------------------------------------ dialogs */
dialog.modal {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--plum-800);
  color: var(--ink);
  padding: 1.5rem;
  width: min(92vw, 440px);
  box-shadow: var(--shadow);
}
dialog.modal::backdrop {
  background: rgba(10, 5, 13, 0.7);
  backdrop-filter: blur(4px);
  animation: fade-in 0.25s ease-out;
}
dialog.modal[open] { animation: modal-in 0.35s var(--ease-spring); }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(26px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal h2 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.modal p { color: var(--ink-dim); font-size: 0.9rem; }
.modal .modal-actions { display: flex; gap: 0.7rem; margin-top: 1.2rem; justify-content: flex-end; }

/* ------------------------------------------------------------------ privacy page */
.tm h2 { margin-top: 2.2rem; font-size: 1.3rem; }
.tm h3 { margin-top: 1.6rem; font-size: 1.05rem; }
.tm table { width: 100%; border-collapse: collapse; margin: 0.8rem 0; font-size: 0.88rem; }
.tm th, .tm td { text-align: left; padding: 0.65rem 0.7rem; border-bottom: 1px solid var(--card-border); vertical-align: top; }
.tm th { color: var(--ink-faint); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.tm tr { transition: background 0.2s; }
.tm tbody tr:hover { background: rgba(255,255,255,0.03); }
.tm code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82em;
  background: rgba(255,255,255,0.06);
  padding: 0.15em 0.45em;
  border-radius: 6px;
}
.tm pre {
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
}
.tm ol.verify-steps li { margin-bottom: 0.7rem; }
.selfcheck {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--card-border);
}

/* ------------------------------------------------------------------ footer */
.site-footer {
  margin-top: 3rem;
  padding: 1.6rem 0 2rem;
  border-top: 1px solid var(--card-border);
  color: var(--ink-faint);
  font-size: 0.8rem;
}
.footer-inner { display: flex; flex-direction: column; gap: 0.6rem; }
.site-footer a { color: var(--ink-dim); }
.monetize-hook {
  border: 1.5px dashed var(--card-border);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
  display: flex;
  gap: 0.8rem;
  align-items: center;
}
.monetize-hook .tag {
  flex: none;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--card-border);
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
}

/* ------------------------------------------------------------------ responsive */
@media (min-width: 640px) {
  .tab { min-width: 84px; font-size: 0.72rem; }
  .day { font-size: 1rem; }
}
@media (max-width: 380px) {
  .tab { min-width: 54px; padding: 0.5rem 0.45rem 0.4rem; }
  .cal-grid { gap: 4px; }
}

/* ------------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .bg-scene { display: none; }
  .stagger { opacity: 1; }
  .day { opacity: 1; }
  .toast { animation: none; }
  .toast.out { display: none; }
}
