:root {
        color-scheme: dark;
        --bg: #090b0f;
        --panel: #10141b;
        --panel-2: #151a23;
        --ink: #f5f0e8;
        --muted: #aab1bd;
        --line: #2a3140;
        --accent: #54d6c7;
        --danger: #ff5b4f;
      }

      * { box-sizing: border-box; }

      body {
        margin: 0;
        font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        background: var(--bg);
        color: var(--ink);
      }

      a { color: var(--accent); }

      header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
        padding: 14px clamp(16px, 3vw, 36px);
        border-bottom: 1px solid var(--line);
        background: rgba(9, 11, 15, 0.94);
      }

      header strong { font-size: 18px; }
      header nav {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        gap: 0;
        color: var(--muted);
        font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
        font-size: 14px;
      }

      header nav::before {
        content: "/pva/2025-2026";
        margin-right: 0.25rem;
        color: var(--accent);
        font-weight: 760;
      }

      header nav a,
      header nav span {
        display: inline-flex;
        align-items: center;
        min-height: 32px;
        padding: 0 0.35rem;
        border-radius: 4px;
        text-decoration: none;
      }

      header nav a::before,
      header nav span::before {
        content: "/";
        margin-right: 0.35rem;
        color: var(--line);
      }

      header nav span {
        color: var(--ink);
        background: rgba(84, 214, 199, 0.12);
      }

      main {
        display: grid;
        grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
        min-height: calc(100vh - 58px);
      }

      .stage,
      .editor {
        min-width: 0;
        padding: clamp(14px, 2vw, 24px);
      }

      .stage {
        display: grid;
        grid-template-rows: auto minmax(420px, 1fr);
        gap: 14px;
        border-right: 1px solid var(--line);
      }

      .toolbar,
      .editor-toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
      }

      .file-warning,
      .load-message {
        display: grid;
        gap: 6px;
        padding: 12px;
        border: 1px solid rgba(255, 91, 79, 0.5);
        border-radius: 8px;
        background: rgba(255, 91, 79, 0.08);
        color: #ffd3cf;
      }

      .file-warning[hidden] { display: none; }

      .file-warning strong,
      .load-message strong {
        color: #f5f0e8;
      }

      .load-message {
        max-width: 520px;
        margin: 18px;
        text-align: center;
      }

      select,
      button,
      textarea {
        font: inherit;
      }

      select,
      button {
        min-height: 40px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: var(--panel-2);
        color: var(--ink);
      }

      select { padding: 8px 10px; }

      button {
        padding: 8px 12px;
        cursor: pointer;
        font-weight: 760;
      }

      button.primary {
        border-color: rgba(84, 214, 199, 0.72);
        background: var(--accent);
        color: #06100f;
      }

      .preview-frame {
        width: 100%;
        height: 100%;
        min-height: 420px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #000;
        display: grid;
        place-items: center;
        overflow: hidden;
      }

      .sketch-mount {
        width: 100%;
        height: 100%;
        display: grid;
        place-items: center;
      }

      .preview-frame canvas {
        max-width: 100%;
        max-height: 100%;
        width: auto !important;
        height: auto !important;
      }

      .editor {
        display: grid;
        grid-template-rows: auto auto minmax(440px, 1fr) auto;
        gap: 12px;
      }

      h1 {
        margin: 0;
        font-size: clamp(28px, 4vw, 52px);
        line-height: 1;
        letter-spacing: 0;
      }

      .meta {
        margin: 8px 0 0;
        color: var(--muted);
      }

      textarea {
        width: 100%;
        height: 100%;
        min-height: 440px;
        resize: vertical;
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #05070a;
        color: #f5f0e8;
        line-height: 1.45;
        tab-size: 2;
        white-space: pre;
        overflow: auto;
      }

      .status {
        min-height: 24px;
        color: var(--muted);
        font-size: 14px;
      }

      .error { color: var(--danger); }

      @media (max-width: 900px) {
        header {
          flex-direction: column;
          align-items: flex-start;
        }

        header nav {
          justify-content: flex-start;
        }

        main { grid-template-columns: 1fr; }
        .stage { border-right: 0; border-bottom: 1px solid var(--line); }
      }
