      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      :root {
        --bg-gradient: radial-gradient(1200px 700px at 50% -120px,
            rgba(59, 130, 246, 0.35),
            transparent 60%),
          radial-gradient(900px 500px at 10% 0%,
            rgba(96, 165, 250, 0.22),
            transparent 55%),
          linear-gradient(180deg, #0b0717, #07060d);
        --panel-bg: linear-gradient(180deg,
            rgba(255, 255, 255, 0.04),
            rgba(255, 255, 255, 0.02));
        --text-primary: rgba(255, 255, 255, 0.92);
        --text-secondary: rgba(255, 255, 255, 0.6);
        --border-color: rgba(255, 255, 255, 0.08);
        --border-color-2: rgba(255, 255, 255, 0.12);
        --input-bg: rgba(255, 255, 255, 0.04);
        --input-focus: #3b82f6;
        --primary-btn-bg: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        --secondary-btn-bg: rgba(255, 255, 255, 0.06);
        --secondary-btn-text: rgba(255, 255, 255, 0.88);
        --success-bg: #059669;
        --active-item-bg: rgba(255, 255, 255, 0.06);
        --active-item-border: #3b82f6;
      }

      body {
        font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
          Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
        background: var(--bg-gradient);
        color: var(--text-primary);
        min-height: 100vh;
        padding: 20px;
      }

      .container {
        display: grid;
        grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
        grid-template-rows: minmax(0, 1fr) 50px;
        gap: 20px;
        height: calc(100vh - 40px);
      }

      .panel {
        background: var(--panel-bg);
        border-radius: 18px;
        padding: 30px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        border: 1px solid var(--border-color);
        min-height: 0;
        backdrop-filter: blur(14px);
      }

      .panel-left {
        grid-column: 1;
        grid-row: 1;
      }

      .panel-center {
        display: none;
      }

      .panel-right {
        grid-column: 2;
        grid-row: 1;
      }

      .bottom-bar {
        grid-column: 1 / span 2;
        grid-row: 2;
        padding: 10px 16px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
      }

      .bottom-bar .log-container {
        display: none;
      }

      .bottom-bar .progress-container {
        margin-top: 0;
        flex: 1;
        min-width: 0;
      }

      .bottom-bar .progress-container,
      .bottom-bar .progress-container.active {
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        display: flex;
        align-items: center;
        gap: 10px;
      }

      .bottom-bar .progress-bar {
        margin: 0;
        flex: 1;
        min-width: 0;
      }

      .bottom-bar .progress-text {
        margin: 0;
        line-height: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .bottom-bar .status-badge {
        margin-top: 0;
        white-space: nowrap;
      }

      .bottom-bar .button-group {
        margin-top: 0;
        flex: 0 0 auto;
      }

      .bottom-bar button {
        padding: 8px 14px;
        font-size: 13px;
      }

      .preview-container {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        margin-top: 20px;
      }

      .right-content {
        display: flex;
        flex-direction: column;
        gap: 16px;
        flex: 1;
        min-height: 0;
      }

      .right-content .result-container {
        flex: 1;
        min-height: 0;
      }

      .preview-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        color: var(--text-secondary);
        text-align: center;
      }

      .preview-empty svg {
        width: 80px;
        height: 80px;
        margin-bottom: 16px;
        opacity: 0.3;
      }

      .preview-media {
        width: 100%;
        border-radius: 12px;
        overflow: hidden;
        background: #000;
        border: 1px solid var(--border-color);
      }

      .preview-media img,
      .preview-media video {
        width: 100%;
        height: auto;
        display: block;
      }

      .preview-media audio {
        width: 100%;
        padding: 12px;
      }

      .preview-actions {
        display: flex;
        gap: 10px;
        align-items: center;
        flex-wrap: wrap;
        margin-top: 12px;
      }

      .media-item.selected {
        outline: 2px solid var(--input-focus);
        outline-offset: 2px;
      }

      .panel-title {
        color: var(--text-primary);
      }

      .connection-status {
        background: rgba(0, 0, 0, 0.2);
        color: var(--text-secondary);
      }

      label {
        color: var(--text-secondary);
      }

      input[type="text"],
      input[type="number"],
      textarea,
      select {
        background: var(--input-bg);
        color: var(--text-primary);
        border: 1px solid var(--border-color);
      }

      input[type="text"]:focus,
      input[type="number"]:focus,
      textarea:focus,
      select:focus {
        border-color: var(--input-focus);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
      }
      
      select {
        background-color: #1e1e1e;
        color: #ffffff;
      }
      
      select option {
        background-color: #1e1e1e;
        color: #ffffff;
      }

      /* Light Theme Support */
      [data-theme="light"] {
        --bg-gradient: #f3f4f6;
        --panel-bg: #ffffff;
        --text-primary: #1f2937;
        --text-secondary: #4b5563;
        --border-color: #e5e7eb;
        --border-color-2: #d1d5db;
        --input-bg: #ffffff;
        --secondary-btn-bg: #e5e7eb;
        --secondary-btn-text: #374151;
        --active-item-bg: #eff6ff;
        --active-item-border: #3b82f6;
      }

      [data-theme="light"] .panel {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        background: #ffffff;
      }

      [data-theme="light"] .panel-title {
        color: #111827;
      }

      [data-theme="light"] select {
        background-color: #ffffff;
        color: #000000;
        border-color: #d1d5db;
      }

      [data-theme="light"] select option {
        background-color: #ffffff;
        color: #000000;
      }
      
      [data-theme="light"] .connection-status,
      [data-theme="light"] .progress-container {
        background: #f9fafb;
        border-color: #e5e7eb;
      }
      
      [data-theme="light"] .workflow-meta,
      [data-theme="light"] .workflow-info,
      [data-theme="light"] .debug-info {
        background: #eff6ff;
        color: #2563eb;
        border-color: #bfdbfe;
      }
      
      [data-theme="light"] .file-input-label {
        background: #f9fafb;
        color: #4b5563;
        border-color: #d1d5db;
      }
      
      [data-theme="light"] .file-input-label:hover {
        background: #eff6ff;
        border-color: #3b82f6;
      }

      textarea {
        background: var(--secondary-btn-bg);
        color: var(--secondary-btn-text);
        border: 1px solid var(--border-color-2);
      }

      .btn-secondary:hover {
        background: #4b5563;
      }

      .aspect-btn {
        background: var(--input-bg);
        border-color: var(--border-color);
        color: var(--text-secondary);
      }

      .aspect-btn:hover {
        border-color: var(--input-focus);
        color: var(--text-primary);
      }

      .aspect-btn.active {
        background: var(--active-item-bg);
        border-color: var(--active-item-border);
        color: var(--input-focus);
      }

      .file-input-label {
        background: var(--input-bg);
        border-color: var(--border-color);
        color: var(--text-secondary);
      }

      .file-input-label:hover {
        border-color: var(--input-focus);
        background: var(--active-item-bg);
      }

      .progress-container {
        background: rgba(0, 0, 0, 0.2);
      }

      .media-item {
        background: #000;
      }

      .workflow-info {
        background: rgba(59, 130, 246, 0.1);
        color: #93c5fd;
      }

      .panel-title {
        font-size: 24px;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 20px;
        display: flex;
        align-items: center;
        gap: 10px;
      }

      .panel-title::before {
        content: "";
        width: 4px;
        height: 24px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 2px;
      }

      .connection-status {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 16px;
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid var(--border-color);
        color: var(--text-secondary);
        border-radius: 8px;
        margin-bottom: 20px;
        font-size: 14px;
      }

      .status-indicator {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: #6c757d;
      }

      .status-indicator.connected {
        background: #28a745;
        animation: pulse 2s infinite;
      }

      .connection-toggle-btn {
        margin-left: auto;
        padding: 6px 14px;
        font-size: 13px;
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: white;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.2s;
        font-weight: 500;
      }

      .connection-toggle-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
      }

      .connection-toggle-btn.active {
        background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
      }

      .connection-toggle-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }

      @keyframes pulse {

        0%,
        100% {
          opacity: 1;
        }

        50% {
          opacity: 0.5;
        }
      }

      .form-group {
        margin-bottom: 20px;
      }

      label {
        display: block;
        font-size: 14px;
        font-weight: 500;
        color: var(--text-secondary);
        margin-bottom: 8px;
      }

      .input-with-button {
        display: flex;
        gap: 8px;
      }

      input[type="text"],
      input[type="number"],
      textarea,
      select {
        width: 100%;
        padding: 12px 16px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        font-size: 14px;
        transition: all 0.3s;
        font-family: inherit;
      }

      input[type="text"]:focus,
      input[type="number"]:focus,
      textarea:focus,
      select:focus {
        outline: none;
        border-color: var(--input-focus);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
      }

      textarea {
        resize: vertical;
        min-height: 100px;
      }

      .button-group {
        display: flex;
        gap: 10px;
        margin-top: auto;
      }

      button {
        flex: 1;
        padding: 14px 24px;
        border: none;
        border-radius: 8px;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
      }

      .btn-small {
        flex: 0 0 auto;
        padding: 10px 16px;
        font-size: 13px;
      }

      .btn-primary {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
      }

      .btn-primary:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
      }

      .btn-primary:disabled {
        opacity: 0.6;
        cursor: not-allowed;
      }

      .btn-secondary {
        background: var(--secondary-btn-bg);
        color: var(--secondary-btn-text);
      }

      .btn-secondary:hover {
        background: #4b5563;
      }

      .btn-success {
        background: #28a745;
        color: white;
      }

      .btn-success:hover {
        background: #218838;
      }

      .aspect-ratio-group {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-bottom: 10px;
      }

      .aspect-btn {
        padding: 10px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--input-bg);
        color: var(--text-secondary);
        cursor: pointer;
        transition: all 0.3s;
        font-size: 13px;
        font-weight: 500;
      }

      .aspect-btn:hover {
        border-color: var(--input-focus);
        color: var(--text-primary);
      }

      .aspect-btn.active {
        border-color: var(--active-item-border);
        background: var(--active-item-bg);
        color: var(--input-focus);
      }

      .size-inputs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
      }

      .checkbox-group {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-top: 8px;
      }

      .toggle-switch-wrapper {
        position: relative;
        display: inline-block;
        width: 54px;
        height: 28px;
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        flex-shrink: 0;
      }

      .toggle-switch-input {
        opacity: 0;
        width: 0;
        height: 0;
      }

      .toggle-switch {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(180deg, rgba(108, 117, 125, 0.38), rgba(108, 117, 125, 0.26));
        border: 1px solid var(--border-color);
        border-radius: 999px;
        transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
      }

      .toggle-switch::before {
        content: "启用";
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.5px;
        color: rgba(255, 255, 255, 0.95);
        opacity: 0;
        transition: opacity 0.2s ease;
        pointer-events: none;
      }

      .toggle-slider {
        position: absolute;
        height: 22px;
        width: 22px;
        left: 3px;
        top: 3px;
        background: linear-gradient(180deg, #ffffff, #f2f4f8);
        border-radius: 50%;
        transition: transform 0.28s cubic-bezier(0.68, -0.55, 0.27, 1.55), box-shadow 0.25s ease, background 0.25s ease;
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.22);
        border: 1px solid rgba(0, 0, 0, 0.12);
        will-change: transform;
      }

      .toggle-switch-input:checked+.toggle-switch {
        background-color: var(--input-focus);
        background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
        border-color: var(--input-focus);
        box-shadow: 0 8px 22px rgba(59, 130, 246, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
      }

      .toggle-switch-input:checked+.toggle-switch::before {
        opacity: 1;
      }

      .toggle-switch-input:checked+.toggle-switch+.toggle-slider {
        transform: translateX(26px);
      }

      .toggle-switch-wrapper:hover .toggle-switch-input:not(:checked)+.toggle-switch {
        border-color: rgba(59, 130, 246, 0.6);
      }

      .toggle-switch-input:focus-visible+.toggle-switch {
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
      }

      .progress-container {
        margin: 20px 0;
        padding: 20px;
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        display: none;
      }

      .progress-container.active {
        display: block;
      }

      .progress-bar {
        width: 100%;
        height: 8px;
        background: rgba(255, 255, 255, 0.12);
        border-radius: 4px;
        overflow: hidden;
        margin-bottom: 12px;
      }

      .progress-fill {
        height: 100%;
        background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
        width: 0%;
        transition: width 0.3s;
        border-radius: 4px;
      }

      .progress-text {
        font-size: 13px;
        color: var(--text-secondary);
        line-height: 1.6;
      }

      .status-badge {
        display: inline-block;
        padding: 4px 12px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 600;
        margin-top: 8px;
      }

      .status-pending {
        background: #fff3cd;
        color: #856404;
      }

      .status-running {
        background: #cfe2ff;
        color: #084298;
      }

      .status-success {
        background: #d1e7dd;
        color: #0f5132;
      }

      .status-error {
        background: #f8d7da;
        color: #842029;
      }

      .result-container {
        flex: 1;
        overflow-y: auto;
        margin-top: 20px;
      }

      .result-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        color: #999;
        text-align: center;
      }

      .result-empty svg {
        width: 80px;
        height: 80px;
        margin-bottom: 16px;
        opacity: 0.3;
      }

      .media-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
      }

      .media-item {
        position: relative;
        border-radius: 12px;
        overflow: hidden;
        background: #f5f5f5;
      }

      .media-item img,
      .media-item video {
        width: 100%;
        height: auto;
        display: block;
        border-radius: 12px;
        transition: transform 0.3s;
      }

      .media-item:hover img,
      .media-item:hover video {
        transform: scale(1.05);
      }

      .media-item audio {
        width: 100%;
        padding: 10px;
      }

      .media-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
        padding: 12px;
        transform: translateY(100%);
        transition: transform 0.3s;
      }

      .media-item:hover .media-overlay {
        transform: translateY(0);
      }

      .download-btn {
        background: var(--secondary-btn-bg);
        color: var(--text-primary);
        padding: 6px 12px;
        border-radius: 6px;
        text-decoration: none;
        font-size: 12px;
        font-weight: 600;
        display: inline-block;
      }

      .log-container {
        background: #1e1e1e;
        color: #d4d4d4;
        padding: 16px;
        border-radius: 8px;
        font-family: "Courier New", monospace;
        font-size: 12px;
        max-height: 200px;
        overflow-y: auto;
        margin-top: 20px;
      }

      .log-entry {
        margin-bottom: 4px;
        line-height: 1.5;
      }

      .log-timestamp {
        color: #858585;
      }

      .log-info {
        color: #4fc3f7;
      }

      .log-success {
        color: #81c784;
      }

      .log-error {
        color: #e57373;
      }

      .log-warning {
        color: #ffb74d;
      }

      @media (max-width: 1024px) {
        .container {
          grid-template-columns: 1fr;
          grid-template-rows: auto;
          height: auto;
        }

        .panel {
          height: auto;
        }

        .panel-left,
        .panel-center,
        .panel-right,
        .bottom-bar {
          grid-column: auto;
          grid-row: auto;
        }
      }

      .spinner {
        border: 3px solid #f3f3f3;
        border-top: 3px solid #667eea;
        border-radius: 50%;
        width: 16px;
        height: 16px;
        animation: spin 1s linear infinite;
      }

      @keyframes spin {
        0% {
          transform: rotate(0deg);
        }

        100% {
          transform: rotate(360deg);
        }
      }

      .form-scroll {
        flex: 1;
        overflow-y: auto;
        margin-bottom: 20px;
        padding-right: 10px;
      }

      ::-webkit-scrollbar {
        width: 8px;
      }

      ::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
      }

      ::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
      }

      ::-webkit-scrollbar-thumb:hover {
        background: #555;
      }

      .file-input-wrapper {
        position: relative;
        display: inline-block;
        width: 100%;
      }

      .file-input-wrapper input[type="file"] {
        position: absolute;
        left: -9999px;
      }

      .file-input-wrapper.tom-media-dropzone {
        border: 2px dashed var(--border-color);
      }

      .file-input-wrapper.tom-media-dropzone:hover {
        border-color: var(--input-focus);
      }

      .file-input-wrapper.tom-media-dropzone input[type="file"] {
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
      }

      .file-input-label {
        align-items: center;
        justify-content: center;
        padding: 12px 16px;
        background: var(--input-bg);
        border: 2px dashed var(--border-color);
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.3s;
        color: var(--text-secondary);
      }

      .file-input-wrapper.tom-media-dropzone .file-input-label {
        position: absolute;
        inset: 0;
        display: flex;
        width: 100%;
        height: 100%;
        background: transparent;
        border: none;
        border-radius: 14px;
        color: transparent;
        font-size: 0;
        line-height: 0;
      }

      .file-input-label:hover {
        border-color: var(--input-focus);
        background: var(--active-item-bg);
      }

      .file-name {
        font-size: 13px;
        color: var(--text-secondary);
        margin-top: 4px;
        word-break: break-all;
      }

      .ref-images-bar {
        margin-top: 6px;
        display: flex;
        align-items: flex-start;
        gap: 10px;
      }

      .ref-images-list {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px;
        margin-top: 0;
      }

      .ref-image-chip {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 4px 10px;
        border: 1px solid var(--border-color-2);
        border-radius: 999px;
        background: var(--active-item-bg);
        max-width: 100%;
      }

      .ref-image-name {
        font-size: 12px;
        color: var(--text-secondary);
        max-width: 240px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .ref-image-del {
        appearance: none;
        border: 0;
        background: transparent;
        color: rgba(248, 113, 113, 0.92);
        cursor: pointer;
        font-size: 12px;
        padding: 2px 0;
        line-height: 1;
      }

      .ref-image-del:hover {
        color: rgba(248, 113, 113, 1);
      }

      .ref-images-clear {
        flex: 0 0 auto;
        appearance: none;
        border: 1px solid var(--border-color-2);
        background: rgba(255, 255, 255, 0.04);
        color: rgba(248, 113, 113, 0.92);
        border-radius: 10px;
        padding: 6px 10px;
        font-size: 12px;
        cursor: pointer;
        transition: all 0.2s;
      }

      .ref-images-clear:hover {
        border-color: rgba(248, 113, 113, 0.65);
        background: rgba(248, 113, 113, 0.08);
        color: rgba(248, 113, 113, 1);
      }

      .workflow-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 6px;
      }

      .workflow-title {
        font-size: 14px;
        font-weight: 500;
        color: var(--text-secondary);
      }

      .workflow-meta {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 12px;
        color: #93c5fd;
        padding: 4px 8px;
        border-radius: 999px;
        background: rgba(59, 130, 246, 0.1);
        border: 1px solid rgba(59, 130, 246, 0.3);
        white-space: nowrap;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .workflow-meta span {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
      }

      .workflow-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 6px;
      }

      .workflow-bar-left {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        flex: 1;
      }

      .workflow-bar-right {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 6px;
      }

      .workflow-info {
        background: rgba(59, 130, 246, 0.1);
        padding: 8px 10px;
        border-radius: 8px;
        font-size: 12px;
        color: #93c5fd;
        margin-top: 4px;
        display: none;
      }

      .workflow-info.active {
        display: block;
      }

      .media-type-badge {
        position: absolute;
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
      }

      .error-detail {
        background: rgba(245, 158, 11, 0.15);
        border-left: 4px solid #ffc107;
        padding: 12px;
        margin-top: 10px;
        border-radius: 4px;
        font-size: 13px;
        color: #fcd34d;
      }

      .debug-info {
        background: rgba(59, 130, 246, 0.12);
        border-left: 4px solid #2196f3;
        padding: 12px;
        margin-top: 10px;
        border-radius: 4px;
        font-size: 12px;
        color: #93c5fd;
        font-family: monospace;
      }

      .history-toggle-btn {
        border-radius: 999px;
        padding: 6px 12px;
        font-size: 12px;
        border: 1px solid var(--border-color);
        background: var(--input-bg);
        color: var(--text-secondary);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 6px;
      }

      .history-toggle-btn.active {
        border-color: var(--input-focus);
        color: var(--input-focus);
        background: var(--active-item-bg);
      }

      .history-panel {
        margin-top: 8px;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        background: rgba(0, 0, 0, 0.25);
        padding: 8px 10px;
        display: none;
      }

      .history-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 6px;
      }

      .history-panel-title {
        font-size: 13px;
        color: var(--text-secondary);
      }

      .history-panel-actions {
        display: flex;
        align-items: center;
        gap: 6px;
      }

      .history-small-btn {
        border-radius: 999px;
        padding: 4px 10px;
        font-size: 12px;
        border: 1px solid var(--border-color);
        background: transparent;
        color: var(--text-secondary);
        cursor: pointer;
      }

      .history-small-btn:hover {
        border-color: var(--input-focus);
        color: var(--input-focus);
      }

      .history-list {
        max-height: 180px;
        overflow: auto;
        display: flex;
        flex-direction: column;
        gap: 4px;
      }

      .history-item {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 6px 8px;
        border-radius: 8px;
        cursor: pointer;
        background: rgba(15, 23, 42, 0.75);
        border: 1px solid rgba(30, 64, 175, 0.5);
        font-size: 12px;
      }

      .history-item.selected {
        border-color: var(--input-focus);
        background: rgba(30, 64, 175, 0.85);
      }

      .history-item-main {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
      }

      .history-item-title {
        color: #e5e7eb;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .history-item-sub {
        color: #9ca3af;
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .history-item-del {
        flex: 0 0 auto;
        border-radius: 999px;
        padding: 2px 8px;
        font-size: 12px;
        border: 1px solid rgba(239, 68, 68, 0.85);
        background: rgba(127, 29, 29, 0.6);
        color: #fecaca;
        cursor: pointer;
      }

      .history-item-del:hover {
        background: rgba(185, 28, 28, 0.9);
      }

      .history-modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        display: none;
        align-items: stretch;
        justify-content: flex-end;
        z-index: 9999;
      }

      .history-modal {
        width: min(520px, 92vw);
        height: 100%;
        background: rgba(15, 23, 42, 0.98);
        border-left: 1px solid rgba(30, 64, 175, 0.55);
        display: flex;
        flex-direction: column;
      }

      .history-modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 14px 14px 10px 14px;
        border-bottom: 1px solid rgba(30, 64, 175, 0.35);
      }

      .history-modal-title {
        font-size: 14px;
        color: #e5e7eb;
        font-weight: 600;
      }

      .history-modal-actions {
        display: flex;
        align-items: center;
        gap: 8px;
      }

      .history-modal-body {
        padding: 12px 14px 14px 14px;
        overflow: auto;
        flex: 1;
        min-height: 0;
      }

      .history-modal-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
      }

      .history-modal-close {
        border-radius: 999px;
        padding: 6px 10px;
        font-size: 12px;
        border: 1px solid rgba(148, 163, 184, 0.35);
        background: transparent;
        color: #e5e7eb;
        cursor: pointer;
      }

      .history-modal-close:hover {
        border-color: var(--input-focus);
        color: var(--input-focus);
      }

      .history-item-thumb {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        border: 1px solid rgba(30, 64, 175, 0.55);
        background: rgba(2, 6, 23, 0.7);
        overflow: hidden;
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: center;
      }

      .history-item-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
      }

      .history-item-thumb span {
        font-size: 12px;
        color: #94a3b8;
      }
