:root {
  --bg0: #fbf1e3;
  --bg1: #ffe9b8;
  --mint-glow: #c9ffe0;
  --ink: #1a2b4e;
  --ink-soft: #3d4f73;
  --muted: #7a8499;
  --card: #fffdf9;
  --card-2: #fff8ef;
  --line: #ead9c6;
  --pink: #e23b3b;
  --pink-deep: #c62828;
  --peach: #ffb4a2;
  --gold: #ffd96a;
  --gold-deep: #e8b83a;
  --mint: #7dffb5;
  --mint-deep: #3fd48a;
  --lavender: #c9b6e4;
  --sky: #9fd6ea;
  --navy: #1a2b4e;
  --danger: #e23b3b;
  --ok: #2fae73;
  --shadow: 0 12px 32px rgba(26, 43, 78, 0.10);
  --shadow-sm: 0 6px 16px rgba(26, 43, 78, 0.06);
  --radius: 24px;
  --radius-sm: 16px;
  --tabbar-h: 68px;
  --max: 430px;
}

.theme-low {
  --bg0: #f4eef2;
  --bg1: #e9e1ea;
  --mint-glow: #dce6e4;
  --gold: #e4cb86;
  --gold-deep: #c9af68;
  --pink: #d9a3b0;
  --pink-deep: #c48898;
  --card: #faf7f8;
}

.theme-off {
  --bg0: #efeaf6;
  --bg1: #e4dfee;
  --mint-glow: #dde3ea;
  --gold: #d4c6a0;
  --gold-deep: #b9ab86;
  --pink: #c9b4c8;
  --pink-deep: #b09aaf;
  --card: #f7f5fa;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 0% -8%, var(--bg1), transparent 55%),
    radial-gradient(720px 460px at 110% 0%, var(--mint-glow), transparent 50%),
    var(--bg0);
  min-height: 100dvh;
}

img { max-width: 100%; display: block; }
a { color: var(--pink-deep); text-decoration: none; }
button, .chip, .tab {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}
button:focus-visible, a:focus-visible, .tab:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
  border-radius: 12px;
}

.wrap {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + 28px);
}

.boot, .error-box {
  min-height: 70dvh;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-soft);
}
[hidden] { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 18px;
}
.topbar img, .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fbf1e3;
  box-shadow: var(--shadow-sm);
  object-fit: cover;
  object-position: 50% 30%;
}
.topbar .who { flex: 1; min-width: 0; }
.topbar h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.02em;
}
.topbar p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.card {
  background: var(--card);
  border: 1px solid rgba(243, 213, 206, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 18px 16px;
  margin: 0 0 14px;
}

.card h2, .section-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kicker {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: none;
  margin: 0 0 6px;
}

.hero {
  text-align: center;
  padding: 8px 8px 4px;
}
.hero .avatar-lg {
  width: 148px;
  height: 148px;
  margin: 0 auto 12px;
  border-radius: 28px;
  box-shadow: var(--shadow);
  background: #fbf1e3;
  object-fit: cover;
  object-position: 50% 40%;
}
.hero h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.04em;
}
.hero .tagline {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.energy-card {
  text-align: center;
  background:
    linear-gradient(180deg, #fffaf3 0%, var(--card) 70%);
  position: relative;
  overflow: hidden;
}
.energy-card::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -40px;
  top: -50px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(125, 255, 181, 0.35), transparent 70%);
  pointer-events: none;
}
.energy-num {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-shadow: 0 4px 0 rgba(125, 255, 181, 0.28);
  margin: 6px 0 4px;
}
.energy-num .unit {
  font-size: 32px;
  margin-left: 2px;
}
.energy-sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 12px;
}
.bar {
  height: 14px;
  border-radius: 999px;
  background: #efe3d0;
  overflow: hidden;
  position: relative;
}
.bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint), var(--gold));
  min-width: 0;
  transition: width 0.4s ease;
}
.theme-low .bar > span {
  background: linear-gradient(90deg, #d8c48a, #c9a0ad);
}
.theme-off .bar > span {
  background: linear-gradient(90deg, #cbbd9a, #b7a8c4);
}

.badge-row, .chips, .tabs, .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.filters { justify-content: flex-start; margin: 0 0 12px; }
.badge, .chip, .pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  background: #e9fff4;
  color: #1a2b4e;
  border: 1px solid #b6f0d2;
}
.badge.ok { background: #e9fff4; color: var(--ok); border-color: #b6f0d2; }
.badge.warn { background: #fff3dc; color: #9a7408; border-color: #ffe1a8; }
.badge.off { background: #e8ebf2; color: #4a5770; border-color: #d3d8e3; }
.chip {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.chip.active, .tab.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.stat {
  background: var(--card-2);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}
.stat b {
  display: block;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.stat span { font-size: 11px; color: var(--muted); }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

.job-card {
  display: flex;
  align-items: center;
  gap: 14px;
}
.job-card .badge-visual {
  flex: 0 0 72px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold), #ffe9a8);
  display: grid;
  place-items: center;
  font-size: 22px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.06);
}
.job-card h3 { margin: 0; font-size: 18px; }
.job-card p { margin: 2px 0 0; color: var(--ink-soft); font-size: 13px; }

.episode-card h3 { margin: 0 0 6px; font-size: 17px; }
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.quote {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff8e6;
  border-left: 4px solid var(--gold);
  color: var(--ink);
}

.empty {
  text-align: center;
  padding: 22px 10px 8px;
  color: var(--ink-soft);
}
.empty .emoji { font-size: 36px; margin-bottom: 8px; }
.empty p { margin: 0; }

.list { display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row .note { font-size: 14px; }
.row .type { font-size: 12px; color: var(--muted); }
.amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.day-head {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 650;
}

.subnav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 14px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 5px;
  position: sticky;
  top: 8px;
  z-index: 5;
  backdrop-filter: blur(8px);
}
.subnav a {
  text-align: center;
  font-size: 13px;
  padding: 8px 0;
  border-radius: 13px;
  color: var(--ink-soft);
}
.subnav a.active {
  background: var(--ink);
  color: #fff;
}

.chart-box { position: relative; }
.chart-box svg { width: 100%; height: 160px; display: block; }
.chart-tip {
  margin-top: 8px;
  min-height: 22px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
}

.sponsor, .wish, .ep {
  background: var(--card);
  border: 1px solid rgba(243, 213, 206, 0.8);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: #e9fff4;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
}

.rules h3 { margin: 18px 0 8px; font-size: 16px; }
.rules p, .rules li { color: var(--ink); }
.rules ul { padding-left: 1.15em; margin: 0 0 8px; }
.rate-table, .cat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.rate-table th, .rate-table td, .cat-table th, .cat-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}
.fineprint { font-size: 12px; color: var(--muted); }

.site-footer {
  margin: 22px 4px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.updated { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 14px; }

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, var(--max));
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 253, 249, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 20;
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}
.tabbar a.active { color: var(--ink); font-weight: 650; }
.tabbar svg { width: 22px; height: 22px; }

.sleep-banner {
  text-align: center;
  padding: 18px 12px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #efe8f8, #fff);
  margin-bottom: 14px;
  border: 1px solid #e2d8f0;
}
.sleep-banner strong { display: block; font-size: 28px; letter-spacing: 0.12em; }

@media (min-width: 720px) {
  :root { --max: 480px; }
  .energy-num { font-size: 72px; }
}
