:root {
  color-scheme: light;
  --ink: #0d0e11;
  --text: #5c636f;
  --strong: #333a44;
  --faint: #626a77;
  --line: #e9ebef;
  --hair: #f1f2f5;
  --canvas: #f1f3f5;
  --page: #fff;
  --card: #fff;
  --raise: #fff;
  --fill: #f3f5f8;
  --mini: #f6f7f9;
  --nav: rgba(255, 255, 255, .92);
  --nav-text: #24282e;
  --solid: #0d0e11;
  --on-solid: #fff;
  --blue: #2a66b0;
  --blue-hi: #5c97d6;
  --link: #2a66b0;
  --link-line: #c5cad2;
  --coral: #f2503b;
  --ln: #e7e9ee;
  --tile-bg: #fff;
  --sc-border: #fff;
  --ok: #146b27;
  --ok-bg: #e8f6ec;
  --kev: #b4300f;
  --kev-bg: #fdeee9;
  --track: #eceff4;
  --pn-bg: #f4f6f9;
  --ghost: #fff;
  --ghost-end: rgba(255, 255, 255, .25);
  --env: #f7f8fa;
  --call-end: #f8f9fb;
  --field: #f6f7f9;
  --term-edge: transparent;
  --icon-filter: none;
  --logo-light: block;
  --logo-dark: none;
  --moon: block;
  --sun: none;
  --head: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --r: 24px;
  --soft: 0 1px 2px rgba(16, 24, 40, .04), 0 18px 40px -22px rgba(16, 24, 40, .22);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --ink: #f3f5f8;
    --text: #a7afbc;
    --strong: #d3d8e0;
    --faint: #98a1af;
    --line: #262c37;
    --hair: #20262f;
    --canvas: #0f1218;
    --page: #0b0e13;
    --card: #161a22;
    --raise: #1e232d;
    --fill: #222833;
    --mini: #1b2029;
    --nav: rgba(22, 26, 34, .86);
    --nav-text: #e3e7ee;
    --solid: #f3f5f8;
    --on-solid: #0d0e11;
    --link: #8fc1f2;
    --link-line: #4b5463;
    --ln: #2a313d;
    --tile-bg: #1e232d;
    --sc-border: #2a313d;
    --ok: #74d690;
    --ok-bg: rgba(56, 194, 87, .16);
    --kev: #ffa899;
    --kev-bg: rgba(242, 80, 59, .18);
    --track: #2a313d;
    --pn-bg: #12161d;
    --ghost: #1c212a;
    --ghost-end: rgba(28, 33, 42, .2);
    --env: #181d25;
    --call-end: #12161d;
    --field: #11151c;
    --term-edge: #262c37;
    --icon-filter: brightness(1.5);
    --logo-light: none;
    --logo-dark: block;
    --moon: none;
    --sun: block;
    --soft: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -22px rgba(0, 0, 0, .7);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --ink: #f3f5f8;
  --text: #a7afbc;
  --strong: #d3d8e0;
  --faint: #98a1af;
  --line: #262c37;
  --hair: #20262f;
  --canvas: #0f1218;
  --page: #0b0e13;
  --card: #161a22;
  --raise: #1e232d;
  --fill: #222833;
  --mini: #1b2029;
  --nav: rgba(22, 26, 34, .86);
  --nav-text: #e3e7ee;
  --solid: #f3f5f8;
  --on-solid: #0d0e11;
  --link: #8fc1f2;
  --link-line: #4b5463;
  --ln: #2a313d;
  --tile-bg: #1e232d;
  --sc-border: #2a313d;
  --ok: #74d690;
  --ok-bg: rgba(56, 194, 87, .16);
  --kev: #ffa899;
  --kev-bg: rgba(242, 80, 59, .18);
  --track: #2a313d;
  --pn-bg: #12161d;
  --ghost: #1c212a;
  --ghost-end: rgba(28, 33, 42, .2);
  --env: #181d25;
  --call-end: #12161d;
  --field: #11151c;
  --term-edge: #262c37;
  --icon-filter: brightness(1.5);
  --logo-light: none;
  --logo-dark: block;
  --moon: none;
  --sun: block;
  --soft: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -22px rgba(0, 0, 0, .7);
}

