    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      background: #0d0d0d;
      color: #ffffff;
      overflow: hidden;
      height: 100vh;
      width: 100vw;
    }

    /* Registration Gate */
    .gate-overlay {
      position: fixed;
      inset: 0;
      background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
      z-index: 10000;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 1;
      transition: opacity 0.5s ease, visibility 0.5s ease;
    }

    .gate-overlay.hidden {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }

    .gate-container {
      max-width: 500px;
      width: 90%;
      text-align: center;
      animation: gateSlideUp 0.6s ease-out;
    }

    @keyframes gateSlideUp {
      from {
        opacity: 0;
        transform: translateY(30px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .gate-logo {
      font-size: 48px;
      font-weight: 400;
      letter-spacing: 1px;
      margin-bottom: 8px;
      color: #888;
    }

    .gate-logo strong {
      font-weight: 800;
      background: linear-gradient(135deg, #f0c060 0%, #d4a843 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
    }

    .gate-tagline {
      font-size: 18px;
      color: #888;
      margin-bottom: 40px;
      font-weight: 400;
    }

    .gate-card {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 20px;
      padding: 40px;
      backdrop-filter: blur(20px);
    }

    .gate-title {
      font-size: 28px;
      font-weight: 700;
      margin-bottom: 12px;
      color: #fff;
    }

    .gate-subtitle {
      font-size: 16px;
      color: #999;
      margin-bottom: 32px;
      line-height: 1.5;
    }

    .gate-features {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      justify-content: center;
      margin-bottom: 32px;
    }

    .gate-feature {
      background: rgba(212, 168, 67, 0.1);
      border: 1px solid rgba(212, 168, 67, 0.3);
      color: #d4a843;
      padding: 8px 16px;
      border-radius: 20px;
      font-size: 13px;
      font-weight: 500;
    }

    .gate-form {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .gate-input {
      width: 100%;
      padding: 16px 20px;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      color: #fff;
      font-size: 16px;
      outline: none;
      transition: all 0.2s ease;
    }

    .gate-input:focus {
      border-color: #d4a843;
      background: rgba(255, 255, 255, 0.08);
    }

    .gate-input::placeholder {
      color: #666;
    }

    .gate-btn {
      width: 100%;
      padding: 16px 24px;
      background: linear-gradient(135deg, #d4a843 0%, #b8902e 100%);
      border: none;
      border-radius: 12px;
      color: #000;
      font-size: 16px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s ease;
      text-transform: uppercase;
      letter-spacing: 1px;
    }

    .gate-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 10px 30px rgba(212, 168, 67, 0.3);
    }

    .gate-btn:active {
      transform: translateY(0);
    }

    .gate-disclaimer {
      margin-top: 20px;
      font-size: 12px;
      color: #555;
      line-height: 1.5;
    }

    .gate-disclaimer a {
      color: #d4a843;
      text-decoration: none;
    }

    .gate-social-proof {
      margin-top: 32px;
      padding-top: 24px;
      border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .gate-avatars {
      display: flex;
      justify-content: center;
      margin-bottom: 12px;
    }

    .gate-avatar {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: linear-gradient(135deg, #333 0%, #555 100%);
      border: 2px solid #1a1a2e;
      margin-left: -8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
    }

    .gate-avatar:first-child {
      margin-left: 0;
    }

    .gate-proof-text {
      font-size: 13px;
      color: #777;
    }

    .gate-proof-text strong {
      color: #d4a843;
    }

    /* Header */
    .header {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 56px;
      background: linear-gradient(180deg, #1a1a1a 0%, #111111 100%);
      border-bottom: 1px solid rgba(255,255,255,0.06);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 20px;
      z-index: 100;
    }

    .header-left {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    /* Hamburger Menu */
    .hamburger-btn {
      background: transparent;
      border: none;
      color: #888;
      width: 36px;
      height: 36px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 5px;
      cursor: pointer;
      border-radius: 6px;
      transition: all 0.15s ease;
    }

    .hamburger-btn:hover {
      background: #252525;
      color: #fff;
    }

    .hamburger-btn span {
      display: block;
      width: 18px;
      height: 2px;
      background: currentColor;
      border-radius: 1px;
    }

    .hamburger-menu {
      position: fixed;
      top: 56px;
      left: 0;
      width: 240px;
      background: #1a1a1a;
      border: 1px solid #2a2a2a;
      border-top: none;
      border-radius: 0 0 8px 0;
      box-shadow: 4px 4px 20px rgba(0, 0, 0, 0.5);
      z-index: 150;
      opacity: 0;
      transform: translateX(-100%);
      transition: all 0.2s ease;
      pointer-events: none;
    }

    .hamburger-menu.visible {
      opacity: 1;
      transform: translateX(0);
      pointer-events: auto;
    }

    .menu-section {
      padding: 8px 0;
      border-bottom: 1px solid #2a2a2a;
    }

    .menu-section:last-child {
      border-bottom: none;
    }

    .menu-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 16px;
      color: #ccc;
      font-size: 13px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .menu-item:hover {
      background: #252525;
      color: #fff;
    }

    .menu-item svg {
      width: 18px;
      height: 18px;
      flex-shrink: 0;
    }

    .menu-item .shortcut {
      margin-left: auto;
      font-size: 11px;
      color: #666;
    }

    .menu-item.danger {
      color: #e57373;
    }

    .menu-item.danger:hover {
      background: #2a1a1a;
      color: #ff6b6b;
    }

    .logo {
      font-weight: 400;
      font-size: 15px;
      letter-spacing: 0.5px;
      color: #999;
    }

    .logo strong {
      font-weight: 700;
      color: #d4a843;
    }

    .project-selector {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-left: 16px;
    }

    #projectSelect {
      background: #1a1a1a;
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 6px;
      color: #e0e0e0;
      padding: 6px 12px;
      font-size: 12px;
      font-weight: 500;
      letter-spacing: 0.2px;
      min-width: 150px;
      cursor: pointer;
      transition: all 0.2s ease;
      color-scheme: dark;
    }

    #projectSelect:hover {
      border-color: rgba(255,255,255,0.15);
      background: #222222;
    }

    #projectSelect:focus {
      outline: none;
      border-color: rgba(212,168,67,0.4);
    }

    #projectSelect option {
      background: #1a1a1a;
      color: #e0e0e0;
      padding: 8px 12px;
    }

    #projectSelect option:hover,
    #projectSelect option:checked {
      background: #2a2a2a;
      color: #fff;
    }

    .project-btn {
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 6px;
      color: #888;
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 12px;
      transition: all 0.2s ease;
    }

    .project-btn:hover {
      background: rgba(255,255,255,0.08);
      color: #fff;
      border-color: rgba(212,168,67,0.25);
    }

    .add-style-btn {
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #888;
      font-size: 16px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .add-style-btn:hover {
      background: #252525;
      color: #fff;
    }

    .header-right {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .header-btn {
      padding: 8px 14px;
      background: rgba(255,255,255,0.04);
      border: 1px solid rgba(255,255,255,0.08);
      border-radius: 6px;
      color: #e0e0e0;
      font-size: 12px;
      font-weight: 500;
      letter-spacing: 0.3px;
      cursor: pointer;
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      min-height: 32px;
    }

    .header-btn:hover {
      background: rgba(255,255,255,0.08);
      border-color: rgba(212,168,67,0.25);
      color: #fff;
    }

    .header-btn.primary {
      background: linear-gradient(180deg, #4a8ff7 0%, #3b82f6 100%);
      border-color: rgba(59,130,246,0.5);
      color: #fff;
      font-weight: 600;
    }

    .header-btn.primary:hover {
      background: linear-gradient(180deg, #5a9af7 0%, #4a8ff7 100%);
      border-color: rgba(59,130,246,0.7);
      box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
    }

    .header-center {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .header-group {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .header-divider {
      width: 1px;
      height: 24px;
      background: rgba(255,255,255,0.08);
      margin: 0 8px;
    }

    .auto-save-indicator {
      color: #22c55e;
      font-size: 14px;
      margin-left: 8px;
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    .auto-save-indicator.visible {
      opacity: 1;
    }

    /* Styles Dropdown */
    .styles-dropdown {
      position: relative;
    }

    .styles-dropdown-menu {
      position: absolute;
      top: 100%;
      right: 0;
      margin-top: 4px;
      background: #1a1a1a;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      min-width: 220px;
      max-height: 400px;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
      z-index: 100;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-8px);
      transition: all 0.15s ease;
    }

    .styles-dropdown-menu.visible {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }

    .styles-dropdown-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 14px;
      border-bottom: 1px solid #2a2a2a;
      font-size: 12px;
      font-weight: 600;
      color: #888;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .styles-dropdown-header .add-style-btn {
      width: 24px;
      height: 24px;
      font-size: 14px;
    }

    .styles-list {
      max-height: 280px;
      overflow-y: auto;
    }

    .styles-list::-webkit-scrollbar {
      width: 6px;
    }

    .styles-list::-webkit-scrollbar-track {
      background: transparent;
    }

    .styles-list::-webkit-scrollbar-thumb {
      background: #3a3a3a;
      border-radius: 3px;
    }

    .style-item {
      display: flex;
      align-items: center;
      padding: 10px 14px;
      cursor: pointer;
      transition: background 0.1s ease;
      gap: 8px;
    }

    .style-item:hover {
      background: #252525;
    }

    .style-item-info {
      flex: 1;
      min-width: 0;
    }

    .style-item-name {
      font-size: 13px;
      color: #fff;
    }

    .style-item-preview {
      font-size: 11px;
      color: #666;
    }

    .style-item-apply-all {
      opacity: 0;
      background: #3b82f6;
      border: none;
      color: #fff;
      font-size: 10px;
      padding: 4px 8px;
      border-radius: 4px;
      cursor: pointer;
      white-space: nowrap;
      transition: opacity 0.1s ease;
    }

    .style-item:hover .style-item-apply-all {
      opacity: 1;
    }

    .style-item-apply-all:hover {
      background: #2563eb;
    }

    .no-styles-message {
      padding: 20px 14px;
      text-align: center;
      color: #666;
      font-size: 12px;
      line-height: 1.5;
    }

    .styles-dropdown-footer {
      padding: 10px 14px;
      border-top: 1px solid #2a2a2a;
    }

    .manage-styles-link {
      background: none;
      border: none;
      color: #3b82f6;
      font-size: 12px;
      cursor: pointer;
      padding: 0;
    }

    .manage-styles-link:hover {
      text-decoration: underline;
    }

    /* Toolbar */
    .toolbar {
      position: fixed;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      background: #141414;
      border: 1px solid #2a2a2a;
      border-left: none;
      border-radius: 0 12px 12px 0;
      padding: 8px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      z-index: 100;
    }

    .tool-btn {
      width: 40px;
      height: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: none;
      border-radius: 8px;
      color: #888;
      font-size: 18px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .tool-btn:hover {
      background: #1e1e1e;
      color: #fff;
    }

    .tool-btn.active {
      background: #3b82f6;
      color: #fff;
    }

    .tool-btn svg {
      width: 20px;
      height: 20px;
    }

    .tool-divider {
      height: 1px;
      background: #2a2a2a;
      margin: 4px 0;
    }

    /* Context Panel */
    .context-panel {
      position: fixed;
      bottom: 16px;
      left: 50%;
      transform: translateX(-50%);
      background: #141414;
      border: 1px solid #2a2a2a;
      border-radius: 12px;
      padding: 12px 16px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      z-index: 100;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease;
    }

    .context-panel.visible {
      opacity: 1;
      pointer-events: auto;
    }

    .context-row {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .context-group {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .context-label {
      font-size: 11px;
      color: #666;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .context-select {
      padding: 6px 10px;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #fff;
      font-size: 13px;
      font-family: inherit;
      cursor: pointer;
      min-width: 120px;
    }

    .context-select:focus {
      outline: none;
      border-color: #3b82f6;
    }

    .context-input {
      padding: 6px 10px;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #fff;
      font-size: 13px;
      font-family: inherit;
      width: 60px;
      text-align: center;
    }

    .context-input:focus {
      outline: none;
      border-color: #3b82f6;
    }

    /* Hide native number spinner for font size input */
    #fontSize::-webkit-outer-spin-button,
    #fontSize::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }
    #fontSize {
      -moz-appearance: textfield;
    }

    .context-color {
      width: 28px;
      height: 28px;
      border: 2px solid #2a2a2a;
      border-radius: 6px;
      cursor: pointer;
      padding: 0;
      background: #fff;
    }

    .context-color::-webkit-color-swatch-wrapper {
      padding: 0;
    }

    .context-color::-webkit-color-swatch {
      border: none;
      border-radius: 4px;
    }

    .context-btn {
      padding: 6px 12px;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #fff;
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .context-btn:hover {
      background: #3b82f6;
      border-color: #3b82f6;
    }

    .context-btn.active {
      background: #3b82f6;
      border-color: #3b82f6;
    }

    .context-divider {
      width: 1px;
      height: 24px;
      background: #2a2a2a;
    }

    .context-input-small {
      padding: 6px 8px;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #fff;
      font-size: 13px;
      font-family: inherit;
      width: 50px;
      text-align: center;
    }

    .context-input-small:focus {
      outline: none;
      border-color: #3b82f6;
    }

    .context-btn-small {
      padding: 6px 10px;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #888;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .context-btn-small:hover {
      background: #252525;
      color: #fff;
      border-color: #3b82f6;
    }

    .context-toggle {
      padding: 6px 10px;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #666;
      font-size: 11px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .context-toggle:hover {
      background: #252525;
      color: #fff;
    }

    .context-toggle.active {
      background: #3b82f6;
      border-color: #3b82f6;
      color: #fff;
    }

    /* Zoom Controls */
    .zoom-controls {
      position: fixed;
      bottom: 16px;
      right: 16px;
      background: #141414;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      z-index: 100;
    }

    .zoom-controls-row {
      display: flex;
      align-items: center;
    }

    .zoom-controls-row:first-child {
      border-bottom: 1px solid #2a2a2a;
    }

    .zoom-row-spacer {
      flex: 1;
      min-width: 16px;
    }

    .zoom-btn {
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: none;
      color: #888;
      font-size: 18px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .zoom-btn:hover {
      color: #fff;
      background: #1e1e1e;
    }

    /* Top row corners */
    .zoom-controls-row:first-child .zoom-btn:first-child {
      border-radius: 8px 0 0 0;
    }

    .zoom-controls-row:first-child .zoom-btn:last-child {
      border-radius: 0 8px 0 0;
    }

    /* Bottom row corners */
    .zoom-controls-row:last-child .zoom-btn:first-child {
      border-radius: 0 0 0 8px;
    }

    .zoom-controls-row:last-child .zoom-btn:last-child {
      border-radius: 0 0 8px 0;
    }

    .zoom-level {
      padding: 0 12px;
      font-size: 13px;
      color: #888;
      min-width: 60px;
      text-align: center;
      border-left: 1px solid #2a2a2a;
      border-right: 1px solid #2a2a2a;
    }

    /* Snap to Scene Button */
    .scene-btn {
      display: flex;
      align-items: center;
      gap: 3px;
      padding: 0 8px;
      background: linear-gradient(135deg, #3b82f6, #2563eb);
      border-color: #3b82f6;
      color: #fff;
      font-weight: 600;
      min-width: auto;
      margin-left: 4px;
    }

    .scene-btn:hover {
      background: linear-gradient(135deg, #60a5fa, #3b82f6);
      border-color: #60a5fa;
    }

    .scene-btn-icon {
      font-size: 12px;
    }

    .scene-btn-num {
      font-size: 13px;
      font-weight: 700;
    }

    /* Add Scene Button */
    .add-scene-btn {
      background: linear-gradient(135deg, #10b981, #059669);
      border-color: #10b981;
      color: #fff;
    }

    .add-scene-btn:hover {
      background: linear-gradient(135deg, #34d399, #10b981);
      border-color: #34d399;
    }

    /* Toggle Frames Visibility Button (Header version) */
    .toggle-frames-header-btn {
      color: #3b82f6;
      padding: 8px 10px;
      min-height: 32px;
    }

    .toggle-frames-header-btn:hover {
      color: #60a5fa;
    }

    .toggle-frames-header-btn.frames-hidden {
      color: #666;
      opacity: 0.7;
    }

    .toggle-frames-header-btn.frames-hidden:hover {
      color: #888;
      opacity: 1;
    }

    .toggle-frames-header-btn svg {
      display: block;
      width: 16px;
      height: 16px;
    }

    /* Layer Controls */
    .layer-controls {
      position: fixed;
      top: 72px;
      right: 16px;
      background: #141414;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      padding: 8px;
      display: none;
      gap: 4px;
      z-index: 100;
    }

    .layer-controls.visible {
      display: flex;
      flex-direction: column;
    }

    .layer-btn {
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #888;
      font-size: 14px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .layer-btn:hover {
      background: #252525;
      color: #fff;
      border-color: #3a3a3a;
    }

    .layer-btn svg {
      width: 16px;
      height: 16px;
    }

    .layer-controls-row {
      display: flex;
      gap: 4px;
    }

    .layer-controls-row + .layer-controls-row {
      margin-top: 4px;
      padding-top: 4px;
      border-top: 1px solid #2a2a2a;
    }

    /* Canvas Container (our wrapper) */
    #canvasContainer {
      position: fixed;
      top: 56px;
      left: 0;
      right: 0;
      bottom: 0;
      background: #1a1a1a;
      overflow: hidden;
    }

    /* Grid overlay - between background and canvas */
    #gridOverlay {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      pointer-events: none;
      z-index: 1;
    }

    /* Fabric.js creates its own .canvas-container wrapper - on top of grid */
    #canvasContainer > .canvas-container {
      position: absolute !important;
      top: 0 !important;
      left: 0 !important;
      z-index: 2;
      background: transparent !important;
    }

    /* Ensure Fabric canvases are transparent so grid shows through */
    #canvasContainer .lower-canvas,
    #canvasContainer .upper-canvas {
      background: transparent !important;
    }

    #canvas {
      display: block;
    }

    /* Drawing Panel */
    .drawing-panel {
      position: fixed;
      left: 72px;
      top: 50%;
      transform: translateY(-50%);
      background: #141414;
      border: 1px solid #2a2a2a;
      border-radius: 12px;
      padding: 12px;
      display: none;
      flex-direction: column;
      gap: 12px;
      z-index: 100;
    }

    .drawing-panel.visible {
      display: flex;
    }

    .drawing-panel-title {
      font-size: 11px;
      color: #666;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .color-swatches {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 4px;
    }

    .color-swatch {
      width: 24px;
      height: 24px;
      border-radius: 4px;
      cursor: pointer;
      border: 2px solid transparent;
      transition: all 0.15s ease;
    }

    .color-swatch:hover {
      transform: scale(1.1);
    }

    .color-swatch.active {
      border-color: #fff;
    }

    .panel-hex-row {
      display: flex;
      gap: 4px;
      margin-top: 8px;
    }

    .panel-hex-input {
      flex: 1;
      padding: 4px 6px;
      background: #1a1a1a;
      border: 1px solid #333;
      border-radius: 4px;
      color: #fff;
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px;
      text-transform: uppercase;
      min-width: 0;
    }

    .panel-hex-input:focus {
      outline: none;
      border-color: #8b5cf6;
    }

    .panel-hex-input::placeholder {
      color: #555;
      text-transform: none;
    }

    .panel-hex-btn {
      padding: 4px 8px;
      background: #333;
      border: 1px solid #444;
      border-radius: 4px;
      color: #888;
      font-size: 12px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .panel-hex-btn:hover {
      background: #8b5cf6;
      border-color: #8b5cf6;
      color: #fff;
    }

    .stroke-slider {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .stroke-slider input {
      width: 100%;
      cursor: pointer;
      accent-color: #3b82f6;
    }

    .stroke-value {
      font-size: 12px;
      color: #888;
      text-align: center;
    }

    /* Modal */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.7);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 1000;
    }

    .modal-overlay.visible {
      display: flex;
    }

    .modal {
      background: #141414;
      border: 1px solid #2a2a2a;
      border-radius: 16px;
      padding: 24px;
      min-width: 320px;
      max-width: 400px;
    }

    .modal-title {
      font-size: 18px;
      font-weight: 600;
      margin-bottom: 16px;
    }

    .modal-input {
      width: 100%;
      padding: 10px 12px;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      color: #fff;
      font-size: 14px;
      font-family: inherit;
      margin-bottom: 16px;
    }

    .modal-input:focus {
      outline: none;
      border-color: #3b82f6;
    }

    .modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
    }

    .modal-btn {
      padding: 8px 16px;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      color: #fff;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .modal-btn:hover {
      background: #252525;
    }

    .modal-btn.primary {
      background: #3b82f6;
      border-color: #3b82f6;
    }

    .modal-btn.primary:hover {
      background: #2563eb;
    }

    .modal-btn.danger {
      background: #dc2626;
      border-color: #dc2626;
    }

    .modal-btn.danger:hover {
      background: #b91c1c;
    }

    /* Font Picker Modal */
    .font-picker-modal {
      min-width: 450px;
      max-width: 500px;
    }

    .font-picker-tabs {
      display: flex;
      gap: 4px;
      margin-bottom: 16px;
      background: #1e1e1e;
      padding: 4px;
      border-radius: 8px;
    }

    .font-picker-tab {
      flex: 1;
      padding: 8px 12px;
      background: transparent;
      border: none;
      border-radius: 6px;
      color: #888;
      font-size: 13px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .font-picker-tab:hover {
      color: #fff;
    }

    .font-picker-tab.active {
      background: #2a2a2a;
      color: #fff;
    }

    .font-picker-content {
      display: none;
    }

    .font-picker-content.active {
      display: block;
    }

    .font-search-container {
      margin-bottom: 12px;
    }

    .font-search-input {
      width: 100%;
      padding: 10px 12px;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      color: #fff;
      font-size: 14px;
      font-family: inherit;
    }

    .font-search-input:focus {
      outline: none;
      border-color: #3b82f6;
    }

    .font-results {
      max-height: 300px;
      overflow-y: auto;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      background: #1e1e1e;
    }

    .font-results-placeholder {
      padding: 40px 20px;
      text-align: center;
      color: #666;
      font-size: 13px;
    }

    .font-result-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 14px;
      border-bottom: 1px solid #2a2a2a;
      cursor: pointer;
      transition: background 0.1s ease;
    }

    .font-result-item:last-child {
      border-bottom: none;
    }

    .font-result-item:hover {
      background: #252525;
    }

    .font-result-info {
      flex: 1;
      min-width: 0;
    }

    .font-result-name {
      font-size: 14px;
      color: #fff;
      margin-bottom: 2px;
    }

    .font-result-preview {
      font-size: 18px;
      color: #888;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .font-result-variants {
      font-size: 11px;
      color: #666;
    }

    .font-result-add {
      background: #3b82f6;
      border: none;
      color: #fff;
      font-size: 12px;
      padding: 6px 12px;
      border-radius: 6px;
      cursor: pointer;
      white-space: nowrap;
    }

    .font-result-add:hover {
      background: #2563eb;
    }

    .font-result-add.added {
      background: #22c55e;
      cursor: default;
    }

    .font-result-loading {
      background: #666;
      cursor: wait;
    }

    .font-upload-area {
      border: 2px dashed #2a2a2a;
      border-radius: 12px;
      padding: 40px 20px;
      text-align: center;
      cursor: pointer;
      transition: all 0.2s ease;
      margin-bottom: 16px;
    }

    .font-upload-area:hover {
      border-color: #3b82f6;
      background: rgba(59, 130, 246, 0.05);
    }

    .font-upload-area.dragover {
      border-color: #3b82f6;
      background: rgba(59, 130, 246, 0.1);
    }

    .font-upload-icon {
      font-size: 32px;
      color: #666;
      margin-bottom: 12px;
    }

    .font-upload-text {
      font-size: 14px;
      color: #fff;
      margin-bottom: 8px;
    }

    .font-upload-hint {
      font-size: 12px;
      color: #666;
    }

    .my-fonts-list {
      max-height: 300px;
      overflow-y: auto;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      background: #1e1e1e;
    }

    .my-font-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 14px;
      border-bottom: 1px solid #2a2a2a;
    }

    .my-font-item:last-child {
      border-bottom: none;
    }

    .my-font-info {
      flex: 1;
    }

    .my-font-name {
      font-size: 14px;
      color: #fff;
    }

    .my-font-source {
      font-size: 11px;
      color: #666;
    }

    .my-font-delete {
      background: transparent;
      border: none;
      color: #666;
      font-size: 18px;
      cursor: pointer;
      padding: 4px 8px;
    }

    .my-font-delete:hover {
      color: #dc2626;
    }

    /* Color Palette Popover */
    .color-palette-popover {
      position: fixed;
      background: #1a1a1a;
      border: 1px solid #2a2a2a;
      border-radius: 12px;
      padding: 12px;
      min-width: 220px;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
      z-index: 1001;
      display: none;
    }

    .color-palette-popover.visible {
      display: block;
    }

    .color-palette-section {
      margin-bottom: 12px;
    }

    .color-palette-section:last-child {
      margin-bottom: 0;
    }

    .color-palette-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
    }

    .color-palette-header span {
      font-size: 11px;
      color: #666;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .color-palette-add {
      width: 20px;
      height: 20px;
      background: #2a2a2a;
      border: none;
      border-radius: 4px;
      color: #888;
      font-size: 14px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s ease;
    }

    .color-palette-add:hover {
      background: #3b82f6;
      color: #fff;
    }

    .color-palette-swatches {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .color-palette-swatch {
      width: 24px;
      height: 24px;
      border-radius: 4px;
      cursor: pointer;
      border: 2px solid transparent;
      transition: all 0.15s ease;
      position: relative;
    }

    .color-palette-swatch:hover {
      transform: scale(1.15);
      border-color: #fff;
    }

    .gradient-swatch {
      width: 40px;
      height: 20px;
      border-radius: 4px;
      cursor: pointer;
      border: 2px solid transparent;
      transition: all 0.15s ease;
    }

    .gradient-swatch:hover {
      transform: scale(1.1);
      border-color: #fff;
    }

    .color-palette-swatch.deletable:hover::after {
      content: '×';
      position: absolute;
      top: -6px;
      right: -6px;
      width: 14px;
      height: 14px;
      background: #dc2626;
      border-radius: 50%;
      font-size: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
    }

    .color-palette-empty {
      font-size: 11px;
      color: #555;
      padding: 8px 0;
    }

    .color-palette-hex-row {
      display: flex;
      gap: 8px;
    }

    .color-palette-hex-input {
      flex: 1;
      padding: 6px 10px;
      background: #252525;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #fff;
      font-size: 13px;
      font-family: 'JetBrains Mono', monospace;
    }

    .color-palette-hex-input:focus {
      outline: none;
      border-color: #3b82f6;
    }

    .color-palette-apply {
      padding: 6px 12px;
      background: #3b82f6;
      border: none;
      border-radius: 6px;
      color: #fff;
      font-size: 12px;
      cursor: pointer;
      transition: background 0.15s ease;
    }

    .color-palette-apply:hover {
      background: #2563eb;
    }

    .color-palette-footer {
      padding-top: 12px;
      border-top: 1px solid #2a2a2a;
      margin-top: 4px;
    }

    .color-palette-custom-btn {
      width: 100%;
      padding: 8px 12px;
      background: #252525;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #888;
      font-size: 12px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .color-palette-custom-btn:hover {
      background: #2a2a2a;
      color: #fff;
      border-color: #3b82f6;
    }

    .color-palette-hex-row {
      display: flex;
      gap: 8px;
      margin-bottom: 8px;
    }

    .color-palette-hex-input {
      flex: 1;
      padding: 8px 10px;
      background: #1a1a1a;
      border: 1px solid #333;
      border-radius: 6px;
      color: #fff;
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      text-transform: uppercase;
    }

    .color-palette-hex-input:focus {
      outline: none;
      border-color: #8b5cf6;
    }

    .color-palette-hex-input::placeholder {
      color: #555;
      text-transform: none;
    }

    .color-palette-hex-apply {
      padding: 8px 14px;
      background: #8b5cf6;
      border: none;
      border-radius: 6px;
      color: #fff;
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: background 0.15s;
    }

    .color-palette-hex-apply:hover {
      background: #7c3aed;
    }

    /* Style Item in Modal */
    .style-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 12px;
      background: #1e1e1e;
      border-radius: 8px;
      margin-bottom: 8px;
    }

    .style-item-name {
      font-size: 14px;
    }

    .style-item-actions {
      display: flex;
      gap: 4px;
    }

    .style-item-btn {
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: none;
      color: #666;
      cursor: pointer;
      border-radius: 4px;
      transition: all 0.15s ease;
    }

    .style-item-btn:hover {
      background: #2a2a2a;
      color: #fff;
    }

    .style-item-btn.delete:hover {
      background: #dc2626;
    }

    /* Hidden file input */
    .hidden-input {
      display: none;
    }

    /* Toast Notification */
    .toast {
      position: fixed;
      bottom: 80px;
      left: 50%;
      transform: translateX(-50%) translateY(100px);
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      padding: 12px 20px;
      font-size: 14px;
      color: #fff;
      z-index: 1000;
      opacity: 0;
      transition: all 0.3s ease;
    }

    .toast.visible {
      transform: translateX(-50%) translateY(0);
      opacity: 1;
    }

    /* Keyboard shortcut hints */
    .shortcut-hint {
      font-size: 10px;
      color: #555;
      margin-top: 2px;
    }

    /* Custom scrollbar for selects */
    .context-select::-webkit-scrollbar {
      width: 8px;
    }

    .context-select::-webkit-scrollbar-track {
      background: #1e1e1e;
    }

    .context-select::-webkit-scrollbar-thumb {
      background: #3a3a3a;
      border-radius: 4px;
    }

    /* Text cursor on canvas when text tool is active */
    #canvasContainer.text-tool {
      cursor: text;
    }

    #canvasContainer.drawing-tool {
      cursor: crosshair;
    }

    /* ===== AI FEATURES STYLES ===== */
    /* Context Menu */
    .context-menu {
      position: fixed;
      background: #1a1a1a;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      padding: 6px 0;
      min-width: 200px;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
      z-index: 1000;
      display: none;
    }

    .context-menu.visible {
      display: block;
    }

    .context-menu-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 16px;
      color: #ccc;
      font-size: 13px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .context-menu-item:hover {
      background: #252525;
      color: #fff;
    }

    .context-menu-item svg {
      width: 16px;
      height: 16px;
      flex-shrink: 0;
    }

    .context-menu-item.has-icon {
      padding-left: 12px;
    }

    .context-menu-divider {
      height: 1px;
      background: #2a2a2a;
      margin: 6px 0;
    }

    /* AI Modal */
    .ai-modal {
      width: 1100px;
      max-width: 95vw;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      overflow: visible;
    }

    .ai-modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px;
      border-bottom: 1px solid #2a2a2a;
    }

    .ai-modal-tabs {
      display: flex;
      gap: 4px;
    }

    .ai-modal-tab {
      padding: 8px 16px;
      background: transparent;
      border: 1px solid transparent;
      border-radius: 6px;
      color: #888;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .ai-modal-tab:hover {
      color: #fff;
      background: #252525;
    }

    .ai-modal-tab.active {
      background: #252525;
      border-color: #3a3a3a;
      color: #fff;
    }

    .ai-modal-tab .badge {
      background: linear-gradient(135deg, #8b5cf6, #6366f1);
      color: #fff;
      font-size: 9px;
      padding: 2px 6px;
      border-radius: 4px;
      margin-left: 6px;
      text-transform: uppercase;
      font-weight: 600;
    }

    .ai-modal-close {
      background: transparent;
      border: none;
      color: #666;
      font-size: 24px;
      cursor: pointer;
      padding: 4px 8px;
      line-height: 1;
    }

    .ai-modal-close:hover {
      color: #fff;
    }

    .ai-modal-body {
      display: flex;
      flex: 1;
      overflow: hidden;
    }

    .ai-modal-left {
      flex: 1;
      padding: 20px;
      display: flex;
      flex-direction: column;
      border-right: 1px solid #2a2a2a;
    }

    .ai-modal-right {
      flex: 1;
      padding: 20px;
      display: flex;
      flex-direction: column;
      background: #0d0d0d;
    }

    .ai-section-label {
      font-size: 12px;
      font-weight: 600;
      color: #666;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 12px;
    }

    .ai-prompt-input {
      flex: 1;
      width: 100%;
      background: #0d0d0d;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      padding: 16px;
      color: #fff;
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      line-height: 1.5;
      resize: none;
      outline: none;
    }

    .ai-prompt-input:focus {
      border-color: #3a3a3a;
    }

    .ai-prompt-input::placeholder {
      color: #555;
    }

    .ai-preview-container {
      flex: 1;
      background: #141414;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: auto;
      min-height: 400px;
      position: relative;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .ai-preview-container:hover {
      border-color: #4a4a4a;
    }

    .ai-preview-container.expanded {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 90vw;
      height: 85vh;
      z-index: 10001;
      border: 2px solid #555;
      box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    }

    .ai-preview-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,0.8);
      z-index: 10000;
    }

    .ai-preview-overlay.visible {
      display: block;
    }

    .ai-preview-placeholder {
      color: #555;
      font-size: 14px;
      text-align: center;
    }

    .ai-preview-container svg,
    .ai-preview-container canvas {
      max-width: 100%;
      max-height: 100%;
    }

    .ai-preview-hint {
      position: absolute;
      bottom: 8px;
      right: 8px;
      font-size: 10px;
      color: #555;
      background: rgba(0,0,0,0.5);
      padding: 4px 8px;
      border-radius: 4px;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.2s;
    }

    .ai-preview-container:hover .ai-preview-hint {
      opacity: 1;
    }

    .ai-preview-container.expanded .ai-preview-hint {
      display: none;
    }

    /* Magnifying glass for expanded preview */
    .ai-magnifier {
      position: fixed;
      width: 500px;
      height: 350px;
      border: 2px solid #666;
      border-radius: 8px;
      pointer-events: none;
      display: none;
      overflow: hidden;
      box-shadow: 0 8px 40px rgba(0,0,0,0.8);
      z-index: 10002;
      background: #0d0d0d;
    }

    .ai-magnifier.visible {
      display: block;
    }

    .ai-magnifier canvas {
      width: 100%;
      height: 100%;
    }

    .ai-magnifier-crosshair {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 20px;
      height: 20px;
      pointer-events: none;
    }
    .ai-magnifier-crosshair::before,
    .ai-magnifier-crosshair::after {
      content: '';
      position: absolute;
      background: rgba(255, 255, 255, 0.8);
    }
    .ai-magnifier-crosshair::before {
      /* Horizontal line */
      width: 20px;
      height: 2px;
      top: 50%;
      left: 0;
      transform: translateY(-50%);
    }
    .ai-magnifier-crosshair::after {
      /* Vertical line */
      width: 2px;
      height: 20px;
      left: 50%;
      top: 0;
      transform: translateX(-50%);
    }

    .ai-magnifier-label {
      position: absolute;
      top: 8px;
      right: 8px;
      font-size: 12px;
      color: #fff;
      background: rgba(0,0,0,0.7);
      padding: 4px 10px;
      border-radius: 4px;
      font-weight: 500;
    }

    .ai-modal-footer {
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding: 16px 20px;
      border-top: 1px solid #2a2a2a;
      overflow: visible;
      position: relative;
      z-index: 10;
    }

    .ai-footer-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
    }

    .ai-theme-controls {
      display: flex;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }

    .ai-theme-label {
      font-size: 12px;
      color: #888;
    }

    .ai-theme-presets {
      display: flex;
      gap: 4px;
    }

    .ai-theme-preset {
      padding: 6px 12px;
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 4px;
      color: #888;
      font-size: 12px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .ai-theme-preset:hover {
      border-color: #3a3a3a;
      color: #fff;
    }

    .ai-theme-preset.active {
      background: #252525;
      border-color: #d4a843;
      color: #fff;
    }

    .ai-color-picker-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      position: relative;
      z-index: 100;
    }

    .ai-color-label {
      font-size: 11px;
      color: #888;
      margin-left: 8px;
    }

    .ai-color-label:first-child {
      margin-left: 0;
    }

    .ai-layout-wrap, .ai-palette-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-left: 16px;
      padding-left: 16px;
      border-left: 1px solid #2a2a2a;
    }

    .ai-layout-select {
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 4px;
      color: #fff;
      padding: 6px 10px;
      font-size: 12px;
      cursor: pointer;
    }

    .ai-layout-select:focus {
      outline: none;
      border-color: #3b82f6;
    }

    .ai-shuffle-btn {
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      border-radius: 4px;
      color: #888;
      padding: 6px 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
    }

    .ai-shuffle-btn:hover {
      background: #2a2a2a;
      color: #fff;
      border-color: #3b82f6;
    }

    .ai-shuffle-btn:active {
      transform: scale(0.95);
    }

    .ai-color-picker {
      width: 32px;
      height: 32px;
      border: 2px solid #2a2a2a;
      border-radius: 4px;
      cursor: pointer;
      padding: 0;
      background: none;
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      position: relative;
      z-index: 100;
    }

    .ai-color-picker::-webkit-color-swatch-wrapper {
      padding: 2px;
    }

    .ai-color-picker::-webkit-color-swatch {
      border: none;
      border-radius: 2px;
    }

    .ai-color-picker::-moz-color-swatch {
      border: none;
      border-radius: 2px;
    }

    .ai-color-picker:hover {
      border-color: #d4a843;
    }

    .ai-color-picker:focus {
      outline: none;
      border-color: #d4a843;
    }

    .ai-actions {
      display: flex;
      gap: 12px;
    }

    .ai-btn {
      padding: 10px 20px;
      border-radius: 6px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s ease;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .ai-btn-secondary {
      background: #1e1e1e;
      border: 1px solid #2a2a2a;
      color: #ccc;
    }

    .ai-btn-secondary:hover {
      background: #252525;
      border-color: #3a3a3a;
      color: #fff;
    }

    .ai-btn-primary {
      background: linear-gradient(135deg, #d4a843 0%, #b8902e 100%);
      border: none;
      color: #000;
    }

    .ai-btn-primary:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(212, 168, 67, 0.3);
    }

    .ai-btn-primary:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    .ai-btn .spinner {
      width: 14px;
      height: 14px;
      border: 2px solid transparent;
      border-top-color: currentColor;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    .ai-no-key-message {
      text-align: center;
      padding: 40px 20px;
      color: #888;
    }

    .ai-no-key-message p {
      margin-bottom: 16px;
    }

    .ai-no-key-message a {
      color: #d4a843;
      text-decoration: none;
    }

    /* API Key Settings */
    .api-key-input-wrap {
      position: relative;
    }

    .api-key-input {
      width: 100%;
      padding: 12px 40px 12px 12px;
      background: #0d0d0d;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      color: #fff;
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
    }

    .api-key-input:focus {
      outline: none;
      border-color: #d4a843;
    }

    .api-key-toggle {
      position: absolute;
      right: 8px;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      color: #666;
      cursor: pointer;
      padding: 4px;
    }

    .api-key-toggle:hover {
      color: #fff;
    }

    .api-key-status {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 12px;
      font-size: 12px;
    }

    .api-key-status.valid {
      color: #4ade80;
    }

    .api-key-status.invalid {
      color: #f87171;
    }

    /* ===== CINEMATIC PRESETS PANEL ===== */
    .preset-btn {
      position: relative;
      background: linear-gradient(135deg, #3b82f6, #2563eb);
      border-color: #3b82f6;
      color: #fff;
    }

    .preset-btn:hover {
      background: linear-gradient(135deg, #60a5fa, #3b82f6);
      border-color: #60a5fa;
    }

    .preset-btn svg {
      display: block;
    }

    .presets-panel {
      position: fixed;
      top: 60px;
      right: -420px;
      width: 400px;
      max-height: calc(100vh - 80px);
      background: #1a1a1a;
      border: 1px solid #2a2a2a;
      border-radius: 12px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
      z-index: 1000;
      transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .presets-panel.visible {
      right: 20px;
    }

    .presets-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 20px;
      border-bottom: 1px solid #2a2a2a;
      background: linear-gradient(180deg, #222 0%, #1a1a1a 100%);
    }

    .presets-header h3 {
      font-size: 16px;
      font-weight: 600;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .presets-header h3::before {
      content: '🎬';
    }

    .presets-close {
      background: none;
      border: none;
      color: #666;
      font-size: 24px;
      cursor: pointer;
      padding: 0;
      line-height: 1;
      transition: color 0.2s;
    }

    .presets-close:hover {
      color: #fff;
    }

    .presets-description {
      padding: 12px 20px;
      font-size: 12px;
      color: #888;
      background: #151515;
      border-bottom: 1px solid #2a2a2a;
    }

    .presets-description strong {
      color: #d4a843;
      font-weight: 600;
    }

    .presets-grid {
      flex: 1;
      overflow-y: auto;
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .preset-slot {
      background: #222;
      border: 1px solid #333;
      border-radius: 8px;
      padding: 12px;
      transition: all 0.2s;
    }

    .preset-slot:hover {
      border-color: #444;
      background: #282828;
    }

    .preset-slot.active {
      border-color: #d4a843;
      box-shadow: 0 0 0 1px rgba(212, 168, 67, 0.3);
    }

    .preset-slot.empty {
      opacity: 0.6;
    }

    .preset-slot-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 10px;
    }

    .preset-number {
      width: 28px;
      height: 28px;
      background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 14px;
      color: #fff;
      flex-shrink: 0;
    }

    .preset-slot.empty .preset-number {
      background: #333;
      color: #666;
    }

    .preset-name-input {
      flex: 1;
      background: #1a1a1a;
      border: 1px solid #333;
      border-radius: 4px;
      padding: 6px 10px;
      color: #fff;
      font-size: 13px;
      font-family: inherit;
    }

    .preset-name-input:focus {
      outline: none;
      border-color: #d4a843;
    }

    .preset-name-input::placeholder {
      color: #555;
    }

    .preset-slot-body {
      display: flex;
      gap: 12px;
      align-items: flex-start;
    }

    .preset-thumbnail {
      width: 80px;
      height: 50px;
      background: #111;
      border: 1px solid #333;
      border-radius: 4px;
      overflow: hidden;
      flex-shrink: 0;
      position: relative;
    }

    .preset-thumbnail canvas {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .preset-thumbnail-empty {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #444;
      font-size: 20px;
    }

    .preset-settings {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .preset-setting-row {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: #888;
    }

    .preset-setting-row label {
      width: 60px;
      flex-shrink: 0;
    }

    .preset-setting-row input[type="number"] {
      width: 60px;
      background: #1a1a1a;
      border: 1px solid #333;
      border-radius: 4px;
      padding: 4px 8px;
      color: #fff;
      font-size: 12px;
    }

    .preset-setting-row input[type="number"]:focus {
      outline: none;
      border-color: #d4a843;
    }

    .preset-setting-row select {
      flex: 1;
      background: #1a1a1a;
      border: 1px solid #333;
      border-radius: 4px;
      padding: 4px 8px;
      color: #fff;
      font-size: 12px;
      cursor: pointer;
    }

    .preset-setting-row select:focus {
      outline: none;
      border-color: #d4a843;
    }

    .preset-actions {
      display: flex;
      gap: 6px;
      margin-top: 4px;
    }

    .preset-action-btn {
      flex: 1;
      padding: 8px 12px;
      border: none;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .preset-action-btn.save {
      background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
      color: #000;
      box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    }

    .preset-action-btn.save:hover {
      background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
      box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
      transform: translateY(-1px);
    }

    .preset-action-btn.go {
      background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
      color: #fff;
      box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    }

    .preset-action-btn.go:hover {
      background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
      box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
      transform: translateY(-1px);
    }

    .preset-action-btn.preview {
      background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
      color: #fff;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    }

    .preset-action-btn.preview:hover {
      background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
      transform: translateY(-1px);
    }

    .preset-action-btn.clear {
      background: transparent;
      color: #9ca3af;
      border: 1px solid #4b5563;
      flex: 0;
      padding: 8px 10px;
    }

    .preset-action-btn.clear:hover {
      background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
      border-color: #ef4444;
      color: #fff;
      box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
      transform: translateY(-1px);
    }

    .preset-action-btn:disabled {
      opacity: 0.3;
      cursor: not-allowed;
      transform: none !important;
      box-shadow: none !important;
    }

    .presets-footer {
      padding: 12px 16px;
      border-top: 1px solid #2a2a2a;
      background: #151515;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .presets-footer-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }

    .production-mode-toggle {
      display: flex;
      align-items: center;
      gap: 10px;
      cursor: pointer;
      user-select: none;
    }

    .production-mode-toggle input {
      display: none;
    }

    .toggle-slider {
      width: 36px;
      height: 20px;
      background: #333;
      border-radius: 10px;
      position: relative;
      transition: background 0.2s;
    }

    .toggle-slider::after {
      content: '';
      position: absolute;
      width: 16px;
      height: 16px;
      background: #666;
      border-radius: 50%;
      top: 2px;
      left: 2px;
      transition: all 0.2s;
    }

    .production-mode-toggle input:checked + .toggle-slider {
      background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    }

    .production-mode-toggle input:checked + .toggle-slider::after {
      left: 18px;
      background: #fff;
    }

    .toggle-label {
      font-size: 12px;
      font-weight: 600;
      color: #ccc;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .production-mode-toggle input:checked ~ .toggle-label {
      color: #ef4444;
    }

    .production-mode-hint {
      font-size: 11px;
      color: #666;
      font-style: italic;
    }

    /* Production mode - hide UI overlays but keep toolbar for drawing */
    body.production-mode .top-bar,
    body.production-mode .zoom-controls,
    body.production-mode .presets-panel,
    body.production-mode .preset-indicator,
    body.production-mode .toast {
      display: none !important;
    }

    .annotations-row {
      border-top: 1px solid #2a2a2a;
      padding-top: 12px;
      margin-top: 4px;
    }

    .clear-annotations-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 14px;
      background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
      border: none;
      border-radius: 6px;
      color: #fff;
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
    }

    .clear-annotations-btn:hover {
      background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
      box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
      transform: translateY(-1px);
    }

    .clear-annotations-btn:active {
      transform: translateY(0);
    }

    .clear-annotations-btn svg {
      flex-shrink: 0;
    }

    .annotation-count {
      font-size: 11px;
      color: #666;
      font-style: italic;
    }

    /* Frame/Artboard UI */
    .frames-row {
      border-top: 1px solid #2a2a2a;
      padding-top: 12px;
      margin-top: 4px;
    }

    .frame-badge {
      background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
      color: #fff;
      font-size: 9px;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 4px;
      margin-left: auto;
    }

    .preset-frame-actions {
      display: flex;
      gap: 6px;
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid #2a2a2a;
    }

    .preset-frame-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 5px 10px;
      background: transparent;
      border: 1px dashed #444;
      border-radius: 4px;
      color: #888;
      font-size: 10px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
      flex: 1;
    }

    .preset-frame-btn:hover {
      border-color: #3b82f6;
      color: #3b82f6;
      background: rgba(59, 130, 246, 0.1);
    }

    .preset-frame-btn.has-frame {
      border-style: solid;
      border-color: #3b82f6;
      color: #3b82f6;
      background: rgba(59, 130, 246, 0.1);
    }

    .preset-export-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 5px 8px;
      background: transparent;
      border: 1px solid #444;
      border-radius: 4px;
      color: #888;
      cursor: pointer;
      transition: all 0.2s;
    }

    .preset-export-btn:hover {
      border-color: #10b981;
      color: #10b981;
      background: rgba(16, 185, 129, 0.1);
    }

    .export-all-frames-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 14px;
      background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
      border: none;
      border-radius: 6px;
      color: #fff;
      font-size: 12px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
    }

    .export-all-frames-btn:hover {
      background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
      box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
      transform: translateY(-1px);
    }

    .export-all-frames-btn.transparent {
      background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
      border: 1px dashed #6b7280;
    }

    .export-all-frames-btn.transparent:hover {
      background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
      box-shadow: 0 2px 8px rgba(107, 114, 128, 0.3);
    }

    .show-frames-toggle {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 11px;
      color: #888;
      cursor: pointer;
    }

    .show-frames-toggle input {
      accent-color: #3b82f6;
    }

    .preset-slot.has-frame {
      border-color: #3b82f6;
    }

    .preset-slot.has-frame .preset-number {
      background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    }

    .presets-play-all {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      background: linear-gradient(135deg, #10b981 0%, #059669 100%);
      border: none;
      border-radius: 6px;
      color: #fff;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
    }

    .presets-play-all:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }

    .presets-play-all:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }

    .presets-global-settings {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: #888;
    }

    .presets-global-settings input {
      width: 50px;
      background: #1a1a1a;
      border: 1px solid #333;
      border-radius: 4px;
      padding: 4px 8px;
      color: #fff;
      font-size: 12px;
    }

    .presets-global-settings input:focus {
      outline: none;
      border-color: #d4a843;
    }

    /* Preset Indicator (shows during transitions) */
    .preset-indicator {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%) scale(0.8);
      background: rgba(0, 0, 0, 0.85);
      border: 1px solid #333;
      border-radius: 12px;
      padding: 20px 40px;
      display: flex;
      align-items: center;
      gap: 16px;
      z-index: 2000;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s, transform 0.2s;
    }

    .preset-indicator.visible {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
    }

    .preset-indicator-number {
      width: 48px;
      height: 48px;
      background: linear-gradient(135deg, #d4a843 0%, #b8942e 100%);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 24px;
      color: #000;
    }

    .preset-indicator-name {
      font-size: 18px;
      font-weight: 500;
      color: #fff;
    }

    /* Preset slot zoom info */
    .preset-zoom-info {
      font-size: 11px;
      color: #666;
      margin-top: 4px;
    }

    /* Scrollbar for presets grid */
    .presets-grid::-webkit-scrollbar {
      width: 6px;
    }

    .presets-grid::-webkit-scrollbar-track {
      background: #1a1a1a;
    }

    .presets-grid::-webkit-scrollbar-thumb {
      background: #333;
      border-radius: 3px;
    }

    .presets-grid::-webkit-scrollbar-thumb:hover {
      background: #444;
    }

    /* ========== TEMPLATES MODAL STYLES ========== */
    .template-btn {
      background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
      color: #fff !important;
    }

    .template-btn:hover {
      background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
    }

    .templates-modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.8);
      backdrop-filter: blur(4px);
      display: none;
      justify-content: center;
      align-items: center;
      z-index: 10000;
      pointer-events: none;
    }

    .templates-modal-overlay.visible {
      display: flex;
      pointer-events: auto;
    }

    .templates-modal {
      background: #1a1a1a;
      border-radius: 12px;
      border: 1px solid #333;
      width: 90%;
      max-width: 700px;
      max-height: 85vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    }

    .templates-modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 20px;
      border-bottom: 1px solid #333;
    }

    .templates-modal-header h3 {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
      color: #fff;
    }

    .templates-modal-close {
      background: none;
      border: none;
      color: #666;
      font-size: 24px;
      cursor: pointer;
      padding: 0;
      line-height: 1;
      transition: color 0.2s;
    }

    .templates-modal-close:hover {
      color: #fff;
    }

    .templates-tabs {
      display: flex;
      gap: 4px;
      padding: 12px 20px;
      border-bottom: 1px solid #2a2a2a;
    }

    .templates-tab {
      padding: 8px 16px;
      background: transparent;
      border: none;
      border-radius: 6px;
      color: #888;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
    }

    .templates-tab:hover {
      background: #252525;
      color: #ccc;
    }

    .templates-tab.active {
      background: #333;
      color: #fff;
    }

    .templates-tab-content {
      display: none;
      padding: 20px;
      overflow-y: auto;
      flex: 1;
    }

    .templates-tab-content.active {
      display: block;
    }

    /* Templates Grid */
    .templates-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 16px;
    }

    .template-card {
      background: #222;
      border: 1px solid #333;
      border-radius: 8px;
      overflow: hidden;
      cursor: pointer;
      transition: all 0.2s;
    }

    .template-card:hover {
      border-color: #f59e0b;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
    }

    .template-card-preview {
      aspect-ratio: 16/9;
      background: #1a1a1a;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }

    .template-card-preview img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .template-card-info {
      padding: 10px 12px;
      border-top: 1px solid #333;
    }

    .template-card-name {
      font-size: 13px;
      font-weight: 500;
      color: #fff;
      margin: 0 0 4px 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .template-card-meta {
      font-size: 11px;
      color: #666;
    }

    /* Empty State */
    .templates-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 60px 20px;
      color: #666;
      text-align: center;
    }

    .templates-empty-icon {
      margin-bottom: 16px;
      opacity: 0.5;
    }

    .templates-empty p {
      margin: 0 0 8px 0;
      font-size: 16px;
      color: #888;
    }

    .templates-empty span {
      font-size: 13px;
    }

    /* Save Form */
    .templates-save-form {
      display: flex;
      gap: 24px;
    }

    .templates-save-preview {
      flex: 0 0 280px;
      aspect-ratio: 16/9;
      background: #111;
      border: 2px dashed #333;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }

    .templates-save-preview img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .templates-save-preview-text {
      color: #555;
      font-size: 13px;
      text-align: center;
      padding: 20px;
    }

    .templates-save-fields {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }

    .templates-save-fields label {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .templates-save-fields label span {
      font-size: 12px;
      color: #888;
      font-weight: 500;
    }

    .templates-save-fields input {
      background: #222;
      border: 1px solid #333;
      border-radius: 6px;
      padding: 10px 12px;
      color: #fff;
      font-size: 14px;
      outline: none;
      transition: border-color 0.2s;
    }

    .templates-save-fields input:focus {
      border-color: #f59e0b;
    }

    .templates-placeholders-info {
      background: #222;
      border-radius: 6px;
      padding: 12px;
    }

    .templates-placeholders-label {
      font-size: 11px;
      color: #888;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: block;
      margin-bottom: 8px;
    }

    .templates-placeholders-list {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .templates-placeholder-tag {
      background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
      color: #000;
      font-size: 11px;
      font-weight: 600;
      padding: 4px 8px;
      border-radius: 4px;
    }

    .templates-placeholder-hint {
      font-size: 11px;
      color: #555;
      font-style: italic;
    }

    .templates-save-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 12px 20px;
      background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
      border: none;
      border-radius: 6px;
      color: #000;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      margin-top: auto;
    }

    .templates-save-btn:hover:not(:disabled) {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }

    .templates-save-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }

    /* Apply Form */
    .templates-apply-form {
      padding: 20px;
      overflow-y: auto;
      flex: 1;
    }

    .templates-apply-header {
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 20px;
    }

    .templates-back-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px 12px;
      background: #333;
      border: none;
      border-radius: 4px;
      color: #ccc;
      font-size: 12px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .templates-back-btn:hover {
      background: #444;
      color: #fff;
    }

    .templates-apply-header h4 {
      margin: 0;
      font-size: 16px;
      color: #fff;
    }

    .templates-apply-preview {
      width: 100%;
      max-width: 400px;
      aspect-ratio: 16/9;
      background: #111;
      border-radius: 8px;
      margin: 0 auto 20px;
      overflow: hidden;
    }

    .templates-apply-preview img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .templates-apply-fields {
      display: flex;
      flex-direction: column;
      gap: 12px;
      margin-bottom: 20px;
    }

    .templates-apply-field {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .templates-apply-field label {
      font-size: 12px;
      color: #f59e0b;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .templates-apply-field input,
    .templates-apply-field textarea {
      background: #222;
      border: 1px solid #333;
      border-radius: 6px;
      padding: 10px 12px;
      color: #fff;
      font-size: 14px;
      outline: none;
      transition: border-color 0.2s;
      resize: vertical;
    }

    .templates-apply-field input:focus,
    .templates-apply-field textarea:focus {
      border-color: #f59e0b;
    }

    .templates-apply-actions {
      display: flex;
      gap: 12px;
      justify-content: space-between;
    }

    .templates-apply-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 12px 24px;
      background: linear-gradient(135deg, #10b981 0%, #059669 100%);
      border: none;
      border-radius: 6px;
      color: #fff;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s;
      flex: 1;
    }

    .templates-apply-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }

    .templates-delete-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 12px;
      background: #2a2a2a;
      border: 1px solid #333;
      border-radius: 6px;
      color: #888;
      cursor: pointer;
      transition: all 0.2s;
    }

    .templates-delete-btn:hover {
      background: #ef4444;
      border-color: #ef4444;
      color: #fff;
    }

    /* ========== LAYOUT GENERATION SYSTEM STYLES ========== */
    .layout-gen-btn {
      background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%) !important;
      color: #fff !important;
    }

    .layout-gen-btn:hover {
      background: linear-gradient(135deg, #a78bfa 0%, #818cf8 100%) !important;
    }

    .layout-gen-modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(4px);
      display: none;
      justify-content: center;
      align-items: center;
      z-index: 10000;
      pointer-events: none;
    }

    .layout-gen-modal-overlay.visible {
      display: flex;
      pointer-events: auto;
    }

    .layout-gen-modal {
      background: #1a1a1a;
      border-radius: 12px;
      border: 1px solid #333;
      width: 90%;
      max-width: 550px;
      max-height: 85vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    }

    .layout-gen-modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 20px;
      border-bottom: 1px solid #333;
    }

    .layout-gen-modal-header h3 {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .layout-gen-modal-header h3::before {
      content: '';
      display: inline-block;
      width: 8px;
      height: 8px;
      background: linear-gradient(135deg, #8b5cf6, #6366f1);
      border-radius: 2px;
    }

    .layout-gen-modal-close {
      background: none;
      border: none;
      color: #666;
      font-size: 24px;
      cursor: pointer;
      padding: 0;
      line-height: 1;
      transition: color 0.2s;
    }

    .layout-gen-modal-close:hover {
      color: #fff;
    }

    .layout-gen-modal-body {
      padding: 20px;
      overflow-y: auto;
      flex: 1;
    }

    .layout-gen-description {
      color: #888;
      font-size: 13px;
      line-height: 1.5;
      margin-bottom: 20px;
    }

    .layout-gen-input-group {
      margin-bottom: 16px;
    }

    .layout-gen-input-group label {
      display: block;
      color: #aaa;
      font-size: 12px;
      font-weight: 500;
      margin-bottom: 8px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .layout-gen-input-group textarea {
      width: 100%;
      min-height: 100px;
      padding: 12px;
      background: #0d0d0d;
      border: 1px solid #333;
      border-radius: 8px;
      color: #fff;
      font-size: 14px;
      font-family: inherit;
      resize: vertical;
      transition: border-color 0.2s;
    }

    .layout-gen-input-group textarea:focus {
      outline: none;
      border-color: #8b5cf6;
    }

    .layout-gen-input-group textarea::placeholder {
      color: #555;
    }

    .layout-gen-options {
      display: flex;
      gap: 16px;
      margin-bottom: 20px;
    }

    .layout-gen-option {
      flex: 1;
    }

    .layout-gen-option label {
      display: block;
      color: #888;
      font-size: 11px;
      font-weight: 500;
      margin-bottom: 6px;
      text-transform: uppercase;
    }

    .layout-gen-option select {
      width: 100%;
      padding: 8px 12px;
      background: #0d0d0d;
      border: 1px solid #333;
      border-radius: 6px;
      color: #fff;
      font-size: 13px;
      cursor: pointer;
    }

    .layout-gen-option select:focus {
      outline: none;
      border-color: #8b5cf6;
    }

    .layout-gen-option input[type="number"] {
      width: 100%;
      padding: 8px 12px;
      background: #0d0d0d;
      border: 1px solid #333;
      border-radius: 6px;
      color: #fff;
      font-size: 13px;
    }

    .layout-gen-option input[type="number"]:focus {
      outline: none;
      border-color: #8b5cf6;
    }

    .layout-gen-start-at {
      flex: 0.5;
    }

    .layout-gen-preview {
      background: #0d0d0d;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      min-height: 120px;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }

    .layout-gen-preview-placeholder {
      color: #444;
      font-size: 13px;
      text-align: center;
      padding: 20px;
    }

    .layout-gen-preview-screens {
      display: flex;
      gap: 8px;
      padding: 12px;
      overflow-x: auto;
      width: 100%;
    }

    .layout-gen-preview-screen {
      flex-shrink: 0;
      width: 120px;
      height: 68px;
      background: #1a1a1a;
      border: 1px solid #333;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #666;
      font-size: 11px;
      position: relative;
    }

    .layout-gen-preview-screen::before {
      content: attr(data-index);
      position: absolute;
      top: 4px;
      left: 4px;
      width: 16px;
      height: 16px;
      background: #8b5cf6;
      border-radius: 3px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: 600;
      color: #fff;
    }

    .layout-gen-modal-footer {
      padding: 16px 20px;
      border-top: 1px solid #333;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 16px;
    }

    .layout-gen-status {
      color: #888;
      font-size: 12px;
      flex: 1;
    }

    .layout-gen-status.error {
      color: #ef4444;
    }

    .layout-gen-status.success {
      color: #22c55e;
    }

    .layout-gen-btn-generate {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 20px;
      background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
      border: none;
      border-radius: 8px;
      color: #fff;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
    }

    .layout-gen-btn-generate:hover:not(:disabled) {
      background: linear-gradient(135deg, #a78bfa 0%, #818cf8 100%);
      transform: translateY(-1px);
    }

    .layout-gen-btn-generate:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .layout-gen-btn-generate .spinner {
      width: 14px;
      height: 14px;
      border: 2px solid rgba(255, 255, 255, 0.3);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    .layout-gen-optional {
      color: #666;
      font-weight: 400;
      text-transform: none;
      font-size: 11px;
    }

    .layout-gen-dropzone {
      background: #0d0d0d;
      border: 2px dashed #333;
      border-radius: 8px;
      min-height: 100px;
      cursor: pointer;
      transition: all 0.2s;
      position: relative;
    }

    .layout-gen-dropzone:hover,
    .layout-gen-dropzone.dragover {
      border-color: #8b5cf6;
      background: rgba(139, 92, 246, 0.05);
    }

    .layout-gen-dropzone-empty {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px;
      gap: 8px;
      color: #555;
    }

    .layout-gen-dropzone-empty svg {
      opacity: 0.5;
    }

    .layout-gen-dropzone-empty span {
      font-size: 13px;
    }

    .layout-gen-dropzone-hint {
      font-size: 11px !important;
      color: #444 !important;
    }

    .layout-gen-dropzone.has-images .layout-gen-dropzone-empty {
      display: none;
    }

    .layout-gen-dropzone-images {
      display: none;
      flex-wrap: wrap;
      gap: 8px;
      padding: 12px;
    }

    .layout-gen-dropzone.has-images .layout-gen-dropzone-images {
      display: flex;
    }

    .layout-gen-ref-image {
      position: relative;
      width: 80px;
      height: 45px;
      border-radius: 4px;
      overflow: hidden;
      background: #1a1a1a;
      border: 1px solid #333;
    }

    .layout-gen-ref-image img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .layout-gen-ref-image-remove {
      position: absolute;
      top: 2px;
      right: 2px;
      width: 16px;
      height: 16px;
      background: rgba(0, 0, 0, 0.7);
      border: none;
      border-radius: 50%;
      color: #fff;
      font-size: 10px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transition: opacity 0.2s;
    }

    .layout-gen-ref-image:hover .layout-gen-ref-image-remove {
      opacity: 1;
    }

    .layout-gen-ref-image-remove:hover {
      background: #ef4444;
    }

    .layout-gen-add-more {
      width: 80px;
      height: 45px;
      border: 2px dashed #333;
      border-radius: 4px;
      background: transparent;
      color: #555;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      transition: all 0.2s;
    }

    .layout-gen-add-more:hover {
      border-color: #8b5cf6;
      color: #8b5cf6;
    }

    /* Text Style Presets Section */
    .layout-gen-styles-section {
      background: #0d0d0d;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      padding: 12px;
      max-height: 180px;
      overflow-y: auto;
    }

    .layout-gen-styles-empty {
      color: #555;
      font-size: 12px;
      text-align: center;
      padding: 16px;
    }

    .layout-gen-styles-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .layout-gen-style-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 10px;
      background: #1a1a1a;
      border: 1px solid #2a2a2a;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .layout-gen-style-item:hover {
      border-color: #3a3a3a;
      background: #222;
    }

    .layout-gen-style-item.selected {
      border-color: #8b5cf6;
      background: rgba(139, 92, 246, 0.1);
    }

    .layout-gen-style-checkbox {
      width: 16px;
      height: 16px;
      border: 2px solid #444;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: all 0.15s;
    }

    .layout-gen-style-item.selected .layout-gen-style-checkbox {
      background: #8b5cf6;
      border-color: #8b5cf6;
    }

    .layout-gen-style-checkbox svg {
      width: 10px;
      height: 10px;
      stroke: #fff;
      stroke-width: 3;
      opacity: 0;
    }

    .layout-gen-style-item.selected .layout-gen-style-checkbox svg {
      opacity: 1;
    }

    .layout-gen-style-preview {
      width: 60px;
      height: 24px;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 600;
      flex-shrink: 0;
      overflow: hidden;
    }

    .layout-gen-style-info {
      flex: 1;
      min-width: 0;
    }

    .layout-gen-style-name {
      font-size: 12px;
      font-weight: 500;
      color: #fff;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .layout-gen-style-details {
      font-size: 10px;
      color: #666;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .layout-gen-style-role {
      flex-shrink: 0;
    }

    .layout-gen-style-role select {
      background: #0d0d0d;
      border: 1px solid #333;
      border-radius: 4px;
      color: #aaa;
      font-size: 10px;
      padding: 4px 6px;
      cursor: pointer;
    }

    .layout-gen-style-item.selected .layout-gen-style-role select {
      border-color: #8b5cf6;
      color: #fff;
    }

    .layout-gen-styles-hint {
      font-size: 11px;
      color: #555;
      margin-top: 6px;
    }
    /* ========== END LAYOUT GENERATION SYSTEM STYLES ========== */

    /* ========== SCENE NAVIGATION INDICATOR ========== */
    .scene-nav-indicator {
      position: fixed;
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
      display: none; /* Hidden until scenes exist */
      align-items: center;
      gap: 2px;
      background: rgba(20, 20, 20, 0.95);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 8px;
      padding: 4px;
      z-index: 1000;
      backdrop-filter: blur(10px);
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }

    .scene-nav-indicator.visible {
      display: flex;
    }

    .scene-nav-btn {
      background: transparent;
      border: none;
      color: #888;
      font-size: 18px;
      width: 28px;
      height: 28px;
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s ease;
    }

    .scene-nav-btn:hover:not(:disabled) {
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
    }

    .scene-nav-btn:disabled {
      opacity: 0.3;
      cursor: not-allowed;
    }

    .scene-nav-current {
      background: transparent;
      border: none;
      color: #ccc;
      font-size: 12px;
      padding: 6px 12px;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.15s ease;
      font-family: inherit;
    }

    .scene-nav-current:hover {
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
    }

    .scene-nav-text {
      white-space: nowrap;
    }

    #sceneNavNum {
      font-weight: 600;
      color: #fff;
    }

    /* Scene List Popover */
    .scene-list-popover {
      position: fixed;
      bottom: 60px;
      left: 50%;
      transform: translateX(-50%);
      width: 280px;
      max-height: 400px;
      background: rgba(20, 20, 20, 0.98);
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 12px;
      z-index: 1001;
      display: none;
      flex-direction: column;
      backdrop-filter: blur(20px);
      box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    }

    .scene-list-popover.visible {
      display: flex;
    }

    .scene-list-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 14px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
      font-size: 12px;
      font-weight: 600;
      color: #888;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .scene-list-close {
      background: transparent;
      border: none;
      color: #666;
      font-size: 18px;
      cursor: pointer;
      padding: 0;
      line-height: 1;
    }

    .scene-list-close:hover {
      color: #fff;
    }

    .scene-list-items {
      flex: 1;
      overflow-y: auto;
      padding: 8px;
    }

    .scene-list-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 6px;
      cursor: pointer;
      transition: background 0.15s ease;
    }

    .scene-list-item:hover {
      background: rgba(255, 255, 255, 0.08);
    }

    .scene-list-item.current {
      background: rgba(139, 92, 246, 0.2);
      border: 1px solid rgba(139, 92, 246, 0.4);
    }

    .scene-list-num {
      width: 24px;
      height: 24px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 600;
      color: #888;
      flex-shrink: 0;
    }

    .scene-list-item.current .scene-list-num {
      background: rgba(139, 92, 246, 0.4);
      color: #fff;
    }

    .scene-list-name {
      flex: 1;
      font-size: 13px;
      color: #ccc;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .scene-list-item.current .scene-list-name {
      color: #fff;
    }

    .scene-list-key {
      font-size: 10px;
      color: #555;
      background: rgba(255, 255, 255, 0.05);
      padding: 2px 6px;
      border-radius: 3px;
    }

    /* Hide scene-related UI when no scenes exist */
    body.no-scenes .scene-nav-indicator,
    body.no-scenes .scene-list-popover,
    body.no-scenes #snapToSceneBtn,
    body.no-scenes #addSceneBtn {
      display: none !important;
    }

    /* Production mode hides scene nav */
    body.production-mode .scene-nav-indicator {
      display: none !important;
    }
    /* ========== END SCENE NAVIGATION STYLES ========== */

    /* ========== ANNOTATION MODE STYLES ========== */
    .annotation-dropdown {
      position: relative;
      display: flex;
      align-items: center;
    }

    .annotation-mode-btn {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px 10px !important;
      border-radius: 6px 0 0 6px !important;
      transition: all 0.15s ease;
    }

    .annotation-mode-btn.active {
      background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
      color: #000 !important;
      box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
    }

    .annotation-mode-btn.active svg {
      stroke: #000;
    }

    .annotation-label {
      font-size: 12px;
      font-weight: 500;
    }

    .annotation-dropdown-toggle {
      padding: 6px 8px !important;
      border-radius: 0 6px 6px 0 !important;
      border-left: 1px solid #333 !important;
      font-size: 10px;
    }

    .annotation-dropdown-menu {
      position: absolute;
      top: 100%;
      left: 0;
      margin-top: 4px;
      background: #1a1a1a;
      border: 1px solid #2a2a2a;
      border-radius: 8px;
      min-width: 200px;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
      z-index: 100;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-8px);
      transition: all 0.15s ease;
      padding: 8px 0;
    }

    .annotation-dropdown-menu.visible {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }

    .annotation-menu-section {
      padding: 8px 12px;
    }

    .annotation-menu-header {
      font-size: 11px;
      font-weight: 600;
      color: #888;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 8px;
    }

    .annotation-menu-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 13px;
      color: #ccc;
      margin-bottom: 6px;
    }

    .annotation-menu-item:last-child {
      margin-bottom: 0;
    }

    .annotation-select {
      background: #2a2a2a;
      color: #fff;
      border: 1px solid #444;
      border-radius: 4px;
      padding: 4px 8px;
      font-size: 12px;
      cursor: pointer;
    }

    .annotation-select:hover {
      border-color: #555;
    }

    .annotation-menu-divider {
      height: 1px;
      background: #2a2a2a;
      margin: 4px 0;
    }

    .annotation-menu-btn {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      padding: 10px 12px;
      background: none;
      border: none;
      color: #ccc;
      font-size: 13px;
      cursor: pointer;
      transition: background 0.1s ease;
      text-align: left;
    }

    .annotation-menu-btn:hover {
      background: #252525;
      color: #fff;
    }

    .annotation-menu-btn.danger:hover {
      background: rgba(239, 68, 68, 0.15);
      color: #ef4444;
    }

    .annotation-menu-btn.danger:hover svg {
      stroke: #ef4444;
    }

    .annotation-menu-btn svg {
      flex-shrink: 0;
    }
    /* ========== END ANNOTATION MODE STYLES ========== */

/* ========== CAROUSEL MODE STYLES ========== */

/* Carousel Mode Toggle Button */
.carousel-mode-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(236, 72, 153, 0.3);
  transition: all 0.2s ease;
  z-index: 1000;
}

.carousel-mode-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(236, 72, 153, 0.4);
}

.carousel-mode-toggle svg {
  width: 16px;
  height: 16px;
}

/* Main Carousel Panel */
.carousel-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0d0d0d;
  z-index: 2000;
  display: none;
  flex-direction: column;
  font-family: 'Inter', system-ui, sans-serif;
}

.carousel-panel.visible {
  display: flex;
}

/* Carousel Header */
.carousel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #151515;
  border-bottom: 1px solid #252525;
}

.carousel-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.carousel-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #252525;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.carousel-back-btn:hover {
  background: #333;
}

.carousel-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.carousel-header-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.carousel-aspect-btn {
  padding: 8px 16px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #888;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.carousel-aspect-btn:hover {
  border-color: #555;
  color: #ccc;
}

.carousel-aspect-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.carousel-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.carousel-export-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.carousel-export-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.carousel-canvas-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.carousel-canvas-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

/* Carousel Main Content */
.carousel-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left Sidebar - Settings */
.carousel-sidebar {
  width: 300px;
  background: #151515;
  border-right: 1px solid #252525;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.carousel-sidebar-section {
  padding: 20px;
  border-bottom: 1px solid #252525;
}

.carousel-sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 12px;
}

/* LUT Panel */
.lut-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.lut-item {
  position: relative;
  aspect-ratio: 1;
  background: #1a1a1a;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.15s ease;
}

.lut-item:hover {
  border-color: #444;
}

.lut-item.active {
  border-color: #ec4899;
}

.lut-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lut-item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  font-size: 9px;
  color: #fff;
  text-align: center;
}

.lut-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: #1a1a1a;
  border: 2px dashed #333;
  border-radius: 8px;
  color: #666;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lut-add-btn:hover {
  border-color: #555;
  color: #888;
}

