:root {
  --bg: #0f1222;
  --surface: #1f2440;
  --surface-2: #262c4d;
  --line: #ffffff14;
  --text: #f3f4fb;
  --text-2: #c5c9e0;
  --muted: #8e93b3;
  --cs: #1fa898;      /* validated series colors (dark surface) */
  --ds: #8b5cf6;
  --cs-soft: #22b8a733;
  --ds-soft: #8b5cf633;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(900px 500px at 10% 0%, #22b8a722, transparent),
    radial-gradient(900px 500px at 90% 0%, #8b5cf622, transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 clamp(16px, 2.5vw, 36px) 24px;
}
[hidden] { display: none !important; }
h2 { font-size: 15px; font-weight: 700; color: var(--text-2); margin: 0; letter-spacing: .02em; }
.num { font-variant-numeric: tabular-nums; }

/* Header */
.bar { display: flex; align-items: center; gap: 16px; padding: 18px 0 12px; flex-wrap: wrap; }
.brand { font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.logo { color: #ffd34d; }
.tag { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; background: #ff5e8a; color: #1b1020; padding: 2px 8px; border-radius: 99px; }
.today { color: var(--muted); margin-left: auto; }
.live { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #ffb547; }
.live.on i { background: #3ddc97; box-shadow: 0 0 0 0 #3ddc97aa; animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px #3ddc9700 } 100% { box-shadow: 0 0 0 0 #3ddc9700 } }

/* Rivalry bar */
.rivalry { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin: 4px 0 18px; }
.r-label { font-weight: 800; font-size: 15px; white-space: nowrap; }
.r-track { height: 12px; display: flex; gap: 2px; border-radius: 99px; overflow: hidden; background: var(--surface); }
.r-track i { display: block; height: 100%; transition: flex-grow .8s; flex: 1 1 0; }
.r-track i.cs { background: var(--cs); }
.r-track i.ds { background: var(--ds); }

/* Pet cards */
.pets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 18px; }
.pet-card {
  background: var(--surface); border-radius: 22px; padding: 20px;
  display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 6px 20px;
  border-top: 4px solid var(--c);
  position: relative; overflow: hidden;
}
.pet-card.cs { --c: var(--cs); --soft: var(--cs-soft); }
.pet-card.ds { --c: var(--ds); --soft: var(--ds-soft); }
.pet-card.party { animation: party-glow 1s ease-in-out 6; }
@keyframes party-glow { 50% { box-shadow: 0 0 0 4px var(--c), 0 0 60px var(--c); } }
.art { aspect-ratio: 1; align-self: center; }
.head h3 { margin: 0; font-size: 28px; }
.head p { margin: 2px 0 12px; color: var(--muted); }
.meter-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.meter-row strong { color: var(--text); font-size: 15px; }
.meter { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 14px; }
.meter i { display: block; height: 100%; border-radius: 99px; transition: width .8s; }
.meter.happy i { background: linear-gradient(90deg, #ff6b81, #ffd34d 50%, #3ddc97); background-size: var(--full, 300px) 100%; }
.meter.xp i { background: var(--c); }

.tiles { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 8px; }
.tile { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.tile b { display: block; font-size: clamp(22px, 2.4vw, 32px); font-weight: 800; line-height: 1.1; }
.tile span { font-size: 12px; color: var(--muted); }
@media (max-width: 560px) {
  .pet-card { grid-template-columns: 1fr; }
  .art { max-width: 200px; justify-self: center; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

.acts { grid-column: 1 / -1; width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.acts th { text-align: right; font-weight: 600; color: var(--muted); font-size: 12px; padding: 4px 8px; }
.acts th:first-child { text-align: left; }
.acts td { padding: 6px 8px; border-top: 1px solid var(--line); text-align: right; color: var(--text-2); }
.acts td:first-child { text-align: left; color: var(--text); }
.acts td.today b { color: var(--text); }
.acts .tier { font-size: 11px; color: var(--muted); margin-left: 6px; }
.acts tr.flash td { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { background: var(--soft); } 100% { background: transparent; } }
.bump { animation: bump .6s ease-out; display: inline-block; }
@keyframes bump { 30% { transform: scale(1.25); color: #ffd34d; } }

/* Lower panels */
.lower { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
@media (max-width: 900px) { .lower { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border-radius: 22px; padding: 18px 20px; min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--text-2); }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.cs { background: var(--cs); }
.sw.ds { background: var(--ds); }

.chart { width: 100%; height: 230px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .bar-cs { fill: var(--cs); }
.chart .bar-ds { fill: var(--ds); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: #ffffff08; }
.chart .val { fill: var(--text-2); font-size: 11px; font-weight: 700; }
.table-view { margin-top: 8px; font-size: 13px; color: var(--muted); }
.table-view table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.table-view td, .table-view th { padding: 4px 6px; text-align: right; border-top: 1px solid var(--line); color: var(--text-2); }
.table-view th:first-child, .table-view td:first-child { text-align: left; }

.feed { list-style: none; margin: 0; padding: 0; max-height: 470px; overflow: hidden; }
.feed li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.feed li:first-child { border-top: 0; }
.feed li.new { animation: slidein .5s ease-out; }
@keyframes slidein { from { transform: translateX(-12px); opacity: 0; } }
.feed .dot { width: 10px; height: 10px; border-radius: 50%; }
.feed .dot.cs { background: var(--cs); }
.feed .dot.ds { background: var(--ds); }
.feed .what b { font-weight: 700; }
.feed .meta { color: var(--muted); font-size: 12px; white-space: nowrap; text-align: right; }
.feed .meta strong { color: var(--text-2); display: block; font-size: 13px; }
.feed .empty { color: var(--muted); display: block; }

.tooltip {
  position: fixed; pointer-events: none; z-index: 30;
  background: #0b0d1a; border: 1px solid #ffffff22; border-radius: 10px; padding: 8px 10px;
  font-size: 13px; color: var(--text); box-shadow: 0 8px 24px #0008; min-width: 140px;
}
.tooltip .t-h { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tooltip .t-r { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tooltip .t-r span { display: flex; align-items: center; gap: 6px; }

.banner {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%); z-index: 40;
  background: linear-gradient(120deg, #ff5e8a, #ffb547); color: #1b1020;
  font-weight: 800; font-size: clamp(18px, 2.4vw, 30px); padding: 16px 30px; border-radius: 20px;
  box-shadow: 0 20px 60px #0009; animation: drop .5s cubic-bezier(.2,1.4,.4,1);
  max-width: calc(100vw - 32px); text-align: center;
}
@keyframes drop { from { transform: translate(-50%, -120%); } }

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
