:root {
  --bg: #0f1419;
  --panel: #1a2029;
  --panel-2: #232a35;
  --ink: #e7ecf3;
  --muted: #8b96a8;
  --accent: #f4b942;
  --accent-2: #5fb2ff;
  --good: #5fd17a;
  --bad: #ef6d6d;
  --border: #2c3441;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

header {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px 16px;
}

header h1 {
  margin: 0 0 8px;
  font-size: 44px;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
  font-size: 15px;
}

.subtitle strong { color: var(--ink); }

section {
  max-width: 1080px;
  margin: 24px auto;
  padding: 0 24px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.control-group select,
.control-group input {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 15px;
  min-width: 120px;
}

#resetBtn {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
}

#resetBtn:hover { background: var(--border); }

.grade-panel {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
}

@media (max-width: 720px) {
  .grade-panel { grid-template-columns: 1fr; }
  header h1 { font-size: 32px; }
}

.grade-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.grade-label {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.grade-value {
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  margin: 8px 0 4px;
  color: var(--accent);
  letter-spacing: -0.04em;
}

.grade-range {
  font-size: 13px;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 720px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 24px;
  font-weight: 600;
  margin-top: 4px;
}

.stat-value.good { color: var(--good); }
.stat-value.bad { color: var(--bad); }

.chart-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.chart-section h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.chart-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.chart-wrap {
  position: relative;
  height: 340px;
}

.table-section h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.table-section table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.table-section th,
.table-section td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}

.table-section th {
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.table-section tr:last-child td { border-bottom: none; }

.table-section td.grade { font-weight: 700; }

.table-section a { color: var(--accent-2); text-decoration: none; }
.table-section a:hover { text-decoration: underline; }

.control-group input[type="checkbox"] { margin-right: 6px; vertical-align: middle; }

footer {
  max-width: 1080px;
  margin: 48px auto 32px;
  padding: 0 24px;
  color: var(--muted);
  font-size: 13px;
}

footer a {
  color: var(--accent-2);
  text-decoration: none;
}

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