:root {
  --bg: #f0f4f8;
  --card: #ffffff;
  --accent: #0057ff;
  --accent2: #ff3b3b;
  --accent3: #00c853;
  --text: #0d1b2a;
  --muted: #4a5a6a;
  --border: #d0dce8;
  --header-bg: #0d1b2a;
  --header-text: #ffffff;
  --stripe: #eaf0f7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.5;
}

header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

header h1 {
  font-family: 'Oswald', 'Noto Sans JP', sans-serif;
  font-size: 24px;
  letter-spacing: 1px;
  color: #fff;
}

header .badge {
  background: var(--accent2);
  color: #fff;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.tabs-bar { background: #1a2a3a; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  background: #1a2a3a;
  overflow-x: auto;
  overscroll-behavior-x: none;
}

.tab {
  padding: 8px 16px;
  border-radius: 6px 6px 0 0;
  background: #2a3a4a;
  color: #c3ccd6;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
  border: none;
}

.tab.active {
  background: var(--bg);
  color: var(--text);
}

.section { display: none; }
.section.active { display: block; }

.container { padding: 10px 12px; }

/* ===== TABLE ===== */
.table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: none;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: 15px;
  min-width: 1180px;
}

thead tr {
  background: var(--header-bg);
  color: #fff;
}

thead th {
  padding: 10px 8px;
  text-align: center;
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
  border-right: 1px solid #2a3a4a;
}

thead th:first-child { text-align: left; padding-left: 10px; }

tbody tr:nth-child(even) { background: var(--stripe); }
tbody tr:hover { background: #d6e8ff; }

tbody td {
  padding: 8px 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
  font-size: 15px;
}

tbody td:first-child {
  text-align: left;
  padding-left: 10px;
  min-width: 150px;
  font-weight: 900;
}

.carrier-name { font-size: 16px; font-weight: 900; }
.carrier-type {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
}
.type-major { background: #0057ff22; color: #0057ff; }
.type-mvno { background: #00c85322; color: #00873a; }
.type-sub { background: #ff3b3b22; color: #cc2222; }

.speed-bar-wrap { display: flex; align-items: center; gap: 6px; justify-content: center; }
.speed-bar {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #0057ff, #00c8ff);
  min-width: 2px;
  transition: width 0.5s;
}
.speed-val { font-size: 15px; font-weight: 900; min-width: 44px; }

.tag {
  display: inline-block;
  font-size: 14px;
  padding: 2px 9px;
  border-radius: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.tag-yes { background: #00c85322; color: #007a33; }
.tag-no  { background: #ff3b3b22; color: #aa2222; }
.tag-opt { background: #ff990022; color: #aa6600; }

.price-cell { font-size: 16px; font-weight: 900; color: #0057ff; white-space: nowrap; }

/* ===== CHARTS ===== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
  padding: 10px 0;
}

.chart-card {
  background: var(--card);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.10);
}

.chart-card h3 {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 8px;
  color: var(--text);
  text-align: center;
  border-bottom: 2px solid var(--border);
  padding-bottom: 6px;
}

.chart-container {
  position: relative;
  height: 320px;
}

.chart-container-pie {
  position: relative;
  height: 360px;
}

/* ===== SCORING ===== */
.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.score-card {
  background: var(--card);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.10);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-card-name { font-size: 16px; font-weight: 900; }

.stars { color: #f5a623; font-size: 20px; letter-spacing: 2px; }

.score-row { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.score-label { color: var(--muted); }
.score-val { font-weight: 900; }

.overall-score {
  font-family: 'Oswald', sans-serif;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  color: var(--accent);
}
.overall-score .max { font-size: 15px; color: var(--muted); }

.rank-badge {
  display: inline-block;
  width: 26px; height: 26px;
  border-radius: 50%;
  text-align: center; line-height: 26px;
  font-size: 15px; font-weight: 900;
  margin-right: 4px;
}
.rank-1 { background: #ffd700; color: #5a3e00; }
.rank-2 { background: #c0c0c0; color: #333; }
.rank-3 { background: #cd7f32; color: #fff; }
.rank-other { background: #e0e8f0; color: #333; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; font-size: 15px; }
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

.note { font-size: 14px; font-weight: 700; color: var(--muted); padding: 4px 0; line-height: 1.6; }
