/* Each color is light-dark(light, dark). color-scheme picks the side:
   the OS setting by default, or data-theme on <html> once the reader chooses. */
:root {
  --bg: light-dark(#FFFFFF, #121A2B);
  --surface: light-dark(#F8FAFC, #172133);
  --surface-2: light-dark(#F1F5F9, #1E293B);
  --text: light-dark(#18181B, #E5E7EB);
  --text-2: light-dark(#3F3F46, #CBD5E1);
  --muted: light-dark(#64748B, #94A3B8);
  --line: light-dark(#E5E7EB, #263247);
  --line-strong: light-dark(#D4D4D8, #334155);
  --accent: light-dark(#2563EB, #3B82F6);
  --accent-strong: light-dark(#1D4ED8, #2563EB);
  --accent-soft: light-dark(#EFF6FF, #172A4A);
  --accent-line: light-dark(#BFDBFE, #284A86);
  --ok: light-dark(#166534, #4ADE80);
  --ok-bg: light-dark(#F0FDF4, #10291D);
  --ok-line: light-dark(#BBF7D0, #166534);
  --ok-solid: light-dark(#16A34A, #22C55E);
  --danger: light-dark(#B91C1C, #F87171);
  --faint: light-dark(#CBD5E1, #475569);

  --page: light-dark(#F3F6FB, #0B1120);
  --navy: light-dark(#0E2350, #0F1C3A);
  --navy-2: light-dark(#16306A, #1A2B52);
  --navy-text: light-dark(#0E2350, #BFDBFE);
  --selected: light-dark(#0E2350, #2563EB);
  --float: light-dark(#0E2350, #24365F);
  --navy-line: rgba(255, 255, 255, 0.12);
  --on-navy: #FFFFFF;
  --on-navy-muted: #A9B8D9;
  --flame: #F97316;

  --lv0-bg: light-dark(#F1F5F9, #1E293B); --lv0-fg: light-dark(#475569, #CBD5E1); --lv0: #94A3B8;
  --lv1-bg: light-dark(#E0F2FE, #0C2A3E); --lv1-fg: light-dark(#0369A1, #7DD3FC); --lv1: #0EA5E9;
  --lv2-bg: light-dark(#DBEAFE, #172A4A); --lv2-fg: light-dark(#1D4ED8, #93C5FD); --lv2: #3B82F6;
  --lv3-bg: light-dark(#EDE9FE, #2A2150); --lv3-fg: light-dark(#6D28D9, #C4B5FD); --lv3: #8B5CF6;
  --lv4-bg: light-dark(#FFEDD5, #3A2314); --lv4-fg: light-dark(#C2410C, #FDBA74); --lv4: #F97316;
  --lv5-bg: light-dark(#FFE4E6, #3F1622); --lv5-fg: light-dark(#BE123C, #FDA4AF); --lv5: #F43F5E;

  --heat-1: light-dark(#BFDBFE, #1E3A8A);
  --heat-2: light-dark(#60A5FA, #1D4ED8);
  --heat-3: light-dark(#2563EB, #3B82F6);
  --heat-4: light-dark(#1E3A8A, #93C5FD);

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --control-h: 2.625rem;
  --header-h: 3.5rem;
  --shadow-pop: 0 1px 2px rgba(24, 24, 27, 0.04), 0 8px 24px light-dark(rgba(24, 24, 27, 0.08), rgba(0, 0, 0, 0.4));
  color-scheme: light dark;
  font-family: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Segoe UI", "Malgun Gothic", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--text); }
body { min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--header-h);
  padding: 0 1.5rem;
  background: var(--navy);
  color: var(--on-navy);
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--on-navy);
  font-weight: 750;
  font-size: 1.02rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  white-space: nowrap;
}
.logo-mark {
  width: 2rem;
  height: 2rem;
  flex: none;
  display: block;
}
.nav { display: flex; gap: 0.25rem; }
.nav a {
  position: relative;
  color: var(--on-navy-muted);
  font-size: 0.94rem;
  font-weight: 550;
  text-decoration: none;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius);
}
.nav a:hover { color: var(--on-navy); background: rgba(255, 255, 255, 0.08); }
.nav a[aria-current="page"] { color: var(--on-navy); font-weight: 700; }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: calc((var(--header-h) - 2.2rem) / -2);
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #60A5FA;
}
.account { justify-self: end; position: relative; display: flex; align-items: center; gap: 0.5rem; }
.progress-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  height: 2.1rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  color: var(--on-navy-muted);
  font-size: 0.85rem;
  text-decoration: none;
}
.progress-chip:hover { background: rgba(255, 255, 255, 0.08); }
.progress-chip strong { color: var(--on-navy); font-weight: 700; }
.feedback-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2.1rem;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--on-navy-muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.feedback-button:hover { background: rgba(255, 255, 255, 0.08); color: var(--on-navy); }
.feedback-button:focus-visible { outline: 2px solid #60A5FA; outline-offset: 2px; }
.feedback-entry { position: relative; display: flex; }
/* Theme toggle: shows the moon in light mode and the sun in dark mode. */
.theme-button {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--on-navy-muted);
  cursor: pointer;
}
.theme-button:hover { background: rgba(255, 255, 255, 0.08); color: var(--on-navy); }
.theme-button:focus-visible { outline: 2px solid #60A5FA; outline-offset: 2px; }
.theme-icon {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5Z'/%3E%3C/svg%3E");
  width: 1.05rem;
  height: 1.05rem;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
:root[data-theme="dark"] .theme-icon { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4'/%3E%3C/svg%3E"); }
}
.feedback-hint {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.4rem 0.5rem 0.85rem;
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  font-size: 0.85rem;
  font-weight: 650;
  white-space: nowrap;
  z-index: 25;
  animation: hint-in 0.2s ease-out;
}
.feedback-hint::before {
  content: "";
  position: absolute;
  top: -0.35rem;
  left: 50%;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--bg);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}
.feedback-hint-close {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}
.feedback-hint-close:hover { background: var(--surface); color: var(--text); }
@keyframes hint-in { from { opacity: 0; margin-top: -0.3rem; } }
.feedback-icon {
  width: 1rem;
  height: 1rem;
  flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12.5a7.5 7.5 0 0 1-11.1 6.6L4 20l1-4.4A7.5 7.5 0 1 1 20 12.5Z'/%3E%3Cpath d='M9 11h6M9 14.5h3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12.5a7.5 7.5 0 0 1-11.1 6.6L4 20l1-4.4A7.5 7.5 0 1 1 20 12.5Z'/%3E%3Cpath d='M9 11h6M9 14.5h3.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.meter { display: block; width: 4rem; height: 0.375rem; background: rgba(255, 255, 255, 0.14); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, #60A5FA, #A78BFA); border-radius: inherit; }
.account-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 2.1rem;
  border: 1px solid var(--navy-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--on-navy);
  border-radius: 999px;
  padding: 0 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.account-button:hover { background: rgba(255, 255, 255, 0.12); }
.account-button:has(.avatar) { padding-left: 0.25rem; }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #60A5FA, #8B5CF6);
  color: #FFFFFF;
  font-size: 0.78rem;
  font-weight: 750;
}
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 9rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  padding: 0.3rem;
  z-index: 30;
}
.account-menu[hidden] { display: none; }
.account-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.account-menu button:hover { background: var(--surface); }
.progress-region { display: none; }

/* Buttons */
.ghost, .primary, .text-button, .page-button, .state-control { cursor: pointer; }
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 0 0.85rem;
  font-weight: 550;
}
.ghost:hover { border-color: var(--line-strong); background: var(--surface); }
a.ghost { color: var(--text); text-decoration: none; }
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  border: 0;
  background: var(--accent);
  color: #FFFFFF;
  border-radius: var(--radius);
  padding: 0 1rem;
  font-weight: 650;
  text-decoration: none;
}
.primary:hover { background: var(--accent-strong); }
.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.25rem 0.35rem;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.text-button:hover { color: var(--text); }
button:disabled { cursor: default; }

/* Page */
.page { width: 100%; max-width: 82rem; margin: 0 auto; padding: 1.5rem 1.5rem 4rem; }
.site-footer { border-top: 1px solid var(--line); }
.site-footer p { max-width: 82rem; margin: 0 auto; padding: 0 1.5rem; color: var(--muted); font-size: 0.78rem; line-height: 1.7; }
.site-footer p:first-child { padding-top: 1.25rem; }
.site-footer p:last-child { padding-bottom: 2rem; }
.site-footer a { color: inherit; font-weight: 650; text-underline-offset: 3px; }
.policy { max-width: 48rem; line-height: 1.75; }
.policy h1 { margin: 0.5rem 0 1rem; font-size: 1.75rem; }
.policy h2 { margin: 2.25rem 0 0.6rem; font-size: 1.15rem; }
.policy h3 { margin: 1.25rem 0 0.35rem; font-size: 0.98rem; }
.policy p, .policy li { color: var(--text-2); font-size: 0.93rem; }
.policy ul { margin: 0.35rem 0; padding-left: 1.25rem; }
.policy li + li { margin-top: 0.25rem; }
.policy code { font-size: 0.85em; }
.hero {
  position: relative;
  background-color: var(--navy);
  background-image:
    radial-gradient(60rem 22rem at 85% -20%, rgba(96, 165, 250, 0.22), transparent 70%),
    radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: auto, 22px 22px;
  color: var(--on-navy);
  overflow: hidden;
}
.hero-inner { max-width: 82rem; margin: 0 auto; padding: 2rem 1.5rem 1.75rem; }
.page-head { margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; font-size: 1.875rem; line-height: 1.25; font-weight: 800; letter-spacing: -0.035em; }
.page-head p { margin: 0.4rem 0 0; color: var(--on-navy-muted); font-size: 0.98rem; }
.explore-head { margin-bottom: 0; }
.explore-hero-row { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem 2rem; }
.explore-hero-row .explore-head { flex: 1 1 29rem; min-width: 0; }
.example-intro { margin-top: 0.85rem; }
.page-head .example-note {
  display: block;
  max-width: 40rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
}
.example-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }


/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 0.5rem; }
.toolbar label { display: block; min-width: 0; }
.search { display: block; }
.search-slot { display: none; margin-bottom: 0.75rem; }
.search-fieldset { padding: 1rem 0; border-top: 1px solid var(--line); }
.search input, .toolbar select, .auth-dialog input, .mini-search {
  width: 100%;
  height: var(--control-h);
  border: 1px solid var(--line);
  background-color: var(--bg);
  border-radius: var(--radius);
  padding: 0 0.85rem;
}
.search input {
  padding-left: 2.6rem;
  font-size: 0.98rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.85rem 50%;
  background-size: 1.1rem;
}
.search input::placeholder, .mini-search::placeholder { color: #94A3B8; }
.search input:hover, .toolbar select:hover { border-color: var(--line-strong); }
.search input:focus, .mini-search:focus, .auth-dialog input:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); outline-offset: 0; }
.toolbar select {
  appearance: none;
  width: auto;
  min-width: 8.5rem;
  height: 2.4rem;
  padding-right: 2.2rem;
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1rem;
}
.filter-open { display: none; height: 2.4rem; }
.hide-solved { height: 2.4rem; white-space: nowrap; font-size: 0.9rem; }
.hide-solved.is-active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
}
.note { color: var(--muted); margin: 0.35rem 0; font-size: 0.875rem; }

/* Active condition chips */
.tag-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 1rem; }
.tag-row[hidden] { display: none; }
.tags { display: contents; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  height: 1.875rem;
  padding: 0 0.3rem 0 0.7rem;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
}
.tag button {
  display: inline-grid;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.tag button:hover { background: var(--accent-line); }

/* Explore layout */
.explore { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.explore > section { min-width: 0; }
.explore.is-message { grid-template-columns: minmax(0, 1fr); }
.explore.is-message .filters { display: none; }
.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.results-head #summary { margin: 0; font-size: 0.95rem; font-weight: 650; color: var(--text); }
.results-head #summary span { color: var(--muted); font-weight: 450; }
.sync-note { margin: 1.25rem 0 0; text-align: center; font-size: 0.8rem; }
.explore .tag-row { margin-bottom: 0.75rem; }

/* Filters */
.filters {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  max-height: calc(100vh - var(--header-h) - 2rem);
  overflow: auto;
  padding: 1rem 1rem 0.25rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  scrollbar-width: thin;
}
fieldset { border: 0; margin: 0; padding: 0 0 1.1rem; min-width: 0; }
fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 1rem; }
legend { float: left; width: 100%; color: var(--text); font-size: 0.82rem; font-weight: 700; margin-bottom: 0.55rem; padding: 0; }
legend + * { clear: both; }
.type-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.type-list label {
  position: relative;
  display: grid;
  place-items: center;
  height: 2rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.type-list label:has(input:checked) { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(24, 24, 27, 0.08), 0 0 0 1px var(--line); }
.type-list label:has(input:focus-visible), .choices label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.type-list input, .choices input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.choices { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.choices label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.875rem;
  padding: 0 0.65rem;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.83rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.choices label[hidden] { display: none; }
.choices label:hover { border-color: var(--line-strong); }
.choices label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 650;
}
.choices .count { color: #94A3B8; font-size: 0.74rem; font-weight: 500; }
.choices label:has(input:checked) .count { color: var(--accent); }
.choices[data-group="levels"] { display: grid; grid-template-columns: repeat(3, 1fr); }
.choices[data-group="levels"] label { justify-content: center; }
.level-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; flex: none; }
.choices[data-group="algorithms"] { max-height: 12rem; overflow: auto; align-content: flex-start; scrollbar-width: thin; }
.choices[data-group="algorithms"][data-expanded="true"] { max-height: none; overflow: visible; }
fieldset:has(> .choices-toggle) { position: relative; }
.choices-toggle { position: absolute; top: 0.85rem; right: 0; padding: 0.1rem 0; font-size: 0.78rem; }
.mini-search { height: 2.1rem; margin-bottom: 0.55rem; font-size: 0.85rem; padding: 0 0.7rem; }
.choices-empty { color: var(--muted); font-size: 0.82rem; margin: 0.25rem 0 0; }

.level-dot[data-level="0"] { background: var(--lv0); }
.level-dot[data-level="1"] { background: var(--lv1); }
.level-dot[data-level="2"] { background: var(--lv2); }
.level-dot[data-level="3"] { background: var(--lv3); }
.level-dot[data-level="4"] { background: var(--lv4); }
.level-dot[data-level="5"] { background: var(--lv5); }

/* Level badge */
.level-badge {
  display: inline-grid;
  place-items: center;
  min-width: 3.1rem;
  height: 1.5rem;
  padding: 0 0.45rem;
  border-radius: var(--radius-sm);
  background: var(--lv0-bg);
  color: var(--lv0-fg);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.level-badge[data-level="1"] { background: var(--lv1-bg); color: var(--lv1-fg); }
.level-badge[data-level="2"] { background: var(--lv2-bg); color: var(--lv2-fg); }
.level-badge[data-level="3"] { background: var(--lv3-bg); color: var(--lv3-fg); }
.level-badge[data-level="4"] { background: var(--lv4-bg); color: var(--lv4-fg); }
.level-badge[data-level="5"] { background: var(--lv5-bg); color: var(--lv5-fg); }

/* Problem table */
.problem-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
}
.problem-table th, .problem-table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.problem-table tbody tr:last-child td { border-bottom: 0; }
.problem-table th {
  position: sticky;
  top: var(--header-h);
  z-index: 2;
  text-align: left;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  background: var(--surface);
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.problem-table th:first-child { border-top-left-radius: var(--radius-lg); }
.problem-table th:last-child { border-top-right-radius: var(--radius-lg); }
.problem-table th .sort-button {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin: 0;
  padding: 0.1rem 0.15rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.problem-table th .sort-button:hover,
.problem-table th.is-sorted { color: var(--text); }
.sort-mark {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  width: 0.5rem;
  height: 0.7rem;
}
.sort-mark::before,
.sort-mark::after {
  content: "";
  align-self: center;
  border-left: 0.22rem solid transparent;
  border-right: 0.22rem solid transparent;
}
.sort-mark::before { border-bottom: 0.24rem solid currentColor; opacity: 0.35; }
.sort-mark::after { border-top: 0.24rem solid currentColor; opacity: 0.35; }
.problem-table th.is-sorted .sort-mark::before,
.problem-table th.is-sorted .sort-mark::after,
.sort-bar .sort-button.is-active .sort-mark::before,
.sort-bar .sort-button.is-active .sort-mark::after { opacity: 0.22; }
.problem-table th[aria-sort="ascending"] .sort-mark::before,
.sort-bar .sort-button.is-active[aria-pressed="true"][data-dir="asc"] .sort-mark::before { opacity: 1; }
.problem-table th[aria-sort="descending"] .sort-mark::after,
.sort-bar .sort-button.is-active[aria-pressed="true"][data-dir="desc"] .sort-mark::after { opacity: 1; }
.sort-bar { display: none; gap: 0.4rem; margin: 0 0 0.75rem; }
.sort-bar .sort-button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-2);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
}
.sort-bar .sort-button.is-active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.problem-table th.num, .problem-table td.num { text-align: right; white-space: nowrap; }
.problem-table th.center, .problem-table td.center { text-align: center; }
.problem-table th.action, .problem-table td.action { text-align: right; width: 1%; white-space: nowrap; }
.problem-table tbody tr:hover td { background: var(--surface); }
.problem-table tbody tr.is-solved td:first-child { box-shadow: inset 3px 0 0 var(--ok-solid); }
.problem-table tbody tr.is-solved .problem-link { color: var(--text-2); }
.list-row.is-solved { box-shadow: inset 3px 0 0 var(--ok-solid); }
.problem-table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius-lg); }
.problem-table tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius-lg); }
.problem-link {
  color: var(--text);
  font-size: 0.97rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.problem-link:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.ext-icon {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-left: 0.3rem;
  vertical-align: -0.05rem;
  background: currentColor;
  opacity: 0.35;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.problem-link:hover .ext-icon { opacity: 0.8; }
.problem-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.45rem; margin-top: 0.3rem; }
.source-line { color: var(--muted); font-size: 0.8rem; }
.source-line + .algo-tag { margin-left: 0.15rem; }
.algo-tag {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  height: 1.3rem;
  padding: 0 0.4rem;
  border: 0;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.74rem;
  font-weight: 550;
  cursor: pointer;
}
.algo-tag:hover { background: var(--accent-soft); color: var(--accent-strong); }
.algo-tag[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent-line); }
.rate { display: inline-flex; align-items: center; gap: 0.55rem; justify-content: flex-end; }
.rate-bar { width: 2.75rem; height: 0.3rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.rate-bar b { display: block; height: 100%; background: #94A3B8; border-radius: inherit; }
.rate-value { min-width: 2.25rem; text-align: right; }

/* Solve toggle */
.state-control {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2rem;
  padding: 0 0.8rem 0 0.5rem;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
}
.state-control:hover { border-color: var(--ok-solid); color: var(--ok); }
.check-icon {
  position: relative;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  border: 1.5px solid var(--faint);
  flex: none;
}
.state-control:hover .check-icon { border-color: var(--ok-solid); }
.state-control.is-done { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.state-control.is-done .check-icon { background: var(--ok-solid); border-color: var(--ok-solid); }
.state-control.is-done .check-icon::after {
  content: "";
  position: absolute;
  left: 0.29rem;
  top: 0.12rem;
  width: 0.24rem;
  height: 0.48rem;
  border: solid #FFFFFF;
  border-width: 0 0.12rem 0.12rem 0;
  transform: rotate(45deg);
}
.state-control:disabled { opacity: 0.6; cursor: progress; }

/* Mobile list */
.list-card { display: none; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg); }
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.5rem 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row .problem-meta { margin-top: 0.4rem; }
.list-row .state-control { padding-right: 0.5rem; }

/* Collection navigation and guidance */
.breadcrumb { display: flex; gap: 0.55rem; align-items: center; margin-bottom: 0.75rem; color: var(--on-navy-muted); font-size: 0.82rem; }
.breadcrumb a { color: var(--on-navy-muted); text-underline-offset: 3px; }
.breadcrumb a:hover { color: var(--on-navy); }
.collection-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.collection-nav a { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text-2); font-size: 0.88rem; font-weight: 650; text-decoration: none; }
.collection-nav a:hover { border-color: var(--accent-line); color: var(--accent-strong); }
.collection-nav a[aria-current="page"] { border-color: var(--selected); background: var(--selected); color: var(--on-navy); }
.collection-count { font-size: 0.74rem; font-weight: 500; opacity: 0.65; }
.collection-guide { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.5rem; margin-top: 2rem; padding: 1.15rem 1.3rem; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--bg); }
.guide-copy h2 { margin: 0 0 0.4rem; font-size: 0.97rem; font-weight: 750; }
.guide-copy p { margin: 0; color: var(--text-2); font-size: 0.86rem; line-height: 1.8; word-break: keep-all; overflow-wrap: anywhere; }
.collection-facts { align-self: center; border-left: 1px solid var(--line); padding-left: 1.5rem; }
.level-distribution { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.distribution-item { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text-2); font-size: 0.78rem; }
.collection-facts p { margin: 0.65rem 0 0; font-size: 0.82rem; color: var(--text-2); }
.collection-facts strong { margin-left: 0.3rem; font-size: 1rem; color: var(--navy-text); }
.fact-hint { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.72rem; }
.topic-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 0.65rem; }
.topic-links a { font-size: 0.82rem; font-weight: 650; text-underline-offset: 3px; }
.mobile-metrics { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.74rem; }
.catalog-note { max-width: 55rem; margin-left: auto; margin-right: auto; text-align: center; line-height: 1.7; }
.account a.account-button { text-decoration: none; }

/* Pager */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.25rem; margin-top: 1.25rem; }
.page-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.6rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius);
  color: var(--text-2);
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}
.page-button:hover:not(:disabled) { background: var(--surface-2); }
.page-button:disabled { color: var(--faint); }
.page-button[aria-disabled="true"] { color: var(--faint); cursor: default; }
.page-button.edge { border-color: var(--line); background: var(--bg); }
.page-button[aria-current="page"] { background: var(--selected); color: #FFFFFF; border-color: var(--selected); }
.page-gap { color: var(--muted); padding: 0 0.2rem; }

/* States */
.empty, .loading, .error-box {
  padding: 3rem 1.5rem;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}
.empty p, .error-box p { margin: 0 0 1rem; }
.empty strong { display: block; color: var(--text); font-size: 1.02rem; margin-bottom: 0.25rem; }
.loading { border-style: solid; border-color: var(--line); }
.skeleton { display: grid; gap: 0.6rem; }
.skeleton span { display: block; height: 3.2rem; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Dialogs */
dialog { background: var(--bg); color: var(--text); }
.auth-dialog, .filter-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: min(25rem, calc(100vw - 1.5rem));
  box-shadow: 0 24px 48px rgba(24, 24, 27, 0.16);
}
.auth-dialog::backdrop, .filter-dialog::backdrop { background: rgba(24, 24, 27, 0.4); }
.auth-dialog h2, .filter-dialog h2 { font-size: 1.2rem; margin: 0 0 1rem; }
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  margin-bottom: 0.9rem;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.mode-switch button {
  height: 2.1rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}
.mode-switch button[aria-selected="true"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(24, 24, 27, 0.08), 0 0 0 1px var(--line); }
.auth-dialog form, .auth-dialog .auth-body { display: grid; gap: 0.75rem; }
.auth-dialog label { display: grid; gap: 0.35rem; }
.auth-dialog label span { font-size: 0.84rem; font-weight: 650; color: var(--text-2); }
.auth-dialog .filter-actions { display: grid; grid-template-columns: 1fr; gap: 0.4rem; }
.auth-submit {
  height: 2.75rem;
  border: 0;
  background: var(--accent);
  color: #FFFFFF;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
}
.auth-submit:hover { background: var(--accent-strong); }
.auth-submit:disabled { opacity: 0.6; cursor: progress; }
.auth-dialog .ghost { height: 2.5rem; border-color: transparent; color: var(--muted); }
.form-error { color: var(--danger); font-size: 0.85rem; min-height: 1.25rem; margin: 0; }
.form-error:empty { min-height: 0; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0 0 0.9rem; }
.filter-actions { display: flex; gap: 0.5rem; align-items: center; }
.filter-dialog .filter-actions { position: sticky; bottom: -1.5rem; margin: 0 -1.5rem -1.5rem; padding: 0.9rem 1.5rem 1.25rem; background: var(--bg); border-top: 1px solid var(--line); }
.filter-dialog .filter-actions .primary { flex: 1; height: 2.75rem; }
.filter-dialog .filter-actions .ghost { height: 2.75rem; }
.filter-dialog .note { margin: 0.5rem 0 0.75rem; }

.feedback-dialog .hint { margin: 0; }
.feedback-field { display: block; }
.feedback-field textarea {
  display: block;
  width: 100%;
  min-height: 8.5rem;
  resize: vertical;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.55;
}
.feedback-field textarea:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); outline-offset: 0; }
.feedback-field textarea:disabled { background: var(--surface); color: var(--muted); }
.feedback-count { margin: -0.4rem 0 0; text-align: right; color: var(--muted); font-size: 0.78rem; }
.feedback-notes {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0.75rem 0.85rem 0.75rem 1.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}
.feedback-sent { margin: 0; font-weight: 700; color: var(--ok); }
.feedback-dialog .auth-submit:disabled { cursor: not-allowed; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: var(--float);
  color: #FFFFFF;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 550;
  box-shadow: 0 12px 32px rgba(24, 24, 27, 0.24);
  z-index: 40;
  animation: toast-in 0.18s ease-out;
}
.toast[hidden] { display: none; }
.toast[role="alert"] { background: var(--danger); }
.toast button { border: 0; background: transparent; color: #FFFFFF; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 0.5rem); } }

/* Record page */
.stat-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}
.stat {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--navy-line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.05);
  min-width: 0;
}
.stat span { display: block; color: var(--on-navy-muted); font-size: 0.82rem; font-weight: 550; }
.stat strong { display: block; margin-top: 0.1rem; color: var(--on-navy); font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; }
.stat small { margin-left: 0.25rem; color: var(--on-navy-muted); font-size: 0.9rem; font-weight: 550; letter-spacing: 0; }
.stat-icon, .stat-ring { position: relative; flex: none; width: 2.75rem; height: 2.75rem; border-radius: 12px; }
.stat-icon::after {
  content: "";
  position: absolute;
  inset: 0.7rem;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.stat-icon[data-icon="check"] { background: rgba(34, 197, 94, 0.16); color: #4ADE80; --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12.5 2.6 2.6L16 9.6'/%3E%3C/svg%3E"); }
.stat-icon[data-icon="calendar"] { background: rgba(96, 165, 250, 0.16); color: #93C5FD; --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15' rx='2.5'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.stat-icon[data-icon="flame"], .stat-icon[data-icon="flame-off"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5c.6 3.2 2.6 4.9 4.3 6.6A7.3 7.3 0 0 1 19 14.5 7 7 0 0 1 5 14.5c0-2.5 1.2-4.3 2.6-5.6.2 1.6 1 2.8 2.3 3.4C9.4 8.6 10.4 5 12 2.5Z'/%3E%3C/svg%3E"); }
.stat-icon[data-icon="flame"] { background: rgba(249, 115, 22, 0.18); color: #FB923C; }
.stat-icon[data-icon="flame-off"] { background: rgba(255, 255, 255, 0.08); color: var(--on-navy-muted); }
.stat-ring {
  border-radius: 50%;
  background: conic-gradient(#60A5FA 0, #A78BFA calc(var(--p) * 1%), rgba(255, 255, 255, 0.12) 0);
}
.stat-ring::after { content: ""; position: absolute; inset: 0.4rem; border-radius: 50%; background: var(--navy); }
.hero .stat-band { margin-top: 0.25rem; }
.hero-summary { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 0.6rem; }
.hero-summary:empty { display: none; }
.hero-summary .stat-band { margin-top: 0; }
.next-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(139, 92, 246, 0.16));
  border: 1px solid rgba(147, 197, 253, 0.28);
}
.next-label { color: #BFDBFE; font-size: 0.78rem; font-weight: 650; }
.next-card .problem-link { color: var(--on-navy); font-size: 1.02rem; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-card .problem-link:hover { color: #FFFFFF; }
.next-card .ext-icon { opacity: 0.6; }
.next-card p { margin: 0; color: var(--on-navy-muted); font-size: 0.85rem; line-height: 1.45; }
.next-card .primary { min-height: 1.75rem; padding: 0 0.8rem; font-size: 0.82rem; }
.next-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.next-meta { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.next-meta .problem-link { min-width: 0; }
.next-meta .level-badge { flex: none; }
.next-more { flex: none; color: #93C5FD; font-size: 0.8rem; font-weight: 600; text-decoration: none; }
.next-more:hover { color: #FFFFFF; text-decoration: underline; text-underline-offset: 2px; }
.hero-summary-compact:not(:empty) { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; margin-left: auto; text-align: right; }
.hero-summary-compact .stat-band { display: flex; justify-content: flex-end; gap: 0.85rem; }
.hero-summary-compact .stat { padding: 0; gap: 0; border: 0; border-radius: 0; background: none; }
.hero-summary-compact .stat + .stat { padding-left: 0.85rem; border-left: 1px solid var(--navy-line); }
.hero-summary-compact .stat-icon, .hero-summary-compact .stat-ring { display: none; }
.hero-summary-compact .stat span { font-size: 0.65rem; white-space: nowrap; }
.hero-summary-compact .stat strong { font-size: 1rem; line-height: 1.3; }
.hero-summary-compact .stat small { font-size: 0.65rem; }
.hero-summary-compact .next-card { flex: 0 0 10rem; gap: 0.35rem; padding: 0 0 0 1rem; border: 0; border-left: 1px solid var(--navy-line); border-radius: 0; background: none; }
.hero-summary-compact .next-label, .hero-summary-compact .next-more { font-size: 0.65rem; }
.hero-summary-compact .next-head { gap: 0.5rem; justify-content: flex-end; }
.hero-summary-compact .next-card p { font-size: 0.68rem; word-break: keep-all; }
.hero-summary-compact .next-card .primary { min-height: 1.45rem; padding: 0 0.5rem; border: 1px solid var(--navy-line); border-radius: 999px; background: rgba(255, 255, 255, 0.06); font-size: 0.65rem; }
.hero-summary-compact .next-card .primary:hover { background: rgba(255, 255, 255, 0.12); }
.hero-summary-compact .next-meta { justify-content: flex-end; gap: 0.35rem; }
.hero-summary-compact .next-card .problem-link { font-size: 0.78rem; }
.hero-summary-compact .level-badge { font-size: 0.65rem; padding: 0.05rem 0.3rem; }
.stat-icon[data-icon="book"] { background: rgba(96, 165, 250, 0.16); color: #93C5FD; --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5.5A2.5 2.5 0 0 1 6.5 3H20v15H6.5A2.5 2.5 0 0 0 4 20.5v-15Z'/%3E%3Cpath d='M4 20.5A2.5 2.5 0 0 1 6.5 18H20v3H6.5'/%3E%3C/svg%3E"); }
.stat-icon[data-icon="code"] { background: rgba(139, 92, 246, 0.2); color: #C4B5FD; --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m8 7-5 5 5 5M16 7l5 5-5 5'/%3E%3C/svg%3E"); }
.stat-icon[data-icon="db"] { background: rgba(20, 184, 166, 0.18); color: #5EEAD4; --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Cellipse cx='12' cy='5.5' rx='8' ry='3'/%3E%3Cpath d='M4 5.5v13c0 1.7 3.6 3 8 3s8-1.3 8-3v-13M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3'/%3E%3C/svg%3E"); }
.stat-icon[data-icon="tag"] { background: rgba(249, 115, 22, 0.18); color: #FDBA74; --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linejoin='round'%3E%3Cpath d='M3 12V4a1 1 0 0 1 1-1h8l9 9-9 9-9-9Z'/%3E%3Ccircle cx='8' cy='8' r='1.6'/%3E%3C/svg%3E"); }
.card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem 1.25rem; background: var(--bg); min-width: 0; }
.card h2 { margin: 0 0 0.9rem; font-size: 1rem; font-weight: 700; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.9rem; }
.card-head h2 { margin: 0; }
.card-head p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.record-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 28.5rem); gap: 1.25rem; margin-bottom: 1.25rem; align-items: start; }
.record-grid.overview { align-items: stretch; }
.record-side { display: grid; gap: 1.25rem; align-content: start; min-width: 0; }

.heatmap-card { position: relative; display: flex; flex-direction: column; }
.heat-tip {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 0.05rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  background: var(--float);
  color: #FFFFFF;
  font-size: 0.78rem;
  white-space: nowrap;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
  box-shadow: 0 8px 20px rgba(14, 35, 80, 0.28);
}
.heat-tip[hidden] { display: none; }
.heat-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}
.heat-tip strong { font-weight: 700; }
.heat-tip span { color: #93C5FD; font-weight: 600; }
.heat-tip[data-empty="true"] span { color: var(--on-navy-muted); font-weight: 500; }
.heatmap .cell[data-date] { cursor: default; }
.heatmap .cell[data-date]:hover { outline: 2px solid var(--navy-text); outline-offset: 1px; }
.heatmap-card .card-head { flex-direction: column; align-items: flex-start; }
.heatmap-wrap { display: flex; gap: 0.4rem; min-width: 0; }
.heatmap-scroll { min-width: 0; overflow-x: auto; padding: 3px 3px 0.35rem; margin: -3px -3px 0; scrollbar-width: thin; direction: rtl; }
.heatmap-scroll > .heatmap { direction: ltr; width: max-content; }
.heatmap-days { display: grid; grid-template-rows: 1rem repeat(7, 1.05rem); gap: 3px; color: var(--muted); font-size: 0.68rem; line-height: 1.05rem; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: 1rem repeat(7, 1.05rem); gap: 3px; }
.heatmap .month { color: var(--muted); font-size: 0.68rem; line-height: 1rem; white-space: nowrap; width: 1.05rem; overflow: visible; }
.heatmap .cell { width: 1.05rem; height: 1.05rem; border-radius: 3px; background: var(--surface-2); }
.heatmap .cell[data-level="1"] { background: var(--heat-1); }
.heatmap .cell[data-level="2"] { background: var(--heat-2); }
.heatmap .cell[data-level="3"] { background: var(--heat-3); }
.heatmap .cell[data-level="4"] { background: var(--heat-4); }
.heatmap .cell.is-future { background: transparent; }
.heatmap .cell.is-today { box-shadow: 0 0 0 1.5px var(--text); }
.heatmap-legend { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: auto; padding-top: 0.75rem; color: var(--muted); font-size: 0.72rem; }
.heatmap-legend .cell { width: 0.7rem; height: 0.7rem; border-radius: 2px; background: var(--surface-2); }
.heatmap-legend .cell[data-level="1"] { background: var(--heat-1); }
.heatmap-legend .cell[data-level="2"] { background: var(--heat-2); }
.heatmap-legend .cell[data-level="3"] { background: var(--heat-3); }
.heatmap-legend .cell[data-level="4"] { background: var(--heat-4); }
.heatmap-legend span:first-child { margin-right: 0.25rem; }
.heatmap-legend span:last-child { margin-left: 0.25rem; }

.levels { display: grid; gap: 0.7rem; }
.level-line { display: grid; grid-template-columns: 3.1rem 1fr 4.5rem; gap: 0.75rem; align-items: center; }
.level-line .track { display: block; height: 0.5rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.level-line .track b { display: block; height: 100%; border-radius: inherit; min-width: 0; }
.level-line .track b[data-level="0"] { background: var(--lv0); }
.level-line .track b[data-level="1"] { background: var(--lv1); }
.level-line .track b[data-level="2"] { background: var(--lv2); }
.level-line .track b[data-level="3"] { background: var(--lv3); }
.level-line .track b[data-level="4"] { background: var(--lv4); }
.level-line .track b[data-level="5"] { background: var(--lv5); }
.level-line .count { color: var(--muted); font-size: 0.82rem; text-align: right; }
.level-line .count strong { color: var(--text); font-weight: 650; }

.radar-card { display: flex; flex-direction: column; }
.radar { display: block; width: 100%; max-width: 23rem; height: auto; margin: 0.25rem auto 0; overflow: visible; }
.radar-ring { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-ring.is-outer { stroke: var(--line-strong); }
.radar-axis { stroke: var(--line); stroke-width: 1; }
.radar-area { fill: rgba(37, 99, 235, 0.16); stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.radar-dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.radar-tick { fill: var(--muted); font-size: 8.5px; font-variant-numeric: tabular-nums; }
.radar-label { fill: var(--text); font-size: 11.5px; font-weight: 650; }
.radar-label.is-empty { fill: var(--muted); font-weight: 550; }
.radar-value { fill: var(--muted); font-size: 10.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.radar-foot { margin: auto 0 0; padding-top: 0.75rem; color: var(--muted); font-size: 0.82rem; }

.skill-list { display: grid; }
.skill { border-bottom: 1px solid var(--line); }
.skill:last-child { border-bottom: 0; }
.skill summary {
  display: grid;
  grid-template-columns: 8.75rem minmax(0, 1fr) 4.5rem 0.75rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.25rem;
  margin: 0 -0.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  list-style: none;
}
.skill:first-child summary { padding-top: 0.1rem; }
.skill summary::-webkit-details-marker { display: none; }
.skill summary:hover { background: var(--surface); }
.skill summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  justify-self: center;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
}
.skill[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.skill-name { font-size: 0.9rem; font-weight: 650; white-space: nowrap; }
.skill .track { display: block; height: 0.5rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.skill .track b { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.skill .count { color: var(--muted); font-size: 0.82rem; text-align: right; }
.skill .count strong { color: var(--text); font-weight: 650; }
.skill-body { display: grid; gap: 0.65rem; padding: 0.15rem 0 0.95rem; }
.skill-empty { margin: 0; color: var(--muted); font-size: 0.86rem; }
.skill-levels { display: flex; flex-wrap: wrap; gap: 0.35rem 0.8rem; }
.skill-levels > span { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--text-2); font-size: 0.8rem; }
.skill-levels .level-badge { min-width: 2.7rem; height: 1.3rem; font-size: 0.72rem; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.skill-tags .algo-tag b { margin-left: 0.3rem; color: var(--accent-strong); font-weight: 700; }
.skill-problems { list-style: none; margin: 0; padding: 0; }
.skill-problems li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; padding: 0.35rem 0; }
.skill-problems .level-badge { min-width: 2.7rem; height: 1.3rem; font-size: 0.72rem; }
.skill-problems .problem-link { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skill-problems li > .num { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.skill-rest, .skill-more { justify-self: start; color: var(--accent); font-size: 0.8rem; font-weight: 600; text-decoration: none; }
.skill-rest { display: inline-block; margin-top: 0.35rem; color: var(--muted); }
.skill-rest:hover, .skill-more:hover { text-decoration: underline; text-underline-offset: 2px; }

.rec-list, .history-list { list-style: none; margin: 0; padding: 0; }
.rec-list li, .history-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}
.rec-list li:first-child { padding-top: 0; }
.rec-list li:last-child, .history-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.rec-list .problem-meta, .history-list .problem-meta { margin-top: 0.15rem; }
.rec-empty { color: var(--muted); font-size: 0.9rem; margin: 0; }
.solved-at {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}
.history-days { columns: 2; column-gap: 2.5rem; }
.day { break-inside: avoid; padding-bottom: 1.25rem; }
.history-more { display: flex; width: 100%; justify-content: center; margin-top: 0.25rem; }
.day h3 { display: flex; align-items: baseline; gap: 0.5rem; margin: 0 0 0.35rem; font-size: 0.86rem; font-weight: 700; color: var(--text); }
.day h3 span { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.gate { text-align: center; padding: 3.5rem 1.5rem; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.gate h2 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.gate p { margin: 0 auto 1.25rem; max-width: 26rem; color: var(--muted); }
.gate .filter-actions { justify-content: center; }

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

@media (max-width: 960px) {
  .record-grid { grid-template-columns: minmax(0, 1fr); }
  .record-side { display: contents; }
  .record-side > .radar-card { order: -1; }
  .history-days { columns: 1; }
}

@media (max-width: 800px) {
  .hero-summary-compact:not(:empty) { width: 100%; flex-wrap: wrap; gap: 0.7rem; }
  .hero-summary-compact .stat-band { gap: 0.7rem; }
  .hero-summary-compact .stat + .stat { padding-left: 0.7rem; }
  .hero-summary-compact .next-card { flex-basis: 10rem; }
  .collection-guide { grid-template-columns: 1fr; gap: 0.85rem; padding: 1rem; }
  .collection-facts { border-left: 0; border-top: 1px solid var(--line); padding: 0.85rem 0 0; }
  .collection-nav { gap: 0.4rem; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.3rem; scrollbar-width: thin; }
  .collection-nav a { flex: 0 0 auto; padding: 0.45rem 0.6rem; font-size: 0.8rem; gap: 0.4rem; }
  .site-header { grid-template-columns: auto minmax(0, 1fr) auto; padding: 0 0.75rem; }
  .nav { justify-content: center; min-width: 0; }
  .nav a { padding: 0.4rem 0.55rem; font-size: 0.9rem; }
  .nav a[aria-current="page"]::after { left: 0.55rem; right: 0.55rem; }
  .progress-chip .meter { display: none; }
  .page { padding: 1.25rem 0.9rem 3rem; }
  .site-footer p { padding-left: 0.9rem; padding-right: 0.9rem; }
  .hero-inner { padding: 1.5rem 0.9rem 1.25rem; }
  .page-head h1 { font-size: 1.5rem; }
  .search-slot { display: block; }
  .results-head .toolbar { flex: 1 1 100%; }
  .toolbar label { flex: 1 1 7rem; }
  .toolbar select { width: 100%; min-width: 0; }
  .explore { grid-template-columns: 1fr; }
  .filters { display: none; }
  .filter-open { display: inline-flex; }
  .sort-bar { display: flex; }
  .problem-table { display: none; }
  .list-card { display: block; }
  .stat-band { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .stat { gap: 0.6rem; padding: 0.65rem 0.75rem; }
  .stat-icon, .stat-ring { width: 2rem; height: 2rem; }
  .stat-icon { border-radius: 9px; }
  .stat-icon::after { inset: 0.5rem; }
  .stat-ring::after { inset: 0.28rem; }
  .stat span { font-size: 0.74rem; }
  .stat strong { font-size: 1.25rem; }
  .stat small { font-size: 0.78rem; }
  .next-card { padding: 0.8rem 0.9rem; }
  .filter-dialog {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
    max-height: 88vh;
    overflow: auto;
  }
  .filter-dialog .choices[data-group="algorithms"] { max-height: none; }
  .filter-dialog .choices-toggle { display: none; }
}

@media (max-width: 560px) {
  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-areas: "logo account" "nav nav";
    row-gap: 0;
    column-gap: 0.5rem;
    min-height: 0;
    padding: 0.5rem 0.75rem 0;
  }
  .logo { grid-area: logo; }
  .nav { grid-area: nav; justify-content: flex-start; margin: 0 -0.55rem; }
  .nav a { padding: 0.55rem 0.55rem 0.65rem; }
  .nav a[aria-current="page"]::after { bottom: 0; }
  .account { grid-area: account; }
  .feedback-button { padding: 0 0.55rem; }
  .feedback-hint { left: auto; right: -0.25rem; transform: none; }
  .feedback-hint::before { left: auto; right: 0.95rem; transform: rotate(45deg); }
  .feedback-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .problem-table th { top: 0; }
  .rec-list li, .history-list li { grid-template-columns: auto minmax(0, 1fr); }
  .history-list .solved-at { grid-column: 2; justify-self: start; margin-top: -0.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
