:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eaf1ff;
  --danger-soft: #fff5f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", Meiryo, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.site-header {
  background: linear-gradient(135deg, #1d4ed8, #38bdf8);
  color: #fff;
  padding: 42px 24px;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: 0.04em;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.16em;
  opacity: 0.85;
}

.lead {
  margin: 12px 0 0;
  max-width: 720px;
  opacity: 0.9;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.control-panel,
.card,
.summary-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.control-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  padding: 18px;
  margin-bottom: 20px;
}

label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

select,
button {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 0 12px;
  background: #fff;
  font: inherit;
}

button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.summary-card {
  padding: 18px;
}

.summary-card .label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.summary-card .value {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.summary-card .unit {
  font-size: 15px;
  color: var(--muted);
  margin-left: 2px;
}

.tables-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.card {
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 12px;
}

.card-header h2 {
  margin: 0;
  font-size: 20px;
}

.card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
}

th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  background: #f9fafb;
}

td.number,
th.number {
  text-align: right;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}


.error {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 14px;
  border-radius: 12px;
}

@media (max-width: 860px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-header {
    display: block;
  }
}

@media (max-width: 560px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .control-panel {
    align-items: stretch;
  }

  label,
  button {
    width: 100%;
  }
}
