:root {
  --paper: #f7f6f2;
  --surface: #ffffff;
  --surface-muted: #f0f1ed;
  --ink: #1d2320;
  --ink-soft: #5d665f;
  --line: #dedfd9;
  --line-strong: #c7cac2;
  --green: #256d4b;
  --green-deep: #174b35;
  --green-soft: #e2eee7;
  --coral: #d96345;
  --coral-soft: #fae9e3;
  --blue: #3865a8;
  --blue-soft: #e8edf6;
  --gold: #a36d10;
  --gold-soft: #f8efd7;
  --purple: #7255a6;
  --purple-soft: #efeaf7;
  --shadow-sm: 0 1px 2px rgb(29 35 32 / 5%), 0 4px 16px rgb(29 35 32 / 4%);
  --shadow-lg: 0 20px 60px rgb(29 35 32 / 16%);
  --sidebar-width: 238px;
  font-family: "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

a {
  color: inherit;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #eeefe9;
}

.brand-row {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  font-family: "Noto Serif SC", serif;
  font-size: 18px;
  font-weight: 700;
}

.brand-name {
  font-family: "Noto Serif SC", serif;
  font-size: 20px;
  font-weight: 700;
}

.main-nav {
  display: grid;
  gap: 4px;
  padding: 4px 12px 18px;
  border-bottom: 1px solid var(--line);
}

.nav-item,
.topic-nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.nav-item {
  min-height: 42px;
  gap: 11px;
  padding: 0 11px;
  border-radius: 6px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(29 35 32 / 5%);
}

.nav-item.is-active svg {
  color: var(--green);
}

.nav-count {
  min-width: 22px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: #dde0d8;
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  text-align: center;
}

.sidebar-section {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 20px 12px;
}

.sidebar-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px 9px 11px;
}

.sidebar-label,
.eyebrow {
  color: #737a74;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mini-icon-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.mini-icon-button {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  color: var(--ink-soft);
}

.mini-icon-button:hover,
.icon-button:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.mini-icon-button svg {
  width: 15px;
  height: 15px;
}

.topic-nav {
  display: grid;
  gap: 2px;
}

.topic-tree-node {
  min-width: 0;
}

.topic-nav-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
}

.topic-nav-row:not(:has(.topic-expand)) {
  grid-template-columns: 1fr;
}

.topic-expand {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #808781;
  cursor: pointer;
}

.topic-expand:hover {
  background: rgb(255 255 255 / 65%);
  color: var(--ink);
}

.topic-expand svg {
  width: 14px;
  height: 14px;
  transition: transform 160ms ease;
}

.topic-expand.is-expanded svg {
  transform: rotate(90deg);
}

.topic-children {
  display: none;
  gap: 1px;
  margin: 2px 0 7px 12px;
  padding-left: 8px;
  border-left: 1px solid #d2d6ce;
}

.topic-children.is-expanded {
  display: grid;
}

.topic-nav-child {
  min-height: 32px;
  padding-right: 6px;
  padding-left: 7px;
  font-size: 12px;
}

.topic-branch {
  width: 6px;
  height: 1px;
  flex: 0 0 auto;
  background: #b6bcb5;
}

.custom-topic-icon {
  width: 12px;
  height: 12px;
  margin-left: auto;
  color: var(--purple);
}

.topic-nav-child .custom-topic-icon + .topic-count {
  margin-left: 0;
}

.topic-child-label {
  margin: 7px 7px 3px;
  color: #8b918c;
  font-size: 9px;
  font-weight: 700;
}

.topic-nav-item {
  min-height: 38px;
  gap: 10px;
  padding: 0 10px;
  border-radius: 5px;
  color: var(--ink-soft);
  font-size: 13px;
}

.topic-nav-item:hover {
  background: rgb(255 255 255 / 55%);
  color: var(--ink);
}

.topic-nav-item.is-active {
  background: var(--green-soft);
  color: var(--green-deep);
  font-weight: 600;
}

.topic-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--topic-color, var(--green));
}

.topic-count {
  margin-left: auto;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  opacity: 0.62;
}