/* Font Configuration */
.font-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #222;
}

.font-config-row:last-child {
  border-bottom: none;
}

.font-config-label {
  font-size: 12px;
  color: #888;
}

.font-config-select {
  flex: 1;
  max-width: 150px;
  margin-left: 12px;
  padding: 6px 10px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
}

/* Template Rules */
.template-rule {
  padding: 12px;
  background: #1a1a1a;
  border-radius: 8px;
  margin-bottom: 8px;
}

.template-rule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.template-rule-words {
  font-size: 11px;
  font-weight: 600;
  color: #ec4899;
}

.template-rule-name {
  font-size: 11px;
  color: #666;
}

.template-rule-preview {
  padding: 8px;
  background: #0d0d0d;
  border-radius: 4px;
  font-size: 10px;
  color: #888;
  line-height: 1.4;
}

/* Slide Grid */
.carousel-grid-container {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: #0d0d0d;
}

.carousel-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.carousel-slide {
  position: relative;
  aspect-ratio: 4/5;
  background: #151515;
  border: 2px solid #252525;
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s ease;
}

.carousel-slide:hover {
  border-color: #444;
  transform: translateY(-2px);
}

.carousel-slide.active {
  border-color: #ec4899;
  box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.2);
}

.carousel-slide-number {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  z-index: 1;
}

