/* ==========================================================================
   Buddy "Today": morning ritual (story cards) + day dashboard.
   Self-contained: every rule is scoped under .wt-root so the same file
   works inside the app and in the stand-alone preview.
   Look: sunrise for the ritual, warm daylight for the dashboard.
   ========================================================================== */
.wt-root {
  --wt-ink: #231c2e;
  --wt-muted: #6f6478;
  --wt-paper: #fffaf4;
  --wt-card: #ffffff;
  --wt-line: #efe4d8;
  --wt-sun-1: #ffcf9e;
  --wt-sun-2: #ff8f8a;
  --wt-sun-3: #b067d8;
  --wt-sun-4: #4b3f9c;
  --wt-rose: #d2456d;
  --wt-teal: #11907f;
  --wt-coral: #d9534f;
  --wt-amber: #c27a00;
  --wt-indigo: #3b4cca;
  --wt-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --wt-sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-family: var(--wt-sans);
  color: var(--wt-ink);
  background: linear-gradient(180deg, #fff1e4 0%, var(--wt-paper) 380px);
  min-height: 100%;
}

.wt-root *,
.wt-root *::before,
.wt-root *::after {
  box-sizing: border-box;
}

.wt-root button {
  font: inherit;
  cursor: pointer;
}

.wt-root :focus-visible {
  outline: 3px solid rgba(59, 76, 202, 0.45);
  outline-offset: 2px;
}

/* ---------- Ritual (full-screen story) ---------- */
.wt-ritual {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: #1c1530;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.wt-ritual[hidden] {
  display: none;
}

.wt-ritual-sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--wt-sun-1) 0%, var(--wt-sun-2) 38%, var(--wt-sun-3) 72%, var(--wt-sun-4) 100%);
  background-size: 160% 160%;
  animation: wt-dawn 18s ease-in-out infinite alternate;
}

.wt-ritual-sky::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -18vmin;
  width: 70vmin;
  height: 70vmin;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 245, 210, 0.95) 0%, rgba(255, 214, 150, 0.55) 35%, rgba(255, 180, 140, 0) 70%);
  animation: wt-sunrise 6s ease-out forwards;
}

.wt-ritual[data-card]:not([data-card="dawn"]) .wt-ritual-sky::after {
  opacity: 0.35;
}

@keyframes wt-dawn {
  from { background-position: 0% 0%; }
  to { background-position: 100% 100%; }
}

@keyframes wt-sunrise {
  from { bottom: -45vmin; opacity: 0.2; }
  to { bottom: -18vmin; opacity: 1; }
}

.wt-ritual-top {
  position: relative;
  z-index: 2;
  padding: 0.75rem max(16px, env(safe-area-inset-left, 0px)) 0 max(16px, env(safe-area-inset-right, 0px));
}

.wt-progress {
  display: flex;
  gap: 4px;
}

.wt-progress span {
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.35);
  overflow: hidden;
}

.wt-progress span i {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
}

.wt-progress span.done i {
  width: 100%;
}

.wt-progress span.now i {
  animation: wt-fill var(--wt-duration, 8s) linear forwards;
}

.wt-ritual.manual .wt-progress span.now i {
  width: 100%;
  animation: none;
  opacity: 0.8;
}

.wt-ritual.paused .wt-progress span.now i {
  animation-play-state: paused;
}

@keyframes wt-fill {
  from { width: 0; }
  to { width: 100%; }
}

.wt-ritual-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.6rem;
  gap: 0.5rem;
}

.wt-ritual-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}

.wt-ritual-brand b {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.25);
}

.wt-brand-sub {
  font-weight: 500;
  opacity: 0.85;
}

@media (max-width: 420px) {
  .wt-brand-sub { display: none; }
}

.wt-ghost {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.wt-ritual-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem max(16px, env(safe-area-inset-left, 0px)) 1.25rem max(16px, env(safe-area-inset-right, 0px));
  overflow-y: auto;
}

.wt-tap {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  z-index: 0;
  background: transparent;
  border: none;
}

.wt-tap.prev { left: 0; }
.wt-tap.next { right: 0; }

.wt-ritual-nav {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0.9rem max(16px, env(safe-area-inset-left, 0px));
}

.wt-ritual-hint {
  font-size: 0.78rem;
  opacity: 0.85;
  text-align: center;
}

.wt-card {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  animation: wt-card-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes wt-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.wt-kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.9;
}

.wt-card h1,
.wt-card h2 {
  font-family: var(--wt-serif);
  font-weight: 700;
  line-height: 1.1;
  margin: 0.25rem 0 1rem;
  text-shadow: 0 2px 16px rgba(60, 10, 50, 0.25);
  text-wrap: balance;
}

.wt-card h1 { font-size: clamp(2.3rem, 8vw, 3.8rem); }
.wt-card h2 { font-size: clamp(1.7rem, 5.5vw, 2.6rem); }

.wt-weather {
  opacity: 0.95;
  margin-bottom: 1.25rem;
}