.sidebar-footer {
  margin: 10px 12px 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgb(255 255 255 / 58%);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.progress-head strong {
  font-family: "DM Mono", monospace;
  font-weight: 500;
}

.progress-track {
  height: 5px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #d9ddd5;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 300ms ease;
}

.sidebar-footer p {
  margin: 9px 0 0;
  color: #747b75;
  font-size: 11px;
  line-height: 1.65;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(24px, 4vw, 56px);
  border-bottom: 1px solid rgb(222 223 217 / 82%);
  background: rgb(247 246 242 / 90%);
  backdrop-filter: blur(12px);
}

.topbar-start,
.topbar-actions,
.breadcrumb,
.breadcrumb span {
  display: flex;
  align-items: center;
}

.topbar-start {
  min-width: 0;
  gap: 10px;
}

.breadcrumb {
  min-width: 0;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
}

.breadcrumb strong {
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb svg {
  width: 14px;
  height: 14px;
  color: #9aa09a;
}

.topbar-actions {
  gap: 10px;
}

.sync-status-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgb(255 255 255 / 66%);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.sync-status-button:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.sync-status-button svg {
  width: 15px;
  height: 15px;
}

.sync-status-button.is-synced {
  border-color: #b9d2c4;
  background: var(--green-soft);
  color: var(--green-deep);
}

.sync-status-button.is-saving,
.sync-status-button.is-loading {
  border-color: #d7c89e;
  background: var(--gold-soft);
  color: var(--gold);
}

.sync-status-button.is-offline {
  border-color: #e7bfb4;
  background: var(--coral-soft);
  color: #9a4934;
}

.sync-status-button.is-loading svg,
.sync-status-button.is-saving svg {
  animation: sync-spin 900ms linear infinite;
}

@keyframes sync-spin {
  to { transform: rotate(360deg); }
}

.account-summary {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.account-summary strong {
  font-size: 13px;
}

.account-summary span {
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.global-search {
  display: flex;
  width: min(310px, 31vw);
  height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: #8b918c;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.global-search:focus-within {
  border-color: #96b2a2;
  box-shadow: 0 0 0 3px rgb(37 109 75 / 9%);
}

.global-search svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.global-search kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 4px;
  background: #f7f7f5;
  color: #858b86;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  white-space: nowrap;
}

.primary-button,
.ghost-button,
.filter-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.primary-button {
  padding: 0 14px;
  border: 1px solid var(--green-deep);
  background: var(--green);
  color: white;
  box-shadow: 0 1px 2px rgb(23 75 53 / 16%);
  font-size: 13px;
}

.primary-button:hover {
  background: var(--green-deep);
}

.primary-button.danger-button {
  border-color: #a63e2d;
  background: #bc4935;
  box-shadow: 0 1px 2px rgb(166 62 45 / 18%);
}

.primary-button.danger-button:hover {
  background: #973422;
}

.primary-button .chevron {
  width: 14px;
  height: 14px;
  margin-left: 1px;
}

.add-wrap {
  position: relative;
}

.add-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: none;
  width: 258px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.add-menu.is-open {
  display: grid;
}

.add-menu button {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 9px;
  align-items: center;
  padding: 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.add-menu button:hover {
  background: var(--surface-muted);
}

.add-menu button > svg {
  width: 17px;
  color: var(--green);
}

.add-menu span {
  display: grid;
  gap: 2px;
}

.add-menu strong {
  font-size: 13px;
}

.add-menu small {
  color: var(--ink-soft);
  font-size: 11px;
}

.view {
  min-height: calc(100vh - 72px);
}

.content-wrap {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: 38px 0 72px;
}

.topic-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  padding: 10px 0 30px;
  border-bottom: 1px solid var(--line);
}

.topic-hero-main {
  min-width: 0;
}

.topic-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.topic-kicker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.topic-kicker-row .topic-kicker {
  margin-bottom: 0;
}

.topic-heading-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.parent-topic-link {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.parent-topic-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.parent-topic-link svg {
  width: 13px;
  height: 13px;
}

.topic-kicker .topic-dot {
  width: 9px;
  height: 9px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.topic-hero h1,
.contest-header h1 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.18;
  letter-spacing: 0;
}

.topic-hero p,
.contest-header p {
  max-width: 660px;
  margin: 13px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
}

.topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 20px;
  color: var(--ink-soft);
  font-size: 12px;
}

.topic-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topic-meta svg {
  width: 15px;
  height: 15px;
}

.hero-stat {
  display: grid;
  min-width: 190px;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.hero-stat > div {
  display: grid;
  gap: 3px;
  padding: 15px 17px;
}

.hero-stat > div + div {
  border-left: 1px solid var(--line);
}

.hero-stat strong {
  font-family: "DM Mono", monospace;
  font-size: 19px;
  font-weight: 500;
}

.hero-stat span {
  color: var(--ink-soft);
  font-size: 11px;
}

.section {
  padding-top: 38px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 22px;
  line-height: 1.25;
}

.section-heading p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.subtopic-section {
  padding-top: 30px;
}

.subtopic-group + .subtopic-group {
  margin-top: 28px;
}

.subtopic-group-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
}

.subtopic-group-heading h3 {
  margin: 0;
  font-size: 14px;
}

.subtopic-group-heading p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.subtopic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.subtopic-card {
  display: flex;
  min-width: 0;
  min-height: 142px;
  flex-direction: column;
  align-items: flex-start;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease;
}

.subtopic-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.subtopic-card-top {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #858c86;
  font-size: 9px;
  font-weight: 600;
}

.custom-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--purple);
}

.custom-badge svg {
  width: 12px;
  height: 12px;
}

.subtopic-card > strong {
  margin-top: 12px;
  font-size: 14px;
}

.subtopic-description {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.subtopic-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 10px;
  color: var(--green);
  font-size: 10px;
  font-weight: 600;
}

.subtopic-count svg {
  width: 12px;
  height: 12px;
}

.subtopic-empty {
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  color: var(--ink-soft);
  font-size: 11px;
  text-align: center;
}

.text-button {
  display: inline-flex;
  min-height: 32px;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.text-button:hover {
  background: var(--green-soft);
}

.text-button svg {
  width: 15px;
  height: 15px;
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 258px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.lesson-article {
  padding: 28px 34px 29px 0;
}

.lesson-article .article-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--coral);
  font-size: 11px;
  font-weight: 700;
}

.lesson-article h3 {
  max-width: 700px;
  margin: 10px 0 15px;
  font-family: "Noto Serif SC", serif;
  font-size: 25px;
  line-height: 1.5;
}

.lesson-body {
  position: relative;
  max-height: 154px;
  overflow: hidden;
  transition: max-height 350ms ease;
}

.lesson-body.is-expanded {
  max-height: 900px;
}

.lesson-body:not(.is-expanded)::after {
  position: absolute;
  inset: auto 0 0;
  height: 46px;
  background: linear-gradient(transparent, var(--paper));
  content: "";
  pointer-events: none;
}

.lesson-body p {
  margin: 0 0 13px;
  color: #465049;
  font-family: "Noto Serif SC", serif;
  font-size: 14px;
  line-height: 2;
}

.lesson-expand {
  margin: 12px 0 0 -8px;
}

.lesson-aside {
  padding: 26px 0 26px 28px;
  border-left: 1px solid var(--line);
}

.lesson-aside h4 {
  margin: 0 0 13px;
  font-size: 12px;
}

.lesson-aside ol {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  counter-reset: list;
  list-style: none;
}

.lesson-aside li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.lesson-aside li::before {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-deep);
  content: counter(list);
  counter-increment: list;
  font-family: "DM Mono", monospace;
  font-size: 10px;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.problem-card {
  display: flex;
  min-width: 0;
  min-height: 215px;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.problem-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 8px 26px rgb(29 35 32 / 8%);
}

.problem-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-head-actions,
.entry-actions,
.featured-controls,
.contest-header-side {
  display: flex;
  align-items: center;
}

.card-head-actions {
  gap: 10px;
}

.entry-actions {
  flex: 0 0 auto;
  gap: 3px;
}

.entry-action {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #747c76;
  cursor: pointer;
}

.entry-action:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.entry-action.is-danger:hover {
  background: var(--coral-soft);
  color: #a63e2d;
}

.entry-action svg {
  width: 15px;
  height: 15px;
}

.oj-mark {
  display: inline-grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  background: var(--oj-bg, var(--surface-muted));
  color: var(--oj-color, var(--ink));
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 500;
}

.difficulty {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
}

.difficulty::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.difficulty.easy { color: var(--green); }
.difficulty.medium { color: var(--gold); }
.difficulty.hard { color: var(--coral); }

.problem-card h3 {
  margin: 17px 0 7px;
  font-size: 15px;
  line-height: 1.55;
}

.problem-id {
  color: #858c86;
  font-family: "DM Mono", monospace;
  font-size: 11px;
}

.problem-note {
  display: -webkit-box;
  min-height: 43px;
  margin: 11px 0 14px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
}

.tag {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fafaf8;
  color: #626a64;
  font-size: 10px;
}

.technique-tag {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #d9d1e6;
  border-radius: 999px;
  background: #f7f4fa;
  color: #655082;
  cursor: pointer;
  font-size: 10px;
}

.technique-tag:hover {
  border-color: #b8a6cf;
  background: var(--purple-soft);
}

.problem-card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 16px;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.problem-card-link svg,
.external-link svg {
  width: 14px;
  height: 14px;
}

.problem-card-link:hover,
.external-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.training-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.training-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafaf8;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
}

