
:root { color-scheme: dark; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #1a1a1a;
  color: #e6e6e6;
  font: 14px -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
}

/* Header */
header {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #262626;
  border-bottom: 1px solid #3a3a3a;
}
.brand { font-size: 20px; font-weight: 700; letter-spacing: -1px; }
.brand b { color: #e49a23; }
.nav { color: #9a9a9a; font-size: 13px; }
.nav a { color: inherit; text-decoration: none; }
.nav a:hover { color: #f0f0f0; }
.toolbar { display: flex; gap: 8px; align-items: center; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 6px;
  padding: 8px 13px;
  background: #3a3a3a;
  color: #dddddd;
}
button.primary { background: #21884e; color: white; }
button:disabled { opacity: .5; cursor: default; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  height: calc(100vh - 58px);
  padding: 8px;
}
.panel {
  background: #262626;
  border: 1px solid #363636;
  border-radius: 9px;
  min-width: 0;
  overflow: hidden;
}
.right {
  display: grid;
  grid-template-rows: minmax(300px, 1.3fr) minmax(200px, 1fr);
  gap: 8px;
  min-height: 0;
}

/* Panel tabs */
.tabs {
  height: 43px;
  background: #303030;
  border-bottom: 1px solid #3a3a3a;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 17px;
  color: #9a9a9a;
  font-size: 13px;
}
.tabs strong { color: #f0f0f0; }
.tabs strong.green { color: #46c6c2; }
.tabs button {
  background: none;
  padding: 0;
  border-radius: 0;
  color: #9a9a9a;
  height: 100%;
}
.tabs button.active { color: #f0f0f0; font-weight: 700; }

/* Description and editorial */
.description {
  height: calc(100% - 43px);
  overflow: auto;
  padding: 23px 25px 35px;
  line-height: 1.65;
}
.description[hidden] { display: none; }
h1 { font-size: 23px; line-height: 1.3; margin: 0 0 13px; letter-spacing: -.5px; }
h3 { font-size: 14px; margin: 21px 0 6px; }
.meta { display: flex; gap: 9px; align-items: center; margin-bottom: 23px; }
.easy { color: #46c6c2; background: #1f3327; border-radius: 20px; padding: 3px 11px; }
.medium { color: #fac31d; background: #3d3020; border-radius: 20px; padding: 3px 11px; }
.tag { color: #b0b0b0; background: #363636; border-radius: 20px; padding: 3px 10px; font-size: 12px; }
p { margin: 10px 0; }
ul, ol { padding-left: 23px; margin: 7px 0; }
li { margin: 5px 0; }
code {
  font: 12px ui-monospace, SFMono-Regular, Consolas, monospace;
  background: #363636;
  padding: 2px 4px;
  border-radius: 4px;
}
pre {
  font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #1f1f1f;
  border-left: 3px solid #3a3a3a;
  padding: 12px;
  margin: 8px 0;
}
pre.code { white-space: pre; overflow-x: auto; overflow-wrap: normal; }
details { margin: 12px 0; color: #a8a8a8; }
summary { cursor: pointer; }
.stats { border-top: 1px solid #333333; margin-top: 25px; padding-top: 12px; color: #8c8c8c; font-size: 12px; }

/* Editor */
.editorpanel { display: flex; flex-direction: column; }
.lang {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid #333333;
  color: #a8a8a8;
  font-size: 13px;
}
.lang button { padding: 4px 8px; }
.editor { display: flex; flex: 1; min-height: 0; overflow: hidden; background: #262626; }
.numbers {
  padding: 13px 10px;
  text-align: right;
  color: #6e6e6e;
  background: #303030;
  font: 13px/22px ui-monospace, monospace;
  user-select: none;
  overflow: hidden;
  white-space: pre;
}
.editor textarea {
  resize: none;
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 13px 10px;
  font: 13px/22px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #9cc4ff;
  background: #262626;
  white-space: pre;
  tab-size: 4;
  overflow: auto;
}
.status { padding: 8px 14px; color: #808080; border-top: 1px solid #333333; font-size: 12px; }

/* Test cases */
.testbody { padding: 16px; overflow: auto; height: calc(100% - 43px); }
.cases { display: flex; gap: 8px; flex-wrap: wrap; }
.case.active { background: #4a4a4a; font-weight: 600; }
.field { margin-top: 13px; color: #9a9a9a; font-size: 12px; }
.value {
  background: #1f1f1f;
  border-radius: 7px;
  padding: 9px 12px;
  margin-top: 6px;
  font: 13px/1.5 ui-monospace, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #dddddd;
}
.notice { font-size: 12px; color: #8c8c8c; margin-top: 13px; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .description { height: auto; padding: 20px; }
  .right { grid-template-rows: 420px 350px; }
  .nav { display: none; }
  header { padding: 0 12px; }
}

/* Shared LeetCode-style chrome. */
:root { --canvas: #1a1a1a; --panel: #262626; --raised: #333; --text: #eff1f6; --muted: #a8a8a8; --accent: #ffa116; }
body { color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
button:hover { filter: brightness(1.13); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid #8ab4f8; outline-offset: 3px; }
[hidden] { display: none !important; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: middle; }
.brand { display: inline-flex; align-items: center; gap: 7px; font-size: 20px; font-weight: 500; letter-spacing: -.65px; white-space: nowrap; }
.brand img { display: block; }
header { height: 48px; border: 0; padding: 0 20px; }
.header-left { display: flex; align-items: center; gap: 18px; min-width: 0; }
.header-note { color: #888; font-size: 13px; }
.problem-header { background: #0f0f0f; position: relative; }
.problem-nav { display: flex; align-items: center; gap: 10px; border-left: 1px solid #333; padding-left: 18px; }
.problem-nav a { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.icon-button { color: #999; padding: 6px; border-radius: 5px; }
.icon-button:hover { color: white; background: #333; }
.toolbar { position: absolute; left: 50%; transform: translateX(-50%); gap: 2px; }
.toolbar button { height: 32px; padding: 0 12px; background: #262626; border-radius: 5px; font-weight: 500; }
button.primary { color: #66bf79; }
.problem-page .layout { height: calc(100dvh - 72px); padding: 0 10px 4px; gap: 8px; background: #0f0f0f; }
.problem-page .panel { border: 1px solid #3b3b3b; border-radius: 8px; }
.problem-page .right { grid-template-rows: minmax(240px, 1.5fr) minmax(180px, 1fr); }
.tabs { height: 36px; gap: 18px; padding: 0 12px; background: #333; border: 0; }
.tabs strong, .tabs button { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.tabs button.active { font-weight: 500; }
.tabs button[data-view="description"] .icon { color: #4a90e2; }
.tabs button[data-view="editorial"] .icon { color: #c8ae65; }
.green { color: #65b778; }
.description { height: calc(100% - 36px); padding: 22px 16px 32px; line-height: 1.6; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -.5px; line-height: 1.4; }
h3 { margin-top: 28px; }
.meta { gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.easy, .medium, .tag { background: #ffffff0f; font-size: 12px; padding: 3px 9px; border-radius: 20px; }
.easy { color: #46c6c2; }
.medium { color: #fac31d; }
.tag { color: #c7c7c7; }
p { margin: 16px 0; }
code { font-size: 12px; border: 1px solid #ffffff0a; background: #ffffff12; }
pre { background: transparent; border-left: 2px solid #555; padding: 0 16px; color: #c8c8c8; font-size: 13px; }
pre.code { padding: 14px; background: #202020; border: 0; border-radius: 6px; }
.lang { padding: 5px 12px; height: 34px; }
.lang button { background: transparent; color: #a8a8a8; padding: 3px 5px; font-size: 12px; }
.numbers { background: #262626; padding: 10px 14px 10px 18px; color: #858585; font: 13px/22px Menlo, Monaco, Consolas, monospace; min-width: 50px; }
.code-surface { position: relative; flex: 1; min-width: 0; min-height: 0; }
.syntax, .editor textarea { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 10px 12px 30px 0; font: 13px/22px Menlo, Monaco, Consolas, monospace; tab-size: 4; white-space: pre; overflow-wrap: normal; border: 0; border-radius: 0; letter-spacing: 0; }
.syntax { overflow: hidden; pointer-events: none; color: #d4d4d4; background: transparent; }
.editor textarea { color: transparent; caret-color: #fff; background: transparent; -webkit-text-fill-color: transparent; }
.editor textarea::selection { background: #264f7880; }
.editor textarea:focus-visible { outline: 1px solid #ffffff15; outline-offset: -1px; }
.token-comment { color: #6a9955; }
.token-string { color: #ce9178; }
.token-keyword { color: #569cd6; }
.token-type { color: #4ec9b0; }
.token-number { color: #b5cea8; }
.status { border: 0; padding: 6px 12px; font-size: 12px; }
.testbody { height: calc(100% - 36px); padding: 16px; }
.case { background: transparent; color: #999; font-size: 14px; padding: 5px 12px; }
.case.active { background: #ffffff12; color: #eff1f6; font-weight: 500; }
.field { font-size: 13px; }
.value { background: #ffffff0a; padding: 10px 12px; }
.problem-footer { height: 24px; background: #0f0f0f; color: #777; font-size: 11px; padding: 4px 12px; text-align: center; }
/* Library */
.library-header { height: 50px; background: #262626; border-bottom: 1px solid #ffffff14; justify-content: flex-start; gap: 32px; }
.library-header nav { display: flex; height: 100%; gap: 26px; align-items: stretch; }
.library-header nav a { display: flex; align-items: center; color: #aaa; font-size: 15px; }
.library-header nav a[aria-current] { color: #eff1f6; border-bottom: 2px solid #eff1f6; font-weight: 500; }
.library-header .header-note { margin-left: auto; }
.library-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr) 270px; min-height: calc(100dvh - 50px); }
.sidebar { border-right: 1px solid #ffffff14; padding: 24px 16px; display: flex; flex-direction: column; gap: 6px; }
.sidebar a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 6px; font-weight: 500; }
.sidebar a:hover { background: #ffffff08; }
.sidebar .selected { background: #ffffff12; }
.sidebar-divider { height: 1px; background: #ffffff14; margin: 20px 0; }
.sidebar-label { color: #888; font-size: 12px; padding: 0 12px 6px; }
.sidebar a:nth-last-of-type(1) { font-size: 13px; font-weight: 400; }
.favorite { color: #ffbf5c; font-size: 18px; }
.sidebar-bottom { margin-top: auto; padding: 24px 12px 0; color: #777; font-size: 12px; }
.library-main { min-width: 0; padding: 40px 24px; max-width: 1100px; width: 100%; margin: 0 auto; }
.study-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; scroll-margin-top: 24px; }
.study-card { min-height: 190px; border-radius: 10px; padding: 22px; position: relative; overflow: hidden; transition: transform .15s; }
.study-card:hover { transform: translateY(-2px); }
.beginner { background: linear-gradient(115deg, #244e71, #1b344f); }
.advanced { background: linear-gradient(115deg, #56417a, #32234f); }
.card-eyebrow { font-size: 10px; letter-spacing: 1px; color: #ffffffa8; position: relative; z-index: 1; }
.study-card h2 { font-size: 23px; line-height: 1.15; margin: 12px 0 9px; font-weight: 600; position: relative; z-index: 1; }
.study-card p { font-size: 12px; margin: 0 0 18px; color: #ffffffb3; position: relative; z-index: 1; }
.card-cta { display: inline-block; padding: 7px 10px; border-radius: 5px; background: #ffffffed; color: #253048; font-size: 12px; font-weight: 500; position: relative; z-index: 1; }
.card-art { position: absolute; right: -14px; top: 38px; transform: rotate(-14deg); color: #ffffff18; }
.card-art .icon { width: 150px; height: 150px; stroke-width: 1; }
.topic-list { display: flex; flex-wrap: wrap; gap: 14px 20px; padding: 30px 0 25px; font-size: 13px; }
.topic-list b { font-weight: 400; font-size: 12px; color: #aaa; border-radius: 12px; background: #ffffff0f; padding: 1px 5px; margin-left: 2px; }
.list-heading { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #ffffff14; padding-bottom: 16px; }
.list-heading h1 { font-size: 15px; background: #eff1f6; color: #262626; padding: 8px 16px; border-radius: 20px; margin: 0; letter-spacing: 0; font-weight: 500; }
.list-heading>span { font-size: 12px; color: #888; }
.filters { display: flex; align-items: center; gap: 10px; padding: 16px 0; }
.search { background: #ffffff12; border-radius: 20px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex: 1; max-width: 380px; color: #aaa; }
.search input { width: 100%; background: transparent; color: #eff1f6; border: 0; outline: 0; font-size: 13px; min-width: 0; }
.search:focus-within { outline: 1px solid #777; }
.difficulty-filter { position: relative; }
.difficulty-filter select { appearance: none; border: 0; background: #ffffff12; color: #aaa; padding: 8px 28px 8px 12px; border-radius: 20px; font-size: 13px; cursor: pointer; }
.difficulty-filter>span { position: absolute; right: 10px; top: 6px; pointer-events: none; color: #aaa; }
.random-button { background: transparent; color: #2cbb5d; padding: 6px; margin-left: auto; font-size: 13px; white-space: nowrap; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 400; color: #888; padding: 10px 12px; border-bottom: 1px solid #ffffff14; }
td { padding: 18px 12px; vertical-align: top; }
tbody tr:nth-child(odd) { background: #ffffff06; }
tbody tr:hover { background: #ffffff0c; }
.number { color: #aaa; width: 1%; }
.title a { font-weight: 500; line-height: 1.5; }
.title a:hover { color: #4b9df6; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tags .tag { font-size: 10px; padding: 2px 7px; }
.rate { color: #aaa; white-space: nowrap; }
td>.easy, td>.medium { background: none; padding: 0; font-size: 13px; }
#empty { text-align: center; color: #aaa; padding: 30px 0; }
.list-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; color: #888; font-size: 12px; }
.page-number { background: #ffffff14; border-radius: 5px; padding: 6px 11px; color: #ddd; }
.library-main footer { margin-top: 60px; border-top: 1px solid #ffffff14; padding-top: 18px; color: #777; font-size: 12px; line-height: 1.7; }
.library-aside { padding: 40px 20px 24px 0; }
.progress-card, .recommendation { background: #262626; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.library-aside h2 { font-size: 14px; font-weight: 500; margin: 0; }
.progress-ring { width: 135px; height: 135px; border: 6px solid #ffffff12; border-radius: 50%; display: grid; place-items: center; margin: 24px auto; text-align: center; }
.progress-ring strong { font-size: 30px; font-weight: 500; }
.progress-ring strong span { font-size: 16px; color: #888; }
.progress-ring small { display: block; font-size: 12px; margin-top: 4px; color: #aaa; }
.progress-level { display: flex; justify-content: space-between; margin: 14px 0; font-size: 12px; }
.progress-level>span:last-child { color: #999; }
.easy-text { color: #46c6c2; }.medium-text { color: #fac31d; }.hard-text { color: #f8615c; }
.library-aside p { font-size: 12px; color: #999; line-height: 1.6; margin-bottom: 0; }
.recommendation { background: linear-gradient(140deg, #352d20, #262626); }
.recommendation-icon { display: block; color: #ffa116; font-size: 24px; margin-bottom: 14px; }
.recommendation a { display: block; margin-top: 18px; font-size: 12px; color: #ffa116; }
@media (min-width: 1500px) { .library-layout { grid-template-columns: 240px minmax(0, 1fr) 300px; }.library-main { padding-top: 48px; }.library-aside { padding-top: 48px; } }
@media (max-width: 1150px) { .library-layout { grid-template-columns: 190px minmax(0, 1fr); }.library-aside { display: none; }.problem-header .header-note { display: none; }.toolbar { position: static; transform: none; } }
@media (max-width: 800px) { .problem-page .layout { height: auto; grid-template-columns: 1fr; }.description { height: auto; max-height: 65dvh; }.problem-page .right { grid-template-rows: 400px 340px; }.problem-footer { height: auto; }.problem-nav { gap: 4px; padding-left: 10px; }.header-left { gap: 10px; }.library-layout { grid-template-columns: 1fr; }.sidebar { display: none; }.library-main { padding: 28px 20px; }.library-header .header-note { display: none; } }
@media (max-width: 540px) { header { padding: 0 10px; }.brand { font-size: 18px; gap: 5px; }.brand img { width: 18px; height: 22px; }.problem-nav a>span { display: none; }.problem-nav { padding-left: 8px; }.toolbar button { padding: 0 8px; font-size: 12px; }.toolbar .icon { width: 15px; }.problem-header { gap: 6px; }.library-header { gap: 24px; }.library-header nav { gap: 16px; }.library-header nav a { font-size: 13px; }.study-cards { gap: 12px; }.study-card { padding: 16px; min-height: 202px; }.study-card h2 { font-size: 21px; }.card-eyebrow { font-size: 9px; letter-spacing: .5px; }.card-art { display: none; }.library-main { padding: 20px 12px; }.topic-list { gap: 12px; }.list-heading>span { font-size: 11px; }.rate { display: none; }th, td { padding-left: 8px; padding-right: 8px; }.random-button span { display: none; }.filters { gap: 6px; }.tags .tag { font-size: 9px; }.library-main footer { margin-top: 40px; } }
@media (prefers-reduced-motion: reduce) { .study-card { transition: none; } }