.carousel-slide-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.carousel-add-slide {
  aspect-ratio: 4/5;
  background: #151515;
  border: 2px dashed #333;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #555;
  cursor: pointer;
  transition: all 0.15s ease;
}

.carousel-add-slide:hover {
  border-color: #555;
  color: #888;
}

.carousel-add-slide svg {
  width: 32px;
  height: 32px;
}

.carousel-add-slide span {
  font-size: 12px;
}

/* Slide Editor (Right Panel) */
.carousel-editor {
  width: 400px;
  background: #151515;
  border-left: 1px solid #252525;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.carousel-editor-header {
  padding: 20px;
  border-bottom: 1px solid #252525;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.carousel-editor-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.carousel-editor-nav {
  display: flex;
  gap: 4px;
}

.carousel-editor-nav-btn {
  width: 32px;
  height: 32px;
  background: #252525;
  border: none;
  border-radius: 6px;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.carousel-editor-nav-btn:hover {
  background: #333;
  color: #fff;
}

.carousel-editor-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Editor Preview */
.carousel-editor-preview {
  position: relative;
  margin: 20px;
  margin-bottom: 70px; /* Space for buttons below */
  background: #0d0d0d;
  border-radius: 8px;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.carousel-editor-preview canvas {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 6px;
}

/* Background Controls - positioned below the preview */
.carousel-bg-controls {
  position: absolute;
  bottom: -50px;
  left: 0;
  right: 0;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.carousel-bg-btn {
  flex: 1;
  padding: 8px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.carousel-bg-btn:hover {
  background: rgba(0,0,0,0.8);
  border-color: rgba(255,255,255,0.2);
}

/* Editor Sections */
.carousel-editor-section {
  padding: 20px;
  border-bottom: 1px solid #252525;
}

.carousel-editor-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  margin-bottom: 12px;
}

/* Text Input */
.carousel-text-input {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.carousel-text-input:focus {
  outline: none;
  border-color: #ec4899;
}

.carousel-text-input::placeholder {
  color: #555;
}

.carousel-word-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: #666;
}

.carousel-word-count-badge {
  padding: 4px 8px;
  background: #ec4899;
  border-radius: 4px;
  color: #fff;
  font-weight: 600;
}

/* Image Upload */
.carousel-image-upload {
  position: relative;
  padding: 24px;
  background: #1a1a1a;
  border: 2px dashed #333;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.carousel-image-upload:hover {
  border-color: #555;
}

.carousel-image-upload.has-image {
  padding: 0;
  border-style: solid;
}

.carousel-image-upload img {
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.carousel-image-upload-text {
  color: #666;
  font-size: 12px;
}

.carousel-image-upload-text svg {
  display: block;
  margin: 0 auto 8px;
  width: 32px;
  height: 32px;
  color: #555;
}

/* Zoom/Position Controls */
.carousel-position-controls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.carousel-position-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.carousel-position-label {
  font-size: 11px;
  color: #666;
}

.carousel-position-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: #333;
  border-radius: 2px;
  outline: none;
}

.carousel-position-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #ec4899;
  border-radius: 50%;
  cursor: pointer;
}

.carousel-control-value {
  float: right;
  color: #ec4899;
  font-weight: 600;
}

.carousel-no-image-hint {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(236, 72, 153, 0.1);
  border: 1px solid rgba(236, 72, 153, 0.2);
  border-radius: 6px;
  font-size: 11px;
  color: #ec4899;
  text-align: center;
}

.carousel-no-image-hint.hidden {
  display: none;
}

/* LUT Intensity */
.carousel-lut-intensity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.carousel-lut-intensity label {
  font-size: 11px;
  color: #666;
  white-space: nowrap;
}

.carousel-lut-intensity input[type="range"] {
  flex: 1;
}

.carousel-lut-intensity span {
  font-size: 11px;
  color: #888;
  min-width: 35px;
  text-align: right;
}

/* AI Generation Panel */
.carousel-ai-section {
  padding: 20px;
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  border-bottom: 1px solid #252525;
}

.carousel-ai-input {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  resize: vertical;
}

.carousel-ai-input:focus {
  outline: none;
  border-color: #ec4899;
}

.carousel-ai-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.carousel-ai-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.carousel-ai-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Loading State */
.carousel-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #888;
}

.carousel-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #333;
  border-top-color: #ec4899;
  border-radius: 50%;
  animation: carousel-spin 0.8s linear infinite;
}