.filter-button:hover,
.filter-button.is-active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.training-count {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 11px;
}

.problem-table {
  width: 100%;
  border-collapse: collapse;
}

.problem-table th {
  height: 39px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  color: #868d87;
  font-size: 10px;
  font-weight: 600;
  text-align: left;
}

.problem-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #e9eae5;
  font-size: 12px;
  vertical-align: middle;
}

.problem-table th:last-child,
.table-actions {
  width: 76px;
  text-align: right;
}

.table-actions .entry-actions {
  justify-content: flex-end;
}

.problem-table tr:last-child td {
  border-bottom: 0;
}

.problem-table tbody tr:hover {
  background: #fbfbf9;
}

.status-check {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: white;
  cursor: pointer;
}

.status-check.is-done {
  border-color: var(--green);
  background: var(--green);
}

.status-check svg {
  width: 13px;
  height: 13px;
}

.table-title {
  display: flex;
  min-width: 210px;
  align-items: center;
  gap: 10px;
}

.table-title a {
  font-weight: 600;
  text-decoration: none;
}

.table-title a:hover {
  color: var(--green);
}

.table-title .oj-mark {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  font-size: 9px;
}

.table-tags {
  display: flex;
  min-width: 160px;
  flex-wrap: wrap;
  gap: 4px;
}

