    :root {
      --sidebar-width: 320px;
      /* Dark theme colors */
      --bg-primary: #0a0a0a;
      --bg-secondary: #111111;
      --bg-tertiary: #1a1a1a;
      --bg-panel: rgba(20, 20, 20, 0.8);
      --bg-panel-hover: rgba(30, 30, 30, 0.9);
      --bg-control: rgba(255, 255, 255, 0.05);
      --bg-control-hover: rgba(255, 255, 255, 0.1);
      --bg-control-active: rgba(255, 255, 255, 0.15);
      --floating-panel-bg: rgba(17, 17, 20, 0.94);
      --text-primary: #ffffff;
      --text-secondary: #a0a0a0;
      --text-tertiary: #707070;
      --accent-primary: #3b82f6;
      --accent-secondary: #6366f1;
      --accent-success: #10b981;
      --accent-warning: #f59e0b;
      --accent-danger: #ef4444;
      --border-primary: rgba(255, 255, 255, 0.1);
      --border-secondary: rgba(255, 255, 255, 0.05);
      --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
      --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
      --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
      --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
      --blur-sm: blur(8px);
      --blur-md: blur(16px);
      --blur-lg: blur(24px);
    }

    [data-theme="light"] {
      /* Light theme colors */
      --bg-primary: #ffffff;
      --bg-secondary: #f8fafc;
      --bg-tertiary: #f1f5f9;
      --bg-panel: rgba(255, 255, 255, 0.9);
      --bg-panel-hover: rgba(255, 255, 255, 0.95);
      --bg-control: rgba(0, 0, 0, 0.05);
      --bg-control-hover: rgba(0, 0, 0, 0.1);
      --bg-control-active: rgba(0, 0, 0, 0.15);
      --floating-panel-bg: rgba(250, 250, 252, 0.95);
      --text-primary: #0f172a;
      --text-secondary: #475569;
      --text-tertiary: #94a3b8;
      --accent-primary: #3b82f6;
      --accent-secondary: #6366f1;
      --accent-success: #10b981;
      --accent-warning: #f59e0b;
      --accent-danger: #ef4444;
      --border-primary: rgba(0, 0, 0, 0.1);
      --border-secondary: rgba(0, 0, 0, 0.05);
      --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
      --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
      --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
      --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
      --blur-sm: blur(8px);
      --blur-md: blur(16px);
      --blur-lg: blur(24px);
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      user-select: none;
      cursor: default;
    }

    button,
    select,
    a {
      cursor: pointer;
    }

    /* Sleek, theme-aware scrollbars (override blocky Windows defaults) */
    ::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }

    ::-webkit-scrollbar-track {
      background: transparent;
    }

    ::-webkit-scrollbar-thumb {
      background: var(--bg-control);
      border-radius: 4px;
      border: 1px solid var(--border-secondary);
    }

    ::-webkit-scrollbar-thumb:hover {
      background: var(--bg-control-hover);
    }

    ::-webkit-scrollbar-corner {
      background: transparent;
    }

    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="url"],
    input[type="tel"],
    textarea,
    [contenteditable="true"] {
      user-select: text;
      cursor: text;
    }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      font-size: 14px;
      font-weight: 400;
      line-height: 1.5;
      color: var(--text-primary);
      background: var(--bg-primary);
      margin: 0;
      overflow: hidden;
      width: 100%;
      height: 100vh;
      display: flex;
    }

    #container {
      position: relative;
      flex: 1;
      min-width: 0;
      height: 100vh;
      background: var(--bg-primary);
      cursor: move;
    }

    #container.checkerboard {
      background-image:
        linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%);
      background-size: 20px 20px;
      background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
      background-color: var(--bg-secondary);
      transition: opacity 0.6s ease-in-out, background-image 0.6s ease-in-out;
    }

    [data-theme="light"] #container.checkerboard {
      background-image:
        linear-gradient(45deg, rgba(0, 0, 0, 0.04) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(0, 0, 0, 0.04) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.04) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.04) 75%);
    }

    @keyframes checkerboard-pulse {

      0%,
      100% {
        opacity: 0.8;
      }

      50% {
        opacity: 1;
      }
    }

    #container canvas {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      border-radius: 0;
      display: block;
      cursor: move;
    }

    #loading {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: var(--bg-primary);
      z-index: 10000;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 24px;
      opacity: 1;
      visibility: visible;
      transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
      color: var(--text-primary);
      font-size: 16px;
      font-weight: 500;
      letter-spacing: 0.5px;
    }

    #loading.hidden {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }

    /* Spinner */
    #loading::before {
      content: '';
      width: 48px;
      height: 48px;
      border: 3px solid var(--bg-tertiary);
      border-top: 3px solid var(--accent-primary);
      border-radius: 50%;
      animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    }

    @keyframes spin {
      0% {
        transform: rotate(0deg);
      }

      100% {
        transform: rotate(360deg);
      }
    }

    /* Sidebar Resizer */
    #sidebarResizer {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      width: 6px;
      cursor: col-resize;
      z-index: 1000;
      background-color: transparent;
    }
    
    #sidebarResizer::before {
      content: '';
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      width: 1px;
      background-color: var(--accent-primary);
      opacity: 0;
      transition: opacity 0.2s, width 0.1s;
    }
    
    #sidebarResizer:hover::before {
      opacity: 0.35;
    }
    
    body.is-resizing * {
      cursor: col-resize !important;
      user-select: none !important;
    }
    
    body.is-resizing #sidebarResizer::before {
      width: 2px;
      opacity: 0.65;
    }
    
    body.is-resizing.at-limit #sidebarResizer::before {
      width: 3px;
      opacity: 1;
    }

    @media (max-width: 600px) {
      #sidebarResizer {
        display: none;
      }
    }

    /* Sidebar Styles */
    #sidebar {
      position: fixed;
      top: 0;
      right: 0;
      width: var(--sidebar-width);
      background: var(--bg-panel);
      backdrop-filter: var(--blur-lg);
      border-left: 1px solid var(--border-primary);
      overflow: hidden;
      height: 100vh;
      display: flex;
      flex-direction: column;
      transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease, border-color 0.22s ease;
      box-shadow: var(--shadow-xl);
      z-index: 100;
    }

    #sidebar.collapsed {
      transform: translateX(100%);
      border-left-color: transparent;
    }

    #sidebar.collapsed #settingsPanel {
      opacity: 0;
    }

    /* Sidebar Toggle Button */
    #sidebarToggle {
      position: fixed;
      right: var(--sidebar-width);
      top: 8px;
      width: 28px;
      height: 40px;
      background: var(--bg-panel);
      border: 1px solid var(--border-primary);
      border-right: none;
      border-radius: 8px 0 0 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      z-index: 1000;
      transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s ease, border-color 0.15s ease;
      box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
      padding: 0;
    }

    #sidebarToggle:hover {
      background: var(--bg-panel-hover);
      border-color: var(--border-secondary);
    }

    #sidebarToggle:active {
      background: var(--bg-panel);
    }

    #sidebarToggle svg {
      width: 16px;
      height: 16px;
      color: var(--text-secondary);
      transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
      flex-shrink: 0;
    }

    /* When sidebar is collapsed, button moves to right edge (slides with sidebar via same transform timing) */
    #sidebar.collapsed ~ #sidebarToggle,
    body:has(#sidebar.collapsed) #sidebarToggle {
      transform: translateX(var(--sidebar-width));
      border-radius: 8px 0 0 8px;
    }

    /* Open state: chevron points left (toward sidebar interior) */
    #sidebarToggle svg {
      transform: rotate(180deg);
    }

    /* Collapsed state: chevron points right (toward window edge) */
    #sidebar.collapsed ~ #sidebarToggle svg,
    body:has(#sidebar.collapsed) #sidebarToggle svg {
      transform: rotate(0deg);
    }

    /* ============================================================
       Dock (icon-rail) mode
       Body modifier: body.dock-active  (distinct from .dock-rail element)
       ============================================================ */

    /* Slim rail strip. Scoped with :not(.collapsed) so the collapse
       (transform / reclaim) state always wins over the dock width. */
    body.dock-active #sidebar:not(.collapsed) {
      width: 60px;
    }

    body.dock-active #settingsPanel,
    body.dock-active .sidebar-footer {
      display: none;
    }

    /* Toggle button rides the inner edge of the rail (60px) in dock mode */
    body.dock-active #sidebarToggle {
      right: 60px;
    }

    body.dock-active #sidebar.collapsed ~ #sidebarToggle,
    body.dock-active:has(#sidebar.collapsed) #sidebarToggle {
      transform: translateX(60px);
    }

    /* In dock mode (open, not collapsed) the chevron points back toward
       the interior to signal "expand to full sidebar" (mirrors collapsed). */
    body.dock-active #sidebar:not(.collapsed) ~ #sidebarToggle svg,
    body.dock-active:has(#sidebar:not(.collapsed)) #sidebarToggle svg {
      transform: rotate(0deg);
    }

    /* The rail container element. Hidden until dock mode is active. */
    .dock-rail {
      display: none;
      flex-direction: column;
      align-items: center;
      gap: 6px;
      width: 60px;
      height: 100%;
      padding: 16px 0 14px;
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior: contain;
    }

    body.dock-active #sidebar:not(.collapsed) .dock-rail {
      display: flex;
    }

    .dock-rail::-webkit-scrollbar {
      width: 0;
    }

    .dock-rail-btn {
      width: 40px;
      height: 40px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 1px solid transparent;
      border-radius: 10px;
      background: transparent;
      color: var(--text-secondary);
      cursor: pointer;
      touch-action: none;
      transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    }

    .dock-rail-btn:hover {
      background: var(--bg-control-hover);
      color: var(--text-primary);
    }

    .dock-rail-btn:active {
      cursor: grabbing;
    }

    .dock-rail-btn:focus-visible {
      outline: 2px solid var(--accent-primary);
      outline-offset: 2px;
    }

    /* Floating panel → subtle toggled-on state (faint accent tint + accent glyph) */
    .dock-rail-btn[aria-pressed="true"] {
      background: color-mix(in srgb, var(--accent-primary) 14%, transparent);
      border-color: color-mix(in srgb, var(--accent-primary) 26%, transparent);
      color: var(--accent-primary);
    }

    .dock-rail-icon {
      width: 20px;
      height: 20px;
      display: block;
      flex-shrink: 0;
      pointer-events: none;
      background-color: currentColor;
      -webkit-mask: center / contain no-repeat;
      mask: center / contain no-repeat;
    }

    /* Bottom-pinned circular logo button */
    .dock-rail-logo {
      margin-top: auto;
      width: 34px;
      height: 34px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: none;
      border-radius: 50%;
      background: transparent;
      cursor: pointer;
      transition: background 0.15s ease;
    }

    .dock-rail-logo:hover {
      background: var(--bg-control-hover);
    }

    .dock-rail-logo:focus-visible {
      outline: 2px solid var(--accent-primary);
      outline-offset: 2px;
    }

    .dock-rail-logo-glyph {
      width: 22px;
      height: 22px;
      display: block;
      pointer-events: none;
      background-color: var(--text-tertiary);
      -webkit-mask: url('../icons/apps/logo-a-circle.svg') center / contain no-repeat;
      mask: url('../icons/apps/logo-a-circle.svg') center / contain no-repeat;
      transition: background-color 0.15s ease;
    }

    .dock-rail-logo:hover .dock-rail-logo-glyph {
      background-color: var(--accent-primary);
    }

    /* Settings Panel */
    #settingsPanel {
      flex: 1;
      padding: 0;
      background: transparent;
      overflow-y: auto;
      overflow-x: hidden;
      display: flex;
      flex-direction: column;
      transition: opacity 0.18s ease;
      overscroll-behavior: contain;
    }

    /* Custom Scrollbar */
    #settingsPanel::-webkit-scrollbar {
      width: 4px;
    }

    #settingsPanel::-webkit-scrollbar-track {
      background: transparent;
    }

    #settingsPanel::-webkit-scrollbar-thumb {
      background: var(--border-primary);
      border-radius: 2px;
    }

    #settingsPanel::-webkit-scrollbar-thumb:hover {
      background: var(--border-primary);
      opacity: 0.8;
    }

    /* Header */
    .panel-header,
    .sidebar-footer {
      min-height: 56px;
      padding: 7px 20px;
      box-sizing: border-box;
      background: var(--bg-panel-hover);
    }

    .panel-header::before,
    .sidebar-footer::before {
      content: '';
      position: absolute;
      inset: 0;
      backdrop-filter: var(--blur-md);
      -webkit-backdrop-filter: var(--blur-md);
      z-index: -1;
      border-radius: inherit;
      pointer-events: none;
    }

    .panel-header {
      border-bottom: 1px solid var(--border-secondary);
      position: sticky;
      top: 0;
      z-index: 10;
    }

    .header-content {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 0;
    }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .app-title {
      font-size: 18px;
      font-weight: 600;
      color: var(--text-primary);
      margin: 0;
      display: flex;
      align-items: center;
      gap: 8px;
      position: relative;
      cursor: pointer;
    }

    .app-version {
      position: absolute;
      top: -0px;
      right: -18px;
      font-size: 8px;
      font-weight: 400;
      color: var(--text-tertiary);
      opacity: 0;
      transition: opacity 0.3s ease;
      pointer-events: none;
    }

    .app-title:hover .app-version {
      opacity: 1;
    }

    .modal-footer-copy {
      margin-top: 14px;
      padding-top: 10px;
      border-top: 1px solid var(--border-secondary);
      font-size: 11px;
      color: var(--text-tertiary);
      text-align: center;
      line-height: 1.4;
    }

    .modal-footer-tooltip-wrap {
      position: relative;
      display: inline-block;
    }

    .modal-footer-link {
      color: inherit;
      text-decoration: none;
      position: relative;
      transition: color 0.25s ease;
    }

    .modal-footer-link::after {
      content: '';
      position: absolute;
      left: 0;
      right: 0;
      bottom: -2px;
      height: 1px;
      background: var(--accent-primary);
      transform: scaleX(0);
      transform-origin: center;
      transition: transform 0.25s ease;
    }

    .modal-footer-link:hover,
    .modal-footer-link:focus-visible {
      color: var(--accent-primary);
    }

    .modal-footer-link:hover::after,
    .modal-footer-link:focus-visible::after {
      transform: scaleX(1);
    }

    .modal-footer-tooltip {
      position: absolute;
      left: 50%;
      bottom: calc(100% + 10px);
      transform: translateX(-50%) translateY(4px);
      background: var(--bg-panel-hover);
      color: var(--text-primary);
      border: 1px solid var(--border-primary);
      border-radius: 6px;
      padding: 6px 8px;
      font-size: 11px;
      white-space: nowrap;
      box-shadow: var(--shadow-md);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease, transform 0.25s ease;
      z-index: 2;
    }

    .modal-footer-tooltip::after {
      content: '';
      position: absolute;
      top: 100%;
      left: 50%;
      margin-left: -5px;
      border-width: 5px;
      border-style: solid;
      border-color: var(--bg-panel-hover) transparent transparent transparent;
    }

    .modal-footer-tooltip.visible {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    .license-account {
      position: absolute;
      top: calc(100% - 8px);
      left: 16px;
      right: 16px;
      padding: 12px;
      border: 1px solid var(--border-primary);
      border-radius: 12px;
      background: color-mix(in srgb, var(--bg-panel) 75%, transparent);
      backdrop-filter: blur(28px) saturate(150%);
      -webkit-backdrop-filter: blur(28px) saturate(150%);
      box-shadow: var(--shadow-xl), 0 4px 20px rgba(0, 0, 0, 0.3);
      display: none;
      gap: 8px;
      z-index: 100;
    }

    .license-account.visible {
      display: grid;
    }

    .license-account-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .license-account-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-secondary);
    }

    .license-status-badge {
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      border-radius: 999px;
      padding: 4px 8px;
      border: 1px solid transparent;
      transition: all 0.2s ease;
    }

    .license-status-badge.trial {
      color: #9ca3af;
      background: rgba(156, 163, 175, 0.15);
      border-color: rgba(156, 163, 175, 0.35);
    }

    .license-status-badge.pro {
      color: #34d399;
      background: rgba(16, 185, 129, 0.16);
      border-color: rgba(16, 185, 129, 0.4);
    }

    .license-status-badge.uncertain {
      color: #f59e0b;
      background: rgba(245, 158, 11, 0.16);
      border-color: rgba(245, 158, 11, 0.45);
    }

    .license-account-line {
      font-size: 11px;
      color: var(--text-secondary);
      line-height: 1.4;
      overflow-wrap: anywhere;
    }

    .license-account-actions {
      margin-top: 2px;
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }

    .license-account-actions .small-button {
      flex: 1;
      min-width: 94px;
      font-size: 10px;
      padding: 6px 8px;
    }

    .license-account-details {
      display: none;
      flex-direction: column;
      gap: 4px;
    }

    .license-account-details.visible {
      display: flex;
    }

    .license-detail-row {
      display: grid;
      grid-template-columns: 52px 1fr;
      gap: 6px;
      align-items: baseline;
    }

    .license-detail-label {
      font-size: 10px;
      font-weight: 600;
      color: var(--text-tertiary);
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .license-detail-value {
      font-size: 10px;
      color: var(--text-secondary);
      overflow-wrap: anywhere;
      font-family: "SF Mono", "Monaco", "Inconsolata", monospace;
    }

    #deactivateLicenseBtn:hover {
      background: rgba(239, 68, 68, 0.12);
      border-color: rgba(239, 68, 68, 0.4);
      color: #ef4444;
    }

    .pro-feature-button {
      position: relative;
    }

    .pro-button-wrapper {
      position: relative;
      width: 100%;
      display: flex;
    }

    .pro-button-wrapper .pro-tag {
      position: absolute;
      top: -8px;
      right: -8px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 2px 7px;
      border-radius: 999px;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      background: transparent;
      color: #ffffff;
      line-height: 1.2;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
      overflow: hidden;
      isolation: isolate;
      z-index: 10;
      pointer-events: none;
    }

    .pro-button-wrapper .pro-tag::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: inherit;
      border: 1px solid rgba(255, 255, 255, 0.35);
      background: rgba(255, 255, 255, 0.25);
      backdrop-filter: blur(12px) saturate(180%);
      -webkit-backdrop-filter: blur(12px) saturate(180%);
      z-index: -1;
    }

    .pro-button-wrapper.licensed .pro-tag {
      display: none;
    }


    .app-toast-container {
      position: fixed;
      left: 50%;
      transform: translateX(-50%);
      bottom: 20px;
      display: grid;
      gap: 8px;
      z-index: 12000;
      pointer-events: none;
      max-width: 320px;
    }

    .app-toast {
      pointer-events: auto;
      background: var(--bg-panel);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      color: var(--text-primary);
      border: 1px solid var(--border-primary);
      border-radius: 10px;
      box-shadow: var(--shadow-lg);
      padding: 10px 12px;
      font-size: 12px;
      line-height: 1.4;
      animation: toast-slide-in 0.2s ease-out;
      display: grid;
      gap: 2px;
    }

    .app-toast-title {
      font-weight: 600;
      color: var(--text-primary);
    }

    .app-toast.is-error {
      border-color: rgba(239, 68, 68, 0.55);
      background: rgba(127, 29, 29, 0.22);
    }

    .app-toast.is-success {
      border-color: rgba(16, 185, 129, 0.55);
      background: rgba(6, 95, 70, 0.24);
    }

    @keyframes toast-slide-in {
      from {
        opacity: 0;
        transform: translateY(6px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .license-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.68);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 11000;
      padding: 20px;
      backdrop-filter: blur(8px);
    }

    .license-modal-overlay.active {
      display: flex;
    }

    .license-modal {
      width: min(560px, 100%);
      background: var(--bg-panel);
      border: 1px solid var(--border-primary);
      border-radius: 14px;
      box-shadow: var(--shadow-xl);
      position: relative;
      overflow: hidden;
    }

    .license-modal-header {
      padding: 18px 20px 12px;
      border-bottom: 1px solid var(--border-secondary);
      display: grid;
      gap: 8px;
    }

    .license-modal-title {
      margin: 0;
      color: var(--text-primary);
      font-size: 20px;
      line-height: 1.2;
      letter-spacing: -0.01em;
    }

    .license-modal-description {
      margin: 0;
      color: var(--text-secondary);
      font-size: 13px;
      line-height: 1.55;
    }

    .license-feature-grid {
      margin: 14px 0 0;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }

    .license-feature-card {
      display: flex;
      align-items: center;
      gap: 11px;
      padding: 10px 11px;
      border-radius: 11px;
      border: 1px solid var(--border-secondary);
      background: var(--bg-control);
      transition: transform 0.16s ease, border-color 0.16s ease,
        box-shadow 0.16s ease, background 0.16s ease;
    }

    .license-feature-card:hover {
      transform: translateY(-2px);
      border-color: var(--accent-primary);
      background: var(--bg-panel);
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    }

    .license-feature-icon {
      flex: 0 0 auto;
      width: 36px;
      height: 36px;
      border-radius: 10px;
      display: grid;
      place-items: center;
      color: var(--accent-primary);
      background: linear-gradient(135deg,
        rgba(59, 130, 246, 0.20), rgba(59, 130, 246, 0.06));
      transition: transform 0.16s ease;
    }

    .license-feature-card:hover .license-feature-icon {
      transform: scale(1.06);
    }

    .license-feature-icon::before {
      content: '';
      width: 19px;
      height: 19px;
      background-color: currentColor;
      -webkit-mask: center / contain no-repeat;
      mask: center / contain no-repeat;
    }

    .license-feature-icon-png::before {
      -webkit-mask-image: url('../icons/ui/image-down.svg');
      mask-image: url('../icons/ui/image-down.svg');
    }

    .license-feature-icon-obj::before {
      -webkit-mask-image: url('../icons/ui/file-axis-3d.svg');
      mask-image: url('../icons/ui/file-axis-3d.svg');
    }

    .license-feature-icon-seq::before {
      -webkit-mask-image: url('../icons/ui/file-video.svg');
      mask-image: url('../icons/ui/file-video.svg');
    }

    .license-feature-icon-save::before {
      -webkit-mask-image: url('../icons/ui/download.svg');
      mask-image: url('../icons/ui/download.svg');
    }

    .license-feature-icon-load::before {
      -webkit-mask-image: url('../icons/ui/upload.svg');
      mask-image: url('../icons/ui/upload.svg');
    }

    .license-feature-icon-preset::before {
      -webkit-mask-image: url('../icons/ui/bookmark-plus.svg');
      mask-image: url('../icons/ui/bookmark-plus.svg');
    }

    .license-feature-text {
      display: grid;
      gap: 2px;
      min-width: 0;
    }

    .license-feature-name {
      color: var(--text-primary);
      font-size: 12.5px;
      font-weight: 600;
      line-height: 1.2;
    }

    .license-feature-desc {
      color: var(--text-secondary);
      font-size: 11px;
      line-height: 1.3;
    }

    .license-modal-body {
      padding: 16px 20px 18px;
      display: grid;
      gap: 12px;
    }

    .license-input-label {
      margin: 0;
      color: var(--text-secondary);
      font-size: 12px;
      font-weight: 600;
    }

    .license-input {
      width: 100%;
      border: 1px solid var(--border-primary);
      background: var(--bg-control);
      color: var(--text-primary);
      border-radius: 10px;
      padding: 12px 14px;
      font-size: 13px;
      font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
      letter-spacing: 0.03em;
      outline: none;
      transition: border-color 0.2s ease, box-shadow 0.2s ease;
      box-sizing: border-box;
    }

    .license-input:focus {
      border-color: var(--accent-primary);
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
    }

    .license-message {
      min-height: 18px;
      font-size: 12px;
      color: var(--text-secondary);
    }

    .license-message.error {
      color: #fca5a5;
    }

    .license-message.success {
      color: #6ee7b7;
    }

    .license-modal-actions {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    .license-modal-actions .btn {
      flex: 1;
      min-width: 140px;
    }

    .license-close-btn {
      position: absolute;
      top: 10px;
      right: 10px;
      width: 34px;
      height: 34px;
      border-radius: 8px;
      border: 1px solid var(--border-primary);
      background: transparent;
      color: var(--text-secondary);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .license-close-btn:hover,
    .license-close-btn:focus-visible {
      color: var(--text-primary);
      background: var(--bg-control-hover);
      border-color: var(--border-secondary);
      outline: none;
    }

    .license-loading .license-input,
    .license-loading .license-modal-actions .btn {
      opacity: 0.72;
      pointer-events: none;
    }

    .license-success-burst {
      position: absolute;
      inset: 0;
      pointer-events: none;
      opacity: 0;
    }

    .license-success-burst.active {
      opacity: 1;
      animation: license-burst 0.9s ease-out forwards;
    }

    .license-success-burst::before,
    .license-success-burst::after {
      content: '';
      position: absolute;
      border-radius: 999px;
      filter: blur(1px);
    }

    .license-success-burst::before {
      width: 220px;
      height: 220px;
      left: -20px;
      bottom: -70px;
      background: radial-gradient(circle, rgba(16, 185, 129, 0.34) 0%, rgba(16, 185, 129, 0) 70%);
    }

    .license-success-burst::after {
      width: 220px;
      height: 220px;
      right: -20px;
      top: -80px;
      background: radial-gradient(circle, rgba(59, 130, 246, 0.34) 0%, rgba(59, 130, 246, 0) 70%);
    }

    @keyframes license-burst {
      0% {
        opacity: 0;
        transform: scale(0.95);
      }

      25% {
        opacity: 1;
      }

      100% {
        opacity: 0;
        transform: scale(1.04);
      }
    }

    /* Disabled state for illumination controls */
    .setting-item.disabled {
      opacity: 0.4;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }

    .setting-item.disabled label {
      color: var(--text-tertiary);
    }

    .setting-item.disabled input[type="range"] {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .setting-item.disabled .value {
      opacity: 0.5;
      cursor: not-allowed;
      background: var(--bg-tertiary);
    }

    .app-icon {
      width: 32px;
      height: 32px;
      background: url('../icons/Icon-Lava-Lamp-1024x1024.svg') center/cover;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      overflow: hidden;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .app-icon:hover {
      transform: scale(1.1) rotate(5deg);
      box-shadow: 0 8px 25px -8px rgba(59, 130, 246, 0.4);
      filter: brightness(1.1) saturate(1.2);
    }

    .app-icon:active {
      transform: scale(1.05) rotate(2deg);
      transition: transform 0.1s ease;
    }

    .app-icon::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
      transform: rotate(45deg) translateX(-100%);
      transition: transform 0.6s ease;
      pointer-events: none;
    }

    .app-icon:hover::before {
      transform: rotate(45deg) translateX(100%);
    }

    .theme-toggle {
      background: var(--bg-control);
      border: 1px solid var(--border-primary);
      border-radius: 8px;
      padding: 8px;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      color: var(--text-secondary);
      font-size: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 40px;
      height: 40px;
      position: relative;
    }

    .theme-toggle:hover {
      background: var(--bg-control-hover);
      color: var(--text-primary);
      transform: scale(1.05);
    }

    .theme-toggle:disabled {
      opacity: 0.3;
      cursor: default;
      pointer-events: none;
    }

    .theme-toggle svg {
      width: 18px;
      height: 18px;
      fill: currentColor;
      stroke: none;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      position: absolute;
    }

    .account-toggle {
      overflow: hidden;
    }

    .account-toggle .btn-icon-mask {
      width: 18px;
      height: 18px;
      opacity: 0.9;
      transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .account-toggle:hover .btn-icon-mask,
    .account-toggle:focus-visible .btn-icon-mask {
      opacity: 1;
      transform: scale(1.05);
    }

    .account-toggle.active {
      background: var(--bg-control-hover);
      color: var(--text-primary);
      border-color: var(--border-secondary);
    }

    /* Show moon icon in dark mode (to switch to light) */
    .theme-icon-dark {
      opacity: 1;
      transform: rotate(0deg);
    }

    .theme-icon-light {
      opacity: 0;
      transform: rotate(180deg);
    }

    /* Show sun icon in light mode (to switch to dark) */
    [data-theme="light"] .theme-icon-dark {
      opacity: 0;
      transform: rotate(180deg);
    }

    [data-theme="light"] .theme-icon-light {
      opacity: 1;
      transform: rotate(0deg);
    }

    .header-subtitle {
      font-size: 13px;
      color: var(--text-secondary);
      margin: 0;
      font-weight: 400;
    }

    /* Settings Content */
    .settings-content {
      flex: 1;
      padding: 8px;
    }

    .setting-group {
      margin-bottom: 24px;
      background: var(--bg-control);
      border: 1px solid var(--border-secondary);
      border-radius: 16px;
      padding: 20px;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      backdrop-filter: var(--blur-sm);
    }

    .sidebar-section {
      position: relative;
      transition: transform 0.2s;
    }

    .sidebar-section.dragging {
      opacity: 0.5;
    }

    #sidebar.panel-dropzone-active {
      outline: 2px dashed var(--primary-color, var(--accent-primary, #3b82f6));
      outline-offset: -5px;
      background: color-mix(in srgb, var(--accent-primary, #3b82f6) 8%, var(--bg-panel));
    }

    .floating-frame {
      position: absolute;
      z-index: 1000;
      display: flex;
      flex-direction: column;
      box-sizing: border-box;
      min-width: 260px;
      min-height: 76px;
      max-width: 90vw;
      max-height: 90vh;
      overflow: hidden;
      background: var(--floating-panel-bg);
      border: 1px solid var(--border-primary);
      border-radius: 16px;
      box-shadow: 0 20px 48px rgba(0, 0, 0, 0.38), 0 2px 10px rgba(0, 0, 0, 0.2);
      backdrop-filter: blur(28px) saturate(135%);
      -webkit-backdrop-filter: blur(28px) saturate(135%);
      isolation: isolate;
    }

    .floating-frame > .sidebar-section {
      display: flex;
      flex: 1 1 auto;
      flex-direction: column;
      min-width: 0;
      min-height: 0;
      height: 100%;
      margin: 0;
      overflow: hidden;
    }

    .floating-frame > .sidebar-section > .setting-content {
      flex: 1 1 auto;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      padding-right: 4px;
    }

    .floating-frame .sidebar-section.collapsed {
      flex: 0 0 auto;
    }

    /* Custom resize handle for detached panels */
    .detached-panel-resize-handle {
      position: absolute;
      bottom: 0;
      right: 0;
      width: 40px;
      height: 40px;
      cursor: se-resize;
      z-index: 10;
    }

    .detached-panel-resize-handle::before {
      content: '';
      position: absolute;
      bottom: 8px;
      right: 8px;
      width: 12px;
      height: 12px;
      border-right: 2px solid var(--border-primary);
      border-bottom: 2px solid var(--border-primary);
      border-radius: 0 0 8px 0;
      opacity: 0.4;
      transition: opacity 0.2s ease, border-color 0.2s ease;
    }

    .detached-panel-resize-handle:hover::before {
      opacity: 0.8;
      border-color: var(--accent-primary);
    }

    /* Hide resize handle when panel is collapsed */
    .floating-frame .sidebar-section.collapsed ~ .detached-panel-resize-handle,
    .floating-frame.collapsed .detached-panel-resize-handle {
      display: none;
    }

    /* Override inline height when collapsed to shrink to header size */
    .floating-frame.resized .sidebar-section.collapsed {
      flex: 0 0 auto;
    }

    .floating-frame.resized .sidebar-section.collapsed ~ .detached-panel-resize-handle {
      display: none;
    }

    /* When resized, ensure content flexes to fill the height */
    .floating-frame.resized > .sidebar-section > .setting-content {
      flex: 1;
      max-height: none;
      min-height: 0;
    }

    .panel-dock-button {
      display: none;
      position: absolute;
      right: 28px;
      width: 24px;
      height: 24px;
      padding: 0;
      align-items: center;
      justify-content: center;
      color: currentColor;
      background: transparent;
      border: 0;
      border-radius: 6px;
      cursor: pointer;
      opacity: 0.65;
    }

    .floating-frame .panel-dock-button {
      display: flex;
    }

    .panel-dock-button:hover {
      color: var(--accent-primary);
      background: var(--bg-control-hover);
      opacity: 1;
    }

    .section-icon {
      cursor: grab;
      touch-action: none;
    }

    .section-icon:active {
      cursor: grabbing;
    }

    .section-icon:focus-visible {
      outline: 2px solid var(--accent-primary, #3b82f6);
      outline-offset: 3px;
      border-radius: 2px;
    }

    .sidebar-section.drop-before::before {
      content: '';
      position: absolute;
      top: -2px;
      left: 0;
      width: 100%;
      height: 2px;
      background-color: var(--primary-color, var(--accent-primary, #3b82f6));
      z-index: 10;
      pointer-events: none;
    }

    .sidebar-section.drop-after::after {
      content: '';
      position: absolute;
      bottom: -2px;
      left: 0;
      width: 100%;
      height: 2px;
      background-color: var(--primary-color, var(--accent-primary, #3b82f6));
      z-index: 10;
      pointer-events: none;
    }

    .setting-group:hover {
      background: var(--bg-control-hover);
      border-color: var(--border-primary);
      transform: translateY(-1px);
      box-shadow: var(--shadow-md);
    }

    .setting-group h4 {
      margin: 0 0 16px 0;
      color: var(--text-primary);
      font-size: 15px;
      font-weight: 600;
      letter-spacing: -0.025em;
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      user-select: none;
      position: relative;
      padding-right: 24px;
    }

    .section-heading {
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }

    .section-heading-text {
      color: var(--text-primary);
      transition: color 0.2s ease;
    }

    .section-title-icon {
      width: 16px;
      height: 16px;
      display: inline-block;
      flex-shrink: 0;
      background-color: currentColor;
      opacity: 0.9;
      -webkit-mask: center / contain no-repeat;
      mask: center / contain no-repeat;
    }

    .section-title-icon-camera {
      -webkit-mask-image: url('../icons/ui/rotate-3d.svg');
      mask-image: url('../icons/ui/rotate-3d.svg');
    }

    .section-title-icon-settings {
      -webkit-mask-image: url('../icons/ui/settings-2.svg');
      mask-image: url('../icons/ui/settings-2.svg');
    }

    .section-title-icon-environment {
      -webkit-mask-image: url('../icons/ui/spotlight.svg');
      mask-image: url('../icons/ui/spotlight.svg');
    }

    .section-title-icon-material {
      -webkit-mask-image: url('../icons/ui/circle-plus.svg');
      mask-image: url('../icons/ui/circle-plus.svg');
    }

    .section-title-icon-normal {
      -webkit-mask-image: url('../icons/ui/badge-plus.svg');
      mask-image: url('../icons/ui/badge-plus.svg');
    }

    .section-title-icon-effects {
      -webkit-mask-image: url('../icons/ui/sparkles.svg');
      mask-image: url('../icons/ui/sparkles.svg');
    }

    .section-title-icon-presets {
      -webkit-mask-image: url('../icons/ui/bookmark.svg');
      mask-image: url('../icons/ui/bookmark.svg');
    }

    .section-title-icon-project {
      -webkit-mask-image: url('../icons/ui/file-sliders.svg');
      mask-image: url('../icons/ui/file-sliders.svg');
    }

    .section-title-icon-export {
      -webkit-mask-image: url('../icons/ui/image-down.svg');
      mask-image: url('../icons/ui/image-down.svg');
    }

    .setting-group h4:hover .section-title-icon,
    .setting-group h4:hover .collapse-toggle {
      color: var(--accent-primary);
    }

    .setting-group h4:hover .section-heading-text {
      color: var(--text-primary);
    }

    .setting-group h4 .collapse-toggle {
      position: absolute;
      right: 0;
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      opacity: 0.6;
    }

    .setting-group h4 .collapse-toggle:hover {
      opacity: 1;
    }

    .setting-group h4 .collapse-toggle svg {
      width: 16px;
      height: 16px;
      fill: none;
      stroke: currentColor;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .setting-group.collapsed h4 .collapse-toggle {
      transform: rotate(-90deg);
    }

    .setting-group .setting-content {
      min-height: 0;
      transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin 0.3s ease;
      overflow: visible;
    }

    .setting-group.collapsed .setting-content {
      max-height: 0;
      opacity: 0;
      margin-top: -16px;
    }

    .setting-group:not(.collapsed) .setting-content {
      max-height: none;
      opacity: 1;
    }

    .group-icon {
      width: 20px;
      height: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--accent-primary);
      border-radius: 6px;
      font-size: 12px;
      color: white;
    }

    .setting-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
      gap: 12px;
      overflow: visible;
      min-height: 24px;
    }

    .setting-item:last-child {
      margin-bottom: 0;
    }

    .setting-item label {
      width: 120px;
      flex-shrink: 0;
      font-size: 13px;
      font-weight: 500;
      color: var(--text-primary);
      cursor: pointer;
      transition: color 0.2s ease;
      line-height: 1.2;
      display: flex;
      align-items: center;
    }

    .setting-item label:hover {
      color: var(--accent-primary);
    }

    [data-panel="effects"] .effect-toggle-item > label {
      transition: color 0.2s ease, opacity 0.2s ease;
    }

    [data-panel="effects"] .effect-toggle-item:has(> input[type="checkbox"]:not(:checked)) > label {
      opacity: 0.62;
    }

    [data-panel="effects"] .effect-toggle-item:has(> input[type="checkbox"]:checked) > label {
      opacity: 1;
    }

    /* Specific alignment fix for speed setting */
    #speedSetting {
      align-items: center;
    }

    #speedSetting label {
      margin-top: -2px;
    }

    /* Control Styles */
    .control-group {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
      flex: 1;
      justify-content: flex-end;
      overflow: visible;
    }

    /* Range Sliders */
    input[type="range"] {
      -webkit-appearance: none;
      appearance: none;
      height: 6px;
      background: var(--bg-tertiary);
      outline: none;
      border-radius: 3px;
      cursor: pointer;
      width: auto;
      min-width: 0;
      flex: 1 1 auto;
      border: 1px solid var(--border-secondary);
      transition: background-color 0.2s ease, border-color 0.2s ease;
      position: relative;
      margin: 7px 0;
    }

    input[type="range"]:hover {
      background: var(--bg-control);
    }

    /* Show progress on hover or active (no width transition to avoid lag) */
    input[type="range"].thumb-hover::before,
    input[type="range"]:active::before {
      background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
      width: calc(var(--slider-progress, 50) * 1%);
      opacity: 1;
    }

    /* Hide progress by default */
    input[type="range"]::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      border-radius: 3px;
      z-index: 1;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.2s ease;
    }

    input[type="range"]::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 20px;
      height: 20px;
      background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
      cursor: grab;
      border-radius: 10px;
      border: 2px solid white;
      box-shadow: var(--shadow-md);
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      z-index: 2;
    }

    input[type="range"]::-webkit-slider-thumb:hover {
      transform: scale(1.1);
      box-shadow: var(--shadow-lg);
    }

    input[type="range"]::-webkit-slider-thumb:active {
      cursor: grabbing;
      transform: scale(1.15);
      box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.1);
    }

    input[type="range"]::-moz-range-thumb {
      width: 20px;
      height: 20px;
      background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
      cursor: grab;
      border-radius: 10px;
      border: 2px solid white;
      box-shadow: var(--shadow-md);
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    input[type="range"]::-moz-range-thumb:hover {
      transform: scale(1.1);
      box-shadow: var(--shadow-lg);
    }

    input[type="range"]::-moz-range-thumb:active {
      cursor: grabbing;
      transform: scale(1.15);
    }

    input[type="range"]::-moz-range-track {
      height: 6px;
      background: var(--bg-tertiary);
      border-radius: 3px;
      border: 1px solid var(--border-secondary);
    }

    .value {
      width: 65px;
      flex-shrink: 0;
      text-align: left;
      font-size: 12px;
      font-weight: 600;
      color: var(--text-secondary);
      background: var(--bg-control);
      padding: 6px 12px;
      border-radius: 6px;
      border: 1px solid var(--border-secondary);
      font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
      transition: all 0.2s ease;
      cursor: text;
      overflow: visible;
      box-sizing: border-box;
    }

    .value:hover {
      color: var(--text-primary);
      background: var(--bg-control-hover);
      overflow: visible;
    }

    .value:focus {
      outline: none;
      border-color: var(--accent-primary);
      background: var(--bg-control-active);
      color: var(--text-primary);
      overflow: visible;
    }

    /* Number input specific styles */
    input[type="number"].value {
      -webkit-appearance: textfield;
      -moz-appearance: textfield;
      appearance: textfield;
    }

    input[type="number"].value::-webkit-outer-spin-button,
    input[type="number"].value::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }

    /* Show spinner on hover for better UX */
    input[type="number"].value:hover::-webkit-outer-spin-button,
    input[type="number"].value:hover::-webkit-inner-spin-button {
      -webkit-appearance: inner-spin-button;
      opacity: 1;
    }

    /* Export PNG scale select: custom chevron shifted left slightly */
    #pngScaleSelect {
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      padding-right: 28px;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-size: 12px 12px;
      background-position: calc(100% - 12px) 50%;
    }

    /* Dithering algorithm select: wider field and chevron nudged left */
    #bitmapDitherSelect {
      width: clamp(132px, 56%, 170px);
      max-width: 100%;
      flex-shrink: 1;
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      padding-right: 30px;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-size: 12px 12px;
      background-position: calc(100% - 14px) 50%;
    }

    #bitmapColorModeSelect {
      width: clamp(132px, 56%, 170px);
      max-width: 100%;
      flex-shrink: 1;
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      padding-right: 30px;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-size: 12px 12px;
      background-position: calc(100% - 14px) 50%;
    }

    /* Checkboxes */
    input[type="checkbox"] {
      -webkit-appearance: none;
      appearance: none;
      width: 44px;
      height: 24px;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-primary);
      border-radius: 12px;
      cursor: pointer;
      position: relative;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    input[type="checkbox"]:checked {
      background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
      border-color: var(--accent-primary);
    }

    input[type="checkbox"]::before {
      content: '';
      position: absolute;
      width: 18px;
      height: 18px;
      background: white;
      border-radius: 50%;
      top: 2px;
      left: 2px;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: var(--shadow-sm);
    }

    input[type="checkbox"]:checked::before {
      transform: translateX(20px);
    }

    /* Color Input */
    input[type="color"] {
      -webkit-appearance: none;
      appearance: none;
      width: 44px;
      height: 32px;
      border: 2px solid var(--border-primary);
      border-radius: 8px;
      cursor: pointer;
      overflow: hidden;
      transition: all 0.2s ease;
    }

    input[type="color"]:hover {
      transform: scale(1.05);
      border-color: var(--accent-primary);
    }

    input[type="color"]::-webkit-color-swatch {
      border: none;
      border-radius: 6px;
    }

    input[type="color"]::-moz-color-swatch {
      border: none;
      border-radius: 6px;
    }

    input[type="color"].wireframe-color-swatch {
      width: 32px;
      height: 32px;
      min-width: 32px;
      flex-shrink: 0;
      border-radius: 4px;
      padding: 0;
      background: transparent;
    }

    input[type="color"].wireframe-color-swatch::-webkit-color-swatch-wrapper {
      padding: 0;
    }

    input[type="color"].wireframe-color-swatch::-webkit-color-swatch {
      border-radius: 2px;
    }

    input[type="color"].wireframe-color-swatch::-moz-color-swatch {
      border-radius: 2px;
    }

    #wireframeColor1Hex,
    #wireframeColor2Hex {
      width: 80px;
      flex-shrink: 0;
      flex-grow: 0;
    }

    /* Buttons */
    .btn {
      background: var(--bg-control);
      color: var(--text-primary);
      border: 1px solid var(--border-primary);
      padding: 12px 20px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      width: 100%;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      font-family: inherit;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      backdrop-filter: var(--blur-sm);
    }

    .btn-icon {
      flex-shrink: 0;
      transition: transform 0.2s ease;
    }

    .btn-icon-mask {
      width: 14px;
      height: 14px;
      display: inline-block;
      flex-shrink: 0;
      background-color: currentColor;
      -webkit-mask: center / contain no-repeat;
      mask: center / contain no-repeat;
    }

    .btn-icon-expand {
      -webkit-mask-image: url('../icons/ui/expand.svg');
      mask-image: url('../icons/ui/expand.svg');
    }

    .btn-icon-dock {
      -webkit-mask-image: url('../icons/ui/arrow-right-to-line.svg');
      mask-image: url('../icons/ui/arrow-right-to-line.svg');
    }

    .btn-icon-account {
      -webkit-mask-image: url('../icons/ui/circle-user-round.svg');
      mask-image: url('../icons/ui/circle-user-round.svg');
    }

    .btn:hover {
      background: var(--bg-control-hover);
      transform: translateY(-1px);
      box-shadow: var(--shadow-md);
    }

    .btn:active {
      transform: translateY(0);
      box-shadow: var(--shadow-sm);
    }

    .btn-primary {
      background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
      color: white;
      border-color: var(--accent-primary);
    }

    .btn-primary:hover {
      background: linear-gradient(135deg, #2563eb, #4f46e5);
      box-shadow: 0 8px 25px -8px rgba(59, 130, 246, 0.5);
    }

    .btn-success {
      background: linear-gradient(135deg, var(--accent-success), #059669);
      color: white;
      border-color: var(--accent-success);
    }

    .btn-success:hover {
      background: linear-gradient(135deg, #059669, #047857);
      box-shadow: 0 8px 25px -8px rgba(16, 185, 129, 0.4);
    }

    .btn-warning {
      background: linear-gradient(135deg, var(--accent-warning), #d97706);
      color: white;
      border-color: var(--accent-warning);
    }

    .btn-warning:hover {
      background: linear-gradient(135deg, #d97706, #b45309);
      box-shadow: 0 8px 25px -8px rgba(245, 158, 11, 0.4);
    }

    .small-button {
      background: var(--bg-control);
      color: var(--text-secondary);
      border: 1px solid var(--border-secondary);
      padding: 6px 10px;
      border-radius: 6px;
      cursor: pointer;
      font-size: 11px;
      font-weight: 500;
      transition: all 0.2s ease;
      white-space: nowrap;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }

    .small-button:hover {
      background: var(--bg-control-hover);
      color: var(--text-primary);
      border-color: var(--border-primary);
    }

    /* Segmented Control */
    .segmented-control {
      display: flex;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-primary);
      border-radius: 10px;
      overflow: hidden;
      width: 100%;
      padding: 2px;
    }

    .segmented-control button {
      flex: 1;
      padding: 10px 16px;
      border: none;
      background: transparent;
      color: var(--text-secondary);
      cursor: pointer;
      font-size: 12px;
      font-weight: 500;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      border-radius: 8px;
      position: relative;
    }

    .segmented-control button.active {
      background: var(--bg-panel);
      color: var(--text-primary);
      box-shadow: var(--shadow-sm);
    }

    .segmented-control button:hover:not(.active) {
      background: var(--bg-control);
      color: var(--text-primary);
    }

    /* Dropzone */
    .dropzone {
      border: 2px dashed var(--border-primary);
      border-radius: 12px;
      padding: 24px;
      text-align: center;
      color: var(--text-secondary);
      background: var(--bg-control);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      margin: 8px 0;
      cursor: pointer;
      position: relative;
      min-height: 80px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }

    .dropzone:hover {
      border-color: var(--accent-primary);
      background: rgba(59, 130, 246, 0.05);
      color: var(--accent-primary);
    }

    .dropzone.dragover {
      border-color: var(--accent-primary);
      background: rgba(59, 130, 246, 0.1);
      color: var(--accent-primary);
      transform: scale(1.02);
    }

    .dropzone-icon {
      font-size: 24px;
      opacity: 0.6;
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .dropzone-icon svg {
      width: 24px;
      height: 24px;
      fill: currentColor;
      opacity: 0.6;
    }

    .dropzone-text {
      font-size: 12px;
      font-weight: 500;
      pointer-events: none;
    }

    /* Gallery */
    .preset-gallery {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
      gap: 8px;
      margin: 12px 0;
      max-height: 160px;
      overflow-y: auto;
      padding: 8px;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-secondary);
      border-radius: 12px;
    }

    .preset-gallery::-webkit-scrollbar {
      width: 4px;
    }

    .preset-gallery::-webkit-scrollbar-track {
      background: transparent;
    }

    .preset-gallery::-webkit-scrollbar-thumb {
      background: var(--border-primary);
      border-radius: 2px;
    }

    /* Base styles for all thumbnails */
    .preset-thumbnail,
    .texture-thumbnail,
    .normal-thumbnail {
      width: 48px;
      height: 48px;
      border: 2px solid var(--border-secondary);
      cursor: pointer;
      object-fit: cover;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      opacity: 0.8;
      background: var(--bg-control);
    }

    /* Material map thumbnails (preset and imported) - circular */
    .preset-thumbnail,
    .texture-thumbnail[data-type="material"] {
      border-radius: 50%;
    }

    /* Normal map thumbnails (preset and imported) - rounded rectangles */
    .normal-thumbnail,
    .texture-thumbnail[data-type="normal"] {
      border-radius: 8px;
    }

    .preset-thumbnail:hover,
    .texture-thumbnail:hover,
    .normal-thumbnail:hover {
      border-color: var(--accent-primary);
      opacity: 1;
      transform: scale(1.05);
      box-shadow: var(--shadow-md);
    }

    .preset-thumbnail.selected,
    .texture-thumbnail.selected,
    .normal-thumbnail.selected {
      border-color: var(--accent-primary);
      border-width: 3px;
      opacity: 1;
      transform: scale(1.05);
      box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
    }

    .preset-thumbnail.loading,
    .normal-thumbnail.loading {
      opacity: 0.5;
      background: var(--bg-control);
      animation: pulse 2s infinite;
    }

    @keyframes pulse {

      0%,
      100% {
        opacity: 0.5;
      }

      50% {
        opacity: 0.8;
      }
    }

    .texture-preview {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
      gap: 8px;
      margin: 12px 0;
      max-height: 160px;
      overflow-y: auto;
      padding: 8px;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-secondary);
      border-radius: 12px;
      display: none;
      /* Initially hidden */
    }

    .texture-preview.has-content {
      display: grid;
      /* Show when it has content */
    }

    .texture-preview::-webkit-scrollbar {
      width: 4px;
    }

    .texture-preview::-webkit-scrollbar-track {
      background: transparent;
    }

    .texture-preview::-webkit-scrollbar-thumb {
      background: var(--border-primary);
      border-radius: 2px;
    }

    /* Add button styles for gallery */
    .add-button {
      width: 48px;
      height: 48px;
      border: 2px dashed var(--border-secondary);
      cursor: pointer;
      background: var(--bg-control);
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      opacity: 0.6;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-secondary);
      font-size: 20px;
      font-weight: 300;
      user-select: none;
      position: relative;
    }

    /* Material add button (circular) */
    .add-button.material {
      border-radius: 50%;
    }

    /* Normal map add button (rounded square) */
    .add-button.normal {
      border-radius: 8px;
    }

    .add-button:hover {
      border-color: var(--accent-primary);
      background: rgba(59, 130, 246, 0.05);
      color: var(--accent-primary);
      opacity: 1;
      transform: scale(1.05);
      border-style: solid;
    }

    .add-button:active {
      transform: scale(0.98);
    }

    .gallery-label {
      font-size: 11px;
      color: var(--text-tertiary);
      margin: 16px 0 8px 0;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      font-weight: 600;
    }

    /* Mobile Responsive */
    @media (max-width: 768px) {
      body {
        flex-direction: column;
        overflow: hidden;
      }

      #container {
        order: 2;
        flex: 0 0 42dvh;
        width: 100%;
        min-height: 260px;
        height: auto;
      }

      #sidebar {
        display: contents;
        position: static;
        width: auto;
        height: auto;
        border-left: none;
        overflow: visible;
        background: transparent;
        box-shadow: none;
        transform: none !important;
      }

      #sidebarToggle,
      #sidebarResizer,
      .dock-rail {
        display: none !important;
      }

      #settingsPanel {
        display: contents;
        opacity: 1 !important;
      }

      body.dock-active #settingsPanel,
      body.dock-active .sidebar-footer {
        display: contents;
      }

      .panel-header {
        order: 1;
        flex: 0 0 auto;
        position: relative;
        top: auto;
        z-index: 10;
        width: 100%;
        box-sizing: border-box;
        border-bottom: 1px solid var(--border-secondary);
      }

      .settings-content {
        order: 3;
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        box-sizing: border-box;
        padding: 12px 16px 8px;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-top: 1px solid var(--border-primary);
        background: var(--bg-panel);
      }

      #sidebar .sidebar-footer {
        order: 4;
        flex: 0 0 auto;
        position: relative;
        bottom: auto;
        width: 100%;
        box-sizing: border-box;
      }

      #loading {
        right: 20px;
      }

      .setting-group {
        padding: 16px;
        margin-bottom: 16px;
      }

      .setting-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
      }

      .setting-item label {
        width: auto;
        text-align: left;
      }

      .control-group {
        justify-content: stretch;
        width: 100%;
      }

      input[type="range"] {
        width: 100%;
        max-width: none;
      }

      .value {
        width: 70px;
      }

      .license-account-actions {
        flex-direction: column;
      }

      .license-account-actions .small-button {
        min-width: 0;
      }

      .app-toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
      }

      .license-modal-overlay {
        padding: 14px;
      }

      .license-modal-header,
      .license-modal-body {
        padding-left: 14px;
        padding-right: 14px;
      }

      .license-feature-grid {
        grid-template-columns: 1fr;
      }

      /* Mobile-specific adjustments for Color and Illumination settings */
      #colorSetting,
      #illuminationSetting {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
      }

      #colorSetting label,
      #illuminationSetting label {
        width: 70px !important;
        font-size: 12px !important;
      }

      #colorSetting .control-group,
      #illuminationSetting .control-group {
        gap: 8px !important;
        max-width: calc(100vw - 70px - 40px) !important;
        overflow: hidden !important;
      }

      #colorSetting #backgroundHexInput {
        width: 70px !important;
        font-size: 10px !important;
        min-width: 70px !important;
      }

      #colorSetting #backgroundColorPicker {
        width: 36px !important;
        height: 28px !important;
        min-width: 36px !important;
      }

      #illuminationSetting input[type="range"] {
        width: 80px !important;
        max-width: 80px !important;
        min-width: 60px !important;
      }

      #illuminationSetting .value {
        width: 40px !important;
        min-width: 40px !important;
      }
    }

    @media (max-width: 480px) {
      .panel-header,
      .sidebar-footer {
        padding-left: 16px;
        padding-right: 16px;
      }

      .app-title {
        font-size: 16px;
      }

      .settings-content {
        padding: 4px 12px;
      }

      .setting-group {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 12px;
      }
    }

    /* Legacy fullscreen switch is hidden; fullscreen is available in Camera controls. */
    #switch {
      display: none;
    }

    #fullscreenBtn {
      background: var(--bg-panel);
      color: var(--text-primary);
      text-decoration: none;
      padding: 12px 20px;
      border-radius: 10px;
      font-size: 13px;
      font-weight: 500;
      border: 1px solid var(--border-primary);
      backdrop-filter: var(--blur-md);
      transition: all 0.2s ease;
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }

    #fullscreenBtn:hover {
      background: var(--bg-panel-hover);
      transform: translateY(-1px);
      box-shadow: var(--shadow-md);
    }

    /* Animation Classes */
    .fade-in {
      opacity: 0;
      animation: fadeIn 0.5s ease-out forwards;
    }

    @keyframes fadeIn {
      to {
        opacity: 1;
      }
    }

    .slide-up {
      transform: translateY(20px);
      opacity: 0;
      animation: slideUp 0.5s ease-out forwards;
    }

    @keyframes slideUp {
      to {
        transform: translateY(0);
        opacity: 1;
      }
    }

    /* Micro-interactions */
    .setting-item:hover .value {
      transform: scale(1.05);
    }

    .btn:hover .btn-icon {
      transform: scale(1.1);
    }

    /* Tooltip Styles */
    .tooltip {
      position: relative;
      cursor: help;
    }

    .tooltip::before {
      content: '';
      position: absolute;
      bottom: 100%;
      left: 50%;
      transform: translateX(-50%);
      width: calc(100% + 24px);
      height: calc(100% + 16px);
      background: rgba(0, 0, 0, 0.3);
      backdrop-filter: var(--blur-sm);
      -webkit-backdrop-filter: var(--blur-sm);
      border-radius: 8px;
      opacity: 0;
      visibility: hidden;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0.8s;
      pointer-events: none;
      z-index: 999;
      margin-bottom: 8px;
    }

    .tooltip::after {
      content: attr(data-tooltip);
      position: absolute;
      bottom: 100%;
      left: 50%;
      transform: translateX(-50%);
      background: var(--bg-panel);
      color: var(--text-primary);
      padding: 8px 12px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: 400;
      white-space: nowrap;
      opacity: 0;
      visibility: hidden;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) 0.8s;
      pointer-events: none;
      z-index: 1000;
      border: 1px solid var(--border-primary);
      box-shadow: var(--shadow-xl);
      backdrop-filter: var(--blur-sm);
      -webkit-backdrop-filter: var(--blur-sm);
      margin-bottom: 8px;
      max-width: 200px;
      text-align: center;
    }

    /* Prevent tooltip cropping in sidebar - use smart positioning */
    #sidebar .tooltip::before,
    #sidebar .tooltip::after {
      /* Default center positioning */
      left: 50%;
      transform: translateX(-50%);
    }

    /* For labels that are too close to the left edge, align tooltip to the left */
    #sidebar .setting-item label.tooltip::before,
    #sidebar .setting-item label.tooltip::after {
      left: 0;
      transform: translateX(0);
      min-width: 120px;
    }

    /* Ensure tooltips stay within sidebar bounds */
    #sidebar .tooltip::before,
    #sidebar .tooltip::after {
      max-width: 280px;
      word-wrap: break-word;
      white-space: normal;
      text-align: center;
    }

    .tooltip:hover::before {
      opacity: 1;
      visibility: visible;
      transform: translateX(-50%) translateY(-4px);
    }

    .tooltip:hover::after {
      opacity: 1;
      visibility: visible;
      transform: translateX(-50%) translateY(-4px);
    }

    /* Adjust hover positioning for sidebar labels */
    #sidebar .setting-item label.tooltip:hover::before,
    #sidebar .setting-item label.tooltip:hover::after {
      transform: translateX(0) translateY(-4px);
    }

    /* Focus styles for accessibility */
    button:focus-visible,
    input:focus-visible {
      outline: 2px solid var(--accent-primary);
      outline-offset: 2px;
    }



    /* Add spacing between gallery and intensity controls */
    .normal-maps-spacing {
      margin-bottom: 16px;
    }

    /* Fade transitions for toggles */
    .toggle-transition {
      transition: opacity 0.6s ease-in-out, transform 0.6s ease-in-out;
    }

    /* Special horizontal alignment for Color and Illumination settings - applies to all screen sizes */
    #colorSetting,
    #illuminationSetting {
      display: flex !important;
      flex-direction: row !important;
      align-items: center !important;
      justify-content: space-between !important;
      gap: 12px !important;
      margin-bottom: 16px !important;
    }

    #colorSetting label,
    #illuminationSetting label {
      width: 120px !important;
      flex-shrink: 0 !important;
      font-size: 13px !important;
      font-weight: 500 !important;
      color: var(--text-primary) !important;
      margin-bottom: 0 !important;
    }

    #colorSetting .control-group,
    #illuminationSetting .control-group {
      display: flex !important;
      align-items: center !important;
      gap: 12px !important;
      min-width: 0 !important;
      flex: 1 !important;
      justify-content: flex-end !important;
    }

    #colorSetting #backgroundHexInput {
      width: 80px !important;
      flex-shrink: 0 !important;
      flex-grow: 0 !important;
    }

    #colorSetting #backgroundColorPicker {
      width: 44px !important;
      height: 32px !important;
      flex-shrink: 0 !important;
    }

    /* Sidebar footer — sticky glass badge */
    .sidebar-footer {
      position: sticky;
      bottom: 0;
      z-index: 10;
      display: flex;
      justify-content: center;
      align-items: center;
      border-top: 1px solid var(--border-secondary);
    }

    .sidebar-footer-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 8px;
      border-radius: 999px;
      text-decoration: none;
      transition: background 0.18s ease;
    }

    .sidebar-footer-badge:hover {
      background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
    }

    .sidebar-footer-logo {
      display: inline-block;
      width: 185px;
      height: 22px;
      background-color: var(--text-secondary);
      opacity: 0.7;
      -webkit-mask: url('../icons/logo/copyright-button.svg') center / contain no-repeat;
      mask: url('../icons/logo/copyright-button.svg') center / contain no-repeat;
      transition: background-color 0.18s ease, opacity 0.18s ease;
    }

    [data-theme="light"] .sidebar-footer-logo {
      opacity: 0.45;
    }

    .sidebar-footer-badge:hover .sidebar-footer-logo {
      background-color: var(--accent-primary);
      opacity: 1;
    }

    .sidebar-footer-badge:active .sidebar-footer-logo {
      -webkit-mask-image: url('../icons/logo/copyright-button-on-click.svg');
      mask-image: url('../icons/logo/copyright-button-on-click.svg');
    }

    .sidebar-bottom-actions {
      padding: 8px 8px 16px;
    }

    #aboutLavaLampBtn {
      width: 100%;
      justify-content: center;
      gap: 8px;
    }

    #aboutLavaLampBtn .about-icon {
      width: 14px;
      height: 14px;
      display: inline-block;
      flex-shrink: 0;
      background-color: currentColor;
      -webkit-mask: url('../icons/ui/info.svg') center / contain no-repeat;
      mask: url('../icons/ui/info.svg') center / contain no-repeat;
    }

    /* Enhanced app icon styles */
    .app-icon {
      width: 24px;
      height: 24px;
      background: url('../icons/Icon-Lava-Lamp-1024x1024.svg') center/cover;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      overflow: hidden;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .app-icon:hover {
      transform: scale(1.1) rotate(5deg);
      box-shadow: 0 8px 25px -8px rgba(59, 130, 246, 0.4);
      filter: brightness(1.1) saturate(1.2);
    }

    .app-icon:active {
      transform: scale(1.05) rotate(2deg);
      transition: transform 0.1s ease;
    }

    .app-icon::before {
      content: '';
      position: absolute;
      top: -50%;
      left: -50%;
      width: 200%;
      height: 200%;
      background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
      transform: rotate(45deg) translateX(-100%);
      transition: transform 0.6s ease;
      pointer-events: none;
    }

    .app-icon:hover::before {
      transform: rotate(45deg) translateX(100%);
    }

    /* Delete icon overlay for imported textures */
    .texture-thumbnail {
      position: relative;
      display: inline-block;
    }

    .texture-thumbnail img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: inherit;
    }

    .texture-thumbnail .delete-icon {
      position: absolute;
      top: -8px;
      right: -8px;
      width: 20px;
      height: 20px;
      background: var(--accent-danger);
      color: white;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: bold;
      cursor: pointer;
      opacity: 0;
      transform: scale(0.8);
      transition: all 0.2s ease;
      z-index: 2;
      box-shadow: var(--shadow-md);
      border: 2px solid white;
    }

    .texture-thumbnail:hover .delete-icon {
      opacity: 1;
      transform: scale(1);
    }

    .texture-thumbnail .delete-icon:hover {
      background: #dc2626;
      transform: scale(1.15) !important;
    }

    .texture-thumbnail.show-delete .delete-icon {
      opacity: 1;
      transform: scale(1);
    }

    /* Remove indicator for Ctrl/Cmd hover */
    .texture-thumbnail .remove-indicator {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 32px;
      height: 32px;
      background: rgba(239, 68, 68, 0.9);
      color: white;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      font-weight: bold;
      opacity: 0;
      pointer-events: none;
      transition: all 0.2s ease;
      z-index: 3;
      box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    }

    .texture-thumbnail:hover .remove-indicator {
      opacity: 0;
    }

    /* Show remove indicator when Ctrl/Cmd is pressed */
    body.ctrl-pressed .texture-thumbnail:hover .remove-indicator {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1.1);
    }

    /* Dragging state for thumbnails */
    .texture-thumbnail.dragging {
      opacity: 0.5;
      transform: scale(0.9);
      transition: all 0.2s ease;
    }

    /* Enhanced dropzone styles */
    .dropzone.dragover {
      border-color: var(--accent-primary);
      background: rgba(59, 130, 246, 0.05);
      transform: scale(1.02);
    }

    /* Preset Items */
    .preset-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 7px 10px;
      border-radius: 8px;
      border: 1px solid var(--border-secondary);
      background: var(--bg-control);
      margin-bottom: 5px;
      transition: border-color 0.15s ease, background 0.15s ease;
    }

    .preset-item:hover {
      border-color: var(--border-primary);
      background: var(--bg-control-hover);
    }

    #presetsList {
      max-height: 250px;
      overflow-y: auto;
      padding-right: 4px;
      margin-top: 12px;
      scrollbar-width: thin;
    }

    #presetsList::-webkit-scrollbar {
      width: 4px;
    }

    #presetsList::-webkit-scrollbar-track {
      background: transparent;
    }

    #presetsList::-webkit-scrollbar-thumb {
      background: var(--border-primary);
      border-radius: 2px;
    }

    #presetsList::-webkit-scrollbar-thumb:hover {
      background: var(--border-primary);
      opacity: 0.8;
    }

    .preset-item-name {
      flex: 1;
      font-size: 12px;
      font-weight: 500;
      color: var(--text-primary);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      cursor: pointer;
      min-width: 0;
    }

    .preset-item-name:hover {
      color: var(--accent-primary);
    }

    .preset-item-actions {
      display: flex;
      gap: 3px;
      flex-shrink: 0;
    }

    .preset-delete-confirmation {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 8px 10px;
      background: var(--bg-panel);
      border: 1px solid var(--border-primary);
      border-radius: 8px;
      margin-bottom: 5px;
      animation: fadeIn 0.15s ease-out;
    }

    .preset-delete-confirmation-text {
      font-size: 12px;
      color: var(--text-primary);
      line-height: 1.4;
    }

    .preset-delete-confirmation-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
    }

    .preset-delete-confirmation-btn {
      padding: 5px 12px;
      font-size: 11px;
      border-radius: 6px;
      border: 1px solid var(--border-primary);
      background: var(--bg-control);
      color: var(--text-primary);
      cursor: pointer;
      transition: background 0.15s ease, border-color 0.15s ease;
    }

    .preset-delete-confirmation-btn:hover {
      background: var(--bg-control-hover);
      border-color: var(--border-primary);
    }

    .preset-delete-confirmation-btn.delete {
      background: rgba(239, 68, 68, 0.15);
      border-color: rgba(239, 68, 68, 0.4);
      color: #fca5a5;
    }

    .preset-delete-confirmation-btn.delete:hover {
      background: rgba(239, 68, 68, 0.25);
      border-color: rgba(239, 68, 68, 0.6);
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(-4px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .preset-action-btn {
      background: none;
      border: 1px solid var(--border-secondary);
      border-radius: 5px;
      padding: 3px 5px;
      cursor: pointer;
      color: var(--text-secondary);
      transition: all 0.15s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      line-height: 0;
    }

    .preset-action-btn:hover {
      background: var(--bg-control-hover);
      color: var(--text-primary);
      border-color: var(--border-primary);
    }

    .preset-action-btn.load-btn:hover,
    .preset-action-btn.export-btn:hover {
      color: var(--accent-primary);
      border-color: var(--accent-primary);
    }

    .preset-action-btn.delete-btn:hover {
      color: #ef4444;
      border-color: #ef4444;
    }

    .preset-rename-form {
      display: flex;
      gap: 4px;
      flex: 1;
      min-width: 0;
    }

    .preset-rename-input {
      flex: 1;
      min-width: 0;
      padding: 3px 7px;
      border: 1px solid var(--accent-primary);
      border-radius: 5px;
      background: var(--bg-control);
      color: var(--text-primary);
      font-size: 11px;
      font-family: inherit;
      outline: none;
    }

    .preset-empty-state {
      text-align: center;
      color: var(--text-tertiary);
      font-size: 11px;
      padding: 14px 8px;
      line-height: 1.6;
    }

    /* ─── Normal Map Body Collapse ──────────────────────────── */
    .normal-map-body {
      overflow: hidden;
      max-height: 1200px;
      opacity: 1;
      transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                  opacity 0.25s ease;
    }

    .normal-map-body.collapsed {
      max-height: 0;
      opacity: 0;
    }

    /* ─── Viewport Context Menu ──────────────────────────────── */
    #viewportContextMenu {
      position: fixed;
      z-index: 99998;
      min-width: 196px;
      background: var(--bg-panel);
      backdrop-filter: var(--blur-md);
      -webkit-backdrop-filter: var(--blur-md);
      border: 1px solid var(--border-primary);
      border-radius: 10px;
      box-shadow: var(--shadow-xl), 0 2px 8px rgba(0, 0, 0, 0.35);
      padding: 4px;
      animation: ctxMenuIn 0.2s cubic-bezier(0.34, 1.4, 0.64, 1) both;
    }

    @keyframes ctxMenuIn {
      from { opacity: 0; transform: scale(0.8); }
      to   { opacity: 1; transform: scale(1); }
    }

    #viewportContextMenu.ctx-closing {
      animation: ctxMenuOut 0.11s ease-in both;
      pointer-events: none;
    }

    @keyframes ctxMenuOut {
      from { opacity: 1; transform: scale(1); }
      to   { opacity: 0; transform: scale(0.88); }
    }

    .ctx-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 7px 10px;
      border-radius: 7px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      color: var(--text-primary);
      transition: background 0.08s ease, transform 0.06s ease;
      white-space: nowrap;
    }

    .ctx-item:hover {
      background: var(--bg-control-hover);
    }

    .ctx-item:hover .ctx-icon {
      opacity: 1;
      color: var(--accent-primary);
    }

    .ctx-item:active {
      background: var(--bg-control-active);
      transform: scale(0.98);
    }

    .ctx-icon {
      width: 15px;
      height: 15px;
      flex-shrink: 0;
      opacity: 0.72;
      pointer-events: none;
    }

    .ctx-divider {
      height: 1px;
      background: var(--border-primary);
      margin: 3px 4px;
      pointer-events: none;
    }

    .ctx-pro-badge {
      margin-left: auto;
      padding: 1px 5px;
      border-radius: 4px;
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--accent-warning);
      background: rgba(245, 158, 11, 0.1);
      border: 1px solid rgba(245, 158, 11, 0.25);
      pointer-events: none;
    }

    /* ── Resizable list handles ── */
    .resize-handle {
      height: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: ns-resize;
      margin: -2px 0 4px 0;
      border-radius: 0 0 6px 6px;
      transition: background 0.15s ease;
      flex-shrink: 0;
    }
    .resize-handle-bar {
      width: 32px;
      height: 3px;
      background: var(--border-primary);
      border-radius: 2px;
      transition: background 0.2s ease, width 0.2s ease;
      pointer-events: none;
    }
    .resize-handle:hover .resize-handle-bar,
    .resize-handle.is-active .resize-handle-bar {
      background: var(--accent-primary);
      width: 48px;
    }
    /* Freeze all pointer interaction during drag */
    body.is-resizing {
      cursor: ns-resize !important;
    }
    body.is-resizing * {
      pointer-events: none !important;
      cursor: ns-resize !important;
    }
    /* Help / About Modal Styles */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.45);
      -webkit-backdrop-filter: blur(24px) saturate(1.2);
      backdrop-filter: blur(24px) saturate(1.2);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 12000;
      opacity: 0;
      transition: opacity 0.25s ease;
      padding: 20px;
    }
    [data-theme="light"] .modal-overlay {
      background: rgba(200, 200, 210, 0.35);
    }
    .modal-overlay.show {
      display: flex;
      opacity: 1;
    }
    .modal-content {
      width: 100%;
      max-width: 720px;
      max-height: 85vh;
      background: var(--bg-panel);
      border: 1px solid var(--border-primary);
      border-radius: 12px;
      box-shadow: var(--shadow-xl);
      display: flex;
      flex-direction: column;
      transform: scale(0.95);
      transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
      overflow: hidden;
      position: relative;
    }
    .modal-overlay.show .modal-content {
      transform: scale(1);
    }
    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px;
      border-bottom: 1px solid var(--border-secondary);
      background: var(--bg-panel);
      flex-shrink: 0;
    }
    .modal-header-left {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .modal-app-icon {
      width: 32px;
      height: 32px;
      border-radius: 8px;
      object-fit: contain;
      background: var(--accent-primary);
    }
    .modal-app-name {
      font-size: 18px;
      font-weight: 600;
      color: var(--text-primary);
      letter-spacing: -0.02em;
    }
    .modal-close-btn {
      background: transparent;
      border: none;
      color: var(--text-secondary);
      width: 32px;
      height: 32px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: background 0.2s, color 0.2s;
    }
    .modal-close-btn:hover {
      background: var(--bg-control-hover);
      color: var(--text-primary);
    }
    .modal-tabs {
      display: flex;
      gap: 4px;
      padding: 0 20px;
      background: var(--bg-secondary);
      border-bottom: 1px solid var(--border-primary);
      overflow-x: auto;
      flex-shrink: 0;
    }
    .modal-tabs::-webkit-scrollbar {
      display: none;
    }
    .modal-tab-btn {
      background: transparent;
      border: none;
      color: var(--text-secondary);
      font-weight: 500;
      font-size: 13px;
      padding: 12px 16px;
      cursor: pointer;
      position: relative;
      white-space: nowrap;
      transition: color 0.2s;
    }
    .modal-tab-btn:hover {
      color: var(--text-primary);
    }
    .modal-tab-btn.active {
      color: var(--accent-primary);
    }
    .modal-tab-btn::after {
      content: '';
      position: absolute;
      bottom: -1px;
      left: 0;
      width: 100%;
      height: 2px;
      background: var(--accent-primary);
      border-radius: 2px 2px 0 0;
      opacity: 0;
      transform: scaleX(0);
      transition: opacity 0.2s, transform 0.2s;
    }
    .modal-tab-btn.active::after {
      opacity: 1;
      transform: scaleX(1);
    }
    .modal-tab-panel {
      display: none;
      flex: 1;
      flex-direction: column;
      overflow: hidden;
      min-height: 0;
    }
    .modal-tab-panel.active {
      display: flex;
    }
    .modal-tab-content-inner {
      flex: 1;
      overflow-y: auto;
      padding: 24px;
      font-size: 14px;
      line-height: 1.6;
      color: var(--text-secondary);
      background: var(--bg-panel);
    }
    .modal-tab-content-inner h3 {
      color: var(--text-primary);
      font-size: 18px;
      font-weight: 600;
      margin: 0 0 12px;
    }
    .modal-tab-content-inner h4 {
      color: var(--text-primary);
      font-size: 15px;
      font-weight: 600;
      margin: 24px 0 8px;
    }
    .modal-tab-content-inner h5 {
      color: var(--text-primary);
      font-size: 14px;
      font-weight: 600;
      margin: 16px 0 8px;
    }
    .modal-tab-content-inner p {
      margin-bottom: 16px;
    }
    .modal-tab-content-inner ul, .modal-tab-content-inner ol {
      margin-bottom: 16px;
      padding-left: 24px;
    }
    .modal-tab-content-inner li {
      margin-bottom: 8px;
    }
    .modal-highlight-box {
      background: var(--bg-control);
      border: 1px solid var(--border-primary);
      border-radius: 8px;
      padding: 16px;
      margin-bottom: 16px;
      border-left: 3px solid var(--accent-primary);
    }
    /* Grid for tip cards */
    .modal-tip-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 16px;
      margin-top: 16px;
    }
    .modal-tip-item {
      background: var(--bg-secondary);
      border: 1px solid var(--border-secondary);
      border-radius: 8px;
      padding: 16px;
    }
    .modal-tip-item h5 {
      margin-top: 0;
    }
    .modal-tip-item p {
      margin-bottom: 0;
      font-size: 13px;
    }
    /* Shortcuts List */
    .shortcut-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 24px;
    }
    .shortcut-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 8px 12px;
      background: var(--bg-secondary);
      border-radius: 6px;
      border: 1px solid var(--border-secondary);
    }
    .shortcut-desc {
      font-size: 13px;
      color: var(--text-secondary);
    }
    .shortcut-keys {
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .shortcut-keys kbd {
      background: var(--bg-control);
      border: 1px solid var(--border-primary);
      border-radius: 4px;
      padding: 3px 6px;
      font-family: inherit;
      font-size: 12px;
      font-weight: 500;
      color: var(--text-primary);
      box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    }
    /* See Also Items */
    .see-also-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .see-also-item {
      background: var(--bg-secondary);
      border: 1px solid var(--border-secondary);
      border-radius: 8px;
      overflow: hidden;
      transition: border-color 0.2s;
    }
    .see-also-item.expanded {
      border-color: var(--border-primary);
    }
    .see-also-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      cursor: pointer;
      user-select: none;
    }
    .see-also-header:hover {
      background: var(--bg-control-hover);
    }
    .see-also-link {
      display: flex;
      align-items: center;
      gap: 12px;
      text-decoration: none;
      color: var(--text-primary);
      font-weight: 500;
    }
    .see-also-link:hover {
      color: var(--accent-primary);
    }
    .see-also-icon {
      width: 24px;
      height: 24px;
      border-radius: 4px;
      object-fit: cover;
    }
    .see-also-chevron {
      color: var(--text-tertiary);
      transition: transform 0.2s;
    }
    .see-also-item.expanded .see-also-chevron {
      transform: rotate(180deg);
    }
    .see-also-desc {
      padding: 0 16px;
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.3s ease, padding 0.3s ease;
      color: var(--text-secondary);
      font-size: 13px;
    }
    .see-also-item.expanded .see-also-desc {
      padding: 0 16px 16px;
      max-height: 200px;
    }
    /* Sticky Footer */
    .modal-footer {
      padding: 16px 20px;
      border-top: 1px solid var(--border-primary);
      background: var(--bg-secondary);
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .modal-footer-buttons {
      display: flex;
      gap: 12px;
    }
    .modal-footer-buttons .btn {
      flex: 1;
      justify-content: center;
    }
    .modal-about-actions {
      display: flex;
      gap: 12px;
      margin-top: 20px;
    }
    .modal-about-actions .btn {
      flex: 1;
      justify-content: center;
    }
    .modal-footer-badge {
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .modal-footer-copy-text {
      text-align: center;
      font-size: 12px;
      color: var(--text-tertiary);
    }
    .modal-footer-copy-text a {
      color: var(--text-secondary);
      text-decoration: none;
      transition: color 0.2s;
    }
    .modal-footer-copy-text a:hover {
      color: var(--accent-primary);
    }