.wt-quote {
  margin: 0;
  padding: 1.1rem 1.25rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.17);
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(6px);
}

.wt-quote blockquote {
  margin: 0 0 0.5rem;
  font-family: var(--wt-serif);
  font-style: italic;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  line-height: 1.4;
}

.wt-quote figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
}

.wt-heart {
  border: none;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  position: relative;
  z-index: 2;
}

.wt-heart.on { background: #fff; color: var(--wt-rose); }

/* glass panels for list cards inside the ritual */
.wt-glass {
  background: rgba(255, 255, 255, 0.93);
  color: var(--wt-ink);
  border-radius: 18px;
  padding: 0.4rem 1rem;
  box-shadow: 0 16px 40px rgba(40, 10, 60, 0.25);
}

.wt-item {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--wt-line);
}

.wt-item:last-child { border-bottom: none; }

.wt-item-main {
  display: flex;
  gap: 0.75rem;
  min-width: 0;
}

.wt-item-text { min-width: 0; overflow-wrap: anywhere; }

.wt-item-title { font-weight: 600; }

.wt-item-why {
  color: var(--wt-muted);
  font-size: 0.88rem;
}

.wt-rank {
  flex: 0 0 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--wt-sun-2), var(--wt-sun-3));
}

.wt-time {
  flex: 0 0 3.2rem;
  font-weight: 700;
  color: var(--wt-rose);
  font-variant-numeric: tabular-nums;
}

.wt-chip {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.08rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: #f3edff;
  color: #5a3fb0;
}

.wt-chip.money { background: #fff1d6; color: #8a5800; }
.wt-chip.alert { background: #fde8e7; color: #a52f2b; }
.wt-chip.good { background: #def5f1; color: #0b6e64; }

.wt-flag {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  border: 1px solid var(--wt-line);
  background: #fff;
  color: var(--wt-muted);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.wt-flag.on {
  background: #fff1cc;
  border-color: #f0c96a;
  color: #7a5200;
  font-weight: 600;
}

.wt-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.6rem 0;
}

.wt-stat {
  background: #fff;
  border: 1px solid var(--wt-line);
  border-radius: 14px;
  padding: 0.6rem 0.75rem;
  color: var(--wt-ink);
}

.wt-stat small {
  display: block;
  color: var(--wt-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.68rem;
}

.wt-stat strong {
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.wt-debit { color: var(--wt-coral); }
.wt-credit { color: var(--wt-teal); }

.wt-tickers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  margin: 0.6rem 0;
}

.wt-ticker {
  background: #fff;
  border: 1px solid var(--wt-line);
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
}

.wt-ticker small {
  display: block;
  color: var(--wt-muted);
  font-size: 0.72rem;
}

.wt-ticker strong {
  font-variant-numeric: tabular-nums;
}

.wt-up { color: var(--wt-teal); font-weight: 600; font-size: 0.85rem; }
.wt-down { color: var(--wt-coral); font-weight: 600; font-size: 0.85rem; }

.wt-watch {
  background: linear-gradient(135deg, #fff0f3, #f1ebff);
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  margin: 0.4rem 0 0.6rem;
}

.wt-watch p {
  margin: 0.25rem 0 0;
  font-family: var(--wt-serif);
  line-height: 1.5;
}

.wt-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--wt-rose);
}

.wt-news {
  margin: 0;
  padding: 0.25rem 0 0.25rem 1.35rem;
}

.wt-news li {
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--wt-line);
}

.wt-news li:last-child { border-bottom: none; }

.wt-news li::marker {
  font-family: var(--wt-serif);
  font-weight: 700;
  color: var(--wt-rose);
}

.wt-news a {
  color: var(--wt-ink);
  text-decoration: none;
  font-weight: 500;
}

.wt-news a:hover { text-decoration: underline; }

.wt-news small {
  color: var(--wt-muted);
}

.wt-check {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--wt-line);
  cursor: pointer;
}

.wt-check:last-child { border-bottom: none; }

.wt-check input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  accent-color: var(--wt-rose);
  flex: 0 0 auto;
}