@keyframes carousel-spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.carousel-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
}

.carousel-empty-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  color: #333;
}

.carousel-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
}

.carousel-empty-text {
  font-size: 13px;
  color: #555;
  max-width: 300px;
}

/* Slide Delete Button */
.carousel-slide-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: rgba(239, 68, 68, 0.8);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.15s ease;
}

.carousel-slide:hover .carousel-slide-delete {
  display: flex;
}

.carousel-slide-delete:hover {
  background: #ef4444;
}

/* Responsive */
@media (max-width: 1400px) {
  .carousel-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1100px) {
  .carousel-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .carousel-sidebar {
    width: 260px;
  }

  .carousel-editor {
    width: 340px;
  }
}

/* ========== AI HEADSHOT GENERATOR STYLES ========== */

.carousel-ai-headshot-section {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(236, 72, 153, 0.08) 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.carousel-ai-headshot-info {
  font-size: 11px;
  color: #a78bfa;
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Multi-Selfie Upload Grid */
.carousel-selfie-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.carousel-selfie-slot {
  position: relative;
  aspect-ratio: 1;
  border: 2px dashed rgba(139, 92, 246, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  background: rgba(139, 92, 246, 0.05);
}

.carousel-selfie-slot:hover {
  border-color: #a78bfa;
  background: rgba(139, 92, 246, 0.1);
}

.carousel-selfie-slot.has-image {
  border-style: solid;
  border-color: #a78bfa;
}

.carousel-selfie-slot-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(139, 92, 246, 0.5);
}

.carousel-selfie-slot.has-image .carousel-selfie-slot-placeholder {
  display: none;
}

.carousel-selfie-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.carousel-selfie-slot-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(239, 68, 68, 0.9);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 2;
}

.carousel-selfie-slot:hover .carousel-selfie-slot-remove {
  display: flex;
}

.carousel-selfie-slot-remove:hover {
  background: #ef4444;
}

.carousel-selfie-hint {
  font-size: 10px;
  color: #666;
  text-align: center;
  margin-bottom: 12px;
}

.carousel-selfie-count {
  font-size: 10px;
  color: #a78bfa;
  text-align: center;
  margin-bottom: 12px;
}

/* Scene Presets Grid - 10 cinematic styles in 5x2 grid */
.carousel-scene-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 12px;
}

