  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --amber:      #e8a020;
    --amber-dim:  #a06810;
    --amber-dark: #2a1a04;
    --amber-deep: #160d02;
    --cyan:       #20c8d8;
    --cyan-dim:   #10788a;
    --bg:         #161616;
    --bg-deep:    #111111;
    --border:     #383838;
    --border-mid: #464646;
    --text-muted: #686868;
    --text-dim:   #505050;
  }

  html { scroll-behavior: smooth; }

  body {
    background: var(--bg);
    color: #c0b898;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
  }

  body::before {
    content: '';
    position: fixed; inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.07) 2px, rgba(0,0,0,0.07) 4px);
    pointer-events: none; z-index: 1000;
  }

  @keyframes blink        { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
  @keyframes cursor-blink { 0%, 100% { opacity: 1; }   50% { opacity: 0; } }

  /* ── Topbar ───────────────────────────────────── */
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 32px;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 200;
  }
  .topbar-left  { font-size: 10px; letter-spacing: 3px; color: var(--amber); opacity: 0.65; }
  .topbar-right { display: flex; align-items: center; gap: 16px; font-size: 10px; color: var(--cyan); opacity: 0.45; letter-spacing: 1px; }
  .blink-dot    { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: blink 2s ease-in-out infinite; }

  /* ── Shell ────────────────────────────────────── */
  .shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: 1fr auto;
    height: calc(100vh - 41px);
    max-width: 1280px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  /* ── Left sidebar ─────────────────────────────── */
  .sidebar {
    grid-column: 1;
    grid-row: 1 / 3;
    border-right: 1px solid var(--border);
    padding: 32px 0 0;             /* no bottom padding — .sidebar-foot sits flush with .footer */
    position: sticky;
    top: 41px;
    height: calc(100vh - 41px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 24px;
    font-size: 12px; letter-spacing: 2px;
    color: #6a6a6a;
    cursor: pointer;
    border-left: 2px solid transparent;
    border-bottom: none;
    text-decoration: none;
    background: none; border-top: none; border-right: none;
    width: 100%; text-align: left;
    font-family: 'IBM Plex Mono', monospace;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
  }
  .nav-item:hover { color: #929292; background: rgba(232,160,32,0.03); }
  .nav-item.active { border-left-color: var(--amber); background: var(--amber-deep); color: var(--amber); }

  .nav-dot { width: 5px; height: 5px; border-radius: 50%; background: #424242; flex-shrink: 0; transition: background 0.2s; }
  .nav-item.active .nav-dot { background: var(--amber); }
  .nav-item:hover .nav-dot  { background: #707070; }

  .sidebar-foot {
    margin-top: auto;
    padding: 4px 24px;
    border-top: 1px solid var(--border);
    font-size: 10px;
    color: #424242;
    letter-spacing: 1px;
    line-height: 1.2;
    text-align: center;
    display: flex;                 /* flexbox: trivial vertical + horizontal centering */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;                      /* small space between END_OF_LINE and copyright */
    height: 52px;                  /* matches .footer bar height (14px padding + ~22px button + 14px padding + 1px border ≈ 51px) */
    box-sizing: border-box;
    overflow: hidden;
  }
  .sidebar-foot .end-line { color: var(--cyan); opacity: 0.55; letter-spacing: 2px; display: block; }
  .sidebar-foot span { display: block; width: 100%; }

  /* ── Main content ─────────────────────────────── */
  .main { grid-column: 2; grid-row: 1; overflow-x: hidden; overflow-y: auto; display: flex; flex-direction: column; }

  /* Pages */
  .page { display: none; }
  .page.active { display: block; flex: 1; min-height: 0; }

  /* ── Shared section styles ────────────────────── */
  .section { padding: 52px 56px; border-bottom: 1px solid var(--border); }
  .section:last-child { border-bottom: none; }

  .section-label {
    font-size: 12px; letter-spacing: 3px; color: rgba(32,200,216,0.6);
    display: flex; align-items: center; gap: 12px; margin-bottom: 28px;
  }
  .section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

  .prose { font-size: 12px; color: var(--text-muted); line-height: 1.9; max-width: 720px; }
  .prose + .prose { margin-top: 16px; }

  .ic { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #c0b898; background: var(--bg-deep); border: 1px solid var(--border); padding: 1px 6px; border-radius: 2px; }

  /* ── Hero block ───────────────────────────────── */
  .hero {
    padding: 64px 56px 52px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 40px;
    align-items: start;
  }

  .section-prompt { font-size: 12px; color: var(--cyan); opacity: 0.55; letter-spacing: 2px; margin-bottom: 8px; }

  .page-title {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: clamp(52px, 7vw, 84px);
    font-weight: 700;
    color: var(--amber);
    letter-spacing: -2px;
    line-height: 0.92;
    margin-bottom: 20px;
  }
  .page-title.single { font-size: clamp(52px, 7vw, 84px); letter-spacing: -1px; }

  .page-title .cursor { color: var(--text-dim); font-weight: 100; animation: cursor-blink 1.2s step-end infinite; }

  /* Logik Portal Version and Flame Version under page title */
  .page-version { font-size: 12px; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 18px; }
  .page-version span { color: var(--cyan); opacity: 0.7; }

  .page-desc { font-size: 13px; color: var(--text-muted); line-height: 1.9; max-width: 500px; }

  .tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
  .tag { font-size: 11px; letter-spacing: 1.5px; padding: 4px 10px; border: 1px solid #424242; color: #686868; border-radius: 2px; }
  .tag.hi { background: var(--amber-deep); border-color: var(--amber-dark); color: var(--amber-dim); }

  .hero-actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; padding-top: 64px; }

  .btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 2px;
    color: var(--amber); background: var(--amber-deep); border: 1px solid var(--amber-dark);
    padding: 12px 20px; border-radius: 2px; text-decoration: none; white-space: nowrap;
    transition: border-color 0.2s, background 0.2s;
  }
  .btn-primary:hover { border-color: var(--amber-dim); background: #1e1204; }

  .btn-secondary {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 2px;
    color: var(--cyan); border: 1px solid var(--cyan-dim);
    padding: 12px 20px; border-radius: 2px; text-decoration: none; white-space: nowrap;
    opacity: 0.6; transition: opacity 0.2s;
  }
  .btn-secondary:hover { opacity: 1; }

  /* ── Info table ───────────────────────────────── */
  .info-table { width: 100%; border-collapse: collapse; font-size: 12px; }
  .info-table tr { border-bottom: 1px solid var(--border); }
  .info-table tr:last-child { border-bottom: none; }
  .info-table td { padding: 12px 0; vertical-align: top; }
  .info-table td:first-child { color: var(--cyan); opacity: 0.6; letter-spacing: 1px; width: 220px; }
  .info-table td:last-child { color: var(--text-muted); }

  /* ── Code block ───────────────────────────────── */
  .code-block { background: var(--bg-deep); border: 1px solid var(--border); border-radius: 3px; padding: 20px 24px; font-size: 12px; color: #c0b898; line-height: 1.8; overflow-x: auto; margin-top: 4px; }
  .cm { color: var(--text-dim); }
  .kw { color: var(--cyan); opacity: 0.8; }
  .st { color: var(--amber); opacity: 0.8; }
  .pt { color: #c0b898; opacity: 0.6; }

  /* ── Changelog ────────────────────────────────── */
  .changelog-entry { padding: 16px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 180px 1fr; gap: 28px; }
  .changelog-entry:last-child { border-bottom: none; }
  .changelog-ver  { font-size: 12px; color: var(--amber); opacity: 0.8; white-space: nowrap; }
  .changelog-date { font-size: 12px; color: var(--text-dim); margin-top: 3px; letter-spacing: 1px; }
  .changelog-notes { font-size: 12px; color: var(--text-muted); line-height: 1.8; list-style: none; }
  .changelog-notes li { padding-left: 14px; position: relative; }
  .changelog-notes li::before { content: '>'; position: absolute; left: 0; color: var(--cyan); opacity: 0.4; }

  /* ── Folder tree ──────────────────────────────── */
  .tree-block { background: var(--bg-deep); border: 1px solid var(--border); border-radius: 3px; padding: 20px 24px; font-size: 12px; color: #c0b898; line-height: 2; }
  .tree-block .dir  { color: var(--amber); opacity: 0.8; }
  .tree-block .file { color: var(--text-muted); }
  .tree-block .req  { color: var(--cyan); opacity: 0.7; }

  /* ── PyFlame Widget Class Reference ──────────────────────────── */
  .class-group { margin-bottom: 32px; }
  .class-group:last-child { margin-bottom: 0; }
  .class-group-title { font-size: 12px; letter-spacing: 2px; color: rgba(32,200,216,0.6); margin-bottom: 12px; }
  .class-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
  .class-item { display: flex; align-items: baseline; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 12px; }
  .class-item:last-child { border-bottom: none; }
  .class-name { color: var(--amber); font-weight: 600; min-width: 280px; flex-shrink: 0; }
  .class-desc { color: var(--text-muted); line-height: 1.6; }

  /* ── QT Widget Detail Panel ─────────────────────────────── */
  .widgets-layout { display: grid; grid-template-columns: 240px 1fr; border: 1px solid var(--border); border-radius: 3px; min-height: 520px; }
  .widget-list { border-right: 1px solid var(--border); background: var(--bg-deep); overflow-y: auto; }
  .widget-list-header { padding: 10px 16px; font-size: 12px; letter-spacing: 2px; color: rgba(32,200,216,0.6); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-deep); z-index: 1; }
  .widget-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 14px; color: #6a6a6a; cursor: pointer; border-left: 2px solid transparent; border-bottom: 1px solid var(--border); transition: color 0.15s, background 0.15s, border-color 0.15s; }
  .widget-item:last-child { border-bottom: none; }
  .widget-item:hover { color: #929292; background: rgba(255,255,255,0.02); }
  .widget-item.active { border-left-color: var(--amber); background: var(--amber-deep); color: var(--amber); }
  .widget-item-dot { width: 5px; height: 5px; border-radius: 50%; background: #383838; flex-shrink: 0; }
  .widget-item.active .widget-item-dot { background: var(--amber); }
  .widget-detail { padding: 28px 32px; overflow-y: auto; }
  .widget-detail-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-dim); font-size: 12px; letter-spacing: 2px; }
  .widget-detail-empty svg { opacity: 0.2; }
  .widget-detail-name { font-family: 'IBM Plex Sans', sans-serif; font-size: 22px; font-weight: 700; color: var(--amber); margin-bottom: 4px; letter-spacing: -0.5px; }
  .widget-detail-sub  { font-size: 12px; letter-spacing: 2px; color: var(--cyan); opacity: 0.55; margin-bottom: 16px; }
  .widget-detail-desc { font-size: 12px; color: var(--text-muted); line-height: 1.8; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
  .detail-sub-label   { font-size: 12px; letter-spacing: 2px; color: rgba(32,200,216,0.6); margin: 16px 0 8px; }
  .widget-detail-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 16px; }
  .widget-detail-table tr { border-bottom: 1px solid var(--border); }
  .widget-detail-table tr:last-child { border-bottom: none; }
  .widget-detail-table td { padding: 9px 0; vertical-align: top; }
  .widget-detail-table td:first-child { min-width: 140px; }
  .widget-detail-table td:nth-child(2) { width: 80px; color: var(--cyan); opacity: 0.55; font-size: 12px; }
  .widget-detail-table td:last-child  { color: var(--text-muted); }
  .widget-detail-code { background: var(--bg-deep); border: 1px solid var(--border); border-radius: 3px; padding: 14px 18px; font-size: 12px; line-height: 1.8; overflow-x: auto; white-space: pre; }
  .widget-detail-code .cm { color: var(--text-dim); }
  .widget-detail-code .kw { color: var(--cyan); opacity: 0.8; }
  .widget-detail-code .st { color: var(--amber); opacity: 0.8; }

  /* ── Logik Portal page text scaling ──────────── */
  #page-logik-portal .page-sections .section-label      { font-size: 14px; }
  #page-logik-portal .page-sections .prose              { font-size: 14px; }
  #page-logik-portal .page-sections .ic                 { font-size: 14px !important; }
  #page-logik-portal .page-sections .info-table         { font-size: 14px; }
  #page-logik-portal .page-sections .code-block         { font-size: 14px; }
  #page-logik-portal .page-sections .changelog-ver      { font-size: 14px; }
  #page-logik-portal .page-sections .changelog-date     { font-size: 14px; }
  #page-logik-portal .page-sections .changelog-notes    { font-size: 14px; }
  #page-logik-portal .page-sections .latest-script-name { font-size: 14px; }
  #page-logik-portal .page-sections .latest-script-desc { font-size: 13px; }
  #page-logik-portal .page-sections .latest-script-version { font-size: 12px; }
  #page-logik-portal .page-sections .latest-script-date { font-size: 12px; }

  /* ── PyFlame page text scaling ───────────────── */
  #page-pyflame .page-sections .section-label       { font-size: 14px; }
  #page-pyflame .page-sections .prose               { font-size: 14px; }
  #page-pyflame .page-sections .info-table          { font-size: 14px; }
  #page-pyflame .page-sections .ic                  { font-size: 14px !important; }
  #page-pyflame .page-sections .tree-block          { font-size: 14px; }
  #page-pyflame .page-sections .class-group-title   { font-size: 14px; }
  #page-pyflame .page-sections .class-item          { font-size: 14px; }
  #page-pyflame .page-sections .widget-list-header  { font-size: 14px; }
  #page-pyflame .page-sections .widget-item         { font-size: 16px; }
  #page-pyflame .page-sections .widget-detail-name  { font-size: 24px; }
  #page-pyflame .page-sections .widget-detail-sub   { font-size: 14px; }
  #page-pyflame .page-sections .widget-detail-desc  { font-size: 14px; }
  #page-pyflame .page-sections .detail-sub-label    { font-size: 14px; }
  #page-pyflame .page-sections .widget-detail-table { font-size: 14px; }
  #page-pyflame .page-sections .widget-detail-table thead td { font-size: 11px !important; }
  #page-pyflame .page-sections .widget-detail-code  { font-size: 14px; }

  /* ── Contact page ────────────────────────────── */
  #page-contact .prose { font-size: 14px; }

  /* ── Logik Portal + PyFlame scrollable body ──── */
  #page-logik-portal .page-sections { overflow-y: visible; }
  #page-pyflame .page-sections { overflow-y: visible; }
  .page-sections { flex: 1; overflow-y: auto; min-height: 0; }

  /* ── Scripts page fluid height ───────────────── */
  /* Hero scrolls freely; sub-tab bar sticks; panel fills remaining viewport */
  #page-scripts .sub-tab-bar { position: sticky; top: 0; z-index: 5; }

  #sub-scripts-list.active {
    flex: none;
    height: calc(100vh - 131px); /* 41px topbar + 45px subtabbar + 45px footer */
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  #sub-scripts-submit { min-height: calc(100vh - 131px); overflow-x: hidden; }

  #sub-scripts-list > .section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  #sub-scripts-list .widgets-layout {
    flex: 1;
    min-height: 0 !important;
    align-items: stretch !important;
  }

  #sub-scripts-list .widget-list {
    max-height: none !important;
    align-self: stretch !important;
    overflow-y: auto;
  }

  #sub-scripts-list .widget-detail {
    overflow-y: auto;
  }

  /* Matchbox list — same layered scroll as scripts. Both columns stretch
     to row height and scroll independently. Avoids the gap below the list
     when the detail panel is taller than the list. */
  #mbx-pane-list .widgets-layout {
    flex: 1;
    min-height: 0 !important;
    align-items: stretch !important;
  }

  #mbx-pane-list .widget-list {
    max-height: none !important;
    align-self: stretch !important;
    overflow-y: auto;
  }

  #mbx-pane-list .widget-detail {
    overflow-y: auto;
  }

  /* ── Links grid ──────────────────────────────── */
  .link-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }

  .link-card {
    display: flex; align-items: center;
    padding: 20px 0;
    position: relative;
    text-decoration: none; color: inherit;
    transition: background .15s;
  }
  .link-card:hover { background: rgba(232,160,32,0.03); }

  .link-card-line-top, .link-card-line-bot {
    position: absolute; left: 0; right: 0; height: 1px;
    background: var(--border); pointer-events: none;
  }
  .link-card-line-top { top: 0; }
  .link-card-line-bot { bottom: 0; }
  .link-card:hover .link-card-line-top,
  .link-card:hover .link-card-line-bot { background: rgba(232,160,32,0.25); }

  .link-card-tick {
    position: absolute; width: 6px; height: 6px;
    border-color: rgba(32,200,216,0.2); border-style: solid; pointer-events: none;
  }
  .link-card-tick.tl { top: -1px;    left: 0;  border-width: 1px 0 0 1px; }
  .link-card-tick.tr { top: -1px;    right: 0; border-width: 1px 1px 0 0; }
  .link-card-tick.bl { bottom: -1px; left: 0;  border-width: 0 0 1px 1px; }
  .link-card-tick.br { bottom: -1px; right: 0; border-width: 0 1px 1px 0; }
  .link-card:hover .link-card-tick { border-color: rgba(232,160,32,0.45); }

  .link-card-bar   { width: 2px; height: 40px; flex-shrink: 0; margin-right: 20px; background: var(--cyan-dim); }
  .link-card-num   { font-size: 12px; color: rgba(32,200,216,0.6); letter-spacing: 2px; width: 28px; flex-shrink: 0; }
  .link-card-main  { flex: 1; min-width: 0; padding-left: 8px; }

  .link-card-title {
    font-family: 'IBM Plex Sans', sans-serif; font-size: 16px; font-weight: 700;
    color: var(--text-muted); letter-spacing: .5px; margin-bottom: 4px; transition: color .12s;
  }
  .link-card:hover .link-card-title { color: var(--amber); }

  .link-card-url {
    font-size: 12px; color: rgba(32,200,216,0.35); letter-spacing: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  .link-card-arrow { font-size: 12px; color: var(--cyan-dim); margin-left: 24px; letter-spacing: 2px; flex-shrink: 0; transition: color .15s; }
  .link-card:hover .link-card-arrow { color: var(--amber-dim); }
  .link-card:hover .link-card-bar   { background: var(--amber) !important; }

  /* ── Footer ───────────────────────────────────── */
  .footer { grid-column: 2; grid-row: 2; display: flex; justify-content: space-between; align-items: center; padding: 14px 56px; border-top: 1px solid var(--border); background: var(--bg-deep); font-size: 10px; color: #424242; letter-spacing: 1px; }
  .footer .a { color: var(--amber); opacity: 0.4; }
  .footer .c { color: var(--cyan); opacity: 0.35; }
  .footer-disclaimer { color: #383838; font-size: 10px; letter-spacing: 0.5px; text-align: center; flex: 1; padding: 0 24px; }
  .footer-disclaimer-btn {
    font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 2px;
    color: #484848; background: none; border: 1px solid #303030;
    padding: 4px 10px; border-radius: 2px; cursor: pointer; flex-shrink: 0;
    transition: color 0.2s, border-color 0.2s;
  }
  .footer-disclaimer-btn:hover { color: var(--amber); border-color: var(--amber-dark); }

  /* ── Disclaimer Modal ─────────────────────────── */
  .modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.75); z-index: 2000;
    align-items: center; justify-content: center;
    padding: 24px;
  }
  .modal-overlay.open { display: flex; }

  .modal-box {
    background: var(--bg-deep); border: 1px solid var(--border);
    border-radius: 3px; width: 100%; max-width: 680px;
    max-height: 85vh; display: flex; flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  }

  .modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .modal-title { font-size: 12px; letter-spacing: 3px; color: var(--amber); opacity: 0.8; }
  .modal-close {
    background: none; border: none; color: var(--text-dim); font-size: 18px;
    cursor: pointer; line-height: 1; padding: 0 4px;
    transition: color 0.2s;
  }
  .modal-close:hover { color: var(--amber); }

  .modal-body {
    overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px;
    font-size: 12px; color: var(--text-muted); line-height: 1.8;
  }
  .modal-updated  { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; }
  .modal-intro    { color: var(--text-muted); }
  .modal-callout  { color: #c0b898; letter-spacing: 0.5px; padding: 12px 16px; border-left: 2px solid var(--amber-dark); background: var(--amber-deep); border-radius: 2px; }
  .modal-section  { display: flex; flex-direction: column; gap: 6px; }
  .modal-section-title { font-size: 11px; letter-spacing: 2px; color: var(--cyan); opacity: 0.6; }
  .modal-agree    { color: #c0b898; font-style: italic; padding-top: 8px; border-top: 1px solid var(--border); }

  /* ── Responsive ───────────────────────────────── */
  @media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; grid-template-rows: none; height: auto; }
    .sidebar { grid-column: 1; grid-row: 1; position: relative; top: 0; height: auto; flex-direction: row; flex-wrap: wrap; padding: 8px 0; border-right: none; border-bottom: 1px solid var(--border); }
    .sidebar-foot { display: none; }
    .nav-item { padding: 10px 14px; width: auto; border-left: none; border-bottom: 2px solid transparent; }
    .nav-item.active { border-left-color: transparent; border-bottom-color: var(--amber); background: transparent; }
    .main { grid-column: 1; grid-row: 2; overflow-y: visible; }
    .hero { grid-template-columns: 1fr; padding: 40px 24px 32px; }
    .hero-actions { align-items: flex-start; padding-top: 0; }
    .section { padding: 40px 24px; }
    .sub-tab-bar { padding: 0 16px; }
    .changelog-entry { grid-template-columns: 1fr; gap: 6px; }
    .widgets-layout { grid-template-columns: 1fr; }
    .widget-list { border-right: none; border-bottom: 1px solid var(--border); max-height: 260px; }
    .class-name { min-width: 180px; }
    .footer { grid-column: 1; grid-row: auto; padding: 12px 24px; flex-direction: column; gap: 6px; }
    .link-grid { grid-template-columns: 1fr; }
    .page-sections { overflow-y: visible; }
    .topbar { padding: 10px 16px; }
    .topbar-right { display: none; }
    #page-scripts .sub-tab-bar { position: static; }
    #sub-scripts-list.active { height: auto; overflow: visible; }
    .submit-wrap { padding: 32px 24px; }
    .submit-type-select { min-width: 0; width: 100%; }
  }

  /* ── Phone ────────────────────────────────────── */
  @media (max-width: 480px) {
    .nav-item { padding: 8px 10px; font-size: 10px; letter-spacing: 1px; }
    .hero { padding: 32px 16px 24px; }
    .section { padding: 32px 16px; }
    .sub-tab-bar { padding: 0 10px; }
    .sub-tab-btn { margin-right: 16px; }
    .page-title, .page-title.single { font-size: clamp(36px, 11vw, 52px); }
    .footer { padding: 12px 16px; }
    .code-block { font-size: 11px; padding: 14px 16px; }
    .changelog-entry { padding: 12px 0; }
    .widget-detail { padding: 20px 16px; }
    .submit-wrap { padding: 24px 16px; }
  }

  /* ── Scripts page detail sections ────────────────── */
  .script-detail-name  { font-family: 'IBM Plex Sans', sans-serif; font-size: 22px; font-weight: 700; color: var(--amber); margin-bottom: 6px; letter-spacing: -0.5px; }
  .script-detail-meta  { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
  .script-detail-date  { font-size: 12px; letter-spacing: 2px; color: var(--text-dim); }
  .script-detail-gh    { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; letter-spacing: 1.5px; color: var(--cyan); text-decoration: none; opacity: 0.6; border: 1px solid var(--cyan-dim); padding: 4px 10px; border-radius: 2px; transition: opacity 0.2s; white-space: nowrap; }
  .script-detail-gh:hover { opacity: 1; }
  .script-section-label { font-size: 14px; letter-spacing: 2px; color: rgba(32,200,216,0.6); margin: 20px 0 8px; }
  .script-prose        { font-size: 14px; color: var(--text-muted); line-height: 1.9; }
  .script-prose p      { margin-bottom: 10px; }
  .script-prose p:last-child { margin-bottom: 0; }
  .script-updates      { display: flex; flex-direction: column; }
  .script-update-row   { display: grid; grid-template-columns: max-content 1fr; gap: 0 14px; padding: 9px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
  .script-update-row:last-child { border-bottom: none; }
  .script-update-ver   { font-size: 14px; letter-spacing: 1.5px; color: var(--amber); opacity: 0.7; white-space: nowrap; }
  .script-update-text  { font-size: 14px; color: var(--text-muted); line-height: 1.7; }
  .script-empty-note   { font-size: 14px; color: var(--text-dim); letter-spacing: 1px; font-style: italic; }


  /* ── Latest scripts (now also hosts batch_setups + inference) ─ */
  .latest-scripts-grid {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 380px;          /* shows ~4 rows; rest scrolls */
  }
  .latest-script-row {
    display: grid;
    grid-template-columns: 1fr 100px 28px;
    gap: 0 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
  }
  .latest-script-row:last-child { border-bottom: none; }
  .latest-script-row:hover { background: rgba(232,160,32,0.04); }
  .latest-script-name {
    font-size: 12px;
    color: var(--amber);
    margin-bottom: 4px;
    opacity: 0.9;
  }
  .latest-script-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
  }
  .latest-script-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
  }
  .latest-script-version {
    font-size: 10px;
    color: var(--cyan);
    opacity: 0.7;
    letter-spacing: 1px;
  }
  .latest-script-date {
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 1px;
  }
  .latest-script-arrow {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: var(--text-dim);
    opacity: 0.35;
  }

  /* ── Scripts page sub-tabs ────────────────────── */
  .sub-tab-bar {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border);
    background: var(--bg-deep);
    padding: 0 56px;
  }
  .sub-tab-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--text-dim);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 14px 0;
    margin-right: 32px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
  }
  .sub-tab-btn:hover  { color: #909090; }
  .sub-tab-btn.active { color: var(--amber); border-bottom-color: var(--amber); }
  .sub-tab-pane       { display: none; }
  .sub-tab-pane.active { display: block; }


  /* ── Script info panel ────────────────────────── */
  .script-info-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 24px;
  }
  .script-info-cell {
    padding: 10px 14px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .script-info-cell:last-child { border-right: none; }
  .script-info-label {
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--cyan);
    opacity: 0.5;
    margin-bottom: 4px;
  }
  .script-info-value {
    font-size: 12px;
    color: #b0a080;
  }


  /* ── Submit tab ───────────────────────────────── */
  .submit-wrap { padding: 40px 56px; max-width: 860px; width: 100%; box-sizing: border-box; }

  .submit-type-row {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 28px;
  }
  .submit-type-label {
    font-size: 11px; letter-spacing: 2px; color: rgba(32,200,216,0.6);
  }
  .submit-type-select {
    position: relative;
    display: inline-flex; align-items: center; justify-content: space-between; gap: 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px; letter-spacing: 1px;
    color: #c0b898;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 2px;
    cursor: pointer;
    min-width: 220px;
    user-select: none;
    transition: border-color 0.2s;
  }
  .submit-type-select:focus,
  .submit-type-select.open { border-color: var(--amber-dim); outline: none; }
  .submit-type-chevron { flex-shrink: 0; transition: transform 0.2s; }
  .submit-type-select.open .submit-type-chevron { transform: rotate(180deg); }
  .submit-type-options {
    display: none;
    position: absolute;
    top: calc(100% + 2px); left: -1px; right: -1px;
    background: var(--bg-deep);
    border: 1px solid var(--amber-dim);
    border-radius: 2px;
    z-index: 100;
  }
  .submit-type-select.open .submit-type-options { display: block; }
  .submit-type-option {
    padding: 9px 14px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px; letter-spacing: 1px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
  }
  .submit-type-option + .submit-type-option { border-top: 1px solid var(--border); }
  .submit-type-option:hover { color: #c0b898; background: rgba(255,255,255,0.03); }
  .submit-type-option.selected { color: var(--amber); }

  .submit-dropzone {
    border: 1px dashed var(--border);
    border-radius: 3px;
    background: var(--bg-deep);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 20px;
    position: relative;
  }
  .submit-dropzone:hover,
  .submit-dropzone.drag-over {
    border-color: var(--amber-dim);
    background: rgba(232,160,32,0.03);
  }
  .submit-dropzone input[type="file"] {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer; font-size: 0;
  }
  .submit-drop-icon {
    margin: 0 auto 14px;
    width: 36px; height: 36px;
    opacity: 0.2;
    color: var(--amber);
  }
  .submit-drop-primary {
    font-size: 14px; color: var(--text-muted); letter-spacing: 1px;
    margin-bottom: 8px;
  }
  .submit-drop-or {
    font-size: 14px; color: var(--text-dim); letter-spacing: 2px;
    margin-bottom: 12px;
  }
  .submit-browse-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px; letter-spacing: 2px;
    color: var(--amber); background: var(--amber-deep);
    border: 1px solid var(--amber-dark);
    padding: 9px 18px; border-radius: 2px; cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    pointer-events: none;
  }
  .submit-dropzone:hover .submit-browse-btn { border-color: var(--amber-dim); background: #1e1204; }

  .submit-file-selected {
    display: none;
    align-items: center; gap: 12px;
    padding: 12px 16px;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 2px;
    margin-bottom: 20px;
    font-size: 14px;
  }
  .submit-file-selected.show { display: flex; }
  .submit-file-icon { color: var(--amber); opacity: 0.6; flex-shrink: 0; }
  .submit-file-name { color: #c0b898; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .submit-file-count { color: var(--text-dim); font-size: 14px; letter-spacing: 1px; flex-shrink: 0; }
  .submit-file-clear {
    background: none; border: none; color: var(--text-dim); cursor: pointer;
    font-size: 16px; line-height: 1; padding: 0 2px; flex-shrink: 0;
    transition: color 0.15s;
  }
  .submit-file-clear:hover { color: #e84040; }

  .submit-validation-row {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px;
    font-size: 14px;
  }
  .submit-val-label {
    color: var(--text-dim); letter-spacing: 1px; width: 60px; flex-shrink: 0;
  }
  .submit-val-name {
    flex: 1; color: #c0b898;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    padding: 9px 14px; border-radius: 2px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    min-width: 0;
  }
  .submit-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 14px; letter-spacing: 2px;
    padding: 6px 12px; border-radius: 2px;
    border: 1px solid transparent;
    flex-shrink: 0; min-width: 72px; justify-content: center;
  }
  .submit-badge.pass {
    color: #38c05a; background: rgba(56,192,90,0.08); border-color: rgba(56,192,90,0.25);
  }
  .submit-badge.fail {
    color: #e84040; background: rgba(232,64,64,0.08); border-color: rgba(232,64,64,0.25);
    cursor: pointer;
  }
  .submit-badge.idle {
    color: var(--text-dim); background: transparent; border-color: var(--border);
  }

  .submit-fields { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; width: 100%; }
  .submit-field-row { display: flex; align-items: center; gap: 12px; }
  .submit-field-lbl {
    width: 60px; flex-shrink: 0;
    font-size: 14px; letter-spacing: 2px; color: var(--text-dim);
  }
  .submit-field-input {
    flex: 1; min-width: 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px; color: #c0b898;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    padding: 11px 14px; border-radius: 2px; outline: none;
    transition: border-color 0.2s;
  }
  .submit-field-input:focus { border-color: var(--amber-dim); }
  .submit-field-input:disabled { opacity: 0.35; cursor: not-allowed; }

  .submit-action-row {
    display: flex; justify-content: flex-end; align-items: center; gap: 16px; width: 100%;
  }
  .submit-btn {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px; letter-spacing: 2px;
    color: var(--amber); background: var(--amber-deep);
    border: 1px solid var(--amber-dark);
    padding: 13px 28px; border-radius: 2px; cursor: pointer;
    transition: border-color 0.2s, background 0.2s, opacity 0.2s;
  }
  .submit-btn:hover:not(:disabled) { border-color: var(--amber-dim); background: #1e1204; }
  .submit-btn:disabled { opacity: 0.3; cursor: not-allowed; }
  .submit-success-msg {
    display: none; font-size: 14px; color: #38c05a; letter-spacing: 1px; opacity: 0.85;
  }
  .submit-success-msg.show { display: block; }

  .val-modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.8); z-index: 3000;
    align-items: center; justify-content: center; padding: 24px;
  }
  .val-modal-overlay.open { display: flex; }
  .val-modal-box {
    background: var(--bg-deep); border: 1px solid var(--border);
    border-radius: 3px; width: 100%; max-width: 600px;
    max-height: 80vh; display: flex; flex-direction: column;
    box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  }
  .val-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  }
  .val-modal-title { font-size: 14px; letter-spacing: 3px; color: #e84040; opacity: 0.9; }
  .val-modal-close {
    background: none; border: none; color: var(--text-dim); font-size: 18px;
    cursor: pointer; line-height: 1; padding: 0 4px; transition: color 0.2s;
  }
  .val-modal-close:hover { color: var(--amber); }
  .val-modal-body {
    overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px;
    font-size: 14px;
  }
  .val-error-item {
    display: flex; flex-direction: column; gap: 5px;
    padding: 12px 14px;
    background: rgba(232,64,64,0.06);
    border: 1px solid rgba(232,64,64,0.18);
    border-radius: 2px;
  }
  .val-error-what { color: #e87070; font-size: 14px; letter-spacing: 0.5px; }
  .val-error-fix  { color: var(--text-muted); font-size: 14px; line-height: 1.7; }
  .val-error-val  {
    font-size: 14px; color: var(--amber); opacity: 0.7;
    background: var(--amber-deep); border: 1px solid var(--amber-dark);
    padding: 2px 8px; border-radius: 2px; display: inline-block;
    word-break: break-all; margin-top: 2px;
  }
  .val-modal-footer {
    padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
    display: flex; justify-content: flex-end; gap: 10px;
  }
  .val-btn-cancel {
    font-family: 'IBM Plex Mono', monospace; font-size: 14px; letter-spacing: 2px;
    color: var(--text-dim); background: none; border: 1px solid var(--border);
    padding: 9px 18px; border-radius: 2px; cursor: pointer; transition: color 0.2s, border-color 0.2s;
  }
  .val-btn-cancel:hover { color: #909090; border-color: #505050; }
  .val-btn-continue {
    font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 2px;
    color: var(--amber); background: var(--amber-deep); border: 1px solid var(--amber-dark);
    padding: 9px 18px; border-radius: 2px; cursor: pointer; transition: border-color 0.2s, background 0.2s;
  }
  .val-btn-continue:hover { border-color: var(--amber-dim); background: #1e1204; }


  /* ── Curl install block ───────────────────────── */
  .curl-install {
    display: flex; align-items: center; gap: 0;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
    width: 100%;
  }
  .curl-install-label {
    font-size: 10px; letter-spacing: 2px; color: var(--cyan-dim);
    padding: 0 12px; white-space: nowrap; flex-shrink: 0;
    border-right: 1px solid var(--border);
    align-self: stretch; display: flex; align-items: center;
  }
  .curl-install-cmd {
    font-size: 11px; color: var(--text-muted); letter-spacing: 0.5px;
    padding: 10px 14px; flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .curl-copy-btn {
    background: none; border: none; border-left: 1px solid var(--border);
    color: var(--text-dim); cursor: pointer; padding: 0 14px;
    align-self: stretch; display: flex; align-items: center;
    font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: 1px;
    transition: color 0.2s, background 0.2s; white-space: nowrap; flex-shrink: 0;
  }
  .curl-copy-btn:hover { color: var(--cyan); background: rgba(32,200,216,0.05); }
  .curl-copy-btn.copied { color: #4ec94e; }

