:root, [data-theme="light"] {
  --color-bg: #f7f6f2;
  --color-surface: #fbfbf9;
  --color-surface-2: #f3f0ec;
  --color-border: #d4d1ca;
  --color-text: #28251d;
  --color-text-muted: #6f6d67;
  --color-primary: #01696f;
  --color-primary-hover: #0c4e54;
  --color-success: #437a22;
  --color-error: #a13544;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius-sm: 0.5rem;
  --radius-md: 0.85rem;
  --radius-lg: 1.2rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.45rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2rem);
  --font-body: "Satoshi", system-ui, sans-serif;
}

[data-theme="dark"] {
  --color-bg: #171614;
  --color-surface: #1c1b19;
  --color-surface-2: #22211f;
  --color-border: #393836;
  --color-text: #e6e2dc;
  --color-text-muted: #9b9891;
  --color-primary: #4f98a3;
  --color-primary-hover: #67aeb9;
  --color-success: #7db35a;
  --color-error: #dd6974;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: #06090f;
  color: #e6f4ff;
  line-height: 1.5;
  transition: background-color 0.25s ease, color 0.25s ease;
}

button,
input,
select,
textarea,
a {
  font: inherit;
}

a {
  color: #38bdf8;
  transition: color 0.2s ease;
}

a:hover {
  color: #7dd3fc;
}

.app,
.about-shell,
.page-shell,
.readme-shell {
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
}

.app {
  padding: var(--space-6) 0 var(--space-10);
}

.about-shell,
.page-shell,
.readme-shell {
  padding: 1.5rem 0 2.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.brand h1 {
  margin: 0;
  font-size: var(--text-xl);
  line-height: 1.1;
}

.brand p {
  margin: 0.35rem 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.topbar-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn,
.range-btn {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 0.75rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn:hover,
.range-btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.btn.primary:hover {
  background: var(--color-primary-hover);
}

.btn.toggle {
  width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}

.range-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.range-btn.is-active {
  background: color-mix(in srgb, var(--color-primary) 20%, var(--color-surface));
  border-color: var(--color-primary);
  color: var(--color-text);
}

.panel {
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hero {
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1.5fr 1fr;
}

.hero h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.hero-meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  border: 1px solid var(--color-border);
  width: fit-content;
}

.hero-status.live {
  color: var(--color-primary);
}

.hero-status.final {
  color: var(--color-success);
}

.hero-side {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  justify-items: start;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.kpi-card {
  padding: var(--space-5);
}

.kpi-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.35rem);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi-sub {
  margin-top: 0.4rem;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.positive {
  color: var(--color-success);
}

.negative {
  color: var(--color-error);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: var(--space-6);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: var(--space-5) var(--space-5) 0;
}

.section-head h3 {
  margin: 0;
  font-size: var(--text-lg);
}

.section-head p {
  margin: 0.35rem 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.table-wrap {
  padding: var(--space-4) var(--space-5) var(--space-5);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

tbody tr.is-selected {
  background: color-mix(in srgb, var(--color-primary) 14%, transparent);
}

.detail {
  padding: var(--space-5);
  display: grid;
  gap: var(--space-5);
  align-content: start;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.mini-stat {
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-surface-2) 82%, transparent);
}

.mini-stat .label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.mini-stat .value {
  margin-top: 0.45rem;
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.empty,
.loading {
  padding: var(--space-6);
  color: var(--color-text-muted);
}

.footer-note {
  margin-top: var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.footer-note a {
  color: #7dd3fc;
  text-decoration: none;
}

.footer-note a:hover {
  text-decoration: underline;
}

.about-subtitle {
  margin: 0 0 1.25rem;
  text-align: center;
  font-size: 1.12rem;
  font-weight: 500;
  line-height: 1.4;
  color: #38bdf8;
}

.visual-wrap {
  width: 100%;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
}

.visual-wrap img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
}

.readme-list-wrap {
  width: 100%;
  margin: 1.4rem auto 0;
}

.readme-list {
  margin: 0;
  padding-left: 1.25rem;
  text-align: left;
  color: #cbd5e1;
}

.readme-list li {
  margin: 0.55rem 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

.readme-list a {
  color: #cbd5e1;
  text-decoration: none;
}

.readme-list a:hover {
  color: #38bdf8;
  text-decoration: underline;
}

.back-row {
  width: 100%;
  margin: 1rem auto 0;
  display: flex;
  justify-content: flex-end;
}

.back-link {
  color: #e6f4ff;
  text-decoration: none;
  font-size: 2rem;
  line-height: 1;
  display: inline-block;
  padding: 0.1rem 0.2rem;
}

.back-link:hover {
  color: #38bdf8;
}

header#title-block-header,
header#title-block-header h1,
h1.title,
body > h1,
body > h2,
body > h3,
body > h4,
body > h5,
body > p,
body > ul,
body > ol,
body > pre,
body > blockquote,
body > table {
  width: min(1100px, calc(100% - 2rem));
  margin-left: auto;
  margin-right: auto;
}

header#title-block-header {
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
}

header#title-block-header h1,
h1.title,
body > h1 {
  margin-top: 0;
  margin-bottom: 0;
  text-align: left;
  color: #f8fafc;
  font-size: clamp(2rem, 1.6rem + 1.8vw, 3rem);
  line-height: 1.12;
}

body > h2,
body > h3,
body > h4,
body > h5 {
  color: #f8fafc;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

body > p,
body > ul,
body > ol,
body > pre,
body > blockquote {
  color: #cbd5e1;
  line-height: 1.65;
}

body > p,
body > ul,
body > ol,
body > pre,
body > blockquote,
body > table {
  margin-top: 0;
  margin-bottom: 1rem;
}

body > ul,
body > ol {
  padding-left: 2rem;
}

body > pre {
  padding: 1rem 1.25rem;
  background: #0b1118;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: auto;
}

body > blockquote {
  padding-left: 1rem;
  border-left: 3px solid #38bdf8;
}

body > table th,
body > table td {
  white-space: normal;
}

@media (max-width: 1024px) {
  .hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .about-shell,
  .page-shell,
  .readme-shell {
    width: min(100%, calc(100% - 1rem));
    padding-top: 1rem;
  }

  .about-subtitle {
    font-size: 1rem;
  }

  .readme-list li {
    font-size: 0.88rem;
  }

  .back-link {
    font-size: 1.75rem;
  }
}

@media (max-width: 640px) {
  .app {
    width: calc(100% - 1rem);
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .detail-summary {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

header#title-block-header,
header#title-block-header h1,
h1.title,
body > h1,
body > h2,
body > h3,
body > h4,
body > h5,
body > p,
body > ul,
body > ol,
body > pre,
body > blockquote,
body > table {
  width: min(1100px, calc(100% - 2rem));
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

header#title-block-header,
h1.title,
body > h1 {
  padding-left: 0;
  text-indent: 0;
}

header#title-block-header h1,
h1.title,
body > h1 {
  margin-top: 0;
  margin-bottom: 0;
  text-align: left;
}

body > p,
body > ul,
body > ol,
body > pre,
body > blockquote,
body > table {
  padding-left: 0;
  text-indent: 0;
}

body > blockquote {
  border-left: none;
  padding-left: 0;
}

header#title-block-header,
header#title-block-header h1,
h1.title,
body > h1 {
  text-align: center !important;
  color: #38bdf8 !important;
}

header#title-block-header {
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
}

header#title-block-header h1,
h1.title,
body > h1 {
  margin-left: auto !important;
  margin-right: auto !important;
}
