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

  :root {
    --bg: #0a0a0f;
    --surface: #111118;
    --surface2: #1a1a24;
    --surface3: #22222f;
    --border: #2a2a3a;
    --border2: #38384a;
    --accent: #00d3f3;
    --accent2: #33e5ff;
    --accent-glow: rgba(0,211,243,0.18);
    --green: #34d399;
    --amber: #fbbf24;
    --red: #f87171;
    --text: #e8e8f0;
    --text2: #9090a8;
    --text3: #5a5a72;
    --mono: 'JetBrains Mono', monospace;
    --sans: 'Syne', sans-serif;
    --radius: 10px;
  }

  html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; }

  /* ---- LAYOUT ---- */
  .app { display: grid; grid-template-rows: 52px 1fr; height: 100vh; }
  .header { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--surface); position: relative; z-index: 10; }
  .header-logo { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; letter-spacing: -0.3px; }
  .header-logo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 2s ease-in-out infinite; }
  @keyframes pulse { 0%,100%{box-shadow:0 0 6px var(--accent)} 50%{box-shadow:0 0 18px var(--accent2)} }
  .header-actions { display: flex; gap: 8px; }
  .header-nav { display: flex; gap: 24px; }
  .nav-link { font-size: 13px; font-weight: 600; color: var(--text2); text-decoration: none; transition: color 0.2s; }
  .nav-link:hover { color: var(--accent); }
  .nav-link.active { color: var(--accent2); }

  .main { display: grid; grid-template-columns: 300px 1fr 340px; height: 100%; overflow: hidden; }

  /* ---- PANELS ---- */
  .panel { border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
  .panel-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
  .panel-title { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text2); }
  .panel-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
  .panel-body::-webkit-scrollbar { width: 4px; }
  .panel-body::-webkit-scrollbar-track { background: transparent; }
  .panel-body::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

  /* ---- CENTER STAGE ---- */
  .stage-panel { border-right: 1px solid var(--border); display: flex; flex-direction: column; }
  .stage-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
  .stage { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; background: var(--surface); }
  .stage-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 32px 32px; opacity: 0.4; }
  .stage-el { position: relative; z-index: 2; }

  /* ---- FORM CONTROLS ---- */
  .control-group { display: flex; flex-direction: column; gap: 6px; }
  .control-label { font-size: 11px; color: var(--text2); font-weight: 600; letter-spacing: 0.05em; display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); }
  .control-label span { color: var(--accent2); font-weight: 400; }

  input[type="range"] { -webkit-appearance: none; width: 100%; height: 4px; background: var(--surface3); border-radius: 2px; outline: none; cursor: pointer; }
  input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 6px var(--accent-glow); cursor: pointer; transition: transform 0.15s; }
  input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

  select { background: var(--surface3); border: 1px solid var(--border2); border-radius: 6px; color: var(--text); font-family: var(--mono); font-size: 12px; padding: 7px 10px; width: 100%; cursor: pointer; outline: none; transition: border-color 0.15s; }
  select:focus { border-color: var(--accent); }

  input[type="color"] { -webkit-appearance: none; width: 32px; height: 32px; border: 1px solid var(--border2); border-radius: 6px; background: none; cursor: pointer; padding: 2px; }
  input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
  input[type="color"]::-webkit-color-swatch { border-radius: 4px; border: none; }

  input[type="number"], input[type="text"] { background: var(--surface3); border: 1px solid var(--border2); border-radius: 6px; color: var(--text); font-family: var(--mono); font-size: 12px; padding: 7px 10px; width: 100%; outline: none; transition: border-color 0.15s; }
  input[type="number"]:focus, input[type="text"]:focus { border-color: var(--accent); }

  .color-row { display: flex; gap: 8px; align-items: center; }
  .color-row input[type="text"] { flex: 1; }

  /* ---- SHAPE PICKER ---- */
  .shape-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .shape-btn { background: var(--surface3); border: 1.5px solid var(--border2); border-radius: 8px; padding: 8px 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; transition: all 0.15s; font-size: 10px; color: var(--text2); font-family: var(--sans); font-weight: 600; letter-spacing: 0.03em; }
  .shape-btn:hover { border-color: var(--accent); color: var(--accent2); }
  .shape-btn.active { border-color: var(--accent); background: var(--accent-glow); color: var(--accent2); }
  .shape-preview { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }

  /* ---- PRESET CHIPS ---- */
  .presets { display: flex; flex-wrap: wrap; gap: 6px; }
  .preset-chip { background: var(--surface3); border: 1px solid var(--border2); border-radius: 20px; padding: 5px 11px; font-size: 11px; font-family: var(--mono); color: var(--text2); cursor: pointer; transition: all 0.15s; font-weight: 600; }
  .preset-chip:hover { border-color: var(--accent); color: var(--accent2); background: var(--accent-glow); }
  .preset-chip.active { border-color: var(--accent); color: var(--accent2); background: var(--accent-glow); }

  /* ---- KEYFRAME EDITOR ---- */
  .kf-list { display: flex; flex-direction: column; gap: 8px; }
  .kf-row { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
  .kf-header { display: flex; align-items: center; justify-content: space-between; }
  .kf-stop { font-size: 12px; font-family: var(--mono); font-weight: 600; color: var(--accent2); background: var(--surface3); border: 1px solid var(--border2); border-radius: 5px; padding: 3px 8px; }
  .kf-props { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .kf-prop { font-size: 10px; font-family: var(--mono); }
  .kf-prop label { display: block; color: var(--text3); margin-bottom: 3px; }
  .kf-prop input { padding: 5px 8px; font-size: 11px; }
  .kf-delete { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 14px; line-height: 1; padding: 2px; transition: color 0.15s; }
  .kf-delete:hover { color: var(--red); }
  .add-kf-btn { background: var(--surface2); border: 1px dashed var(--border2); border-radius: 8px; padding: 9px; font-size: 11px; font-family: var(--mono); color: var(--text3); cursor: pointer; text-align: center; transition: all 0.15s; width: 100%; }
  .add-kf-btn:hover { border-color: var(--accent); color: var(--accent2); }

  /* ---- PLAYBACK CONTROLS ---- */
  .playback { display: flex; align-items: center; gap: 8px; }
  .play-btn { background: var(--accent); border: none; color: white; border-radius: 7px; padding: 7px 14px; font-size: 12px; font-family: var(--sans); font-weight: 600; cursor: pointer; transition: all 0.15s; letter-spacing: 0.03em; }
  .play-btn:hover { background: var(--accent2); transform: translateY(-1px); }
  .play-btn.playing { background: var(--surface3); color: var(--text2); border: 1px solid var(--border2); }
  .iter-toggle { background: var(--surface3); border: 1px solid var(--border2); border-radius: 7px; padding: 6px 12px; font-size: 11px; font-family: var(--mono); color: var(--text2); cursor: pointer; transition: all 0.15s; }
  .iter-toggle.active { border-color: var(--green); color: var(--green); }

  /* ---- CODE OUTPUT ---- */
  .code-panel { display: flex; flex-direction: column; border-right: none; }
  .code-area { flex: 1; overflow-y: auto; padding: 16px; }
  .code-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
  .code-block-head { padding: 8px 14px; background: var(--surface2); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .code-lang { font-size: 10px; font-family: var(--mono); font-weight: 600; color: var(--text3); letter-spacing: 0.08em; text-transform: uppercase; }
  .code-copy { background: none; border: none; font-size: 11px; font-family: var(--mono); color: var(--text3); cursor: pointer; transition: color 0.15s; padding: 2px 6px; border-radius: 4px; }
  .code-copy:hover { color: var(--accent2); background: var(--surface3); }
  .code-copy.copied { color: var(--green); }
  pre { padding: 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.75; color: var(--text); overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
  pre::-webkit-scrollbar { height: 4px; }
  pre::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

  /* ---- SYNTAX COLORS ---- */
  .kw { color: #a78bfa; } /* keyword/selector */
  .prop { color: #7dd3fc; } /* property */
  .val { color: #86efac; } /* value */
  .pct { color: #fbbf24; } /* percentage */
  .com { color: #4a5568; font-style: italic; }
  .brace { color: #e2e8f0; }

  /* ---- BUTTONS ---- */
  .btn { background: var(--surface2); border: 1px solid var(--border2); border-radius: 7px; padding: 6px 14px; font-size: 12px; font-family: var(--sans); font-weight: 600; color: var(--text2); cursor: pointer; transition: all 0.15s; letter-spacing: 0.02em; }
  .btn:hover { border-color: var(--border); color: var(--text); }
  .btn-accent { background: var(--accent-glow); border-color: var(--accent); color: var(--accent2); }
  .btn-accent:hover { background: var(--accent); color: white; }

  /* ---- DIVIDER ---- */
  .divider { height: 1px; background: var(--border); margin: 2px 0; flex-shrink: 0; }

  /* ---- TIMING PREVIEW ---- */
  .easing-preview { height: 38px; background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; position: relative; }
  .easing-ball { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transform: translateY(-50%); left: 8px; }
  .easing-track { position: absolute; top: 50%; left: 8px; right: 8px; height: 1px; background: var(--border2); }

  /* ---- SCROLLBAR GLOBAL ---- */
  ::-webkit-scrollbar { width: 4px; height: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

  /* ---- SECTION LABEL ---- */
  .sec-label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text3); border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 0; }

  .tag { font-size: 9px; font-family: var(--mono); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border-radius: 20px; }
  .tag-green { background: rgba(52,211,153,0.12); color: var(--green); border: 1px solid rgba(52,211,153,0.25); }
