  @import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Manrope:wght@400;500;600;700&display=swap');

  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }

  :root {
    --bg: #08080c;
    --surface: #111118;
    --surface2: #1a1a24;
    --surface3: #22222e;
    --border: #2a2a38;
    --border2: #3a3a4a;
    --accent: #ff5100;
    --accent-glow: rgba(255,81,0,0.25);
    --accent2: #ff9500;
    --green: #00e676;
    --blue: #448aff;
    --purple: #b388ff;
    --red: #ff5252;
    --text: #eaeaef;
    --text2: #8888a0;
    --text3: #55556a;
    --mobile-viewport-height: 100dvh;
    --mobile-tab-height: 68px;
    --mobile-sheet-height: 62dvh;
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Manrope', sans-serif;
    height: 100vh;
    overflow: hidden;
  }

  .native-only { display: none !important; }
  html.is-native .native-only { display: initial !important; }
  html.is-native #aiAuthorBtn { display: none !important; }
  html.is-native .web-only { display: none !important; } /* FCP-internal controls, e.g. Export for Cowork */

  /* ═══════════ HEADER ═══════════ */
  .header {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 10;
  }
  .header-left { display: flex; align-items: center; gap: 14px; }
  .logo {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 3px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .logo-sub { font-size: 10px; color: var(--text3); letter-spacing: 1.5px; text-transform: uppercase; }
  .header-right { display: flex; gap: 8px; }
  .workspace-switch {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
  }
  .workspace-tab {
    border: none;
    background: transparent;
    color: var(--text2);
    padding: 7px 11px;
    border-radius: 6px;
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-transform: uppercase;
  }
  .workspace-tab.active {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
  }

  /* ═══════════ LAYOUT ═══════════ */
  .layout {
    display: flex;
    height: calc(100vh - 52px);
  }

  /* ═══════════ LEFT PANEL ═══════════ */
  .panel-left {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .section {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
  }
  .section-title {
    font-family: 'Oswald', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text2);
    text-transform: uppercase;
    margin-bottom: 8px;
  }

  .input-field {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 5px;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    letter-spacing: 1px;
    outline: none;
    transition: border-color 0.15s;
  }
	  .input-field:focus { border-color: var(--accent); }
	  .input-field.compact {
	    font-family: 'Manrope', sans-serif;
	    font-size: 11px;
	    letter-spacing: 0;
	    margin-bottom: 6px;
	  }

  .btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }

  .tbtn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 7px 4px;
    border-radius: 5px;
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
    text-align: center;
    white-space: nowrap;
  }
  .tbtn:hover { border-color: var(--accent); color: var(--text); background: rgba(255,81,0,0.06); }
  .tbtn.active { border-color: var(--accent); color: var(--accent); background: rgba(255,81,0,0.12); }
  .tbtn.wide { grid-column: 1 / -1; }

  .color-chips { display: flex; gap: 5px; flex-wrap: wrap; }
  .chip {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.1s;
  }
  .chip:hover { transform: scale(1.2); }
  .chip.active { border-color: #fff; transform: scale(1.2); }

  .slider-field { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
  .slider-field label { font-size: 10px; color: var(--text3); min-width: 50px; }
  .slider-field input[type="range"] { flex: 1; accent-color: var(--accent); height: 3px; }

  select.sel {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 8px;
    border-radius: 5px;
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    outline: none;
  }
  select.sel:focus { border-color: var(--accent); }

  .step-list { display: flex; flex-direction: column; gap: 3px; max-height: 240px; overflow-y: auto; }
  .step-open { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
  .step-thumb { width: 52px; height: 52px; border-radius: 3px; flex: none; background: #222; }
  .step-row button { min-width: 28px; min-height: 28px; margin-left: 2px; }
  .step-row button:disabled { opacity: .3; }
  .step-note { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 6px 8px; font: inherit; font-size: 13px; resize: vertical; border: 1px solid #ccc; border-radius: 6px; }
  .step-row {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 11px; padding: 4px 8px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
    cursor: pointer;
  }
  .step-row.active { border-color: var(--accent); color: var(--accent); }
  .step-row .x { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 12px; }
  .step-row .x:hover { color: var(--red); }
  .hint { font-size: 9px; color: var(--text3); margin-top: 5px; line-height: 1.4; }

  /* ═══════════ CENTER — CANVAS ═══════════ */
  .center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--bg);
    background-image: radial-gradient(circle at 50% 50%, rgba(255,81,0,0.03) 0%, transparent 70%);
  }

  .canvas-frame {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 80px rgba(255,81,0,0.06), 0 20px 60px rgba(0,0,0,0.6);
    border: 1px solid var(--border);
  }
  canvas#mainCanvas { display: block; cursor: crosshair; }

  .playback-bar {
    position: absolute;
    bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 14px;
  }
  .pb-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 34px; height: 34px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.12s;
  }
  .pb-btn:hover { border-color: var(--accent); }
  .pb-btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none; color: #fff; width: 40px; height: 40px;
    border-radius: 50%;
    font-size: 16px;
  }
  .pb-btn.primary:hover { transform: scale(1.05); box-shadow: 0 0 20px var(--accent-glow); }
  .step-label { font-size: 11px; color: var(--text2); min-width: 65px; text-align: center; }

  /* ═══════════ RIGHT PANEL — EXPORT ═══════════ */
  .panel-right {
    width: 280px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .platform-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
  }
  .platform-card:hover { border-color: var(--accent); }
  .platform-card.selected { border-color: var(--accent); box-shadow: 0 0 16px var(--accent-glow); }

  .plat-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  .plat-icon { font-size: 20px; }
  .plat-name { font-family: 'Oswald', sans-serif; font-size: 14px; font-weight: 600; letter-spacing: 1px; }
  .plat-specs { font-size: 10px; color: var(--text3); line-height: 1.5; }
  .plat-check {
    position: absolute; top: 10px; right: 10px;
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; transition: all 0.15s;
  }
  .platform-card.selected .plat-check {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
  }

  .export-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    color: white;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
  }
  .export-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px var(--accent-glow); }
  .export-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

  .export-all-btn {
    width: 100%;
    padding: 10px;
    background: var(--surface3);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: 'Oswald', sans-serif;
    font-size: 13px;
    letter-spacing: 1.5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
  }
  .export-all-btn:hover { border-color: var(--accent); }

  .video-pane-section { margin-top: 12px; }
  .video-file-name {
    margin-top: 6px;
    font-size: 10px;
    line-height: 1.35;
    color: var(--text2);
    word-break: break-word;
  }
  .video-offset-input {
    width: 74px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 5px 7px;
    border-radius: 5px;
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    outline: none;
  }
  .video-offset-input:focus { border-color: var(--accent); }

  .progress-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    display: none;
  }
	  .progress-bar .fill {
	    height: 100%;
	    background: linear-gradient(90deg, var(--accent), var(--accent2));
	    width: 0%;
	    transition: width 0.3s;
	  }

	  .publishing-section {
	    border-color: rgba(255,149,0,0.42);
	    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
	  }
	  .publishing-section select.sel { margin-bottom: 6px; }
	  .publishing-summary {
	    margin: 6px 0;
	    padding: 7px 8px;
	    border: 1px solid var(--border);
	    border-radius: 6px;
	    background: var(--bg);
	    color: var(--text2);
	    font-size: 10px;
	    font-weight: 700;
	    text-transform: uppercase;
	    letter-spacing: 0.08em;
	  }

	  /* ═══════════ ANIMATOR STUDIO ═══════════ */
	  .animator-studio {
	    height: calc(100vh - 52px);
	    display: grid;
	    grid-template-columns: 286px minmax(460px, 1fr) 286px;
	    gap: 14px;
	    padding: 14px;
	    background:
	      radial-gradient(circle at 50% 0%, rgba(255,81,0,0.10), transparent 36%),
	      var(--bg);
	    overflow: hidden;
	  }
	  .animator-sidebar,
	  .animator-stage,
	  .animator-inspector {
	    min-width: 0;
	    min-height: 0;
	    overflow-y: auto;
	  }
	  .animator-stage {
	    display: flex;
	    flex-direction: column;
	    align-items: center;
	    justify-content: center;
	    gap: 12px;
	    padding: 14px;
	    border: 1px solid var(--border);
	    border-radius: 8px;
	    background:
	      linear-gradient(180deg, rgba(255,255,255,0.02), transparent 36%),
	      #050508;
	  }
	  .animator-stage-head {
	    width: min(100%, 760px);
	    display: flex;
	    align-items: flex-end;
	    justify-content: space-between;
	    gap: 12px;
	  }
	  .animator-stage h2 {
	    margin: 0;
	    font-family: 'Oswald', sans-serif;
	    font-size: 26px;
	    letter-spacing: 0.02em;
	  }
	  .animator-timecode {
	    color: var(--text2);
	    font-family: 'Oswald', sans-serif;
	    font-size: 13px;
	    letter-spacing: 0.08em;
	  }
	  .animator-canvas-shell {
	    display: grid;
	    place-items: center;
	    width: min(100%, 760px);
	    min-height: 0;
	    padding: 10px;
	    border: 1px solid var(--border);
	    border-radius: 8px;
	    background: #020204;
	    box-shadow: 0 20px 70px rgba(0,0,0,0.55);
	  }
	  #animatorCanvas {
	    display: block;
	    max-width: 100%;
	    max-height: calc(100vh - 250px);
	    border-radius: 7px;
	    background: #000;
	  }
	  .animator-transport {
	    width: min(100%, 760px);
	    display: grid;
	    grid-template-columns: 44px 52px 44px minmax(120px, 1fr);
	    align-items: center;
	    gap: 8px;
	    padding: 8px;
	    border: 1px solid var(--border);
	    border-radius: 8px;
	    background: var(--surface);
	  }
	  .animator-transport input[type="range"],
	  .animator-control input[type="range"] {
	    width: 100%;
	    accent-color: var(--accent);
	  }
	  .animator-timeline {
	    width: min(100%, 760px);
	    display: flex;
	    gap: 3px;
	    min-height: 42px;
	    padding: 7px;
	    border: 1px solid var(--border);
	    border-radius: 8px;
	    background: var(--surface);
	  }
	  .animator-segment {
	    min-width: 12px;
	    border-radius: 4px;
	    border: 1px solid rgba(255,255,255,0.07);
	    background: var(--surface3);
	    position: relative;
	    overflow: hidden;
	  }
	  .animator-segment.move { background: rgba(68,138,255,0.28); }
	  .animator-segment.path { background: rgba(255,81,0,0.34); }
	  .animator-segment.action { background: rgba(255,149,0,0.38); }
	  .animator-segment.hold { background: rgba(255,255,255,0.10); }
	  .animator-segment.title,
	  .animator-segment.end { background: rgba(255,255,255,0.22); }
	  .animator-segment.active { outline: 2px solid var(--accent2); outline-offset: 1px; }
	  .animator-control {
	    display: grid;
	    grid-template-columns: 58px 1fr 44px;
	    align-items: center;
	    gap: 8px;
	    margin-top: 8px;
	  }
	  .animator-control label,
	  .animator-field-grid label,
	  .animator-toggle {
	    color: var(--text2);
	    font-size: 10px;
	    font-weight: 800;
	    letter-spacing: 0.08em;
	    text-transform: uppercase;
	  }
	  .animator-control span {
	    color: var(--text);
	    font-family: 'Oswald', sans-serif;
	    font-size: 12px;
	    text-align: right;
	  }
	  .animator-field-grid {
	    margin-top: 10px;
	    align-items: end;
	  }
	  .animator-field-grid.compact-first { margin-top: 0; margin-bottom: 10px; }
	  .animator-save-cell { display: flex; align-items: end; height: 100%; }
	  .animator-field-grid .tbtn { margin-top: 5px; }
	  .animator-field-grid .sel { margin-top: 5px; }
	  .animator-toggle {
	    display: flex;
	    align-items: center;
	    gap: 8px;
	    margin-top: 10px;
	  }
	  .animator-toggle.compact { margin-top: 0; margin-bottom: 8px; }
	  .animator-toggle input { accent-color: var(--accent); }
	  .animator-video-tools {
	    margin-top: 10px;
	    padding: 10px;
	    border: 1px solid var(--border);
	    border-radius: 8px;
	    background: rgba(255,255,255,0.025);
	  }
	  .animator-video-tools .export-all-btn {
	    width: 100%;
	    padding: 9px;
	  }
	  .animator-video-offset {
	    display: flex;
	    align-items: center;
	    justify-content: space-between;
	    gap: 8px;
	    margin-top: 8px;
	    color: var(--text2);
	    font-size: 10px;
	    font-weight: 800;
	    letter-spacing: 0.08em;
	    text-transform: uppercase;
	  }
	  .animator-source-meta {
	    margin-top: 7px;
	    color: var(--text2);
	    font-size: 10px;
	    line-height: 1.4;
	  }
	  .animator-step-list {
	    display: flex;
	    flex-direction: column;
	    gap: 6px;
	    max-height: calc(100vh - 190px);
	    overflow-y: auto;
	  }
	  .animator-step-item {
	    display: grid;
	    grid-template-columns: 28px 1fr auto;
	    align-items: center;
	    gap: 8px;
	    padding: 8px;
	    border: 1px solid var(--border);
	    border-radius: 7px;
	    background: var(--bg);
	    color: var(--text2);
	    cursor: pointer;
	  }
	  .animator-step-item.active {
	    border-color: var(--accent);
	    color: var(--text);
	    background: rgba(255,81,0,0.10);
	  }
	  .animator-step-index {
	    width: 24px;
	    height: 24px;
	    display: grid;
	    place-items: center;
	    border-radius: 50%;
	    background: var(--surface3);
	    color: var(--text);
	    font-size: 10px;
	    font-weight: 900;
	  }
	  .animator-step-name {
	    font-size: 12px;
	    font-weight: 800;
	  }
	  .animator-step-meta {
	    color: var(--text3);
	    font-size: 9px;
	    text-transform: uppercase;
	    letter-spacing: 0.08em;
	  }
	  .animator-caption-list {
	    display: flex;
	    flex-direction: column;
	    gap: 6px;
	    max-height: 210px;
	    overflow-y: auto;
	  }
	  .animator-caption-item {
	    display: grid;
	    grid-template-columns: 48px 1fr;
	    gap: 8px;
	    padding: 8px;
	    border: 1px solid var(--border);
	    border-radius: 7px;
	    background: var(--bg);
	    color: var(--text2);
	    cursor: pointer;
	  }
	  .animator-caption-item.active {
	    border-color: var(--accent);
	    color: var(--text);
	    background: rgba(255,81,0,0.10);
	  }
	  .animator-caption-time {
	    font-family: 'Oswald', sans-serif;
	    color: var(--accent2);
	    font-size: 12px;
	  }
	  .animator-caption-text {
	    font-size: 11px;
	    line-height: 1.35;
	  }
	  .animator-caption-editor {
	    margin-top: 10px;
	  }
	  .animator-caption-editor label {
	    display: block;
	    margin-top: 8px;
	    color: var(--text2);
	    font-size: 10px;
	    font-weight: 800;
	    letter-spacing: 0.08em;
	    text-transform: uppercase;
	  }

	  /* ═══════════ PUBLISHING STUDIO ═══════════ */
	  .publishing-studio {
    height: calc(100vh - 52px);
    display: grid;
    grid-template-columns: 290px minmax(420px, 0.95fr) minmax(420px, 1.05fr);
    gap: 14px;
    padding: 14px;
    background:
      radial-gradient(circle at 50% 0%, rgba(255,81,0,0.12), transparent 34%),
      var(--bg);
    overflow: hidden;
  }
  .studio-sidebar,
  .studio-editor,
  .studio-preview {
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
  }
  .studio-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
  }
  .studio-row { margin-top: 4px; }
  .studio-play-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: calc(100vh - 290px);
    overflow-y: auto;
  }
  .studio-play-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg);
    color: var(--text2);
    cursor: grab;
  }
  .studio-play-item.active {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(255,81,0,0.10);
  }
  .studio-play-index {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface3);
    color: var(--text);
    font-size: 10px;
    font-weight: 800;
  }
  .studio-play-name {
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
  }
  .studio-play-chapter {
    margin-top: 3px;
    font-size: 9px;
    color: var(--text3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .studio-fields-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
  }
  .studio-fields h2 {
    margin: 0;
    color: var(--text);
    font-family: 'Oswald', sans-serif;
    font-size: 24px;
    letter-spacing: 0.02em;
  }
  .studio-fields label {
    display: block;
    margin-top: 9px;
    color: var(--text2);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.10em;
    text-transform: uppercase;
  }
  .field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .studio-textarea {
    margin-top: 5px;
    min-height: 70px;
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    letter-spacing: 0;
    line-height: 1.45;
    resize: vertical;
  }
  .studio-image-panel {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
  .studio-image-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .studio-image-slot {
    display: grid;
    gap: 5px;
    min-width: 0;
  }
  .studio-image-preview {
    height: 78px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg);
    color: var(--text3);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.10em;
    text-transform: uppercase;
  }
  .studio-image-preview.has-image {
    place-items: stretch;
    color: transparent;
  }
  .studio-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .studio-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .studio-actions .export-btn {
    grid-column: 1 / -1;
  }
  .compact-action {
    width: auto;
    min-width: 104px;
    padding: 7px 10px;
    font-size: 11px;
  }
  .preview-card {
    height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
  }
  #publishingPreviewFrame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
  }

  .safe-zone-toggle {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; color: var(--text2); margin-top: 6px;
  }
  .safe-zone-toggle input { accent-color: var(--accent); }

  .rec-badge {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    background: rgba(255,40,40,0.9);
    color: white; padding: 4px 14px; border-radius: 20px;
    font-size: 11px; font-weight: 700; letter-spacing: 1px;
    display: none; align-items: center; gap: 6px; z-index: 5;
  }
  .rec-badge .blink { width: 7px; height: 7px; background: #fff; border-radius: 50%; animation: blink 0.8s infinite; }
  @keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

  /* Scrollbar */
  ::-webkit-scrollbar { width: 5px; }
  ::-webkit-scrollbar-track { background: var(--surface); }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ═══════════ INLINE MODAL ═══════════ */
.inline-modal {
  position: absolute;
  z-index: 20;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 4px;
  display: flex;
  gap: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.inline-modal-input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 4px;
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  outline: none;
  width: 120px;
}
.inline-modal-input:focus { border-color: var(--accent); }
.inline-modal-ok {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
}

/* ═══════════ RESPONSIVE ═══════════ */
.mobile-tab-bar,
.mobile-sheet-scrim,
.mobile-studios-sheet { display: none; }

@media (max-width: 768px) {
	  body { height: var(--mobile-viewport-height); padding-bottom: env(safe-area-inset-bottom); }
	  .layout {
	    height: calc(var(--mobile-viewport-height) - 52px - var(--mobile-tab-height) - env(safe-area-inset-bottom));
	    transition: height 180ms ease;
	  }
	  .panel-left, .panel-right {
	    display: none;
	    position: fixed;
	    z-index: 102;
	    left: 0;
	    right: 0;
	    bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom));
	    width: auto;
	    height: var(--mobile-sheet-height);
	    padding: 10px 12px calc(18px + env(safe-area-inset-bottom));
	    overflow-y: auto;
	    overscroll-behavior: contain;
	    border: 1px solid var(--border2);
	    border-width: 1px 0 0;
	    border-radius: 18px 18px 0 0;
	    background: var(--surface);
	    box-shadow: 0 -18px 44px rgba(0,0,0,0.55);
	  }
	  .layout[data-mobile-sheet="tools"] .panel-left,
	  .layout[data-mobile-sheet="steps"] .panel-left,
	  .layout[data-mobile-sheet="export"] .panel-right { display: flex; }
	  .layout[data-mobile-sheet="tools"] .panel-left .mobile-steps-section { display: none; }
	  .layout[data-mobile-sheet="steps"] .panel-left > :not(.mobile-steps-section) { display: none; }
	  .layout[data-mobile-sheet="steps"] .panel-left { justify-content: flex-start; }
	  .layout.mobile-sheet-open {
	    height: max(176px, calc(var(--mobile-viewport-height) - var(--mobile-sheet-height) - 52px));
	  }
	  .center { width: 100%; min-height: 0; padding: 8px 0; }
	  .canvas-frame {
	    max-width: 100vw;
	    max-height: calc(100% - 54px);
	    border-radius: 8px;
	  }
	  canvas#mainCanvas {
	    width: auto;
	    height: auto;
	    max-width: 100vw;
	    max-height: calc(var(--mobile-viewport-height) - 132px - env(safe-area-inset-bottom));
	    touch-action: none;
	  }
	  .layout.mobile-sheet-open canvas#mainCanvas { max-height: max(118px, calc(var(--mobile-viewport-height) - var(--mobile-sheet-height) - 112px)); }
	  .header { padding: env(safe-area-inset-top) 10px 0; height: calc(52px + env(safe-area-inset-top)); }
	  .header-right { display: none; }
	  .animator-studio { grid-template-columns: 1fr; overflow-y: auto; }
	  .animator-stage { min-height: 620px; }
	  .animator-inspector { min-height: 260px; }
	  .publishing-studio { grid-template-columns: 1fr; overflow-y: auto; }
	  .studio-preview { min-height: 560px; }
	  .playback-bar { position: relative; bottom: auto; margin-top: 7px; flex-shrink: 0; }
	  .mobile-sheet-scrim {
	    position: fixed;
	    z-index: 101;
	    inset: 0 0 calc(var(--mobile-tab-height) + env(safe-area-inset-bottom));
	    background: rgba(0,0,0,0.42);
	  }
	  .mobile-sheet-scrim.open { display: block; }
	  .mobile-tab-bar {
	    display: grid;
	    grid-template-columns: repeat(4, 1fr);
	    position: fixed;
	    z-index: 110;
	    left: 0;
	    right: 0;
	    bottom: 0;
	    min-height: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom));
	    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
	    border-top: 1px solid var(--border2);
	    background: rgba(17,17,24,0.98);
	    backdrop-filter: blur(18px);
	  }
	  .mobile-tab-bar button {
	    min-width: 0;
	    min-height: 50px;
	    border: 0;
	    border-radius: 10px;
	    color: var(--text2);
	    background: transparent;
	    font: 700 10px 'Manrope', sans-serif;
	    letter-spacing: 0.04em;
	    text-transform: uppercase;
	  }
	  .mobile-tab-bar button span { display: block; margin-bottom: 2px; color: var(--text); font-size: 21px; line-height: 1; }
	  .mobile-tab-bar button.active { color: #fff; background: rgba(255,81,0,0.16); }
	  .mobile-tab-bar button.active span { color: var(--accent); }
	  .mobile-studios-sheet {
	    position: fixed;
	    z-index: 102;
	    left: 0;
	    right: 0;
	    bottom: calc(var(--mobile-tab-height) + env(safe-area-inset-bottom));
	    height: var(--mobile-sheet-height);
	    padding: 10px 14px 24px;
	    border-top: 1px solid var(--border2);
	    border-radius: 18px 18px 0 0;
	    background: var(--surface);
	    box-shadow: 0 -18px 44px rgba(0,0,0,0.55);
	  }
	  .mobile-studios-sheet.open { display: block; }
	  .mobile-sheet-handle { width: 42px; height: 4px; margin: 0 auto 16px; border-radius: 2px; background: var(--border2); }
	  .mobile-studio-card {
	    display: grid;
	    width: 100%;
	    gap: 5px;
	    margin-bottom: 10px;
	    padding: 18px;
	    text-align: left;
	    border: 1px solid var(--border);
	    border-radius: 12px;
	    background: var(--surface2);
	    color: var(--text);
	  }
	  .mobile-studio-card strong { font: 600 18px 'Oswald', sans-serif; letter-spacing: 0.04em; }
	  .mobile-studio-card span { color: var(--text2); font-size: 11px; line-height: 1.45; }
	  input, textarea, select { font-size: 16px; }
	}

@media (min-width: 769px) and (max-width: 1100px) {
  .panel-left { width: 220px; }
  .panel-right { width: 250px; }
}

/* Storage-full banner (shown by saveLibrary when localStorage rejects a write) */
.save-warning {
  position: relative; flex: none;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; text-align: center; font-weight: 600;
  background: var(--red); color: #fff;
}
.save-warning-actions { display:flex; justify-content:center; gap:8px; margin-top:6px; flex-wrap:wrap; }
.save-warning-actions button { min-height:44px; padding:8px 12px; border:1px solid #fff9; border-radius:6px; background:#3007; color:white; font:inherit; }

.player-actions { margin: auto; border: 1px solid #555; border-radius: 12px; padding: 12px; background: #171820; color: #fff; width: min(300px, 90vw); }
.player-actions::backdrop { background: #0009; }
.player-actions button { display: block; width: 100%; min-height: 48px; margin: 4px 0; background: #292b36; border: 0; border-radius: 6px; color: #fff; font: inherit; }
