* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  html,
  body {
    overflow: hidden;
  }
  
  #model-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    box-shadow: 2px 0 6px rgba(0,0,0,0.05);
    z-index: 950;
    padding: 16px 12px;
    overflow-y: auto;
  }

  .sidebar-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
  }

  .show-all-button {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    color: #374151;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .show-all-button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
  }

  .show-all-button:active {
    background: #e5e7eb;
  }

  #model-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  #model-list .model-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
  }

  #model-list .model-item:hover {
    background: #f5f7fb;
  }

  #model-list .model-item.active {
    background: #e1ecff;
  }

  #model-list .folder-node {
    list-style: none;
  }

  #model-list details {
    background: #f8fafc;
    border-radius: 8px;
    padding: 6px 8px;
  }

  #model-list summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    list-style: none;
  }

  #model-list summary::-webkit-details-marker {
    display: none;
  }

  #model-list summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 6px;
    transform: rotate(0deg);
    transition: transform 0.2s ease;
  }

  #model-list details[open] summary::before {
    transform: rotate(90deg);
  }

  #model-list .folder-list {
    list-style: none;
    margin-top: 6px;
    padding-left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  #model-list .model-name {
    font-size: 14px;
    color: #111827;
  }

  #model-list .model-item.is-hidden .model-name {
    color: #9ca3af;
  }

  #model-list .show-toggle {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
    cursor: pointer;
  }

  .model-select-button {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #ffffff;
    color: #374151;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
  }

  .model-select-button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
  }

  .model-select-button:active {
    background: #e5e7eb;
  }

  #three-canvas {
    position: fixed;
    top: 0;
    left: 260px;
    outline: none;
  }
  
  #file-input {
    z-index: 1;
    position: absolute;
  }

  #uploader-panel {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
  }

  .sidebar-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
  }

  .uploader-label {
    font-size: 12px;
    color: #6b7280;
    display: block;
    margin-bottom: 6px;
  }

  .uploader-row {
    display: flex;
    gap: 6px;
    align-items: center;
  }

  #uploader-password,
  #prefix-select,
  #new-prefix {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
  }

  #uploader-unlock,
  #prefix-refresh {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    background: #111827;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
  }

  #new-prefix {
    margin-top: 8px;
  }

  #dropzone {
    margin-top: 10px;
    padding: 12px;
    border: 2px dashed #cbd5f5;
    border-radius: 10px;
    text-align: center;
    color: #4b5563;
    font-size: 12px;
    background: #f8fafc;
    transition: border-color 0.2s ease, background 0.2s ease;
  }

  #dropzone.dragging {
    border-color: #2563eb;
    background: #eef2ff;
  }

  .file-input-label {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 10px;
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
  }

  .file-input-label input {
    display: none;
  }

  .uploader-help {
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
  }

  .view-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
    align-items: center;
  }

  .toggle-button {
    display: flex;
    background: #f0f0f0;
    border: 2px solid #ccc;
    border-radius: 20px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    width: 120px;
    height: 40px;
  }

  .toggle-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-weight: bold;
    transition: all 0.3s ease;
  }

  .toggle-option.active {
    background: #007bff;
    color: white;
  }

  .qr-button {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    border: 2px solid #ccc;
    background: #f0f0f0;
    color: #333;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .qr-button:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
  }

  .qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
  }

  .qr-modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .qr-modal-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }

  .qr-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
  }

  .qr-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
  }

  .qr-close:hover {
    background: #f0f0f0;
  }

  #qr-code-container {
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-bottom: 16px;
  }

  .qr-url-text {
    margin: 0;
    font-size: 12px;
    color: #666;
    word-break: break-all;
    text-align: center;
    max-width: 100%;
  }

  #pdf-container {
    position: fixed;
    top: 0;
    left: 260px;
    width: calc(100% - 260px);
    height: 100%;
    background: white;
    z-index: 900;
    display: flex;
    flex-direction: column;
  }

  #pdf-container iframe {
    width: 100%;
    height: 100%;
    border: none;
  }

  .pdf-viewer {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .pdf-fallback {
    text-align: left;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.85);
    color: #f8fafc;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
    font-size: 12px;
    max-width: 280px;
  }

  .pdf-fallback-link {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: #cbd5f5;
  }

  #pdf-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    overflow: auto;
  }

  #pdf-canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }

  #pdf-controls {
    position: fixed;
    bottom: 80px;
    left: calc(50% + 130px);
    transform: translateX(-50%);
    background: white;
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 15px;
    align-items: center;
    z-index: 1000;
  }

  #pdf-controls button {
    padding: 8px 16px;
    border: none;
    background: #007bff;
    color: white;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s ease;
  }

  #pdf-controls button:hover {
    background: #0056b3;
  }

  #pdf-fallback {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    pointer-events: none;
    z-index: 1100;
  }

  #pdf-fallback[hidden] {
    display: none;
  }

  #pdf-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.85);
    z-index: 1050;
  }

  #pdf-loading[hidden] {
    display: none;
  }

  #pdf-loading p {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
  }

  .pdf-loading-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: pdf-spin 0.7s linear infinite;
  }

  @keyframes pdf-spin {
    to { transform: rotate(360deg); }
  }

  .upload-page {
    font-family: "Trebuchet MS", "Verdana", sans-serif;
    background: #eef2f7;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
  }

  .upload-card {
    width: min(640px, 96vw);
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    max-height: calc(100vh - 48px);
    overflow: auto;
  }

  #file-browser {
    margin-top: 20px;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
  }

  .file-browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
  }

  .file-browser-header h2 {
    font-size: 16px;
    color: #0f172a;
  }

  #files-refresh {
    padding: 6px 10px;
    border: 1px solid #cbd5f5;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 12px;
    cursor: pointer;
  }

  .file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .file-list-status {
    font-size: 12px;
    color: #64748b;
  }

  .file-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
  }

  .file-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
  }

  .file-name {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
  }

  .file-path {
    font-size: 12px;
    color: #475569;
  }

  .file-details {
    font-size: 11px;
    color: #94a3b8;
  }

  .file-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
  }

  .file-move-select {
    min-width: 160px;
    padding: 6px 8px;
    border: 1px solid #cbd5f5;
    border-radius: 8px;
    font-size: 12px;
  }

  .file-action-btn {
    padding: 6px 10px;
    border: 1px solid #cbd5f5;
    border-radius: 8px;
    background: #ffffff;
    font-size: 12px;
    cursor: pointer;
  }

  .file-action-btn.danger {
    border-color: #fca5a5;
    background: #fee2e2;
    color: #b91c1c;
  }

  .upload-header h1 {
    font-size: 22px;
    color: #0f172a;
    margin-bottom: 6px;
  }

  .upload-header p {
    font-size: 13px;
    color: #475569;
    margin-bottom: 16px;
  }

  .upload-page #uploader-panel {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  #page-info {
    font-weight: bold;
    color: #333;
  }

  #version-display {
    position: fixed;
    bottom: 8px;
    left: 8px;
    font-size: 10px;
    color: #9ca3af;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    z-index: 1000;
    pointer-events: none;
    user-select: none;
  }
