/* Spring Loaded — navy, royal blue and silver, matched to the cougar icon */
:root {
  --bg: #030b22;
  --navy: #061747;
  --card: rgba(13, 36, 104, 0.55);
  --line: rgba(150, 180, 255, 0.16);
  --line-soft: rgba(150, 180, 255, 0.08);
  --blue: #2f6bff;
  --blue2: #4d8dff;
  --ice: #a9c8ff;
  --silver: #cfd7e6;
  --text: #f2f5fb;
  --muted: #9fb0d0;
  --dim: #7082a8;
  --radius: 18px;
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; color: var(--text); font-family: var(--font); background: var(--bg); }
body {
  min-height: 100dvh;
  background:
    radial-gradient(900px 520px at 100% -8%, rgba(47, 107, 255, 0.35), transparent 60%),
    radial-gradient(700px 500px at -10% 30%, rgba(20, 60, 190, 0.22), transparent 60%),
    linear-gradient(180deg, #061747 0%, #040f30 45%, #030b22 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: linear-gradient(180deg, rgba(4, 15, 48, 0.97), rgba(4, 15, 48, 0.85));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-logo { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 4px 14px rgba(47, 107, 255, 0.45); }
.wordmark {
  flex: 1; font-family: var(--display); font-weight: 800; font-style: italic;
  text-transform: uppercase; font-size: 23px; letter-spacing: 0.04em; line-height: 1;
}
.wordmark span { color: var(--blue2); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: var(--silver); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04);
}
.icon-btn svg { width: 22px; height: 22px; }

.view { max-width: 560px; margin: 0 auto; padding: 14px 16px calc(100px + var(--safe-b)); }

/* ---------- tab bar ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + var(--safe-b));
  background: rgba(3, 11, 34, 0.93);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
  color: var(--dim); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--text); }
.tab.on svg { color: var(--blue2); }

/* ---------- day / week header ---------- */
.dayhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.nav-btn {
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--silver);
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn:disabled { opacity: 0.3; }
.dh-mid { flex: 1; text-align: center; min-width: 0; }
.dh-date { font-family: var(--display); font-weight: 800; font-size: 24px; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.1; }
.dh-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.today-pill {
  display: block; margin: -2px auto 12px; padding: 7px 16px; border-radius: 99px;
  background: rgba(77, 141, 255, 0.16); color: var(--ice); font-size: 13px; font-weight: 700;
}

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 18px 18px 16px; margin-bottom: 14px;
  background: linear-gradient(135deg, #2a63f0 0%, #1440c2 38%, #0b2a86 72%, #081f63 100%);
  box-shadow: 0 12px 30px rgba(10, 40, 140, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.hero::before {
  content: ""; position: absolute; inset: -40%; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0 26px, transparent 26px 72px);
}
.hero-mark {
  position: absolute; right: -34px; top: -26px; width: 168px; height: 168px;
  opacity: 0.2; transform: rotate(-8deg); pointer-events: none;
}
.hero > *:not(.hero-mark) { position: relative; }
.hero-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ice); }
.hero-title {
  margin: 4px 0 14px; font-family: var(--display); font-weight: 800; font-style: italic;
  text-transform: uppercase; font-size: 36px; line-height: 0.95; letter-spacing: 0.01em; max-width: 78%;
}
.hero-text { margin: -4px 0 12px; color: #dfe8ff; font-size: 15px; line-height: 1.45; max-width: 92%; }
.hero-row { display: flex; align-items: center; gap: 22px; }
.stat b { display: block; font-family: var(--display); font-weight: 800; font-size: 32px; line-height: 1; }
.stat span { font-size: 11px; color: var(--ice); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.ring { margin-left: auto; position: relative; width: 66px; height: 66px; }
.ring svg { transform: rotate(-90deg); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 19px; }
.ring .pct svg { width: 28px; height: 28px; transform: none; }
.hero.complete { background: linear-gradient(135deg, #3c78ff 0%, #1d52e0 40%, #1036a6 75%, #0a2577 100%); }
.done-stamp {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 6px; vertical-align: middle;
  background: #fff; color: #0b2a86; font-family: var(--display); font-style: normal; font-weight: 800;
  font-size: 13px; letter-spacing: 0.1em;
}

/* ---------- checklist ---------- */
.group {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 6px 6px; margin-bottom: 12px;
}
.g-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 10px 4px; }
.g-title { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; font-size: 15px; color: var(--silver); }
.g-count { font-size: 12px; color: var(--muted); font-weight: 700; }
.g-note { margin: 0 10px 6px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.items { list-style: none; margin: 0; padding: 0; }
.items > li + li { border-top: 1px solid var(--line-soft); }
.item { display: flex; align-items: center; gap: 6px; }
.i-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 11px 8px; text-align: left; border-radius: 12px; }
.i-main:active { background: rgba(77, 141, 255, 0.1); }
.check {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  border: 2px solid rgba(169, 200, 255, 0.45); color: transparent; transition: all 0.15s ease;
}
.check svg { width: 18px; height: 18px; }
.item.done .check { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 0 0 4px rgba(47, 107, 255, 0.18); }
.i-body { flex: 1; min-width: 0; }
.i-label { font-weight: 600; font-size: 16px; line-height: 1.25; }
.i-sub { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.item.done .i-label { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(169, 200, 255, 0.5); }
.i-how {
  flex: none; width: 32px; height: 32px; margin-right: 4px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--ice); font-weight: 800; font-size: 14px;
}
.i-how[aria-expanded="true"] { background: rgba(77, 141, 255, 0.2); border-color: var(--blue2); }
.how-text {
  margin: 0 10px 10px 50px; padding: 10px 12px; border-radius: 10px;
  font-size: 14px; line-height: 1.45; color: var(--silver); background: rgba(77, 141, 255, 0.1);
}

/* ---------- cards & forms ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card-title, .card h3 {
  margin: 0 0 10px; font-family: var(--display); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; font-size: 15px; color: var(--silver);
}
.feel { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.feel button {
  padding: 11px 0; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03);
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.feel button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.field label { display: block; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 16px 0 6px; }
.field label span { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--dim); }
input, textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: rgba(3, 11, 34, 0.6); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
textarea { min-height: 80px; resize: vertical; line-height: 1.4; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue2); outline-offset: 0; border-color: transparent; }
select { appearance: none; -webkit-appearance: none; }
.time-row { display: flex; align-items: center; gap: 8px; }
.time-row select { flex: 1.3; }
.time-row input { flex: 1; text-align: center; }
.time-row .colon { font-family: var(--display); font-size: 24px; font-weight: 800; color: var(--muted); }
.hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.hint.ok { color: var(--ice); }

/* ---------- week ---------- */
.strip { display: grid; grid-template-columns: repeat(15, 1fr); gap: 3px; margin: 2px 0 6px; }
.strip button { height: 10px; border-radius: 3px; background: rgba(150, 180, 255, 0.16); }
.strip button.past { background: rgba(77, 141, 255, 0.45); }
.strip button.now { background: var(--ice); }
.strip button.sel { background: var(--blue2); box-shadow: 0 0 0 2px #fff; }
.strip button.gap, .strip-labels .gap { margin-left: 5px; }
.strip-labels { display: grid; grid-template-columns: repeat(15, 1fr); gap: 3px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; margin-bottom: 14px; }
.sum-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sum-big { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; }
.sum-big small { font-size: 18px; color: var(--muted); font-weight: 700; }
.sum-side { text-align: right; font-size: 13px; color: var(--muted); }
.sum-side b { color: var(--text); font-size: 15px; }
.bar { height: 8px; border-radius: 99px; background: rgba(150, 180, 255, 0.14); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue2)); border-radius: 99px; }
.key-line { margin: 12px 0 0; font-size: 14px; color: var(--silver); }
.days { list-style: none; margin: 0; padding: 0; }
.day {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
}
.day.is-today { border-color: var(--blue2); box-shadow: inset 0 0 0 1px var(--blue2); }
.day.is-rest { opacity: 0.7; }
.d-date { flex: none; width: 44px; text-align: center; }
.d-dow { font-size: 11px; color: var(--muted); text-transform: uppercase; font-weight: 800; letter-spacing: 0.1em; }
.d-num { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1; }
.d-body { flex: 1; min-width: 0; }
.d-title { font-weight: 700; font-size: 16px; }
.d-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.d-status { flex: none; width: 30px; height: 30px; display: grid; place-items: center; }
.d-status .done-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; }
.d-status .done-dot svg { width: 16px; height: 16px; }
.d-status .mini svg { transform: rotate(-90deg); }

/* ---------- log ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 10px; }
.tile b { display: block; font-family: var(--display); font-size: 32px; font-weight: 800; line-height: 1; }
.tile span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.chart-tip { font-size: 14px; color: var(--text); min-height: 20px; margin: 0 0 8px; }
.chart-tip span { color: var(--muted); }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .hit { fill: transparent; cursor: pointer; }
.legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; }
.legend .sw-done { background: var(--blue2); }
.legend .sw-plan { border: 1.5px solid rgba(207, 215, 230, 0.55); }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li + li { border-top: 1px solid var(--line-soft); }
.hist button { width: 100%; text-align: left; padding: 12px 2px; display: block; }
.h-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.h-date { font-weight: 700; }
.h-meta { font-size: 13px; color: var(--muted); white-space: nowrap; }
.h-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.h-note { font-size: 14px; color: var(--silver); margin-top: 6px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; background: rgba(77, 141, 255, 0.18); color: var(--ice); font-size: 12px; font-weight: 700; margin-left: 6px; }
.empty { text-align: center; color: var(--muted); padding: 18px 8px; font-size: 14px; line-height: 1.5; }

/* ---------- plan ---------- */
.phase { display: flex; gap: 12px; padding: 12px 2px; }
.phase + .phase { border-top: 1px solid var(--line-soft); }
.phase-num {
  flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 20px; background: rgba(150, 180, 255, 0.12); color: var(--silver);
}
.phase.on .phase-num { background: var(--blue); color: #fff; }
.phase-name { font-weight: 700; }
.phase-name small { color: var(--ice); font-weight: 600; margin-left: 6px; }
.phase-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; padding: 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.tbl .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
details { border-top: 1px solid var(--line-soft); }
details:first-of-type { border-top: 0; }
summary { list-style: none; padding: 12px 2px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--ice); font-size: 20px; font-weight: 600; }
details[open] summary::after { content: "–"; }
details p { margin: 0 2px 12px; color: var(--silver); font-size: 14px; line-height: 1.5; }
.rules { margin: 0; padding-left: 18px; }
.rules li { margin-bottom: 10px; font-size: 14px; line-height: 1.45; color: var(--silver); }
.rules b { color: var(--text); }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(1, 6, 20, 0.62); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-panel {
  width: 100%; max-width: 560px; max-height: 90dvh; overflow: auto;
  background: #081a52; border: 1px solid var(--line); border-bottom: 0;
  border-top-left-radius: 22px; border-top-right-radius: 22px;
  padding: 8px 16px calc(20px + var(--safe-b)); animation: up 0.22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.grabber { width: 40px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.25); margin: 4px auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 26px; }
.btn { display: block; width: 100%; padding: 13px; border-radius: 12px; font-weight: 700; background: var(--blue); color: #fff; margin-top: 10px; }
.btn.ghost { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: rgba(255, 80, 80, 0.1); border: 1px solid rgba(255, 120, 120, 0.35); color: #ffc2c2; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row.one { grid-template-columns: 1fr; }
.link-btn { display: block; margin: 14px auto 2px; color: var(--ice); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.card.due { border-color: rgba(77, 141, 255, 0.65); box-shadow: inset 0 0 0 1px rgba(77, 141, 255, 0.35); }
.version { text-align: center; color: var(--dim); font-size: 12px; margin: 8px 0 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: 0.25s ease;
  background: #eef3ff; color: #06194d; font-weight: 700; font-size: 14px;
  padding: 10px 18px; border-radius: 99px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
