:root {
  --bg: #f3efe6;
  --bg-strong: #ece4d7;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --border: rgba(38, 49, 64, 0.12);
  --text: #17212d;
  --muted: #617082;
  --accent: #1d7a85;
  --accent-2: #c56142;
  --accent-3: #2f5c9f;
  --shadow: 0 24px 60px rgba(23, 33, 45, 0.09);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(29, 122, 133, 0.16), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(197, 97, 66, 0.16), transparent 28rem),
    linear-gradient(180deg, var(--bg), #f7f4ee);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

body {
  position: relative;
}

.ambient {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(30px);
  opacity: 0.5;
  pointer-events: none;
}

.ambient-a {
  top: 4rem;
  right: 6vw;
  width: 14rem;
  height: 14rem;
  background: rgba(29, 122, 133, 0.18);
}

.ambient-b {
  bottom: 10rem;
  left: 3vw;
  width: 12rem;
  height: 12rem;
  background: rgba(197, 97, 66, 0.16);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

code {
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(23, 33, 45, 0.08);
  font-size: 0.95em;
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.main-shell {
  display: grid;
  gap: 1rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand small {
  color: var(--muted);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.nav-links a,
.nav-user {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
}

.nav-links a:hover {
  background: rgba(23, 33, 45, 0.05);
}

.nav-links a.is-current {
  background: rgba(29, 122, 133, 0.12);
  color: var(--accent);
}

.nav-user {
  background: rgba(23, 33, 45, 0.06);
  color: var(--muted);
}

.hero-card,
.surface-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  gap: 1rem;
  padding: 1.4rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6)),
    linear-gradient(120deg, rgba(29, 122, 133, 0.08), rgba(197, 97, 66, 0.08));
}

.surface-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  padding: 1.25rem;
}

.hero-copy h1,
.surface-card h2,
.auth-panel h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Georgia", serif;
  font-weight: 700;
  line-height: 1.05;
}

.hero-copy h1,
.auth-panel h1 {
  font-size: clamp(2rem, 5vw, 4.3rem);
  max-width: 12ch;
}

.hero-meta,
.feature-stack,
.range-strip,
.metric-grid,
.summary-grid,
.chart-grid,
.admin-grid,
.inline-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.hero-actions {
  display: grid;
  gap: 0.8rem;
  align-content: start;
}

.hero-meta span,
.feature-chip,
.range-pill,
.caption {
  color: var(--muted);
}

.feature-chip,
.range-pill,
.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
}

.feature-chip,
.range-pill {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(23, 33, 45, 0.08);
}

.range-strip {
  padding: 0 0.2rem;
}

.range-pill.is-active {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
}

.primary-button,
.ghost-button {
  border: 1px solid transparent;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: white;
  box-shadow: 0 18px 30px rgba(29, 122, 133, 0.22);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.62);
  border-color: var(--border);
  color: var(--text);
}

.disabled-button {
  opacity: 0.6;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--accent);
}

.lede {
  margin: 0.8rem 0 0;
  max-width: 58ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.summary-grid,
.chart-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.player-card {
  grid-column: span 6;
}

.player-card__header,
.card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.player-card__header h2,
.card-heading h2 {
  font-size: 1.35rem;
}

.player-card__header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.player-swatch {
  width: 0.95rem;
  height: 2.5rem;
  border-radius: 999px;
}

.summary-pill-stack {
  display: grid;
  gap: 0.45rem;
}

.summary-pill {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(29, 122, 133, 0.08);
  color: var(--accent);
}

.summary-pill--accent {
  background: rgba(197, 97, 66, 0.1);
  color: var(--accent-2);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1rem 0 0.75rem;
  gap: 0.8rem;
}

.metric-grid div {
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(23, 33, 45, 0.06);
}

.metric-grid span {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.metric-grid strong {
  font-size: 1.5rem;
}

.chart-card {
  grid-column: span 6;
}

.chart-card-wide {
  grid-column: span 12;
}

.chart-shell {
  margin-top: 0.8rem;
  position: relative;
}

.chart-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-frame {
  position: relative;
}

.grid-line {
  stroke: rgba(23, 33, 45, 0.08);
  stroke-width: 1;
}

.axis-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-hitbox {
  cursor: crosshair;
}

.chart-hover-line {
  stroke: rgba(23, 33, 45, 0.18);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.chart-hover-point {
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 2;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 11rem;
  max-width: min(18rem, calc(100% - 1.5rem));
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(23, 33, 45, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 252, 246, 0.96);
  box-shadow: 0 18px 40px rgba(23, 33, 45, 0.12);
  backdrop-filter: blur(12px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.chart-tooltip__title {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart-tooltip__list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chart-tooltip__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.chart-tooltip__series {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.legend-dot {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.4rem;
  border-radius: 999px;
  vertical-align: middle;
}

.table-shell {
  overflow-x: auto;
}

.stack-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.stack-table th,
.stack-table td {
  padding: 0.95rem 0.75rem;
  border-bottom: 1px solid rgba(23, 33, 45, 0.08);
  text-align: left;
}

.stack-table th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.flash-stack {
  display: grid;
  gap: 0.7rem;
}

.flash {
  padding: 0.95rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.flash-success {
  background: rgba(29, 122, 133, 0.08);
  border-color: rgba(29, 122, 133, 0.2);
}

.flash-error {
  background: rgba(197, 97, 66, 0.08);
  border-color: rgba(197, 97, 66, 0.2);
}

.auth-page .site-shell {
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1rem;
}

.auth-form-panel {
  align-self: center;
}

.stack-form {
  display: grid;
  gap: 1rem;
}

.stack-form label {
  display: grid;
  gap: 0.45rem;
}

.stack-form span {
  color: var(--muted);
  font-size: 0.92rem;
}

.stack-form input,
.stack-form select {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(23, 33, 45, 0.1);
  background: rgba(255, 255, 255, 0.84);
}

.inline-button {
  margin-top: 0.8rem;
}

.empty-card {
  text-align: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 1rem;
}

.inline-actions form {
  margin: 0;
}

.inline-password-form {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.inline-password-form input {
  min-width: 10.5rem;
  padding: 0.7rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(23, 33, 45, 0.1);
  background: rgba(255, 255, 255, 0.84);
}

.caption {
  margin: 0;
  font-size: 0.92rem;
}

.chart-empty {
  color: var(--muted);
}

@media (max-width: 980px) {
  .player-card,
  .chart-card,
  .chart-card-wide {
    grid-column: span 12;
  }

  .admin-grid,
  .auth-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-shell {
    width: min(100% - 1rem, 100%);
  }

  .topbar {
    align-items: start;
  }

  .hero-card,
  .surface-card {
    padding: 1rem;
    border-radius: 22px;
  }

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

  .inline-password-form {
    width: 100%;
  }

  .inline-password-form input,
  .inline-password-form button {
    width: 100%;
  }

  .stack-table {
    min-width: 560px;
  }
}
