:root {
      --bg: #0c0f14;
      --surface: #141922;
      --surface2: #1c2433;
      --border: #2a3548;
      --text: #e8ecf4;
      --muted: #8b9cb3;
      --accent: #38bdf8;
      --accent-dim: #0ea5e9;
      --ok: #34d399;
      --warn: #fbbf24;
      --danger: #f87171;
      --radius: 10px;
      --font: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
      --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
    }
    * { box-sizing: border-box; }
    html, body { height: 100%; margin: 0; }
    body {
      font-family: var(--font);
      background: var(--bg);
      color: var(--text);
      font-size: 14px;
      line-height: 1.45;
      display: flex;
      flex-direction: column;
      min-height: 100%;
    }
    a { color: var(--accent); text-decoration: none; }
    a:hover { text-decoration: underline; }

    .topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 12px 20px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      flex-wrap: wrap;
    }
    .brand { display: flex; align-items: center; gap: 12px; }
    .logo {
      width: 36px; height: 36px; border-radius: 9px;
      background: linear-gradient(135deg, #0ea5e9, #6366f1);
      box-shadow: 0 0 20px rgba(14, 165, 233, 0.35);
    }
    .brand h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
    .brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
    .top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
    .top-actions label { font-size: 12px; color: var(--muted); }
    select, input[type="text"], input[type="password"], textarea {
      font: inherit;
      background: var(--surface2);
      border: 1px solid var(--border);
      color: var(--text);
      border-radius: 8px;
      padding: 8px 10px;
    }
    select:focus, input:focus, textarea:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
    }
    button.btn {
      font: inherit;
      cursor: pointer;
      border-radius: 8px;
      padding: 8px 14px;
      border: 1px solid var(--border);
      background: var(--surface2);
      color: var(--text);
    }
    button.btn:hover { background: #243044; }
    button.btn-primary {
      background: linear-gradient(135deg, #0284c7, #2563eb);
      border-color: transparent;
      color: #fff;
    }
    button.btn-primary:hover { filter: brightness(1.08); }
    button.btn:disabled { opacity: 0.45; cursor: not-allowed; }

    .layout { display: flex; flex: 1; min-height: 0; }
    .nav {
      width: 200px;
      flex-shrink: 0;
      background: var(--surface);
      border-right: 1px solid var(--border);
      padding: 16px 10px;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .nav button {
      text-align: left;
      padding: 10px 12px;
      border: none;
      border-radius: 8px;
      background: transparent;
      color: var(--muted);
      font: inherit;
      cursor: pointer;
    }
    .nav button:hover { background: var(--surface2); color: var(--text); }
    .nav button.active { background: var(--surface2); color: var(--accent); font-weight: 600; }

    main { flex: 1; overflow: auto; padding: 20px 24px 40px; }
    .panel { display: none; max-width: 1200px; }
    .panel.active { display: block; }
    .panel h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
    .panel .hint { margin: 0 0 20px; font-size: 13px; color: var(--muted); }

    .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 14px 16px;
    }
    .card .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
    .card .value { font-size: 15px; font-weight: 500; word-break: break-all; }
    .card .value.mono { font-family: var(--mono); font-size: 12px; font-weight: 400; }
    .pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; margin-top: 8px; }
    .pill.ok { background: rgba(52, 211, 153, 0.15); color: var(--ok); }
    .pill.bad { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
    .pill.warn { background: rgba(251, 191, 36, 0.15); color: var(--warn); }

    .json-wrap {
      position: relative;
      margin-top: 12px;
      border-radius: var(--radius);
      border: 1px solid var(--border);
      background: #0a0d12;
    }
    .json-wrap .toolbar {
      display: flex; justify-content: flex-end; gap: 8px;
      padding: 8px 10px;
      border-bottom: 1px solid var(--border);
      background: var(--surface2);
    }
    pre.json {
      margin: 0;
      padding: 14px 16px;
      overflow: auto;
      max-height: 420px;
      font-family: var(--mono);
      font-size: 12px;
      line-height: 1.5;
      color: #cbd5e1;
    }
    .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
    .row label { min-width: 100px; color: var(--muted); font-size: 13px; }
    .flex-grow { flex: 1; min-width: 200px; }
    table.data {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
      margin-top: 12px;
    }
    table.data th, table.data td {
      text-align: left;
      padding: 8px 10px;
      border-bottom: 1px solid var(--border);
    }
    table.data th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
    table.data tr:hover td { background: rgba(255,255,255,0.02); }
    table.data td { font-family: var(--mono); font-size: 12px; }
    .filter-input { width: 100%; max-width: 480px; margin-bottom: 8px; }

    .visually-hidden {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }
    .role-card-dropzone {
      border: 1px dashed var(--border);
      border-radius: var(--radius);
      padding: 10px 12px;
      background: var(--surface2);
      transition: border-color 0.15s, background 0.15s;
    }
    .role-card-dropzone.dragover {
      border-color: var(--accent, #3b82f6);
      background: rgba(59, 130, 246, 0.08);
    }
    .fixed-npc-card.highlight {
      border-color: #34d399;
      box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.25);
      animation: fixedNpcPulse 1.2s ease-in-out 2;
    }
    @keyframes fixedNpcPulse {
      0%, 100% { box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.25); }
      50% { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.4); }
    }

    .links { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
    .links a {
      display: block;
      padding: 12px 14px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      color: var(--text);
    }
    .links a:hover { border-color: var(--accent); text-decoration: none; background: var(--surface2); }

    .npc-meta { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.55; }
    .npc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
    .scene-map { font-size: 12px; color: var(--muted); margin-bottom: 14px; padding: 10px 12px; background: var(--surface2); border-radius: 8px; border: 1px solid var(--border); }
    .scene-map strong { color: var(--text); }
    .subgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
    .field { display: flex; flex-direction: column; gap: 6px; }
    .field label { font-size: 12px; color: var(--muted); }
    .field textarea { min-height: 96px; resize: vertical; font-family: var(--mono); font-size: 12px; }
    .field input { font-family: var(--mono); font-size: 12px; }
    .kv-list, .hint-list {
      border: 1px solid var(--border);
      border-radius: 8px;
      background: #0f1420;
      max-height: 180px;
      overflow: auto;
      padding: 6px;
    }
    .kv-row, .hint-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 4px;
      border-bottom: 1px dashed rgba(255,255,255,0.07);
    }
    .kv-row:last-child, .hint-row:last-child { border-bottom: none; }
    .kv-row code, .hint-row code { flex: 1; font-family: var(--mono); font-size: 12px; color: #cbd5e1; }
    .btn-mini {
      font-size: 11px;
      padding: 4px 8px;
      border-radius: 6px;
      border: 1px solid var(--border);
      background: var(--surface2);
      color: var(--text);
      cursor: pointer;
    }
    .btn-mini:hover { background: #243044; }
    .chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
    .chip-role {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 8px;
      border: 1px solid var(--border);
      border-radius: 999px;
      background: #121826;
      color: var(--text);
      font-size: 12px;
    }
    .chip-role input { margin: 0; }

    .toast {
      position: fixed;
      bottom: 24px;
      right: 24px;
      padding: 10px 16px;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 13px;
      box-shadow: 0 8px 30px rgba(0,0,0,0.4);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s;
      z-index: 100;
    }
    .toast.show { opacity: 1; }

    @media (max-width: 768px) {
      .layout { flex-direction: column; }
      .nav { width: 100%; flex-direction: row; flex-wrap: wrap; }
    }

/* auto-generated from former inline style attributes */
.dev-st-0 { margin:24px 0 8px;font-size:14px;color:var(--muted); }
.dev-st-1 { color:var(--muted);font-size:12px; }
.dev-st-10 { margin-top:2px; }
.dev-st-11 { margin-top:8px; margin-bottom:0; align-items:flex-start; }
.dev-st-12 { min-height:84px; }
.dev-st-13 { display:flex;flex-direction:column;gap:6px; }
.dev-st-14 { margin-top:8px; }
.dev-st-15 { margin:0 0 8px;color:var(--muted);font-size:12px;line-height:1.5; }
.dev-st-16 { margin-bottom:8px; align-items:flex-start; }
.dev-st-17 { min-height:92px; }
.dev-st-18 { margin-top:16px; }
.dev-st-19 { cursor:pointer;color:var(--muted);font-size:13px;user-select:none; }
.dev-st-2 { margin-bottom:0; }
.dev-st-20 { margin:20px 0 8px;font-size:14px;color:var(--muted); }
.dev-st-21 { color:var(--muted);font-size:13px; }
.dev-st-22 { min-width:auto;display:flex;align-items:center;gap:6px; }
.dev-st-23 { width:90px; }
.dev-st-24 { width:70px; }
.dev-st-25 { margin:28px 0 8px;font-size:14px;color:var(--muted); }
.dev-st-26 { flex-wrap:wrap;align-items:flex-start; }
.dev-st-27 { flex:1;min-width:280px;display:flex;flex-direction:column;gap:10px; }
.dev-st-28 { margin-bottom:0;align-items:center;gap:8px; }
.dev-st-29 { font-size:13px;color:var(--muted);white-space:nowrap; }
.dev-st-3 { margin-top:12px; }
.dev-st-30 { margin:0;font-size:12px; }
.dev-st-31 { min-height:160px;max-width:none;width:100%;margin-bottom:0;resize:vertical;font-family:ui-monospace,monospace;font-size:12px; }
.dev-st-32 { margin:18px 0 8px;font-size:13px;color:var(--muted); }
.dev-st-33 { margin-bottom:10px; }
.dev-st-34 { flex-wrap:wrap;align-items:center;margin-bottom:8px; }
.dev-st-35 { min-width:90px; }
.dev-st-36 { max-width:300px; }
.dev-st-37 { flex-wrap:wrap;align-items:center;margin-bottom:4px; }
.dev-st-38 { max-width:260px; }
.dev-st-39 { margin:0 0 8px 96px;font-size:11px;color:var(--muted);max-width:520px;line-height:1.45; }
.dev-st-4 { margin-bottom:8px; }
.dev-st-40 { max-width:420px; }
.dev-st-41 { max-width:120px; }
.dev-st-42 { min-width:40px; }
.dev-st-43 { max-width:140px; }
.dev-st-44 { margin-bottom:8px;align-items:center; }
.dev-st-45 { display:flex;align-items:center;gap:6px;cursor:pointer; }
.dev-st-46 { gap:8px; }
.dev-st-47 { margin-top:20px; }
.dev-st-5 { max-width:180px; }
.dev-st-6 { margin-top:8px; margin-bottom:0; }
.dev-st-7 { margin:6px 0 8px;color:var(--muted);font-size:12px;line-height:1.5; }
.dev-st-8 { margin-bottom:0; align-items:flex-start; }
.dev-st-9 { min-height:64px; }

.dev-console-mono-tight {
  font-size: 11px;
}
.dev-console-empty-hint {
  color: var(--muted);
  font-size: 12px;
  padding: 6px;
}