.table-techniques {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.empty-state {
  display: grid;
  min-height: 210px;
  place-items: center;
  padding: 32px;
  color: var(--ink-soft);
  text-align: center;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  margin-bottom: 9px;
  color: #9aa19b;
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 14px;
}

.empty-state p {
  margin: 0;
  font-size: 12px;
}

.contest-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.contest-summary {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-family: "DM Mono", monospace;
  font-size: 12px;
}

.contest-summary strong {
  color: var(--ink);
  font-size: 26px;
  font-weight: 500;
}

.contest-header-side {
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.featured-contest {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 24px 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.featured-controls {
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.contest-date {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  align-content: center;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  line-height: 1.05;
}

.contest-date strong {
  font-family: "DM Mono", monospace;
  font-size: 22px;
  font-weight: 500;
}

.contest-date span {
  margin-top: 5px;
  color: #cfd5d0;
  font-size: 9px;
  text-transform: uppercase;
}

.featured-copy h3,
.contest-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}

.featured-copy p,
.contest-card p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.contest-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--coral);
  font-size: 10px;
  font-weight: 700;
}

.contest-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.contest-card {
  display: grid;
  min-height: 178px;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 15px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.contest-card .oj-mark {
  width: 42px;
  height: 42px;
}

.contest-card-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.contest-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
  color: #848b85;
  font-family: "DM Mono", monospace;
  font-size: 10px;
}

.contest-card-meta .entry-actions {
  margin-left: auto;
  margin-top: -7px;
}

.contest-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 15px;
}

.external-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.delete-confirmation {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.delete-confirmation-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  background: var(--coral-soft);
  color: #a63e2d;
}

.delete-confirmation strong {
  display: block;
  margin-top: 1px;
  font-size: 15px;
}

.delete-confirmation p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.modal-layer[hidden] {
  display: none;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(18 23 20 / 45%);
  backdrop-filter: blur(3px);
}

.modal {
  position: relative;
  width: min(620px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 17px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(10px);
}

.modal-header h2 {
  margin: 4px 0 0;
  font-family: "Noto Serif SC", serif;
  font-size: 22px;
}

.icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 6px;
  color: var(--ink-soft);
}

