:root {
  --bg: #0b0f17;
  --card: #121a29;
  --text: #e9eefc;
  --muted: #aab4cf;
  --line: rgba(255, 255, 255, 0.08);
  --pill: rgba(255, 255, 255, 0.1);
  --error: #ff6b6b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)),
    radial-gradient(1200px 800px at 20% 0%, rgba(91, 140, 255, 0.18), transparent 55%),
    radial-gradient(1200px 800px at 80% 20%, rgba(255, 125, 91, 0.12), transparent 55%),
    url("/bg/team-bg.png");
  background-size: auto, 1200px 800px, 1200px 800px, cover;
  background-position: center, 20% 0%, 80% 20%, center;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; }

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.2px;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }

.card {
  background: linear-gradient(180deg, rgba(12, 18, 30, 0.9), rgba(12, 18, 30, 0.82));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.alert {
  border-color: rgba(127, 209, 174, 0.45);
  background: linear-gradient(180deg, rgba(18, 36, 30, 0.95), rgba(16, 30, 26, 0.85));
}

.alert .kicker {
  color: #c9f4df;
}

.row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.chart-head {
  align-items: center;
}

.chart-header-left {
  min-width: 0;
  flex: 1;
}

.right { text-align: right; }

.section-header {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.section-header-left {
  min-width: 0;
}

.section-header .chart-header-right {
  margin-left: auto;
}

.kicker {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.big {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--pill);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
}

.badge-good {
  background: rgba(127, 209, 174, 0.2);
  color: #c9f4df;
  border-color: rgba(127, 209, 174, 0.45);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.badge-warn {
  background: rgba(242, 107, 107, 0.2);
  color: #ffd1d1;
  border-color: rgba(242, 107, 107, 0.45);
}

.pace-line {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.25;
}

.chart-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 84px;
  flex: 1;
}

.chart-delta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 96px;
}

.delta-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
}

.delta-pos {
  color: #ff8a8a;
  border-color: rgba(255, 138, 138, 0.45);
  background: rgba(255, 138, 138, 0.18);
}

.delta-neg {
  color: #7fd1ae;
  border-color: rgba(127, 209, 174, 0.45);
  background: rgba(127, 209, 174, 0.18);
}

.delta-zero {
  color: var(--muted);
}

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

.pace-row .badge {
  font-size: 11px;
  padding: 4px 10px;
}

.form {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(5, 8, 14, 0.5);
  color: var(--text);
  outline: none;
  font-size: 16px;
}

button {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.2);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  min-width: 110px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error {
  margin-top: 10px;
  color: var(--error);
  min-height: 18px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.history-table th,
.history-table td {
  padding: 8px 4px;
  font-size: 14px;
}

.history-table thead th {
  color: var(--muted);
  font-weight: 600;
}

.history-table .weighin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}

.history-table tbody .weighin-row {
  border-top: 1px solid var(--line);
}

.weighin-cell {
  min-width: 0;
}

.weighin-date {
  justify-self: start;
  text-align: left;
}

.weighin-weight {
  justify-self: end;
  text-align: right;
  padding-left: 12px;
  padding-right: 0;
}

.history-table thead .weighin-weight {
  padding-right: 16px;
}

.weight-cell {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
  justify-content: flex-end;
  white-space: nowrap;
}

.weight-delta {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 600;
  min-width: 64px;
  text-align: right;
}

.weight-delta-pos {
  color: #ff8a8a;
}

.weight-delta-neg {
  color: #7fd1ae;
}

.weight-delta-zero {
  color: var(--muted);
}

.weight-delta-spacer {
  visibility: hidden;
  opacity: 0;
}

.history-table thead .weight-delta-spacer {
  visibility: hidden;
  opacity: 0;
}