.wt-start {
  width: 100%;
  margin-top: 1rem;
  border: none;
  border-radius: 16px;
  padding: 0.9rem 1rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(135deg, #ff7e7e, #a25ad6);
  box-shadow: 0 12px 30px rgba(120, 30, 90, 0.35);
  position: relative;
  z-index: 2;
}

.wt-hint {
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 0.75rem;
}

/* ---------- Dashboard ---------- */
.wt-dash {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem max(16px, env(safe-area-inset-right, 0px)) 2rem max(16px, env(safe-area-inset-left, 0px));
}

.wt-hero {
  border-radius: 22px;
  padding: clamp(1rem, 3vw, 1.75rem);
  color: #fff;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, 0.28), transparent 55%),
    linear-gradient(120deg, var(--wt-sun-1) 0%, var(--wt-sun-2) 45%, var(--wt-sun-3) 100%);
  box-shadow: 0 14px 34px rgba(170, 70, 110, 0.25);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-end;
}

.wt-hero h1 {
  font-family: var(--wt-serif);
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  margin: 0.15rem 0 0.25rem;
  line-height: 1.1;
}

.wt-hero .wt-mini-quote {
  font-family: var(--wt-serif);
  font-style: italic;
  opacity: 0.95;
  max-width: 640px;
}

.wt-hero-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wt-grid {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.wt-panel {
  background: var(--wt-card);
  border: 1px solid var(--wt-line);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  box-shadow: 0 6px 18px rgba(90, 60, 30, 0.06);
  min-width: 0;
}

.wt-panel h3 {
  font-family: var(--wt-serif);
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.wt-panel h3 small {
  font-family: var(--wt-sans);
  font-size: 0.75rem;
  color: var(--wt-muted);
  font-weight: 500;
}

.wt-span-5 { grid-column: span 5; }
.wt-span-7 { grid-column: span 7; }
.wt-span-4 { grid-column: span 4; }
.wt-span-6 { grid-column: span 6; }
.wt-span-8 { grid-column: span 8; }
.wt-span-12 { grid-column: span 12; }

.wt-top3 .wt-check { border-bottom: 1px solid var(--wt-line); }
.wt-top3 .wt-check.done .wt-item-title { text-decoration: line-through; color: var(--wt-muted); }

.wt-timeline {
  position: relative;
  padding-left: 1.2rem;
  border-left: 2px solid var(--wt-line);
}

.wt-tl-item {
  position: relative;
  padding: 0.45rem 0 0.45rem 0.4rem;
}

.wt-tl-item::before {
  content: "";
  position: absolute;
  left: -1.62rem;
  top: 0.85rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--wt-sun-3);
}

.wt-tl-item.past { opacity: 0.55; }
.wt-tl-item.free::before { border-color: var(--wt-teal); }

.wt-now {
  position: relative;
  margin: 0.2rem 0;
  height: 0;
  border-top: 2px solid var(--wt-rose);
}

.wt-now span {
  position: absolute;
  left: -1.95rem;
  top: -0.65rem;
  background: var(--wt-rose);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
}

.wt-tabs {
  display: inline-flex;
  gap: 0.25rem;
  background: #f6efe6;
  border-radius: 999px;
  padding: 0.2rem;
}

.wt-tabs button {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.78rem;
  color: var(--wt-muted);
}

.wt-tabs button[aria-selected="true"] {
  background: #fff;
  color: var(--wt-ink);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.wt-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.wt-count {
  border: 1px solid var(--wt-line);
  border-radius: 12px;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
}

.wt-count b { font-variant-numeric: tabular-nums; }

.wt-empty {
  color: var(--wt-muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

.wt-evening {
  background: linear-gradient(135deg, #2c2556, #4b3f9c);
  color: #fff;
  border: none;
}

.wt-evening .wt-empty { color: rgba(255, 255, 255, 0.8); }

.wt-solid {
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  background: #fff;
  color: var(--wt-ink);
  font-weight: 600;
  font-size: 0.85rem;
}

.wt-setup {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  background: #fff4dc;
  border-color: #f2d48f;
}

.wt-setup .wt-solid {
  background: #231c2e;
  color: #fff;
}

.wt-inshorts {
  display: inline-block;
  margin-top: 0.6rem;
  text-decoration: none;
  border: 1px solid var(--wt-line);
}

/* ---------- Follow-up menu + toast ---------- */
.wt-menu {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  background: #fff;
  color: var(--wt-ink);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(30, 10, 40, 0.35);
  padding: 1rem;
  animation: wt-card-in 0.25s ease;
}

.wt-menu[hidden] { display: none; }

.wt-menu-title {
  font-weight: 700;
  margin-bottom: 0.15rem;
  overflow-wrap: anywhere;
}

.wt-menu-sub {
  color: var(--wt-muted);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.wt-menu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.wt-menu button.opt {
  border: 1px solid var(--wt-line);
  background: #fffaf4;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.88rem;
}

.wt-menu button.opt:hover { border-color: var(--wt-rose); }

.wt-menu button.remove { color: var(--wt-coral); }

.wt-toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  top: max(16px, env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  background: #231c2e;
  color: #fff;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: calc(100% - 32px);
}

.wt-toast[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .wt-span-4, .wt-span-5, .wt-span-6, .wt-span-7, .wt-span-8 { grid-column: span 6; }
}

@media (max-width: 680px) {
  .wt-grid { grid-template-columns: minmax(0, 1fr); }
  .wt-span-4, .wt-span-5, .wt-span-6, .wt-span-7, .wt-span-8, .wt-span-12 { grid-column: auto; }
  .wt-item { flex-direction: column; }
  .wt-flag { align-self: flex-start; }
  .wt-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .wt-ritual-sky,
  .wt-ritual-sky::after,
  .wt-card,
  .wt-menu { animation: none; }
}
