@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;600;700&family=Outfit:wght@500;600;700;800&display=swap');

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

:root {
  --bg: #0d0f14;
  --surface: #111318;
  --card: #171b24;
  --border: #1f2535;
  --accent: #4f8ef7;
  --accent2: #2ed4a0;
  --accent3: #f5a623;
  --accent4: #e05c7a;
  --accent5: #a78bfa;
  --muted: #4b5563;
  --text: #dde4f0;
  --sub: #7c8fa6;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Inter', system-ui, sans-serif;
  --easy: #2ed4a0;
  --medium: #f5a623;
  --hard: #e05c7a;
  --page-accent: #4f8ef7;
  --page-accent-glow: rgba(79, 142, 247, 0.4);
}

body[data-phase="1"] {
  --page-accent: #5b8df6;
  --page-accent-glow: rgba(91, 141, 246, 0.5);
}
html[data-phase="1"] {
  --page-accent: #5b8df6;
  --page-accent-glow: rgba(91, 141, 246, 0.5);
}
body[data-phase="2"] {
  --page-accent: #3ecf8e;
  --page-accent-glow: rgba(62, 207, 142, 0.5);
}
html[data-phase="2"] {
  --page-accent: #3ecf8e;
  --page-accent-glow: rgba(62, 207, 142, 0.5);
}
body[data-phase="3"] {
  --page-accent: #f5a623;
  --page-accent-glow: rgba(245, 166, 35, 0.5);
}
html[data-phase="3"] {
  --page-accent: #f5a623;
  --page-accent-glow: rgba(245, 166, 35, 0.5);
}
body[data-phase="4"] {
  --page-accent: #e05c7a;
  --page-accent-glow: rgba(224, 92, 122, 0.5);
}
html[data-phase="4"] {
  --page-accent: #e05c7a;
  --page-accent-glow: rgba(224, 92, 122, 0.5);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  padding: 0 0 4rem;
}

a { color: inherit; text-decoration: none; }

.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav-home {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--page-accent);
  background: color-mix(in srgb, var(--page-accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--page-accent) 35%, transparent);
  border-radius: 0;
  padding: 0.3rem 0.7rem;
  transition: 0.2s;
}

.nav-home:hover {
  background: color-mix(in srgb, var(--page-accent) 22%, transparent);
  border-color: var(--page-accent-glow);
}

.nav-title { font-size: 0.85rem; color: var(--sub); }

.nav-badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 0.2rem 0.6rem;
  border-radius: 0;
}

.hero {
  text-align: center;
  padding: 3rem 1.5rem 2.5rem;
  border-bottom: 1px solid var(--border);
}

.phase-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 0.25rem 0.7rem;
  border-radius: 0;
  margin-bottom: 1rem;
  letter-spacing: 0.08em;
}

.hero h1 {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 900;
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.hero h1 .hero-num { color: var(--page-accent); }

.hero p,
.hero-lead {
  color: var(--sub);
  font-size: 0.9rem;
  max-width: 520px;
  margin: 0 auto 1.5rem;
  line-height: 1.75;
}

.hero-lead a {
  color: var(--page-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.font-topic {
  font-family: 'Outfit', var(--sans);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.hero-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.playlist-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.7rem 1.5rem;
  border-radius: 8px;
  transition: 0.2s;
  cursor: pointer;
  border: none;
  font-family: var(--sans);
}

.playlist-btn {
  background: var(--page-accent);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.playlist-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }

.hero-stats {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.7rem;
}

.streak-box {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.35);
  color: var(--accent3);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-weight: 700;
}

.tag-row {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tag-pill {
  font-family: var(--mono);
  font-size: 0.6rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}

.wrap { max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem; }

.section-hdr {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 1rem;
}

.section-hdr h2 {
  font-size: 1rem;
  font-weight: 700;
}

.section-line { flex: 1; height: 1px; background: var(--border); }

.prob-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  table-layout: fixed;
}

.prob-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  vertical-align: middle;
}

.prob-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  vertical-align: middle;
  word-break: break-word;
  height: 3.1rem;
}

.td-idx {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.65rem;
  width: 2.4rem;
  text-align: center;
  vertical-align: middle;
}

.prob-name-cell {
  vertical-align: middle;
  max-width: 18rem;
  line-height: 1.35;
}

