:root {
  color-scheme: dark;
  font: 100%/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --canvas: #101317;
  --panel: #191e24;
  --raised: #222830;
  --field: #12161b;
  --line: #343c45;
  --text: #f0eee9;
  --muted: #a7afb8;
  --accent: #ff7b51;
  --accent-text: #ffab90;
  --accent-wash: #412b26;
  --positive: #b6e0be;
  --positive-wash: #25392e;
  --warning: #ffe0aa;
  --warning-wash: #3b3124;
  --error: #ffb5ad;
  --error-wash: #412929;
  --radius: 1.15rem;
  color: var(--text);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 17.5rem; min-height: 100dvh; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-text); text-underline-offset: .21em; }
a:hover { color: #ffd5c8; }
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .57; }
:focus-visible { outline: 2px solid #ffc1af; outline-offset: 3px; }
h1 { font-size: clamp(2.4rem, 5vw, 3.65rem); line-height: 1.01; letter-spacing: -.075em; font-weight: 720; }
h2 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -.03em; }
h3 { font-size: 1.08rem; line-height: 1.35; letter-spacing: -.016em; }
.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: .875rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .835rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.notice, .form-notice { color: var(--positive); }
.notice { padding: .8rem 1rem; margin-bottom: 1rem; border-radius: .75rem; background: var(--positive-wash); }
.notice.error { color: var(--error); background: var(--error-wash); }
.form-notice { margin-top: .5rem; color: var(--error); }