.modal-body {
  display: grid;
  gap: 17px;
  padding: 22px 24px 26px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span,
.field legend {
  color: #4e5851;
  font-size: 12px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  background: white;
  color: var(--ink);
  font-size: 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input,
.field select {
  height: 40px;
  padding: 0 11px;
}

.field textarea {
  min-height: 102px;
  padding: 10px 11px;
  line-height: 1.7;
  resize: vertical;
}

.field textarea.article-input {
  min-height: 190px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #78a38b;
  box-shadow: 0 0 0 3px rgb(37 109 75 / 9%);
}

.field small {
  color: #89908a;
  font-size: 10px;
}

fieldset.field {
  margin: 0;
  padding: 0;
  border: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.checkbox-option,
.radio-option {
  position: relative;
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafaf8;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 11px;
}

.checkbox-option:has(input:checked),
.radio-option:has(input:checked) {
  border-color: #79a28b;
  background: var(--green-soft);
  color: var(--green-deep);
}

.checkbox-option input,
.radio-option input {
  width: 14px;
  height: 14px;
  accent-color: var(--green);
}

.radio-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: rgb(250 250 248 / 96%);
  backdrop-filter: blur(10px);
}

.ghost-button {
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: white;
  color: var(--ink-soft);
  font-size: 12px;
}

.ghost-button:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  padding: 0 15px;
  border-radius: 7px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast svg {
  width: 16px;
  height: 16px;
  color: #8bd0ad;
}

.menu-button,
.sidebar-close {
  display: none;
}

@media (max-width: 1040px) {
  .sync-status-button span {
    display: none;
  }

  .sync-status-button {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .example-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .subtopic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lesson-layout {
    grid-template-columns: minmax(0, 1fr) 225px;
  }

  .problem-table th:nth-child(4),
  .problem-table td:nth-child(4) {
    display: none;
  }
}

@media (max-width: 820px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: none;
    background: rgb(18 23 20 / 28%);
  }

  .sidebar-scrim.is-open {
    display: block;
  }

  .workspace {
    margin-left: 0;
  }

  .menu-button,
  .sidebar-close {
    display: inline-grid;
  }

  .topbar {
    padding-inline: 20px;
  }

  .global-search {
    width: min(280px, 44vw);
  }

  .lesson-layout {
    grid-template-columns: 1fr;
  }

  .lesson-article {
    padding-right: 0;
  }

  .lesson-aside {
    padding: 22px 0 6px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .contest-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 64px;
    gap: 10px;
    padding: 10px 14px;
  }

  .breadcrumb span:first-child,
  .breadcrumb svg,
  .global-search kbd,
  .primary-button .chevron {
    display: none;
  }

  .global-search {
    width: 40px;
    padding: 0 11px;
    cursor: pointer;
  }

  .global-search:focus-within {
    position: absolute;
    inset: 10px 138px 10px 52px;
    z-index: 3;
    width: auto;
  }

  .global-search input {
    opacity: 0;
  }

  .global-search:focus-within input {
    opacity: 1;
  }

  .topbar-actions .primary-button {
    width: 40px;
    padding: 0;
  }

  .topbar-actions .primary-button span {
    display: none;
  }

  .add-menu {
    position: fixed;
    top: 60px;
    right: 10px;
  }

  .content-wrap {
    width: min(100% - 28px, 1160px);
    padding-top: 26px;
  }

  .topic-hero,
  .contest-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .topic-hero {
    display: grid;
  }

  .topic-hero h1,
  .contest-header h1 {
    font-size: 32px;
  }

  .hero-stat {
    width: 100%;
  }

  .example-grid {
    grid-template-columns: 1fr;
  }

  .subtopic-grid {
    grid-template-columns: 1fr;
  }

  .subtopic-group-heading {
    align-items: flex-start;
  }

  .section {
    padding-top: 30px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .lesson-article h3 {
    font-size: 21px;
  }

  .training-panel {
    overflow-x: auto;
  }

  .training-toolbar {
    position: sticky;
    left: 0;
    width: calc(100vw - 28px);
  }

  .problem-table {
    min-width: 620px;
  }

  .contest-header {
    display: flex;
    align-items: flex-start;
  }

  .featured-contest {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 14px;
  }

  .featured-controls {
    grid-column: 2;
    align-items: flex-start;
  }

  .contest-date {
    width: 54px;
    height: 58px;
  }

  .contest-card {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 12px;
    padding: 15px;
  }

  .contest-card .oj-mark {
    width: 36px;
    height: 36px;
  }

  .modal-layer {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding-right: 17px;
    padding-left: 17px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .checkbox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