.carousel-scene-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.carousel-scene-preset:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
}

.carousel-scene-preset.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: #a78bfa;
}

.carousel-scene-preset .preset-icon {
  font-size: 16px;
  margin-bottom: 2px;
}

.carousel-scene-preset .preset-label {
  font-size: 8px;
  color: #ccc;
  text-align: center;
  line-height: 1.1;
}

.carousel-scene-preset.active .preset-label {
  color: #a78bfa;
}

/* Custom Scene Input */
.carousel-scene-custom {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  margin-bottom: 12px;
  transition: border-color 0.2s ease;
}

.carousel-scene-custom:focus {
  outline: none;
  border-color: #a78bfa;
}

.carousel-scene-custom::placeholder {
  color: #666;
}

/* Headshot Options */
.carousel-headshot-options {
  margin-bottom: 12px;
}

.carousel-headshot-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #aaa;
  cursor: pointer;
  margin-bottom: 8px;
}

.carousel-headshot-option input[type="checkbox"] {
  accent-color: #a78bfa;
}

.carousel-headshot-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.carousel-headshot-count span {
  font-size: 11px;
  color: #888;
}

.carousel-headshot-count select {
  flex: 1;
  padding: 6px 8px;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
}

.carousel-headshot-count select:focus {
  outline: none;
  border-color: #a78bfa;
}