.brand { display: flex; align-items: center; gap: .68rem; min-width: 0; }
.brand strong { font-size: 1.26rem; font-weight: 770; letter-spacing: -.065em; white-space: nowrap; }
.mark { position: relative; display: grid; align-content: center; justify-items: start; gap: .18rem; padding: 0 .58rem; width: 2.45rem; height: 2.45rem; border-radius: .7rem; background: var(--accent); color: #28150f; }
.mark i, .artmark i { display: block; width: 100%; height: .17rem; border-radius: 100vw; background: currentColor; }
.mark i:nth-child(2), .artmark i:nth-child(2) { width: 66%; }
.mark i:nth-child(3), .artmark i:nth-child(3) { width: 83%; }

.workspace { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); align-items: start; gap: clamp(1.15rem, 3vw, 2.3rem); max-width: 87rem; margin-inline: auto; padding: 1.4rem clamp(1.05rem, 3vw, 2rem); }
.sidebar { position: sticky; top: 1.4rem; display: flex; flex-direction: column; min-height: calc(100dvh - 2.8rem); padding: 1rem .75rem; }
.sidebar .brand { padding: .2rem .28rem 1.5rem; }
.navigation { display: grid; gap: .28rem; }
.navigation a { display: flex; gap: .72rem; align-items: center; min-height: 2.7rem; padding: .56rem .72rem; border: 1px solid transparent; border-radius: .7rem; font-weight: 590; font-size: .92rem; color: var(--muted); text-decoration: none; }
.navigation a:hover { background: var(--raised); color: var(--text); }
.navigation a[aria-current="page"] { color: #fff1eb; border-color: #784b3e; background: var(--accent-wash); }
.nav-icon { position: relative; display: block; flex: 0 0 1.05rem; width: 1.05rem; height: 1.05rem; opacity: .85; }
.nav-feed { border-block: 1.5px solid currentColor; height: .79rem; }
.nav-feed::after { position: absolute; content: ""; height: 1.5px; inset: calc(50% - .75px) .26rem auto 0; background: currentColor; }
.nav-sources { overflow: hidden; }
.nav-sources::after, .nav-sources::before { position: absolute; content: ""; width: 1.45rem; height: 1.45rem; right: .04rem; top: .035rem; border: 1.5px solid currentColor; border-radius: 50%; }
.nav-sources::before { width: 1.45rem; height: 1.45rem; top: .35rem; right: .36rem; }
.nav-publish { border: 1.5px solid currentColor; border-radius: .19rem; width: .91rem; flex-basis: .91rem; margin-inline-end: .14rem; }
.nav-publish::after { position: absolute; content: ""; inset: .31rem .16rem auto; height: 1.5px; background: currentColor; box-shadow: 0 .23rem currentColor; }
#logout { align-self: flex-start; margin-top: auto; }

.main { min-width: 0; padding-block: .6rem 1.75rem; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; }
.page-header > div, .source-row > * { min-width: 0; }
.mode { display: flex; gap: .42rem; align-items: center; min-height: 1.2rem; margin-bottom: .48rem; font-size: .83rem; font-weight: 620; color: var(--muted); }
.mode::before { content: ""; width: .37rem; height: .37rem; flex: 0 0 .37rem; border-radius: 50%; background: currentColor; }
.mode.live { color: var(--positive); }
.content { display: grid; gap: .85rem; }
.tabs { display: flex; align-items: center; flex-wrap: wrap; gap: .42rem; margin-bottom: .25rem; }
.tabs .button { border-color: transparent; background: transparent; color: var(--muted); min-height: 2.45rem; }
.tabs .button:hover { color: var(--text); background: var(--raised); }
.tabs .button[aria-pressed="true"] { border-color: var(--line); color: var(--text); background: var(--raised); }
.count { font-variant-numeric: tabular-nums; color: var(--muted); margin-left: .13rem; }
.stream { display: grid; gap: .75rem; }
.story { min-width: 0; padding: clamp(.85rem, 2vw, 1.25rem); }
.story-head, .section-head, .dialog-header, .source-row, .inline-list, .form-actions, .story-links { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .85rem; }
.story-head, .section-head, .dialog-header { justify-content: space-between; }
.story-head { gap: .38rem .8rem; }
.story-head .meta { font-variant-numeric: tabular-nums; }
.story h2 { margin-top: .55rem; overflow-wrap: anywhere; }
.story .summary { margin-top: .45rem; max-width: 52rem; overflow-wrap: anywhere; }
.story-links { margin-block: .69rem 0; font-size: .9rem; }
.story-links a { overflow-wrap: anywhere; }
.story-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .48rem; margin-top: .9rem; }
.story-error { margin-top: .62rem; color: var(--error); overflow-wrap: anywhere; }
.empty { padding: 1.1rem; color: var(--muted); border: 1px dashed #49505c; border-radius: var(--radius); }
.empty a { display: inline-block; margin-top: .5rem; }
.badge { display: inline-flex; align-items: center; padding: .18rem .54rem; width: fit-content; border-radius: 100vw; font-size: .8rem; line-height: 1.28; font-weight: 610; color: #d7dde2; background: #303943; }
.badge.positive { color: var(--positive); background: var(--positive-wash); }
.badge.warning { color: var(--warning); background: var(--warning-wash); }
.badge.error { color: var(--error); background: var(--error-wash); }

.section-card { padding: clamp(.9rem, 2vw, 1.2rem); }
.section-head { margin-bottom: .8rem; }
.source-list { display: grid; }
.source-row { padding-block: .75rem; justify-content: space-between; }
.source-row + .source-row { border-top: 1px solid var(--line); }
.source-row p { overflow-wrap: anywhere; }
.source-row a, .source-row .endpoint { display: block; width: fit-content; max-width: 100%; overflow-wrap: anywhere; margin-block: .26rem; }
.source-row .inline-list { margin-top: .25rem; }
.source-info { flex: 1 1 14rem; }
.settings-grid { width: min(100%, 42rem); }
.qwen-settings summary { display: flex; align-items: center; justify-content: space-between; gap: .55rem; cursor: pointer; list-style: none; }
.qwen-settings summary::-webkit-details-marker { display: none; }
.qwen-settings summary::after { content: "+"; color: var(--muted); font-size: 1.15rem; }
.qwen-settings[open] summary::after { content: "−"; }
.qwen-settings summary h2 { margin-inline-end: auto; }
.setting-status { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; column-gap: .7rem; padding-block: .55rem; }
.setting-status + .setting-status { border-top: 1px solid var(--line); }
.settings-form { display: grid; gap: .8rem; margin-top: .7rem; }
.settings-form .form-actions { margin-top: .15rem; }

.button { display: inline-flex; justify-content: center; align-items: center; gap: .28rem; min-height: 2.48rem; padding: .43rem .75rem; border: 1px solid #48525d; border-radius: .65rem; background: var(--raised); color: var(--text); font-size: .9rem; font-weight: 620; white-space: nowrap; text-decoration: none; }
.button:hover { background: #2b333d; }
.button.primary { color: #26160f; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: #ff9472; border-color: #ff9472; }
.button.subtle { background: transparent; }
.button.subtle:hover { background: var(--raised); }
.button.danger { color: var(--error); }
.button.compact { min-height: 2.24rem; padding: .29rem .65rem; }
input, textarea { width: 100%; min-width: 0; padding: .52rem .66rem; color: var(--text); background: var(--field); border: 1px solid #4d5966; border-radius: .58rem; }
input::placeholder, textarea::placeholder { color: #87939e; }
textarea { min-height: 5.2rem; resize: vertical; }
input[type="checkbox"] { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); margin: 0; }
label { font-size: .92rem; font-weight: 640; }
.field { display: grid; gap: .36rem; }
.check { display: flex; align-items: center; gap: .56rem; width: fit-content; }
.form-fields { display: grid; gap: .7rem; margin-top: .8rem; }
.form-actions { justify-content: flex-start; margin-top: .8rem; }
dialog { width: min(36rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 1.5rem); overflow: auto; padding: 1.05rem; color: var(--text); background: var(--panel); border: 1px solid #4d5964; border-radius: var(--radius); box-shadow: 0 2rem 5rem #0008; }
dialog::backdrop { background: #090b0dd4; }
.dialog-header { align-items: start; gap: .55rem; }
.dialog-header h2 { padding-block: .3rem; }

.login-layout { display: grid; min-height: 100dvh; padding: 1.25rem; place-items: center; }
.login-shell { width: min(100%, 47rem); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); border: 1px solid var(--line); border-radius: 1.3rem; overflow: hidden; background: var(--panel); box-shadow: 0 1.5rem 4rem #00045; }
.login-form { grid-area: 1 / 1; display: grid; gap: .55rem; padding: clamp(1.15rem, 4vw, 2.3rem); align-content: center; }
.login-form h1 { margin-block: 1rem .6rem; font-size: clamp(2.1rem, 5vw, 2.95rem); }
.login-form button { margin-top: .28rem; }
.login-art { display: grid; place-items: center; grid-area: 1 / 2; min-height: 20rem; background: radial-gradient(ellipse at 60% 40%, #512f27 0, #2a2426 60%, #212023 100%); border-inline-start: 1px solid #594039; }
.artmark { display: grid; align-content: center; justify-items: start; gap: .7rem; width: min(8.7rem, 68%); aspect-ratio: 1; padding-inline: 1.5rem; color: #e5876c; border: 1px solid #7d5144; border-radius: 24%; transform: rotate(-10deg); box-shadow: 0 .85rem 2rem #100e0e63; background: #432b29; }
.artmark i { height: .59rem; }

@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); gap: .9rem; padding: .85rem; }
  .sidebar { position: static; display: grid; grid-template-columns: 1fr auto; min-height: 0; padding: .65rem; }
  .sidebar .brand { padding: .07rem .16rem .4rem; }
  .navigation { display: flex; flex-wrap: wrap; grid-row: 2; grid-column: 1 / -1; }
  .navigation a { min-height: 2.4rem; gap: .43rem; padding-inline: .5rem; }
  #logout { grid-column: 2; grid-row: 1; align-self: start; margin-top: 0; }
  .main { padding-top: .15rem; }
  .page-header { margin-bottom: 1rem; }
  .login-shell { grid-template-columns: 1fr; max-width: 23rem; }
  .login-art { display: none; }
}
@media (max-width: 370px) {
  .navigation .nav-icon { display: none; }
  .page-header { align-items: center; }
  .page-header .button { min-height: 2.3rem; }
}