.prob-name-cell .prob-link {
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

input.mscp-chk[type='checkbox'] {
  appearance: none;
  width: 1.05rem;
  height: 1.05rem;
  border: 1px solid color-mix(in srgb, var(--page-accent) 60%, #fff);
  background: color-mix(in srgb, var(--page-accent) 16%, var(--surface));
  border-radius: 3px;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
}

input.mscp-chk[type='checkbox']::before {
  content: "";
  width: 0.58rem;
  height: 0.58rem;
  transform: scale(0);
  transition: transform 120ms ease-in-out;
  box-shadow: inset 1em 1em #fff;
  clip-path: polygon(14% 44%, 0 60%, 45% 100%, 100% 20%, 84% 6%, 43% 74%);
}

input.mscp-chk[type='checkbox']:checked {
  background: var(--page-accent);
  border-color: var(--page-accent);
}

input.mscp-chk[type='checkbox']:checked::before { transform: scale(1); }

.prob-table tr:hover td { background: var(--surface); }

.prob-table .chk {
  width: 36px;
  text-align: center;
}

.prob-table th:nth-child(1), .prob-table td:nth-child(1) { width: 2.4rem; text-align: center; }
.prob-table th:nth-child(2), .prob-table td:nth-child(2) { width: 2.8rem; text-align: center; }
.prob-table th:nth-child(4), .prob-table td:nth-child(4) { width: 5.2rem; }
.prob-table th:nth-child(5), .prob-table td:nth-child(5) { width: 8.4rem; }
.prob-table th:nth-child(6), .prob-table td:nth-child(6) { width: 5.8rem; }
.prob-table th:nth-child(7), .prob-table td:nth-child(7) { width: 8.8rem; }

.prob-table input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent2);
  cursor: pointer;
}

.prob-link {
  color: var(--page-accent);
  font-weight: 600;
  transition: 0.15s;
}

.prob-link:hover { color: #fff; }

.diff {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
}

.diff-easy {
  background: rgba(46, 212, 160, 0.12);
  color: var(--easy);
  border: 1px solid rgba(46, 212, 160, 0.25);
}

.diff-med {
  background: rgba(245, 166, 35, 0.12);
  color: var(--medium);
  border: 1px solid rgba(245, 166, 35, 0.25);
}

.diff-hard {
  background: rgba(224, 92, 122, 0.12);
  color: var(--hard);
  border: 1px solid rgba(224, 92, 122, 0.25);
}

.oj-badge {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  white-space: nowrap;
}

.tag-cell {
  font-size: 0.65rem;
  color: var(--muted);
  line-height: 1.4;
}

.mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.mini-tag {
  font-family: var(--mono);
  font-size: 0.55rem;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--sub);
}

.callout {
  background: rgba(79, 142, 247, 0.07);
  border: 1px solid rgba(79, 142, 247, 0.2);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  font-size: 0.8rem;
  color: var(--sub);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.7rem;
}

.callout-icon { flex-shrink: 0; font-size: 1rem; margin-top: 0.05rem; }

.footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.footer-sign {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-family: 'Outfit', var(--sans);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: color-mix(in srgb, var(--page-accent) 75%, #fff);
}

.level-pill {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--accent5);
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.25);
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-family: var(--mono);
  font-size: 0.7rem;
}

.filter-label { color: var(--muted); margin-right: 0.25rem; }

.filter-btn {
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--sub);
  cursor: pointer;
  transition: 0.15s;
}

.filter-btn:hover {
  border-color: var(--page-accent);
  color: var(--text);
}

.filter-btn.active {
  background: color-mix(in srgb, var(--page-accent) 20%, var(--surface));
  border-color: var(--page-accent);
  color: var(--page-accent);
}

.progress-pill {
  font-weight: 700;
  color: var(--page-accent);
  background: color-mix(in srgb, var(--page-accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--page-accent) 35%, transparent);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

.progress-bar-hero {
  max-width: 360px;
  height: 6px;
  margin: 0.75rem auto 0;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar-hero span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--page-accent), color-mix(in srgb, var(--page-accent) 70%, white));
  border-radius: 3px;
  transition: width 0.4s ease;
}

@media (max-width: 720px) {
  .prob-table { font-size: 0.72rem; }
  .prob-table th:nth-child(8),
  .prob-table td:nth-child(8) { display: none; }
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--page-accent) #0e0e28;
}

*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track {
  background: #0e0e28;
  border-radius: 0 !important;
}

*::-webkit-scrollbar-thumb {
  background: var(--page-accent);
  border-radius: 0 !important;
  border: none;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--page-accent);
}