.carousel-headshot-count select option {
  background: #1a1a2e;
  color: #fff;
  padding: 8px;
}

/* Generate Button */
.carousel-headshot-generate-btn {
  background: linear-gradient(135deg, #8b5cf6, #ec4899) !important;
  margin-bottom: 8px;
}

.carousel-headshot-generate-btn:disabled {
  background: rgba(139, 92, 246, 0.3) !important;
  cursor: not-allowed;
  opacity: 0.6;
}

.carousel-headshot-generate-btn:not(:disabled):hover {
  filter: brightness(1.1);
}

/* API Notice */
.carousel-api-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 6px;
  font-size: 10px;
  color: #fbbf24;
}

.carousel-api-notice.hidden {
  display: none;
}

.carousel-api-setup-btn {
  padding: 4px 10px;
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 4px;
  color: #fbbf24;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.carousel-api-setup-btn:hover {
  background: rgba(251, 191, 36, 0.3);
}

/* Generation Progress */
.carousel-headshot-progress {
  margin-top: 12px;
  padding: 12px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 8px;
}

.carousel-headshot-progress-text {
  font-size: 11px;
  color: #a78bfa;
  margin-bottom: 8px;
}

.carousel-headshot-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.carousel-headshot-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ========== END CAROUSEL MODE STYLES ========== */
