:root {
      --bg:        #0c0c10;
      --surface:   #14141a;
      --surface2:  #1c1c25;
      --border:    #252530;
      --border2:   #30303e;
      --accent:    #7c5cfc;
      --accent2:   #fc5c7d;
      --green:     #22c55e;
      --green-dim: #16a34a;
      --text:      #eaeaf5;
      --muted:     #64647a;
      --muted2:    #44445a;
      --r:         10px;
    }

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    :focus-visible { outline: 3px solid rgba(124,92,252,.72); outline-offset: 3px; }
    html, body { height: 100%; }

    body {
      font-family: 'DM Sans', sans-serif;
      background: var(--bg);
      color: var(--text);
      display: flex;
      flex-direction: column;
      min-height: 100vh;
      overflow-x: hidden;
    }

    /* Ambient */
    body::before {
      content: '';
      position: fixed;
      top: -25vh; left: -15vw;
      width: 60vw; height: 60vh;
      background: radial-gradient(ellipse, rgba(124,92,252,.10) 0%, transparent 65%);
      pointer-events: none; z-index: 0;
    }
    body::after {
      content: '';
      position: fixed;
      bottom: -15vh; right: -10vw;
      width: 45vw; height: 45vh;
      background: radial-gradient(ellipse, rgba(252,92,125,.07) 0%, transparent 65%);
      pointer-events: none; z-index: 0;
    }

    /* ── Header ── */
    header {
      padding: 0 32px;
      height: 56px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--border);
      background: rgba(12,12,16,.9);
      backdrop-filter: blur(16px);
      position: sticky; top: 0; z-index: 200;
      flex-shrink: 0;
    }

    .logo {
      font-family: 'Syne', sans-serif;
      font-size: 20px;
      font-weight: 800;
      letter-spacing: -.03em;
      background: linear-gradient(100deg, var(--accent) 30%, var(--accent2));
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .logo sup {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: .06em;
      -webkit-text-fill-color: var(--muted);
      color: var(--muted);
    }

    .header-right { display: flex; align-items: center; gap: 12px; }

    .model-badge {
      font-size: 11px;
      font-weight: 500;
      color: var(--muted);
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 100px;
      padding: 4px 11px;
      letter-spacing: .04em;
    }

    .articles-btn {
      font-size: 12.5px;
      font-weight: 500;
      color: var(--text);
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 8px;
      padding: 5px 13px;
      cursor: pointer;
      transition: border-color .15s;
      display: flex; align-items: center; gap: 6px;
    }
    .articles-btn:hover { border-color: var(--accent); color: var(--accent); }
    .articles-btn.header-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
    .articles-btn.header-primary:hover { color: #fff; opacity: .9; }
    .legacy-header-action { display: none !important; }

    /* ── Landing ── */
    .landing {
      position: relative;
      min-height: calc(100vh - 56px);
      overflow: hidden;
      display: flex;
      align-items: center;
      padding: 56px 32px;
      z-index: 1;
    }
    .landing-bg {
      position: absolute;
      inset: 0;
      background:
        radial-gradient(circle at 18% 20%, rgba(124,92,252,.22), transparent 34%),
        radial-gradient(circle at 88% 12%, rgba(252,92,125,.14), transparent 30%);
      pointer-events: none;
    }
    .landing-inner {
      position: relative;
      width: min(1180px, 100%);
      margin: 0 auto;
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
      gap: 34px;
      align-items: center;
    }
    .landing-pill {
      display: inline-flex;
      border: 1px solid rgba(124,92,252,.35);
      background: rgba(124,92,252,.12);
      color: var(--accent);
      border-radius: 999px;
      padding: 7px 12px;
      font: 800 11px 'Syne', sans-serif;
      letter-spacing: .12em;
      text-transform: uppercase;
      margin-bottom: 18px;
    }
    .landing h1 {
      font-family: 'Syne', sans-serif;
      font-size: clamp(38px, 7vw, 78px);
      line-height: .96;
      letter-spacing: -.06em;
      max-width: 850px;
    }
    .landing p {
      color: var(--muted);
      font-size: 17px;
      line-height: 1.7;
      max-width: 690px;
      margin-top: 20px;
    }
    .landing-actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
    .landing-actions .btn-gen, .landing-actions .btn-tool { width: auto; min-width: 190px; justify-content: center; }
    .landing-card {
      background: rgba(20,20,26,.86);
      border: 1px solid var(--border2);
      border-radius: 22px;
      padding: 24px;
      box-shadow: 0 24px 80px rgba(0,0,0,.28);
      backdrop-filter: blur(12px);
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .landing-card-head { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; }
    .landing-feature {
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 14px;
      display: flex;
      flex-direction: column;
      gap: 5px;
    }
    .landing-feature strong { color: var(--text); font-size: 14px; }
    .landing-feature span { color: var(--muted); font-size: 13px; line-height: 1.55; }
    .landing-legal { display:flex;gap:12px;flex-wrap:wrap;border-top:1px solid var(--border);padding-top:14px;margin-top:4px; }
    .landing-legal a { color: var(--accent); font-size: 12px; text-decoration:none; }
    .landing-legal a:hover { text-decoration:underline; }

    /* ── App grid ── */
    .app {
      flex: 1;
      display: grid;
      grid-template-columns: 400px 1fr;
      min-height: calc(100vh - 56px);
      position: relative; z-index: 1;
    }

    /* ── Left panel ── */
    .panel {
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .panel-scroll { padding: 24px 22px; display: flex; flex-direction: column; gap: 20px; }

    .section-label {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: .14em;
      text-transform: uppercase;
      color: var(--muted);
      display: flex; align-items: center; gap: 8px;
    }
    .section-label::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--border);
    }
    .welcome-note { display: flex; flex-direction: column; gap: 4px; padding: 13px 14px; border: 1px solid rgba(34,197,94,.32); border-radius: var(--r); background: rgba(34,197,94,.09); }
    .welcome-note[hidden] { display: none; }
    .welcome-note strong { color: var(--green); font-size: 13px; }
    .welcome-note span { color: var(--muted); font-size: 12px; line-height: 1.45; }
    .advanced-settings { border: 1px solid var(--border2); border-radius: var(--r); background: rgba(28,28,37,.45); }
    .advanced-settings summary { padding: 12px 14px; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; list-style-position: inside; }
    .advanced-settings[open] summary { color: var(--text); border-bottom: 1px solid var(--border); }
    .advanced-settings-body { display: flex; flex-direction: column; gap: 18px; padding: 14px; }

    /* Fields */
    .field { display: flex; flex-direction: column; gap: 7px; }

    label.flabel {
      font-size: 12.5px;
      font-weight: 500;
      color: var(--text);
      display: flex; align-items: center; gap: 7px;
    }

    textarea, input[type="text"] {
      width: 100%;
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: var(--r);
      color: var(--text);
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      padding: 10px 13px;
      transition: border-color .18s, box-shadow .18s;
      outline: none;
      resize: vertical;
      line-height: 1.6;
    }
    textarea { min-height: 100px; }
    textarea:focus, input[type="text"]:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(124,92,252,.12);
    }
    textarea.invalid { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(252,92,125,.1); }
    textarea::placeholder, input::placeholder { color: var(--muted2); }
    .field-error { min-height: 0; color: var(--accent2); font-size: 11.5px; line-height: 1.4; }
    .field-error:empty { display: none; }
    .topic-examples { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
    .topic-examples span { color: var(--muted); font-size: 11.5px; }
    .topic-examples button { border: 1px solid var(--border2); border-radius: 999px; background: transparent; color: var(--muted); padding: 5px 9px; font: 500 11px 'DM Sans',sans-serif; cursor: pointer; }
    .topic-examples button:hover { color: var(--accent); border-color: var(--accent); }

    /* Segmented */
    .seg-group { display: grid; gap: 5px; }
    .seg-group.g2 { grid-template-columns: 1fr 1fr; }
    .seg-group.g3 { grid-template-columns: 1fr 1fr 1fr; }
    .seg-group.g5 { grid-template-columns: repeat(5, 1fr); }

    .seg-opt { display: none; }
    .seg-lbl {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      padding: 9px 6px 8px;
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 8px;
      cursor: pointer;
      font-size: 11.5px;
      font-weight: 500;
      color: var(--muted);
      text-align: center;
      line-height: 1.3;
      transition: all .15s;
      user-select: none;
    }
    .seg-lbl .ic { font-size: 17px; }
    .seg-opt:checked + .seg-lbl {
      background: rgba(124,92,252,.14);
      border-color: var(--accent);
      color: var(--text);
    }
    .seg-lbl:hover { border-color: rgba(124,92,252,.4); color: var(--text); }

    /* Drop zone */
    .dropzone {
      border: 2px dashed var(--border2);
      border-radius: var(--r);
      padding: 22px 16px;
      text-align: center;
      cursor: pointer;
      position: relative;
      transition: all .18s;
    }
    .dropzone:hover, .dropzone.over { border-color: var(--accent); background: rgba(124,92,252,.05); }
    .dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
    .dz-ico { font-size: 28px; margin-bottom: 6px; }
    .dz-txt { font-size: 13px; color: var(--muted); line-height: 1.5; }
    .dz-txt strong { color: var(--accent); }

    .dz-preview {
      display: none; gap: 10px; align-items: center;
      background: var(--surface2); border: 1px solid var(--border2);
      border-radius: 8px; padding: 9px 12px; margin-top: 8px;
      font-size: 13px;
    }
    .dz-preview.on { display: flex; }
    .dz-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
    .dz-fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 12.5px; }
    .dz-rm { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 17px; padding: 0; line-height: 1; flex-shrink: 0; }
    .dz-rm:hover { color: var(--accent2); }

    /* Generate button */
    .btn-gen {
      width: 100%;
      padding: 14px;
      border: none;
      border-radius: var(--r);
      background: linear-gradient(130deg, var(--accent) 0%, var(--accent2) 100%);
      color: #fff;
      font-family: 'Syne', sans-serif;
      font-size: 14.5px;
      font-weight: 700;
      letter-spacing: .02em;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      transition: opacity .2s, transform .1s;
    }
    .btn-gen::before {
      content: '';
      position: absolute;
      top: 0; left: -100%; width: 60%; height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent);
      animation: shim 2s infinite;
    }
    @keyframes shim { to { left: 160%; } }
    .btn-gen:hover { opacity: .92; }
    .btn-gen:active { transform: scale(.98); }
    .btn-gen:disabled { opacity: .45; cursor: not-allowed; }
    .btn-gen:disabled::before { animation: none; }
    .generation-hint { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.5; }
    .generation-hint.warning { color: var(--accent2); }

    /* ── Right pane ── */
    .preview-pane {
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    /* Toolbar */
    .toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 20px;
      height: 48px;
      border-bottom: 1px solid var(--border);
      background: rgba(20,20,26,.95);
      backdrop-filter: blur(8px);
      flex-shrink: 0;
      gap: 12px;
    }

    .toolbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

    .device-switch {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 3px;
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 9px;
      flex-shrink: 0;
    }
    .device-btn {
      border: none;
      background: transparent;
      color: var(--muted);
      border-radius: 7px;
      padding: 5px 8px;
      font-family: 'DM Sans', sans-serif;
      font-size: 11.5px;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      transition: background .15s, color .15s;
    }
    .device-btn:hover { color: var(--text); }
    .device-btn.active { background: rgba(124,92,252,.18); color: var(--accent); }

    .status-indicator {
      display: flex; align-items: center; gap: 7px;
      font-size: 12px; font-weight: 500; color: var(--muted);
    }
    .dot {
      width: 7px; height: 7px; border-radius: 50%;
      background: var(--muted2);
      transition: background .3s, box-shadow .3s;
      flex-shrink: 0;
    }
    .dot.live    { background: var(--green); box-shadow: 0 0 6px var(--green); }
    .dot.loading { background: var(--accent); animation: blink 1s infinite; }
    @keyframes blink { 0%,100%{opacity:1} 50%{opacity:.35} }

    .toolbar-actions { display: flex; align-items: center; gap: 8px; position: relative; }
    .update-action:disabled { display: none; }
    .result-more { position: relative; }
    .result-more > summary { list-style: none; background: var(--surface2); border: 1px solid var(--border2); border-radius: 7px; color: var(--text); font-size: 12.5px; font-weight: 500; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
    .result-more > summary::-webkit-details-marker { display: none; }
    .result-more > summary::after { content: ' ⋯'; color: var(--muted); }
    .result-more[open] > summary { border-color: var(--accent); color: var(--accent); }
    .result-more-menu { position: absolute; top: calc(100% + 7px); right: 0; z-index: 80; width: 190px; display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--border2); border-radius: 10px; background: var(--surface); box-shadow: 0 16px 45px rgba(0,0,0,.4); }
    .result-more-menu .btn-tool { width: 100%; justify-content: flex-start; }

    .btn-tool {
      display: flex; align-items: center; gap: 5px;
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 7px;
      color: var(--text);
      font-family: 'DM Sans', sans-serif;
      font-size: 12.5px;
      font-weight: 500;
      padding: 6px 12px;
      cursor: pointer;
      transition: all .15s;
      white-space: nowrap;
    }
    .btn-tool:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
    .btn-tool:disabled { opacity: .35; cursor: not-allowed; }

    .btn-publish {
      background: linear-gradient(130deg, rgba(34,197,94,.15), rgba(22,163,74,.2));
      border-color: rgba(34,197,94,.4);
      color: var(--green);
    }
    .btn-publish:hover:not(:disabled) {
      background: linear-gradient(130deg, rgba(34,197,94,.25), rgba(22,163,74,.3));
      border-color: var(--green);
      color: var(--green);
    }

    /* Preview frame */
    .frame-wrap {
      flex: 1;
      position: relative;
      overflow: hidden;
      background: #fff;
      transition: background .18s, padding .18s;
    }

    iframe#preview {
      width: 100%;
      height: 100%;
      border: none;
      background: #fff;
      position: relative; z-index: 1;
      transition: width .18s, border-radius .18s, box-shadow .18s;
    }
    .frame-wrap.device-tablet,
    .frame-wrap.device-phone {
      display: flex;
      justify-content: center;
      align-items: stretch;
      padding: 18px;
      overflow: auto;
      background: radial-gradient(circle at top, rgba(124,92,252,.12), transparent 45%), #0b0b10;
    }
    .frame-wrap.device-tablet iframe#preview {
      width: 768px;
      max-width: 100%;
      border-radius: 16px;
      box-shadow: 0 18px 60px rgba(0,0,0,.45);
    }
    .frame-wrap.device-phone iframe#preview {
      width: 390px;
      max-width: 100%;
      border-radius: 24px;
      box-shadow: 0 18px 60px rgba(0,0,0,.5);
    }

    /* Empty state */
    .empty {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
      background: var(--bg);
      z-index: 2;
      pointer-events: none;
      transition: opacity .3s;
    }
    .empty.gone { opacity: 0; pointer-events: none; }
    .empty-icon { font-size: 52px; opacity: .2; }
    .empty-title { font: 700 18px 'Syne',sans-serif; color: var(--text); }
    .empty-steps { margin: 0; padding-left: 22px; color: var(--muted); font-size: 13px; line-height: 1.9; }
    .empty-steps li::marker { color: var(--accent); font-weight: 700; }

    /* Loading overlay */
    .overlay {
      position: absolute;
      inset: 0;
      background: rgba(12,12,16,.88);
      backdrop-filter: blur(6px);
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 18px;
      z-index: 5;
    }
    .overlay.on { display: flex; }

    .spinner {
      width: 44px; height: 44px;
      border: 3px solid var(--border2);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin .75s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    .ov-title {
      font-family: 'Syne', sans-serif;
      font-size: 14px;
      font-weight: 600;
      color: var(--muted);
    }

    .gen-timer {
      font-family: 'Syne', sans-serif;
      font-size: 42px;
      font-weight: 700;
      color: var(--accent);
      line-height: 1;
      text-align: center;
    }
    .gen-timer small { font-size: 14px; font-weight: 400; margin-left: 4px; color: var(--muted); }
    .gen-timer.slow { color: var(--accent2); }
    .timer-bar-wrap {
      width: 180px; height: 3px;
      background: var(--border2);
      border-radius: 2px;
      overflow: hidden;
    }
    .timer-bar {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, var(--accent), var(--accent2));
      border-radius: 2px;
      transition: width 1s linear;
    }
    .steps { display: flex; flex-direction: column; gap: 7px; }
    .step {
      display: flex; align-items: center; gap: 9px;
      font-size: 13px; color: var(--muted2);
      transition: color .25s, opacity .25s;
      opacity: .4;
    }
    .step.active { color: var(--accent); opacity: 1; }
    .step.done   { color: var(--green);  opacity: .8; }
    .step-ico { font-size: 15px; width: 20px; text-align: center; }

    .gen-timer {
      font-family: 'Syne', sans-serif;
      font-size: 38px;
      font-weight: 800;
      color: var(--text);
      letter-spacing: -0.03em;
      text-align: center;
      line-height: 1;
    }
    .gen-timer small { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 5px; letter-spacing: 0; }
    .timer-bar-wrap {
      width: 180px;
      height: 3px;
      background: var(--border2);
      border-radius: 2px;
      overflow: hidden;
    }
    .timer-bar {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, var(--accent), var(--accent2));
      border-radius: 2px;
      transition: width 1s linear;
    }

    /* ── Publish result banner ── */
    .pub-banner {
      display: none;
      align-items: center;
      gap: 12px;
      padding: 10px 16px;
      background: rgba(34,197,94,.08);
      border-bottom: 1px solid rgba(34,197,94,.2);
      flex-shrink: 0;
    }
    .pub-banner.on { display: flex; }
    .pub-icon { font-size: 18px; flex-shrink: 0; }
    .pub-text { flex: 1; font-size: 12.5px; line-height: 1.4; }
    .pub-text strong { color: var(--green); font-size: 11px; display: block; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 2px; }
    .pub-url {
      color: var(--accent);
      font-size: 13px;
      font-weight: 500;
      text-decoration: none;
      word-break: break-all;
    }
    .pub-url:hover { text-decoration: underline; }
    .btn-copy {
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 6px;
      color: var(--muted);
      font-size: 12px;
      padding: 5px 10px;
      cursor: pointer;
      transition: all .15s;
      white-space: nowrap;
    }
    .btn-copy:hover { border-color: var(--accent); color: var(--accent); }
    .btn-copy.copied { border-color: var(--green); color: var(--green); }

    /* ── Articles drawer ── */
    .drawer-backdrop {
      display: none;
      position: fixed; inset: 0;
      background: rgba(0,0,0,.6);
      backdrop-filter: blur(4px);
      z-index: 300;
    }
    .drawer-backdrop.on { display: block; }

    .drawer {
      position: fixed;
      top: 0; right: 0;
      width: 360px; height: 100%;
      background: var(--surface);
      border-left: 1px solid var(--border);
      z-index: 301;
      display: flex;
      flex-direction: column;
      transform: translateX(100%);
      transition: transform .28s cubic-bezier(.4,0,.2,1);
    }
    .drawer.open { transform: translateX(0); }

    .drawer-header {
      padding: 18px 20px;
      border-bottom: 1px solid var(--border);
      display: flex; align-items: center; justify-content: space-between;
    }
    .drawer-title {
      font-family: 'Syne', sans-serif;
      font-size: 15px;
      font-weight: 700;
    }
    .drawer-close {
      background: none; border: none;
      color: var(--muted); font-size: 20px;
      cursor: pointer; padding: 0; line-height: 1;
    }
    .drawer-close:hover { color: var(--text); }

    .drawer-search-wrap { padding: 12px 16px; border-bottom: 1px solid var(--border); }
    .drawer-search {
      width: 100%;
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 8px;
      color: var(--text);
      font-family: 'DM Sans', sans-serif;
      font-size: 13px;
      padding: 9px 12px;
      outline: none;
    }
    .drawer-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,252,.12); }

    .drawer-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }

    .art-card {
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 8px;
      padding: 12px 14px;
      transition: border-color .15s;
      display: flex;
      gap: 10px;
      align-items: flex-start;
    }
    .art-card:hover { border-color: var(--accent); }
    .art-card-link { flex: 1; text-decoration: none; min-width: 0; }
    .art-card-title { font-size: 13.5px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
    .art-card-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
    .art-card-slug { font-family: monospace; font-size: 11px; color: var(--accent); }
    .art-card-delete {
      background: transparent;
      border: 1px solid rgba(252,92,125,.25);
      border-radius: 6px;
      color: var(--accent2);
      cursor: pointer;
      font-size: 12px;
      padding: 5px 8px;
      flex-shrink: 0;
    }
    .art-card-delete:hover { background: rgba(252,92,125,.1); border-color: var(--accent2); }

    .drawer-empty { color: var(--muted); font-size: 13.5px; text-align: center; padding: 40px 0; }

    /* ── Toast ── */
    .toast {
      position: fixed;
      bottom: 24px; right: 24px;
      background: #2a1a1a;
      border: 1px solid #6b2a2a;
      border-radius: 8px;
      padding: 12px 18px;
      color: #ff8a8a;
      font-size: 13.5px;
      max-width: 340px;
      z-index: 999;
      transform: translateY(130%);
      transition: transform .28s cubic-bezier(.4,0,.2,1);
    }
    .toast.on { transform: translateY(0); }

    /* ── Publish modal ── */
    .modal-backdrop {
      display: none;
      position: fixed; inset: 0;
      background: rgba(0,0,0,.7);
      backdrop-filter: blur(6px);
      z-index: 500;
      align-items: center;
      justify-content: center;
    }
    .modal-backdrop.on { display: flex; }

    .modal {
      background: var(--surface);
      border: 1px solid var(--border2);
      border-radius: 16px;
      padding: 32px;
      width: 460px;
      max-width: calc(100vw - 40px);
      display: flex;
      flex-direction: column;
      gap: 18px;
      animation: modalIn .2s ease;
    }
    @keyframes modalIn {
      from { opacity:0; transform: scale(.94) translateY(10px); }
      to   { opacity:1; transform: scale(1)  translateY(0); }
    }

    .modal-icon { font-size: 40px; text-align: center; }
    .modal-title {
      font-family: 'Syne', sans-serif;
      font-size: 20px;
      font-weight: 700;
      text-align: center;
      color: var(--text);
    }
    .modal-description { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; text-align: center; }
    .confirm-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
    .confirm-actions .btn-gen, .confirm-actions .btn-tool { width: 100%; justify-content: center; }
    .modal-url-wrap {
      display: flex;
      gap: 8px;
      align-items: center;
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 8px;
      padding: 10px 14px;
    }
    .modal-url {
      flex: 1;
      font-size: 13.5px;
      color: var(--accent);
      word-break: break-all;
      text-decoration: none;
      font-weight: 500;
    }
    .modal-url:hover { text-decoration: underline; }
    .publish-success-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .publish-success-actions .btn-tool, .publish-success-actions .btn-gen { width: 100%; justify-content: center; text-align: center; }
    .publish-open { display: flex; align-items: center; text-decoration: none; padding: 10px 12px; }
    .btn-modal-copy {
      background: var(--accent);
      border: none;
      border-radius: 6px;
      color: #fff;
      font-size: 12px;
      font-weight: 600;
      padding: 6px 12px;
      cursor: pointer;
      white-space: nowrap;
      transition: opacity .15s;
      flex-shrink: 0;
    }
    .btn-modal-copy:hover { opacity: .85; }
    .btn-modal-copy.copied { background: var(--green); }
    .btn-modal-close {
      width: 100%;
      padding: 11px;
      border: 1px solid var(--border2);
      border-radius: 8px;
      background: transparent;
      color: var(--muted);
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      cursor: pointer;
      transition: all .15s;
    }
    .btn-modal-close:hover { border-color: var(--text); color: var(--text); }

    /* ── Admin modal ── */
    .admin-input {
      width: 100%;
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 8px;
      color: var(--text);
      font-family: 'DM Sans', sans-serif;
      font-size: 14px;
      padding: 10px 13px;
      outline: none;
      transition: border-color .18s;
    }
    .admin-input:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(252,92,125,.12); }
    .legal-check { display:flex; gap:10px; align-items:flex-start; color:var(--muted); font-size:12px; line-height:1.45; }
    .legal-check input { margin-top:2px; accent-color:var(--accent); flex-shrink:0; }
    .legal-check a { color:var(--accent); text-decoration:none; }
    .legal-check a:hover { text-decoration:underline; }
    .btn-danger {
      width: 100%;
      padding: 11px;
      border: none;
      border-radius: 8px;
      background: linear-gradient(130deg, #9b1c1c, #c53030);
      color: #fff;
      font-family: 'Syne', sans-serif;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      transition: opacity .15s;
    }
    .btn-danger:hover { opacity: .88; }

    .billing-products { display: flex; flex-direction: column; gap: 10px; }
    .billing-product {
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 12px;
      padding: 14px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .billing-product-title { color: var(--text); font-weight: 700; font-size: 14px; }
    .billing-product-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
    .billing-product-price { color: var(--green); font-family: 'Syne', sans-serif; font-weight: 800; white-space: nowrap; }

    .editor-modal {
      width: min(980px, calc(100vw - 40px));
      height: min(760px, calc(100vh - 40px));
      padding: 22px;
    }
    .html-editor {
      width: 100%;
      flex: 1;
      min-height: 420px;
      resize: none;
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 12.5px;
      line-height: 1.5;
      background: #09090d;
    }
    .modal-actions { display: flex; gap: 10px; }
    .modal-actions .btn-tool, .modal-actions .btn-gen { justify-content: center; }
    .modal-actions.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }

    .visual-editor-modal { width: min(1100px, calc(100vw - 40px)); }
    .visual-editor {
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      padding-right: 4px;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .visual-editor-toolbar { display: flex; gap: 10px; align-items: center; }
    .visual-editor-toolbar select { flex: 1; }
    .visual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .visual-grid label, .visual-full {
      display: flex;
      flex-direction: column;
      gap: 6px;
      font-size: 12px;
      color: var(--muted);
      font-weight: 600;
    }
    .visual-textarea { min-height: 84px; resize: vertical; }
    .visual-section-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding-top: 4px;
      color: var(--text);
      font-family: 'Syne', sans-serif;
      font-weight: 700;
      font-size: 14px;
    }
    .visual-list { display: flex; flex-direction: column; gap: 10px; }
    .visual-card {
      background: var(--surface2);
      border: 1px solid var(--border2);
      border-radius: 10px;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 9px;
    }
    .visual-card-head { display: flex; gap: 8px; align-items: center; }
    .visual-card-head .admin-input { flex: 1; }
    .visual-paragraphs { display: flex; flex-direction: column; gap: 7px; }
    .visual-row { display: flex; gap: 8px; align-items: flex-start; }
    .visual-row .admin-input { flex: 1; }
    .visual-list.compact .visual-row { align-items: center; }
    .visual-mini-btn {
      background: transparent;
      border: 1px solid var(--border2);
      color: var(--muted);
      border-radius: 7px;
      min-width: 34px;
      height: 34px;
      cursor: pointer;
      flex-shrink: 0;
    }
    .visual-mini-btn:hover { color: var(--accent2); border-color: var(--accent2); }
    .raw-json-wrap { display: none; flex-direction: column; gap: 10px; }
    .raw-json-wrap.on { display: flex; }
    .raw-json-wrap .html-editor { min-height: 260px; }

    /* ── Responsive ── */
    @media (max-width: 980px) {
      .app { grid-template-columns: 360px minmax(0, 1fr); }
      .toolbar { align-items: flex-start; height: auto; min-height: 48px; padding: 10px 14px; }
      .toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
    }

    @media (max-width: 860px) {
      html, body { height: auto; min-height: 100%; }
      body { overflow-x: hidden; }
      header {
        height: auto;
        min-height: 56px;
        padding: 10px 14px;
        gap: 10px;
        flex-wrap: wrap;
        align-items: flex-start;
      }
      .logo { font-size: 18px; line-height: 1.2; }
      .header-right {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
        flex-wrap: wrap;
      }
      .model-badge { display: none; }
      .articles-btn { padding: 7px 10px; font-size: 12px; }

      .landing { padding: 34px 16px; align-items: flex-start; }
      .landing-inner { grid-template-columns: 1fr; gap: 22px; }
      .landing h1 { font-size: clamp(34px, 12vw, 54px); }
      .landing p { font-size: 15.5px; }
      .landing-actions { flex-direction: column; }
      .landing-actions .btn-gen, .landing-actions .btn-tool { width: 100%; }
      .landing-card { padding: 16px; border-radius: 16px; }

      .app {
        display: flex;
        flex-direction: column;
        min-height: 0;
      }
      .panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: none;
        overflow: visible;
      }
      .panel-scroll { padding: 18px 14px; gap: 16px; }
      textarea { min-height: 120px; }
      .seg-group.g5 { grid-template-columns: repeat(3, 1fr); }
      .seg-lbl { min-height: 54px; padding: 8px 5px; font-size: 11px; }

      .preview-pane {
        min-height: 72vh;
        overflow: visible;
      }
      .toolbar {
        position: sticky;
        top: 0;
        z-index: 50;
        display: block;
        padding: 10px 12px;
      }
      .toolbar-left { margin-bottom: 8px; flex-direction: column; align-items: stretch; }
      .device-switch { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
      .device-btn { padding: 7px 5px; font-size: 11px; }
      .toolbar-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
        align-items: stretch;
      }
      .result-more { min-width: 0; }
      .result-more > summary { display: flex; align-items: center; justify-content: center; min-height: 36px; padding: 8px 7px; font-size: 11.5px; }
      .result-more-menu { width: min(220px, calc(100vw - 28px)); }
      .btn-tool {
        width: 100%;
        justify-content: center;
        padding: 8px 7px;
        font-size: 11.5px;
        min-height: 36px;
        white-space: normal;
        line-height: 1.2;
      }
      .frame-wrap {
        min-height: 72vh;
        overflow: hidden;
      }
      iframe#preview { min-height: 72vh; }
      .frame-wrap.device-tablet, .frame-wrap.device-phone { padding: 10px; }

      .pub-banner { align-items: flex-start; flex-direction: column; gap: 8px; }
      .btn-copy { width: 100%; padding: 8px 10px; }

      .drawer { width: 100%; max-width: 100vw; }
      .drawer-header { padding: 14px; gap: 10px; align-items: flex-start; }
      .drawer-title { font-size: 14px; line-height: 1.3; }
      .drawer-body { padding: 12px; }
      .art-card { flex-direction: column; gap: 10px; padding: 12px; }
      .art-card-link { width: 100%; }
      .art-card-title { overflow-wrap: anywhere; }
      .art-card-meta { gap: 5px; }
      .art-card-slug { overflow-wrap: anywhere; word-break: break-word; }
      .art-card > div:last-child {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 8px !important;
      }
      .art-card-delete, .art-card .btn-tool { width: 100%; justify-content: center; min-height: 34px; }

      .modal-backdrop { align-items: flex-start; overflow-y: auto; padding: 14px; }
      .modal {
        width: 100%;
        max-width: none;
        padding: 20px;
        border-radius: 14px;
        margin: auto 0;
      }
      .modal-url-wrap { flex-direction: column; align-items: stretch; }
      .publish-success-actions { grid-template-columns: 1fr; }
      .billing-product { flex-direction: column; align-items: stretch; }
      .billing-product-price { white-space: normal; }
      .btn-modal-copy { width: 100%; padding: 9px 12px; }
      .editor-modal {
        width: 100%;
        height: calc(100dvh - 28px);
        min-height: 0;
        padding: 14px;
      }
      .html-editor { min-height: 0; font-size: 12px; }
      .visual-editor-toolbar { flex-direction: column; align-items: stretch; }
      .visual-grid { grid-template-columns: 1fr; }
      .visual-card-head, .visual-row { flex-direction: column; align-items: stretch; }
      .visual-mini-btn { width: 100%; }
      .modal-actions { flex-direction: column; }
      .modal-actions.confirm-actions { grid-template-columns: 1fr; }
      .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
    }

    @media (max-width: 520px) {
      .seg-group.g2, .seg-group.g3, .seg-group.g5 { grid-template-columns: 1fr 1fr; }
      .toolbar-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .btn-tool { font-size: 11px; padding-left: 5px; padding-right: 5px; }
      .dropzone { padding: 18px 12px; }
      .modal-title { font-size: 18px; }
    }

    @media (max-width: 360px) {
      header { padding-left: 10px; padding-right: 10px; }
      .panel-scroll { padding-left: 10px; padding-right: 10px; }
      .toolbar-actions { grid-template-columns: 1fr 1fr; }
      .seg-lbl { font-size: 10.5px; }
      .art-card > div:last-child { grid-template-columns: 1fr; }
    }
