      :root {
        --bg: #0b0d12;
        --panel: #121821;
        --panel-2: #1a2230;
        --panel-3: #0f141d;
        --text: #ebf0f8;
        --muted: #97a4b5;
        --line: #283244;
        --accent: #e8bf52;
        --accent-2: #3c82f6;
        --danger: #df5b5b;
        --success: #27ae60;
      }

      * {
        box-sizing: border-box;
      }

      body {
        margin: 0;
        min-height: 100vh;
        font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
        background: radial-gradient(circle at top left, #1b2331 0%, #0c1017 42%, #07090d 100%);
        color: var(--text);
      }

      button,
      input,
      textarea {
        font: inherit;
      }

      .app {
        display: grid;
        grid-template-columns: minmax(320px, 1fr) 380px;
        gap: 20px;
        min-height: 100vh;
        padding: 20px;
      }

      .stage,
      .sidebar {
        background: rgba(18, 24, 33, 0.92);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 18px;
        box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
        min-width: 0;
      }

      .stage {
        padding: 18px;
        display: flex;
        flex-direction: column;
        gap: 14px;
      }

      .toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: end;
      }

      .toolbar label,
      .field {
        display: flex;
        flex-direction: column;
        gap: 6px;
        font-size: 12px;
        color: var(--muted);
        min-width: 0;
      }

      .toolbar input,
      .field input,
      .field textarea,
      .field button,
      .toolbar button {
        background: var(--panel-2);
        color: var(--text);
        border: 1px solid var(--line);
        border-radius: 10px;
        padding: 10px 12px;
      }

      .toolbar input,
      .field input,
      .field textarea {
        width: 100%;
        min-width: 0;
      }

      .toolbar button,
      .layer-actions button,
      .selection-actions button {
        cursor: pointer;
        transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
      }

      .pill-btn {
        border-radius: 999px;
        padding: 10px 14px;
        box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
      }

      button:hover {
        transform: translateY(-1px);
      }

      button.primary {
        background: var(--accent-2);
        border-color: #2f6bd0;
      }

      button.accent {
        background: var(--accent);
        color: #261f0a;
        border-color: #cda233;
        font-weight: 700;
      }

      button.danger {
        background: rgba(223, 91, 91, 0.16);
        border-color: rgba(223, 91, 91, 0.45);
      }

      .topbar {
        margin: 16px 16px 0;
        padding: 10px 14px;
        min-height: 80px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        background: rgba(18, 24, 33, 0.92);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 18px;
        box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
        backdrop-filter: blur(12px);
      }

      .topbar-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
      }

      .topbar-actions {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        flex: 1 1 auto;
        min-width: 0;
        flex-wrap: wrap;
      }

      .topbar-logo {
        display: block;
        width: auto;
        max-width: 64px;
        max-height: 64px;
        object-fit: contain;
        flex: 0 0 auto;
      }

      .topbar-copy {
        min-width: 0;
      }

      .topbar-name {
        font-size: 14px;
        font-weight: 700;
        letter-spacing: 0.02em;
        color: var(--text);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .language-toggle {
        background: rgba(18, 24, 33, 0.94);
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: var(--text);
        backdrop-filter: blur(14px);
        white-space: nowrap;
        flex: 0 0 auto;
      }

      .language-toggle[aria-pressed="true"] {
        border-color: rgba(60, 130, 246, 0.75);
        box-shadow: 0 14px 28px rgba(60, 130, 246, 0.18);
      }

      .canvas-wrap {
        background: linear-gradient(180deg, #0d1118, #0a0d13);
        border: 1px solid var(--line);
        border-radius: 16px;
        padding: 14px;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: auto;
        min-height: 420px;
      }

      canvas {
        display: block;
        background: #f6f0df;
        border-radius: 12px;
        box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.08), 0 20px 40px rgba(0, 0, 0, 0.28);
      }

      .stage-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 10px 18px;
        align-items: center;
        justify-content: space-between;
      }

      .meta-row {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        font-size: 12px;
        color: var(--muted);
      }

      .status {
        font-size: 12px;
        color: var(--muted);
      }

      .sidebar {
        padding: 18px;
        display: flex;
        flex-direction: column;
        gap: 16px;
      }

      .section {
        background: var(--panel-2);
        border-radius: 14px;
        padding: 14px;
        border: 1px solid rgba(255, 255, 255, 0.04);
        min-width: 0;
      }

      .section h3 {
        margin: 0 0 12px;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--muted);
      }

      .kv {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 8px 12px;
        font-size: 13px;
      }

      .kv div {
        background: var(--panel-3);
        border-radius: 8px;
        padding: 8px 10px;
        min-height: 36px;
        display: flex;
        align-items: center;
        min-width: 0;
        overflow-wrap: anywhere;
      }

      .field-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
      }

      .field-grid.full,
      .field.full {
        grid-column: 1 / -1;
      }

      .field textarea {
        min-height: 74px;
        resize: vertical;
      }

      .selection-actions,
      .layer-actions {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
      }

      .selection-actions button,
      .layer-actions button {
        flex: 1 1 140px;
      }

      .layer-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
        max-height: 320px;
        overflow: auto;
      }

      .layer-item {
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--panel-3);
        padding: 10px 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        cursor: pointer;
        min-width: 0;
      }

      .layer-item.is-selected {
        border-color: var(--accent-2);
        background: rgba(60, 130, 246, 0.12);
      }

      .layer-main {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
      }

      .layer-title,
      .layer-subtitle {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .layer-title {
        font-size: 13px;
        color: var(--text);
      }

      .layer-subtitle {
        font-size: 11px;
        color: var(--muted);
      }

      .badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 38px;
        padding: 4px 8px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.06);
        font-size: 11px;
        color: var(--muted);
        flex-shrink: 0;
      }

      .color-input {
        width: 100%;
        min-height: 44px;
        padding: 6px;
        cursor: pointer;
      }

      .color-chip {
        width: 14px;
        height: 14px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.18);
        box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
        flex: 0 0 auto;
      }

      .layer-badge {
        display: flex;
        align-items: center;
        gap: 8px;
      }

      .modal {
        position: fixed;
        inset: 0;
        z-index: 50;
        display: grid;
        place-items: center;
        padding: 20px;
      }

      .modal-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(3, 6, 12, 0.72);
        backdrop-filter: blur(6px);
      }

      .modal-card {
        position: relative;
        z-index: 1;
        width: min(540px, 100%);
        background: rgba(18, 24, 33, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 20px;
        box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
        padding: 18px;
      }

      .modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 14px;
      }

      .modal-title {
        margin: 0;
        font-size: 18px;
      }

      .modal-text {
        margin: 0 0 14px;
        color: var(--muted);
        line-height: 1.6;
      }

      .modal-link {
        color: var(--accent-2);
        text-decoration: none;
        font-weight: 700;
      }

      .modal-link:hover {
        text-decoration: underline;
      }

      .modal-close {
        padding: 8px 12px;
      }

      .hint {
        margin: 0;
        font-size: 12px;
        line-height: 1.5;
        color: var(--muted);
      }

      @media (max-width: 1080px) {
        .app {
          grid-template-columns: 1fr;
        }
      }

      @media (max-width: 520px) {
        .topbar {
          margin: 12px 12px 0;
          padding: 10px 12px;
          gap: 10px;
          align-items: flex-start;
          flex-direction: column;
        }

        .topbar-actions {
          width: 100%;
          justify-content: flex-start;
        }

        .topbar-logo {
          max-width: 52px;
          max-height: 52px;
        }

        .topbar-name {
          font-size: 12px;
        }

        .language-toggle {
          padding: 8px 10px;
        }

        .modal {
          padding: 14px;
        }

        .field-grid {
          grid-template-columns: 1fr;
        }

        .kv {
          grid-template-columns: 80px minmax(0, 1fr);
        }
      }

      /* App views */
      .is-hidden {
        display: none !important;
      }

      /* Home */
      .home {
        min-height: 100vh;
        padding: 16px 20px 26px;
        display: grid;
        place-items: start center;
      }

      .home-shell {
        width: min(980px, 100%);
        background: rgba(18, 24, 33, 0.92);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 18px;
        box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
        padding: 18px;
        display: flex;
        flex-direction: column;
        gap: 14px;
      }

      .home-title {
        margin: 0;
        font-size: 16px;
        letter-spacing: 0.2px;
      }

      .home-actions {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        align-items: end;
      }

      .project-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
      }

      .project-row {
        display: flex;
        gap: 10px;
        align-items: center;
        justify-content: space-between;
        border: 1px solid rgba(40, 50, 68, 0.8);
        border-radius: 14px;
        background: rgba(15, 20, 29, 0.72);
        padding: 10px 12px;
      }

      .project-main {
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
      }

      .project-name {
        font-weight: 700;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .project-meta {
        font-size: 11px;
        color: var(--muted);
      }

      .project-actions {
        display: flex;
        gap: 8px;
        flex-shrink: 0;
      }

      .project-actions .pill-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 88px;
      }

      /* Editor menu */
      .menu-bar {
        display: flex;
        gap: 10px;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
      }

      .menu-center {
        display: flex;
        gap: 10px;
        align-items: center;
        min-width: 0;
        justify-content: center;
        width: 100%;
      }

      .project-badge {
        font-size: 22px;
        line-height: 1.2;
        color: var(--text);
        font-weight: 800;
        letter-spacing: 0.01em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: center;
        max-width: min(100%, 760px);
      }

      textarea {
        resize: vertical;
      }