@font-face { font-family: 'Inter Tight'; src: url('/fonts/intertight-latin.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter Tight'; src: url('/fonts/intertight-vi.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; src: url('/fonts/bvp-latin-400.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Be Vietnam Pro'; src: url('/fonts/bvp-vi-400.woff2') format('woff2'); font-weight: 400; font-display: swap; unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; src: url('/fonts/bvp-latin-500.woff2') format('woff2'); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Be Vietnam Pro'; src: url('/fonts/bvp-vi-500.woff2') format('woff2'); font-weight: 500; font-display: swap; unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; src: url('/fonts/bvp-latin-600.woff2') format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Be Vietnam Pro'; src: url('/fonts/bvp-vi-600.woff2') format('woff2'); font-weight: 600; font-display: swap; unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jbmono-latin.woff2') format('woff2'); font-weight: 100 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jbmono-vi.woff2') format('woff2'); font-weight: 100 800; font-display: swap; unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 400 15px/1.55 var(--body); }
h1, h2, h3 { margin: 0; color: var(--ink); font-family: var(--head); line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: clamp(26px, 3vw, 34px); }
h2 { font-size: 19px; letter-spacing: -.012em; }
h3 { margin-top: 20px; font-size: 16px; }
p { margin: 0; }
a { color: var(--link); text-underline-offset: 3px; }
code { padding: 1px 5px; border-radius: 6px; background: var(--fill); color: var(--strong); font: 400 .88em var(--mono); overflow-wrap: anywhere; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
.logo-light { display: var(--logo-light); }
.logo-dark { display: var(--logo-dark); }
.moon { display: var(--moon); }
.sun { display: var(--sun); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 20; padding: 8px 14px; border-radius: 10px; background: var(--solid); color: var(--on-solid); }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--blue-hi); outline-offset: 2px; }

.bar { position: sticky; top: 12px; z-index: 10; display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; width: min(1240px, calc(100% - 24px)); margin: 12px auto 0; padding: 8px 10px 8px 16px; background: var(--nav); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--soft); }
.bar nav { display: flex; gap: 2px; flex-wrap: wrap; }
.bar nav a { padding: 6px 12px; border-radius: 10px; color: var(--nav-text); font-weight: 500; text-decoration: none; }
.bar nav a:hover { background: var(--fill); }
.bar nav a[aria-current] { background: var(--fill); color: var(--ink); }
.bar-end { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.bar-end form { margin: 0; }
.brand { display: block; }

main { width: min(1240px, calc(100% - 24px)); margin: 0 auto; padding: 22px 0 60px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; }
.back { display: inline-block; margin-bottom: 4px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; color: var(--faint); font-size: 13.5px; }

.card { padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.card + .card { margin-top: 14px; }
.card > h2 { margin-bottom: 12px; }
.card[id] { scroll-margin-top: 136px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.two .card + .card { margin-top: 0; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { display: grid; gap: 2px; padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; font-size: 13.5px; }
.tile b { color: var(--ink); font: 600 24px/1.15 var(--head); letter-spacing: -.02em; }
.tile.hot { border-color: var(--blue-hi); }

.setup { margin-bottom: 14px; }
.setup ul { margin: 0; padding-left: 18px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.tabs a, .tabs button { padding: 6px 12px; border: 0; border-radius: 10px; background: none; color: var(--strong); font: 500 14px var(--body); text-decoration: none; cursor: pointer; }
.tabs a:hover, .tabs button:hover { background: var(--fill); }
.tabs [aria-current], .tabs [aria-selected='true'] { background: var(--solid); color: var(--on-solid); }
.jump { position: sticky; top: 76px; z-index: 5; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }

.posts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.posts a { display: flex; gap: 14px; align-items: center; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; color: inherit; text-decoration: none; }
.posts a:hover { border-color: var(--blue-hi); }
.thumb { display: grid; place-items: center; flex: 0 0 136px; height: 76px; overflow: hidden; border-radius: 10px; background: var(--fill); color: var(--faint); font-size: 12.5px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-text { display: grid; gap: 2px; min-width: 0; }
.post-text strong { color: var(--ink); font-weight: 600; }
.err { color: var(--kev); font-size: 13.5px; }
.empty { padding: 34px 20px; color: var(--faint); text-align: center; }

.chip { display: inline-block; padding: 1px 9px; border-radius: 99px; background: var(--fill); color: var(--strong); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.bad, .chip.warn { background: var(--kev-bg); color: var(--kev); }
.chip.info { background: var(--solid); color: var(--on-solid); }

button, .btn { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--raise); color: var(--ink); font: 500 14px/1.3 var(--body); text-decoration: none; cursor: pointer; }
button:hover, .btn:hover { border-color: var(--faint); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.primary:hover { background: #235694; border-color: #235694; }
.ghost { border-color: transparent; background: none; color: var(--strong); }
.danger { color: var(--kev); }
.wide { width: 100%; margin-top: 8px; }

.stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; color: var(--strong); font-size: 14px; font-weight: 500; }
small, .hint { color: var(--faint); font-size: 13px; font-weight: 400; }
input:not([type='checkbox']), select, textarea { width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--ink); font: 400 14.5px/1.5 var(--body); }
input[readonly] { color: var(--faint); }
textarea { resize: vertical; }
.mono { font: 400 13.5px/1.6 var(--mono); }
.check { display: flex; align-items: center; gap: 8px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
fieldset { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.pane legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
fieldset > label, fieldset > .row { margin-top: 12px; }
legend { color: var(--ink); font: 600 16px var(--head); }
.days { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; }
.days legend { font: 500 14px var(--body); color: var(--strong); }
.savebar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; margin: 0 -22px -20px; padding: 12px 22px; background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 20px 20px; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.editor-side { display: grid; gap: 14px; }
.editor-side .card + .card { margin-top: 0; }
.editor-side h2 { margin-bottom: 8px; }
.cover { width: 100%; border-radius: 12px; margin-bottom: 10px; }
.problems { margin: 6px 0; padding-left: 18px; color: var(--kev); font-size: 14px; }
.ok-line { color: var(--ok); }
.warn-list { margin: 0 0 12px; padding: 10px 14px 10px 30px; border-radius: 12px; background: var(--kev-bg); color: var(--kev); }
.briefs { margin: 0 0 10px; padding: 0; list-style: none; font-size: 14px; }
.fig { margin: 0 0 12px; }
.fig img { border-radius: 10px; }
.fig figcaption { margin-top: 4px; }
details { margin: 8px 0; font-size: 14px; }

.alert, .notice, .flash { margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; }
.alert { background: var(--kev-bg); color: var(--kev); white-space: pre-wrap; overflow-wrap: anywhere; }
.alert a { color: inherit; }
.flash { background: var(--ok-bg); color: var(--ok); }
.flash.bad { background: var(--kev-bg); color: var(--kev); }
.notice { background: var(--fill); color: var(--strong); }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { color: var(--ink); font-weight: 600; text-align: left; white-space: nowrap; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.steps { margin: 0; padding-left: 20px; }
.steps li { padding: 4px 0; overflow-wrap: anywhere; }
.steps li b { color: var(--ink); font-weight: 600; }
.steps li span { color: var(--faint); font-size: 13px; }
.steps li.bad, .steps li.bad b { color: var(--kev); }
.keyline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 14px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0 0 12px; }
.facts dt { color: var(--strong); font-weight: 500; }
.facts dd { margin: 0; }
.log { max-height: 240px; margin: 0 0 12px; padding: 12px; border-radius: 12px; background: var(--fill); color: var(--strong); font: 400 12.5px/1.5 var(--mono); overflow: auto; white-space: pre-wrap; }
.versions { margin: 8px 0; padding: 0; list-style: none; }
.versions li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.card form + form { margin-top: 8px; }

.bare main { display: grid; place-items: center; min-height: 100vh; padding: 20px 0; }
.auth { display: grid; gap: 14px; width: min(400px, 100%); padding: 28px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--soft); }
.auth h1 { font-size: 24px; }
.auth .alert { margin: 0; }
.qr { display: grid; place-items: center; padding: 12px; border-radius: 14px; background: #fff; }
.qr svg { width: 200px; height: 200px; }

@media (max-width: 960px) {
  .editor, .two { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jump { position: static; }
}
@media (max-width: 560px) {
  .bar { position: static; }
  .thumb { flex-basis: 96px; height: 54px; }
  .card { padding: 16px; }
  .savebar { margin: 0 -16px -16px; padding: 10px 16px; }
  .card[id] { scroll-margin-top: 12px; }
}
