/* Star Companion v0.1 — style.css
   Phone-first (Galaxy S10e, 360px), works up to desktop.
   Two chrome themes: "pastel" (default, the drawing's pastel rainbow vibe)
   and "pride" (rainbow gradient chrome). Japhis's art is never filtered. */

:root {
  --ink: #33305a;
  --ink-soft: #5c5887;
  --card: #ffffff;
  --card-line: #e6def5;
  --accent: #e86ba7;        /* Japhis pink */
  --accent-soft: #fdeef6;
  --good: #3f9e6e;
  --bg: linear-gradient(180deg, #fde7f3 0%, #e7e4fb 45%, #dff5ec 100%);
  --header-bg: rgba(255,255,255,.75);
  --scene-bg: linear-gradient(180deg, #fbe3f1 0%, #e3defc 55%, #d8f3e6 100%);
  --shadow: 0 4px 18px rgba(80, 60, 140, .12);
}

html[data-theme="pride"] {
  --ink: #2e2a4a;
  --card-line: #d9d2f2;
  --accent: #d6336c;
  --accent-soft: #fff0f5;
  --bg: linear-gradient(180deg,
    #ff8fa3 0%, #ffb26b 18%, #ffe066 36%, #8ce99a 54%,
    #66d9e8 72%, #b197fc 88%, #f783ac 100%);
  --header-bg: rgba(255,255,255,.88);
  --scene-bg: linear-gradient(180deg, #fff5f5 0%, #e7f5ff 55%, #ebfbee 100%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  padding: 0 12px 40px;
}

h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
button { font: inherit; cursor: pointer; }
input { font: inherit; }

/* ---------- top bar / counters ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; max-width: 560px; margin: 0 auto; padding: 14px 4px 8px;
}
.subtitle { margin: 2px 0 0; color: var(--ink-soft); font-size: .85rem; }
.counters { display: flex; gap: 8px; }
.counter {
  background: var(--header-bg); border: 1px solid var(--card-line);
  border-radius: 14px; padding: 6px 10px; text-align: center;
  display: flex; flex-direction: column; line-height: 1.15; min-width: 64px;
}
.counter-icon { color: var(--accent); }
.counter-label { font-size: .68rem; color: var(--ink-soft); }

.welcome-back {
  max-width: 560px; margin: 4px auto 10px; text-align: center;
  background: var(--accent-soft); border: 1px dashed var(--accent);
  border-radius: 14px; padding: 8px 12px; font-weight: 600;
}

/* ---------- scene card / Japhis ---------- */
.scene-card, .panel {
  max-width: 560px; margin: 0 auto 14px; background: var(--card);
  border: 1px solid var(--card-line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 14px;
}
.scene-card { padding: 0 14px 14px; overflow: hidden; }
.scene-sky {
  position: relative; margin: 0 -14px; padding: 14px 10px 0;
  background: var(--scene-bg); text-align: center;
}
.japhis {
  width: min(78%, 330px); height: auto; display: inline-block;
  animation: sway 5s ease-in-out infinite;
  transform-origin: 50% 90%;
}
@keyframes sway {
  0%, 100% { transform: rotate(-1.3deg) translateY(0); }
  50% { transform: rotate(1.3deg) translateY(-5px); }
}
.day-star {
  position: absolute; top: 12px; right: 14px; width: 56px; height: 56px;
  transition: filter .6s ease, transform .6s ease;
}
.day-star svg { width: 100%; height: 100%; fill: #f7b8d0; stroke: #e86ba7; stroke-width: 2; }
.day-star.charged { transform: scale(1.12); filter: drop-shadow(0 0 14px #ff8fc0) drop-shadow(0 0 30px #ffd166); }
.day-star.charged svg { fill: #ffd166; stroke: #ff8fc0; animation: starPulse 2.2s ease-in-out infinite; }
@keyframes starPulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.07);} }

.bubble {
  position: relative; margin-top: 12px; background: var(--accent-soft);
  border: 1px solid var(--card-line); border-radius: 16px; padding: 10px 12px;
}
.bubble::before {
  content: ""; position: absolute; top: -8px; left: 50%; margin-left: -8px;
  border: 8px solid transparent; border-bottom-color: var(--accent-soft); border-top: 0;
}
.bubble-name { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.bubble p { margin: 2px 0 0; }

.bond-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.bond-label { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.bond-meter { flex: 1; height: 12px; background: #efeafd; border-radius: 99px; overflow: hidden; }
.bond-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #f783ac, #ffd166, #8ce99a, #66d9e8); transition: width .6s ease; }

/* ---------- panels / tasks ---------- */
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-sub { color: var(--ink-soft); font-size: .9rem; margin: 4px 0 10px; }
.toggle-btn, .small-btn, .theme-btn {
  border: 1px solid var(--card-line); background: #faf8ff; color: var(--ink);
  border-radius: 99px; padding: 6px 12px; font-size: .85rem;
}
.toggle-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.theme-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }

.lowday-banner {
  background: #fff7db; border: 1px solid #f2df9a; border-radius: 12px;
  padding: 8px 10px; font-size: .9rem;
}

.task-list { list-style: none; margin: 8px 0; padding: 0; }
.task {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--card-line); border-radius: 14px;
  padding: 10px; margin-bottom: 8px; background: #fff;
}
.task.done { background: #f2fbf6; border-color: #bfe6cf; }
.task-check {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--accent); background: #fff; color: var(--good);
  font-size: 1.05rem; line-height: 1;
}
.task.done .task-check { background: var(--good); border-color: var(--good); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-name { font-weight: 600; display: block; }
.task-min { color: var(--ink-soft); font-size: .85rem; display: block; }
.task-min::before { content: "smallest version: "; font-style: italic; }
.task-tools { display: flex; gap: 4px; }
.tool-btn { border: 0; background: transparent; font-size: 1rem; padding: 4px; color: var(--ink-soft); }
.task-edit input { display: block; width: 100%; margin-bottom: 6px; padding: 7px 9px; border: 1px solid var(--card-line); border-radius: 9px; }

.add-task { display: grid; gap: 6px; margin-top: 10px; }
.add-task input { padding: 9px 10px; border: 1px solid var(--card-line); border-radius: 10px; width: 100%; }

.run-btn {
  width: 100%; margin-top: 12px; padding: 13px; border: 0; border-radius: 14px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1rem;
}

/* ---------- three stars ---------- */
.three-stars { background: linear-gradient(180deg, #fff, #fff8e6); border-color: #f2df9a; text-align: center; }
.three-stars ol { text-align: left; max-width: 380px; margin: 8px auto; }
.three-stars-sub, .three-stars-foot { color: var(--ink-soft); }

/* ---------- mood ---------- */
.mood-orbs { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 12px; }
.orb {
  width: 42px; height: 42px; border-radius: 50%; border: 3px solid transparent;
  padding: 0;
}
.orb.selected { border-color: var(--ink); transform: scale(1.1); }
.week-strip { display: flex; gap: 6px; }
.week-day { flex: 1; text-align: center; font-size: .68rem; color: var(--ink-soft); }
.week-swatch { height: 30px; border-radius: 9px; border: 1px dashed var(--card-line); margin-bottom: 3px; }
.week-swatch.filled { border-style: solid; border-color: rgba(0,0,0,.08); }

/* ---------- settings / support ---------- */
.field { display: grid; gap: 6px; font-weight: 600; }
.field input { padding: 9px 10px; border: 1px solid var(--card-line); border-radius: 10px; }
.theme-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }

.support-footer { max-width: 560px; margin: 0 auto; text-align: center; }
.support-btn {
  border: 1px solid var(--card-line); background: var(--header-bg);
  border-radius: 99px; padding: 9px 18px; font-weight: 600;
}
.support-panel {
  text-align: left; background: var(--card); border: 1px solid var(--card-line);
  border-radius: 16px; padding: 12px 14px; margin-top: 10px; box-shadow: var(--shadow);
}
.support-link { color: var(--accent); }
.support-note { color: var(--ink-soft); font-size: .9rem; }
.tiny-note { color: var(--ink-soft); font-size: .78rem; margin-top: 14px; }

/* ---------- routine run overlay ---------- */
.run-overlay {
  position: fixed; inset: 0; background: rgba(46, 42, 74, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 30;
}
.run-card {
  background: var(--card); border-radius: 22px; padding: 20px; text-align: center;
  max-width: 420px; width: 100%; box-shadow: var(--shadow);
}
.run-step-count { color: var(--ink-soft); margin: 0 0 6px; }
.run-timer { position: relative; width: 130px; height: 130px; margin: 0 auto 8px; }
.run-timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.run-timer circle { fill: none; stroke-width: 9; }
.ring-bg { stroke: #efeafd; }
.ring-fg { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 0; }
.run-timer-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700;
}
.run-task-min { color: var(--ink-soft); }
.run-timer-note { font-size: .85rem; color: var(--ink-soft); }
.run-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.run-done-btn { background: var(--good); color: #fff; border: 0; border-radius: 99px; padding: 11px 22px; font-weight: 700; }
.subtle { opacity: .75; }

#burst { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ---------- reduced motion: sway, pulse and bursts are JS/CSS-gated ---------- */
@media (prefers-reduced-motion: reduce) {
  .japhis { animation: none; }
  .day-star.charged svg { animation: none; }
  .bond-fill { transition: none; }
}
