:root {
  font-family: Inter, system-ui, sans-serif;
  color-scheme: dark;
  color: #f1ebe0;
  background: #11111b;
  --panel: #1a1a25;
  --line: #393845;
  --muted: #bcb4a7;
  --gold: #d4bf9c;
  --ink: #f1ebe0;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--gold); text-underline-offset: .23em; }
:focus-visible { outline: 2px solid #f4d69f; outline-offset: 4px; }
.masthead {
  min-height: 68px; background: #171722; border-bottom: 1px solid var(--line);
  padding: 12px max(20px, calc((100% - 1080px) / 2)); display: flex;
  align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; white-space: nowrap; }
.mark { background: var(--gold); color: #231e18; border-radius: 9px; padding: 7px 9px; letter-spacing: -.04em; }
.workspace { width: min(1080px, 100% - 40px); margin: 40px auto 64px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-head nav { display: flex; gap: 20px; flex-wrap: wrap; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -.045em; }
h2 { font-size: 1.18rem; letter-spacing: -.02em; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; padding: 22px; min-width: 0; }
.session { max-width: 450px; }
.session button { margin-top: 16px; }
.controls { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.controls label { margin-top: 0; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
#revision, #preview-label, .news-item time, .story time { color: var(--muted); font-size: .88rem; }
label { display: block; margin: 16px 0 6px; font-size: .91rem; font-weight: 620; }
input, select, button { font: inherit; }
input, select { width: 100%; min-width: 0; min-height: 42px; padding: 9px 10px; border: 1px solid #50505f; border-radius: 8px; background: #222230; color: var(--ink); }
button { cursor: pointer; border: 1px solid transparent; border-radius: 8px; padding: 9px 13px; font-weight: 700; }
button:disabled { cursor: progress; opacity: .6; }
.primary { background: var(--gold); color: #211c18; }
.quiet { color: var(--ink); background: #262632; border-color: var(--line); }
fieldset { margin: 16px 0 0; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
legend { color: var(--muted); padding: 0 4px; font-size: .86rem; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.two label { margin-top: 0; }
.form-actions { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 20px; }
.checkbox { display: flex; align-items: center; gap: 8px; margin: 0; }
.checkbox input { width: 18px; min-height: 18px; accent-color: var(--gold); }
.notice { padding: 12px 14px; margin-bottom: 14px; border: 1px solid #3b654e; background: #22382e; border-radius: 8px; }
.notice[data-error] { border-color: #855456; background: #422c33; }
#preview-label { margin-top: 7px; overflow-wrap: anywhere; }
.preview-frame { aspect-ratio: 3 / 1; min-height: 110px; display: grid; place-items: center; border: 1px dashed #555261; border-radius: 10px; margin-top: 16px; color: var(--muted); padding: 14px; text-align: center; }
.preview-frame img { max-width: 100%; max-height: 180px; object-fit: contain; }

.reader { color-scheme: light; background: #f6f3ed; color: #1a1920; }
.reader .masthead { background: #181822; border-color: #272733; }
.reader .masthead a:first-child { font-size: 1.16rem; font-weight: 700; text-decoration: none; }
.reading { width: min(940px, 100% - 40px); margin: 32px auto 64px; }
.reading h1 { margin-bottom: 16px; }
.reading a { color: #513a24; }
.reader-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; }
.reader-grid > .ad-slot { max-width: 280px; align-self: start; }
.ad-slot { display: grid; gap: 6px; margin: 0 0 20px; min-width: 0; }
.ad-slot small { color: #62584d; }
.ad-slot img { max-width: 100%; max-height: 240px; object-fit: contain; display: block; }
.news-item { border-top: 1px solid #d5cbbf; padding: 16px 0; }
.news-item h2 { margin: 5px 0; }
.news-item time, .story time { color: #62584d; }
.story { max-width: 720px; line-height: 1.65; }
.story h1 { margin-top: 10px; }
.story .ad-slot { margin: 24px 0; }
.story-body { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .editor-grid, .reader-grid { grid-template-columns: 1fr; }
  .workspace { margin-top: 28px; }
}
@media (max-width: 430px) {
  .two, .controls { grid-template-columns: 1fr; }
}
