:root {
  --bg: #0a0e17;
  --bg-soft: #0f1626;
  --panel: #121a2b;
  --panel-2: #16203400;
  --border: #1f2c44;
  --border-soft: #18253c;
  --text: #cbd5e1;
  --text-dim: #7c8aa5;
  --text-faint: #4a5874;
  --gold: #ffd84d;
  --gold-soft: #f0b429;
  --silver: #aeb9cc;
  --green: #4ade80;
  --accent: #7ee787;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
  --mono: "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---- base ---- */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(1200px 600px at 80% -10%, #15233f 0%, transparent 60%),
  radial-gradient(900px 500px at 0% 0%, #122036 0%, transparent 55%),
  var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- layout primitives ---- */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.section {
  margin-bottom: 46px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

@media (max-width: 820px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: linear-gradient(180deg, rgba(18, 26, 43, .9), rgba(12, 19, 33, .9));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

/* ---- hero ---- */
.hero {
  text-align: center;
  margin-bottom: 38px;
}

.hero__title {
  font-size: clamp(26px, 4vw, 40px);
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: .5px;
  color: #eaf2ff;
  text-shadow: 0 0 28px rgba(255, 216, 77, .18);
}

.hero__star {
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 216, 77, .7);
}

.hero__subtitle {
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: .4px;
}

.hero__subtitle b {
  color: var(--accent);
  font-weight: 600;
}

/* ---- stats grid + card ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 42px;
}

.stat-card {
  background: linear-gradient(180deg, var(--panel) 0%, #0e1626 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.stat-card::after {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, rgba(255, 216, 77, .10), transparent 70%);
}

.stat-card__label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 28px;
  font-weight: 700;
  color: #f4f8ff;
  line-height: 1.1;
}

.stat-card__unit {
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 400;
}

.stat-card__sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

.stat-card--gold .stat-card__value {
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 216, 77, .35);
}

/* ---- section head ---- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.section-head__title {
  margin: 0;
  font-size: 16px;
  letter-spacing: .5px;
  color: #e7eefc;
  font-weight: 600;
}

.section-head__hash {
  color: var(--accent);
  margin-right: 6px;
}

.section-head__note {
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ---- toggle ---- */
.toggle-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toggle {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .5px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s ease;
}

.toggle:hover {
  color: var(--text);
  border-color: #2c3d5e;
}

.toggle--active {
  background: #1c2a44;
  color: var(--accent);
  border-color: #355084;
}

/* ---- calendar ---- */
.calendar-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
}

.calendar {
  border-collapse: separate;
  border-spacing: 3px;
  margin: 0 auto;
}

.calendar__daynum {
  font-size: 9px;
  color: var(--text-faint);
  font-weight: 400;
  width: 22px;
  height: 18px;
  text-align: center;
  padding: 0;
}

.calendar__year {
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
  padding-right: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.calendar__year-pct {
  font-size: 9.5px;
  color: var(--text-faint);
  font-weight: 400;
}

/* "the wall" line */
.calendar__wall-mark {
  position: relative;
}

.calendar__wall-mark::after {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  right: -2px;
  border-left: 1.5px dashed rgba(231, 135, 135);
  pointer-events: none;
  z-index: 4;
}

/* ---- cell (calendar square) ---- */
.cell {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: #0c1320;
  border: 1px solid #16213600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .025);
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
  position: relative;
}

.cell:hover {
  transform: scale(1.28);
  z-index: 5;
  box-shadow: 0 0 0 1px #4a648f, 0 4px 14px rgba(0, 0, 0, .5);
}

.cell--absent {
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.cell--absent:hover {
  transform: none;
  box-shadow: none;
}

/* stars mode */
.cell--empty {
  background: #0e1626;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
}

.cell--part {
  background: linear-gradient(135deg, #9fb0c9, #6c7e9c);
  box-shadow: 0 0 6px rgba(174, 185, 204, .35);
}

.cell--full {
  background: linear-gradient(135deg, #ffe173, #f0b429);
  box-shadow: 0 0 9px rgba(255, 216, 77, .5);
}

.cell--finale.cell--full {
  box-shadow: 0 0 12px rgba(255, 216, 77, .75), 0 0 0 1.5px rgba(255, 238, 170, .6);
}

.cell--finale {
  border-radius: 50%;
}

/* difficulty mode (fill set inline via JS; ring marks completeness) */
.cell--diff-incomplete {
  opacity: .42;
}

.cell--diff-complete::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .55);
}

/* ---- legend ---- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-dim);
  align-items: center;
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend__swatch {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  display: inline-block;
}

.legend__swatch--wall {
  width: 0;
  height: 14px;
  border-radius: 0;
  background: none;
  border-left: 1.5px dashed rgba(126, 231, 135, .32);
}

/* ---- year bars chart ---- */
.year-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 200px;
  padding-top: 10px;
}

.year-bars__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}

.year-bars__track {
  width: 70%;
  max-width: 34px;
  background: #0e1626;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: flex-end;
  position: relative;
  flex: 1;
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.year-bars__fill {
  width: 100%;
  background: linear-gradient(180deg, #ffe173, #f0b429);
  border-radius: 5px 5px 0 0;
  transition: height .8s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 0 12px rgba(255, 216, 77, .3);
}

.year-bars__value {
  font-size: 10px;
  color: var(--gold);
  margin-bottom: 3px;
  font-weight: 600;
}

.year-bars__label {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ---- difficulty rows ---- */
.diff-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.diff-row__name {
  width: 64px;
  font-size: 11.5px;
  flex-shrink: 0;
}

.diff-row__bar-wrap {
  flex: 1;
  background: #0e1626;
  border-radius: 6px;
  height: 22px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.diff-row__bar {
  height: 100%;
  border-radius: 6px 0 0 6px;
  transition: width .8s cubic-bezier(.2, .8, .2, 1);
  position: relative;
}

.diff-row__count {
  width: 118px;
  flex-shrink: 0;
  font-size: 10.5px;
  color: var(--text-dim);
  text-align: right;
}

.diff-row__count b {
  color: var(--text);
}

/* ---- category rows ---- */
.cat-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: default;
}

.cat-row__name {
  width: 132px;
  flex-shrink: 0;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-row__bar-wrap {
  flex: 1;
  background: #0e1626;
  border-radius: 5px;
  height: 16px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.cat-row__bar {
  height: 100%;
  border-radius: 5px;
  transition: width .8s cubic-bezier(.2, .8, .2, 1);
}

.cat-row__value {
  width: 92px;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--text-dim);
  text-align: right;
}

.cat-row__value b {
  color: var(--text);
}

/* ---- pills ---- */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.pill {
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.pill--good {
  border-color: rgba(74, 222, 128, .35);
  color: #9ff0b5;
  background: rgba(74, 222, 128, .07);
}

.pill--bad {
  border-color: rgba(248, 113, 113, .35);
  color: #f6a6a6;
  background: rgba(248, 113, 113, .07);
}

/* ---- tooltip ---- */
.tip {
  position: fixed;
  z-index: 100;
  max-width: 340px;
  background: rgba(8, 12, 20, .97);
  border: 1px solid #2c3d5e;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .6);
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease;
  backdrop-filter: blur(4px);
}

.tip--visible {
  opacity: 1;
}

.tip__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
}

.tip__title {
  color: #f4f8ff;
  font-weight: 600;
  font-size: 12.5px;
}

.tip__day {
  color: var(--text-faint);
  font-size: 10.5px;
  white-space: nowrap;
}

.tip__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  align-items: center;
}

.tip__badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
}

.tip__stars {
  color: var(--gold);
  letter-spacing: 1px;
}

.tip__essence {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.45;
}

.tip__cats {
  margin-top: 7px;
  font-size: 10px;
  color: var(--text-faint);
}

/* ---- message (loading / error) ---- */
.message {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.message code {
  background: #0e1626;
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--accent);
  border: 1px solid var(--border);
}

.message--error {
  color: #f6a6a6;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- footer ---- */
.footer {
  text-align: center;
  color: var(--text-faint);
  font-size: 11px;
  margin-top: 30px;
}
