:root {
  --ink: #07090d;
  --panel: #0d1118;
  --raised: #111722;
  --paper: #f4f1ea;
  --muted: #929aa6;
  --line: rgba(244,241,234,.13);
  --line-strong: rgba(244,241,234,.28);
  --ember: #ff6b3d;
  --ice: #87d8ee;
  --green: #78d8a0;
}

* { box-sizing: border-box; }
html { background: var(--ink); color-scheme: dark; }
body { min-height: 100vh; margin: 0; background: var(--ink); color: var(--paper); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; padding: 24px; background: radial-gradient(circle at 18% 18%, rgba(255,107,61,.11), transparent 32rem), radial-gradient(circle at 82% 76%, rgba(135,216,238,.09), transparent 34rem), var(--ink); }
.login-panel { display: grid; width: min(100%, 1180px); min-height: calc(100vh - 48px); margin: auto; padding: 38px; border: 1px solid var(--line); border-radius: 30px; background: rgba(13,17,24,.85); grid-template-rows: auto 1fr auto; box-shadow: 0 40px 100px rgba(0,0,0,.34); }
.studio-brand { display: inline-flex; align-items: center; gap: 12px; width: max-content; font-size: 14px; font-weight: 800; letter-spacing: .17em; }
.studio-brand img { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.8); border-radius: 10px; }
.login-copy { align-self: center; padding: 70px 4vw; }
.studio-kicker { margin: 0 0 26px; color: #8c949f; font: 650 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; text-transform: uppercase; }
.login-copy h1 { margin: 0; font-size: clamp(64px, 8vw, 112px); font-weight: 650; letter-spacing: -.075em; line-height: .86; }
.login-copy > p:last-child { max-width: 560px; margin: 34px 0 0; color: #aeb4bd; font-size: 18px; line-height: 1.6; }
.login-form { padding: 30px 4vw 20px; border-top: 1px solid var(--line); }
.login-fields { display: grid; align-items: end; grid-template-columns: minmax(180px, .72fr) minmax(240px, 1fr) auto; gap: 10px; }
.login-form label { display: grid; gap: 10px; }
.login-form label > span { color: #808894; font: 600 9px/1 ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; }
.login-form input { min-width: 0; min-height: 56px; padding: 0 18px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: #080b10; color: var(--paper); }
.login-form input:focus { border-color: var(--ice); }
.login-form button { min-height: 56px; padding: 0 22px; border: 0; border-radius: 12px; background: var(--paper); color: var(--ink); font-weight: 700; cursor: pointer; }
.form-message { min-height: 20px; margin: 10px 0 0; color: #ff9c80; font-size: 12px; }

.studio { min-height: 100vh; background: radial-gradient(circle at 82% 10%, rgba(135,216,238,.06), transparent 28rem), var(--ink); }
.studio-header { position: sticky; top: 0; z-index: 20; display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(7,9,13,.88); backdrop-filter: blur(20px); }
.studio-header-actions { display: flex; align-items: center; gap: 24px; color: #a7adb6; font-size: 12px; }
.quiet-button, .text-button { padding: 0; border: 0; background: transparent; color: #8f97a2; cursor: pointer; }
.studio-layout { display: grid; min-height: calc(100vh - 76px); grid-template-columns: 320px minmax(0, 1fr); }
.post-library { position: sticky; top: 76px; height: calc(100vh - 76px); overflow-y: auto; padding: 28px 18px; border-right: 1px solid var(--line); background: rgba(9,12,17,.74); }
.library-heading { display: flex; align-items: end; justify-content: space-between; padding: 0 8px 24px; }
.library-heading .studio-kicker { margin-bottom: 12px; }
.library-heading h2 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.new-post-button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: transparent; font-size: 24px; cursor: pointer; }
.new-post-button:hover { background: var(--paper); color: var(--ink); }
.post-list { display: grid; gap: 8px; }
.post-list-item { display: grid; width: 100%; gap: 9px; padding: 16px; border: 1px solid transparent; border-radius: 14px; background: transparent; text-align: left; cursor: pointer; }
.post-list-item:hover { background: rgba(255,255,255,.035); }
.post-list-item.active { border-color: var(--line); background: var(--raised); }
.post-status { width: max-content; color: #838c98; font: 600 8px/1 ui-monospace, monospace; letter-spacing: .13em; text-transform: uppercase; }
.post-status.published { color: var(--green); }
.post-list-item strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.post-list-item small { color: #68717d; font-size: 10px; }
.library-empty { padding: 30px 16px; color: #747d88; font-size: 13px; line-height: 1.6; }

.editor-panel { width: min(100%, 1100px); margin: 0 auto; padding: 30px clamp(24px, 5vw, 70px) 70px; }
.editor-topline { display: flex; align-items: center; justify-content: space-between; padding-bottom: 26px; color: #737c88; font: 600 9px/1 ui-monospace, monospace; letter-spacing: .13em; text-transform: uppercase; }
#save-status[data-tone="success"] { color: var(--green); }
#save-status[data-tone="error"] { color: #ff8b6b; }
.post-fields { display: grid; gap: 24px; }
.post-fields label { display: grid; gap: 9px; }
.post-fields label > span { color: #7b8490; font: 600 8px/1 ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; }
.post-fields input { width: 100%; min-width: 0; border: 0; border-bottom: 1px solid var(--line); outline: 0; background: transparent; color: var(--paper); }
#post-title { padding: 8px 0 18px; font-size: clamp(46px, 6vw, 78px); font-weight: 650; letter-spacing: -.065em; line-height: .95; }
#post-title::placeholder { color: #343b45; }
.field-row { display: grid; grid-template-columns: .75fr 1.25fr; gap: 24px; }
.field-row input { padding: 10px 0 13px; color: #bbc0c7; font-size: 13px; }

.cover-field { margin-top: 34px; }
.cover-preview { display: grid; min-height: 260px; place-items: center; overflow: hidden; border: 1px dashed var(--line-strong); border-radius: 20px; background: radial-gradient(circle at 65% 35%, rgba(135,216,238,.13), transparent 27%), linear-gradient(145deg,#0d121a,#090c11); }
.cover-preview > div { text-align: center; }
.cover-preview span { display: block; margin-bottom: 12px; color: #707986; font: 600 8px/1 ui-monospace, monospace; letter-spacing: .16em; text-transform: uppercase; }
.cover-preview strong { color: #b9bec6; font-size: 15px; }
.cover-preview img { width: 100%; height: 330px; object-fit: cover; }
.cover-actions { display: flex; gap: 18px; margin-top: 12px; }

.secondary-button, .publish-button, .danger-button { min-height: 44px; padding: 0 16px; border-radius: 11px; font-size: 12px; font-weight: 650; cursor: pointer; }
.secondary-button { border: 1px solid var(--line); background: var(--raised); color: #d4d6da; }
.publish-button { border: 0; background: var(--paper); color: var(--ink); }
.danger-button { border: 1px solid rgba(255,107,61,.3); background: transparent; color: #ff8b6b; }

.writing-room { margin-top: 44px; border: 1px solid var(--line); border-radius: 20px; background: #090c11; }
.editor-toolbar { position: sticky; top: 76px; z-index: 10; display: flex; flex-wrap: wrap; gap: 5px; padding: 10px; border-bottom: 1px solid var(--line); border-radius: 20px 20px 0 0; background: rgba(13,17,24,.94); backdrop-filter: blur(16px); }
.editor-toolbar button { min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #aeb4bd; font-size: 11px; cursor: pointer; }
.editor-toolbar button:hover, .editor-toolbar button:focus-visible { border-color: var(--line); background: var(--raised); color: var(--paper); }
.editor-toolbar > span { width: 1px; margin: 4px 3px; background: var(--line); }
.rich-editor { min-height: 620px; padding: clamp(30px, 5vw, 70px); outline: none; color: #d5d6d9; font-family: Georgia, "Times New Roman", serif; font-size: 20px; line-height: 1.8; }
.rich-editor:empty::before { color: #4d5661; content: attr(data-placeholder); pointer-events: none; }
.rich-editor p { margin-top: 0; margin-bottom: 1.4em; }
.rich-editor h2, .rich-editor h3 { color: var(--paper); font-family: Inter, ui-sans-serif, sans-serif; letter-spacing: -.04em; line-height: 1.15; }
.rich-editor h2 { margin: 1.6em 0 .6em; font-size: 42px; }
.rich-editor h3 { margin: 1.5em 0 .55em; font-size: 30px; }
.rich-editor blockquote { margin: 2em 0; padding-left: 24px; border-left: 3px solid var(--ember); color: var(--paper); font-size: 1.15em; }
.rich-editor img { max-width: 100%; margin: 1.6em 0; border-radius: 16px; }
.rich-editor a { color: var(--ice); text-decoration: underline; }

.editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; }
.editor-actions > div { display: flex; gap: 10px; margin-left: auto; }

@media (max-width: 900px) {
  .studio-layout { grid-template-columns: 1fr; }
  .post-library { position: static; height: auto; max-height: 330px; border-right: 0; border-bottom: 1px solid var(--line); }
  .editor-panel { padding-top: 28px; }
  .editor-toolbar { top: 76px; }
}

@media (max-width: 620px) {
  .login-shell { padding: 0; }
  .login-panel { min-height: 100vh; padding: 24px; border: 0; border-radius: 0; }
  .login-copy { padding: 60px 0; }
  .login-form { padding: 24px 0 10px; }
  .login-fields { grid-template-columns: 1fr; }
  .studio-header { padding: 0 16px; }
  .studio-header-actions { gap: 14px; }
  .studio-header-actions > a { display: none; }
  .editor-panel { padding-right: 16px; padding-left: 16px; }
  .field-row { grid-template-columns: 1fr; }
  .cover-preview { min-height: 210px; }
  .rich-editor { min-height: 520px; padding: 28px 20px; }
  .editor-actions { align-items: stretch; flex-direction: column-reverse; }
  .editor-actions > div { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
}
