:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-weak: #eff6ff;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
.container { max-width: 1180px; margin: 0 auto; padding: 0 18px; }
.page { padding-top: 24px; padding-bottom: 40px; }
.row { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.topbar {
  background: #111827;
  color: white;
  padding: 14px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.brand { color: white; text-decoration: none; font-size: 20px; font-weight: 700; margin-right: 10px; }
.nav a { color: #e5e7eb; text-decoration: none; margin-left: 14px; }
.nav a:hover { color: white; }
.topbar .row {
  gap: 12px;
  flex-wrap: wrap;
}
.topbar .row > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 6px;
}
.phase {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #374151; color: white;
}
.phase-running { background: #065f46; }
.phase-pending { background: #92400e; }
.phase-ended { background: #4b5563; }
.card, .subcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 6px 18px rgba(15,23,42,.04);
}
.hero { padding: 28px; }
.narrow { max-width: 520px; margin: 0 auto; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.actions { display: flex; gap: 12px; margin: 18px 0; flex-wrap: wrap; }
.btn {
  display: inline-block; border: none; border-radius: 10px; padding: 10px 16px; cursor: pointer;
  background: var(--primary); color: white; text-decoration: none; font-size: 14px;
}
.btn:hover { opacity: .92; }
.btn-secondary { background: #374151; }
.btn-danger { background: var(--danger); }
.btn-small { padding: 6px 10px; font-size: 12px; }
.btn-large { padding: 14px 26px; font-size: 22px; font-weight: 700; border-radius: 14px; }
.btn-huge {
  padding: 18px 38px;
  font-size: 72px;
  font-weight: 800;
  border-radius: 18px;
  line-height: 1.1;
}
.form-grid { display: grid; gap: 14px; }
.form-grid.compact { gap: 10px; }
.form-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 8px; font-weight: 600; }
input, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit;
  background: white;
}
textarea { resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.checkbox-inline-label {
  display: inline;
  font-weight: 400;
  margin: 0;
}
.inline-form { display: inline-block; }
.top-gap { margin-top: 12px; }
.flash-stack { display: grid; gap: 10px; margin-bottom: 18px; }
.flash {
  padding: 12px 14px; border-radius: 12px; border: 1px solid transparent;
}
.flash-success { background: #ecfdf5; border-color: #a7f3d0; }
.flash-danger { background: #fef2f2; border-color: #fecaca; }
.flash-warning { background: #fffbeb; border-color: #fde68a; }
.flash-info { background: #eff6ff; border-color: #bfdbfe; }
.stat .label { color: var(--muted); margin-bottom: 8px; }
.stat .value { font-size: 28px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tag { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #e5e7eb; font-size: 12px; }
.tag.ok { background: #dcfce7; }
.tag.warn { background: #fee2e2; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e5e7eb;
  font-size: 12px;
}
.badge.danger {
  color: #7f1d1d;
  background: #fee2e2;
}
table {
  width: 100%; border-collapse: collapse; background: white;
}
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; }
.problems-table {
  table-layout: auto;
  width: 100%;
  min-width: 0;
}
.problems-table th:nth-child(1),
.problems-table td:nth-child(1) { width: 86px; }
.problems-table th:nth-child(2),
.problems-table td:nth-child(2) { min-width: 420px; }
.problems-table th:nth-child(3),
.problems-table td:nth-child(3) { width: 130px; }
.problems-table th:nth-child(4),
.problems-table td:nth-child(4) { width: 120px; }
.problems-table th:nth-child(5),
.problems-table td:nth-child(5) { width: 120px; }
.problems-table th:nth-child(6),
.problems-table td:nth-child(6) { width: 100px; }
.problems-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.problem-title-cell strong,
.problem-title-cell .small {
  display: block;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}
.segment-list { padding-left: 22px; line-height: 1.7; }
.admin-adjust-form {
  display: grid; grid-template-columns: 84px 84px 1fr auto; gap: 8px; min-width: 420px;
}
.danger-zone { border-color: #fecaca; }
code { background: #f3f4f6; padding: 2px 6px; border-radius: 6px; }
@media (max-width: 960px) {
  .grid.two, .grid.three, .grid.four, .form-grid.two-col { grid-template-columns: 1fr; }
  .admin-adjust-form { grid-template-columns: 1fr; min-width: 0; }
}
.narrow-card { max-width: 560px; margin: 0 auto; }
.sentence-stack { display: grid; gap: 12px; }
.sentence-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  line-height: 1.7;
}
.action-cell { display: flex; flex-wrap: wrap; gap: 8px; }
.growing-text {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  min-height: 96px;
  line-height: 1.9;
  font-size: 18px;
  white-space: pre-wrap;
}
.file-box {
  padding: 12px 14px;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  background: #f8fafc;
}
.countdown-wrap {
  margin-top: 18px;
  text-align: center;
}
.hero-countdown {
  margin-top: 4px;
  margin-bottom: 18px;
}
.hero-start-wrap {
  margin: 14px 0 20px;
  text-align: center;
}
.countdown-label {
  margin: 0 0 8px;
  font-size: 16px;
}
.countdown-big {
  margin: 0 0 14px;
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 2px;
}
.countdown-structured {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}
.countdown-num {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
}
.countdown-unit {
  font-size: 16px;
  color: var(--muted);
  margin-right: 8px;
}
.player-name {
  margin: 4px 0 14px;
  color: #111111;
  font-size: 24px;
  font-weight: 800;
}
.json-sample {
  margin: 0;
  padding: 14px 16px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  overflow-x: auto;
  line-height: 1.6;
}
.problem-nav-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.problem-nav-title {
  margin: 0;
  text-align: center;
}
.problem-nav-side {
  min-height: 40px;
  display: flex;
  align-items: center;
}
.problem-nav-side.align-right {
  justify-content: flex-end;
}
@media (max-width: 640px) {
  .container { padding: 0 14px; }
  .page { padding-top: 16px; padding-bottom: 28px; }
  .topbar { padding: 10px 0; }
  .topbar .row {
    justify-content: center;
    text-align: center;
  }
  .brand { font-size: 18px; margin-right: 0; }
  .nav {
    width: 100%;
    justify-content: center;
    gap: 8px 10px;
  }
  .nav a {
    margin-left: 0;
    padding: 6px 10px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.3);
  }
  .hero { padding: 18px; }
  .hero h1 { margin-top: 0; font-size: 28px; }
  .btn-huge {
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    font-size: 40px;
  }
  .countdown-label { font-size: 14px; }
  .countdown-num { font-size: 32px; }
  .countdown-unit { font-size: 14px; margin-right: 6px; }
  .actions {
    gap: 10px;
  }
  .actions .btn {
    width: 100%;
    text-align: center;
  }
  .player-name {
    font-size: 20px;
    line-height: 1.4;
  }
  table { white-space: nowrap; }
  .problems-table {
    min-width: 1080px;
  }
  .problems-table th:nth-child(1),
  .problems-table td:nth-child(1),
  .problems-table th:nth-child(6),
  .problems-table td:nth-child(6) {
    position: sticky;
    background: #ffffff;
  }
  .problems-table th:nth-child(1),
  .problems-table td:nth-child(1) {
    left: 0;
    z-index: 4;
    box-shadow: 1px 0 0 var(--line);
  }
  .problems-table th:nth-child(6),
  .problems-table td:nth-child(6) {
    right: 0;
    z-index: 4;
    box-shadow: -1px 0 0 var(--line);
  }
  .problems-table thead th:nth-child(1),
  .problems-table thead th:nth-child(6) {
    z-index: 5;
    background: #f8fafc;
  }
  .problem-nav-head {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .problem-nav-side,
  .problem-nav-side.align-right {
    justify-content: center;
  }
}


.inline-filter-form { margin-left: 12px; }
.checkbox-label { font-size: 14px; color: #334155; display: inline-flex; align-items: center; gap: 6px; }
.site-footer { margin-top: 28px; padding: 14px 0 24px; text-align: center; color: #64748b; font-size: 13px; }
.site-footer a { color: inherit; text-decoration: none; }
.chart-card h3 { margin-top: 0; margin-bottom: 14px; }
.progress-chart-wrap { position: relative; }
.progress-canvas { width: 100%; height: 350px; display: block; border-radius: 10px; background: #fff; }
.chart-legend { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 12px; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 4px 10px;
  background: #fff;
  cursor: pointer;
}
.legend-item:not(.active) {
  opacity: 0.45;
}
.legend-item .legend-text {
  user-select: none;
}
.legend-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.g2-tooltip {
  position: absolute;
  visibility: hidden;
  z-index: 8;
  background-color: #fff;
  box-shadow: 0 0 10px #aeaeae;
  border-radius: 3px;
  color: #595959;
  font-size: 12px;
  line-height: 12px;
  padding: 0 12px;
  opacity: 0.95;
  pointer-events: none;
  min-width: 170px;
}
.g2-tooltip-title { margin: 12px 0; font-weight: 600; }
.g2-tooltip-list { margin: 0; padding: 0; list-style-type: none; }
.g2-tooltip-list-item { margin: 12px 0; white-space: nowrap; }
.g2-tooltip-marker {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}
.g2-tooltip-value {
  display: inline-block;
  float: right;
  margin-left: 30px;
}
