/* ──────────────────────────────────────────────────────────────────────────────
   saveToCloud.css – Cloud save, version-history, and local-open modal styles
   ──────────────────────────────────────────────────────────────────────────────
   The stgd-* rules style Google Drive save flows, stod-* rules style
   OneDrive save flows, vh-* rules support versionHistory.js, and ofl-* rules
   support openFromLocal.js. saveToCloud.js, quickSave.js, versionHistory.js,
   and unified modal code toggle the state classes documented below.
────────────────────────────────────────────────────────────────────────────── */

/* ── Shared provider modal overlays ─────────────────────────────────────── */
.stgd-modal,
.stod-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.stgd-active,
.stod-active {
  opacity: 1;
  pointer-events: auto;
}
.stgd-backdrop,
.stod-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgb(0 0 0 / .5);
  backdrop-filter: blur(4px);
}
/* ── Google Drive decorative backdrop elements ─────────────────────────── */
.stgd-cloud {
  position: absolute;
  opacity: .3;
  animation: float 20s ease-in-out infinite;
}
.stgd-cloud-1 {
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}
.stgd-cloud-2 {
  bottom: 20%;
  right: 15%;
  animation-delay: 5s;
}
@keyframes float {
  0%, 100% {
    transform: translateY(0) translateX(0);
  }
  25% {
    transform: translateY(-20px) translateX(10px);
  }
  50% {
    transform: translateY(0) translateX(20px);
  }
  75% {
    transform: translateY(20px) translateX(10px);
  }
}
/* ── OneDrive decorative backdrop elements ─────────────────────────────── */
.stod-square {
  position: absolute;
  width: 40px;
  height: 40px;
  opacity: .2;
  animation: rotate-square 15s linear infinite;
}
.stod-square-1 {
  top: 10%;
  left: 10%;
  background: #f25022;
}
.stod-square-2 {
  top: 10%;
  right: 10%;
  background: #7fba00;
  animation-delay: 3s;
}
.stod-square-3 {
  bottom: 10%;
  left: 10%;
  background: #00a4ef;
  animation-delay: 6s;
}
.stod-square-4 {
  bottom: 10%;
  right: 10%;
  background: #ffb900;
  animation-delay: 9s;
}
@keyframes rotate-square {
  0%, 100% {
    transform: rotate(0) scale(1);
  }
  25% {
    transform: rotate(90deg) scale(1.2);
  }
  50% {
    transform: rotate(180deg) scale(1);
  }
  75% {
    transform: rotate(270deg) scale(.8);
  }
}
/* ── Modal card containers and provider headers ───────────────────────── */
.stgd-container,
.stod-container {
  position: relative;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgb(0 0 0 / .3);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform .3s ease;
  display: flex;
  flex-direction: column;
}
.stgd-active .stgd-container,
.stod-active .stod-container {
  transform: translateY(0);
}
.stgd-close,
.stod-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgb(255 255 255 / .9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s ease;
  z-index: 10;
}
.stgd-close:hover,
.stod-close:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgb(0 0 0 / .15);
  transform: scale(1.1);
}
.stgd-close svg,
.stod-close svg {
  width: 20px;
  height: 20px;
  stroke: #6B7280;
}
.stgd-header {
  background: linear-gradient(135deg, #4285f4 0, #34a853 100%);
  padding: 40px 30px 30px;
  text-align: center;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.stod-header {
  background: linear-gradient(135deg, #0078d4 0, #107c10 100%);
  padding: 40px 30px 30px;
  text-align: center;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.stgd-header-icon,
.stod-header-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: rgb(255 255 255 / .2);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  position: relative;
}
.stgd-cloud-icon,
.stod-cloud-icon {
  width: 50px;
  height: 50px;
}
.stgd-google-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgb(0 0 0 / .15);
}
.stod-ms-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  padding: 4px;
  box-shadow: 0 2px 8px rgb(0 0 0 / .15);
}
.stod-ms-square:first-child {
  background: #f25022;
}
.stod-ms-square:nth-child(2) {
  background: #7fba00;
}
.stod-ms-square:nth-child(3) {
  background: #00a4ef;
}
.stod-ms-square:nth-child(4) {
  background: #ffb900;
}
.stgd-title,
.stod-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 10px 0;
  letter-spacing: -.5px;
}
.stgd-subtitle,
.stod-subtitle {
  font-size: 16px;
  opacity: .95;
  margin: 0;
  font-weight: 500;
}
.stgd-body,
.stod-body {
  padding: 30px;
  background: #fff;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.stgd-body::-webkit-scrollbar,
.stod-body::-webkit-scrollbar {
  width: 8px;
}
.stgd-body::-webkit-scrollbar-track,
.stod-body::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}
.stgd-body::-webkit-scrollbar-thumb,
.stod-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}
.stgd-body::-webkit-scrollbar-thumb:hover,
.stod-body::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
/* ── Authentication status rows and sign-in prompts ───────────────────── */
.stgd-auth-status,
.stod-auth-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #f0fdf4 0, #dcfce7 100%);
  border: 2px solid #86efac;
  border-radius: 12px;
  margin-bottom: 24px;
}
.stgd-not-signed-in,
.stod-not-signed-in {
  background: linear-gradient(135deg, #fffbeb 0, #fef3c7 100%);
  border-color: #fcd34d;
}
.stgd-auth-icon,
.stod-auth-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgb(255 255 255 / .5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stgd-auth-icon svg,
.stod-auth-icon svg {
  width: 24px;
  height: 24px;
}
.stgd-auth-text,
.stod-auth-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #166534;
}
.stgd-not-signed-in .stgd-auth-text,
.stod-not-signed-in .stod-auth-text {
  color: #92400e;
}
.stgd-auth-user,
.stod-auth-user {
  font-weight: 700;
  color: #065f46;
}
.stgd-signin-btn,
.stod-signin-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  color: #374151;
}
.stgd-signin-btn:hover,
.stod-signin-btn:hover {
  border-color: #9ca3af;
  box-shadow: 0 2px 8px rgb(0 0 0 / .1);
  transform: translateY(-1px);
}
/* ── File naming, destination folder, and action controls ─────────────── */
.stgd-step-header,
.stod-step-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.stgd-step-title,
.stod-step-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}
.stgd-name-input,
.stod-name-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  transition: all .2s ease;
  background: #fff;
}
.stgd-name-input:focus,
.stod-name-input:focus {
  outline: 0;
  border-color: #4285f4;
  box-shadow: 0 0 0 3px rgb(66 133 244 / .1);
}
.stod-name-input:focus {
  border-color: #0078d4;
  box-shadow: 0 0 0 3px rgb(0 120 212 / .1);
}
.stgd-name-input::placeholder,
.stod-name-input::placeholder {
  color: #9ca3af;
}
.stgd-folder-info,
.stod-folder-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 24px;
}
.stgd-folder-text,
.stod-folder-text {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}
.stgd-folder-text strong,
.stod-folder-text strong {
  color: #1f2937;
  font-weight: 600;
}
.stgd-actions,
.stod-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.stgd-btn,
.stod-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  border: none;
  font-family: inherit;
}
.stgd-btn-cancel,
.stod-btn-cancel {
  background: #f3f4f6;
  color: #6b7280;
}
.stgd-btn-cancel:hover,
.stod-btn-cancel:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}
.stgd-btn-save {
  background: linear-gradient(135deg, #4285f4 0, #34a853 100%);
  color: #fff;
}
.stod-btn-save {
  background: linear-gradient(135deg, #0078d4 0, #107c10 100%);
  color: #fff;
}
.stgd-btn-save:hover,
.stod-btn-save:hover {
  box-shadow: 0 4px 12px rgb(0 0 0 / .2);
  transform: translateY(-2px);
}
/* ── Upload loading and success states toggled by saveToCloud.js ──────── */
.stgd-loading,
.stod-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgb(255 255 255 / .95);
  backdrop-filter: blur(4px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 20;
}
.stgd-show,
.stod-show {
  display: flex!important;
}
.stgd-spinner,
.stod-spinner {
  width: 60px;
  height: 60px;
  position: relative;
}
.stgd-spinner-ring {
  width: 100%;
  height: 100%;
  border: 4px solid #e5e7eb;
  border-top-color: #4285f4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.stod-spinner-squares {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
}
.stod-spinner-square:first-child {
  background: #f25022;
}
.stod-spinner-square:nth-child(2) {
  background: #7fba00;
}
.stod-spinner-square:nth-child(3) {
  background: #00a4ef;
}
.stod-spinner-square:nth-child(4) {
  background: #ffb900;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.stgd-success-overlay,
.stod-success-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgb(255 255 255 / .98);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 30;
}
.stgd-success-content,
.stod-success-content {
  text-align: center;
  padding: 40px;
  max-width: 400px;
}
.stgd-success-title,
.stod-success-title {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 12px 0;
}
.stgd-success-message,
.stod-success-message {
  font-size: 16px;
  color: #6b7280;
  margin: 0 0 24px 0;
  line-height: 1.5;
}
.stgd-error-toast,
.stod-error-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #fff;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgb(0 0 0 / .15);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10001;
  max-width: 400px;
  border: 2px solid #fca5a5;
  opacity: 0;
  transition: all .3s ease;
}
.stgd-error-toast.stgd-show,
.stod-error-toast.stod-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.stgd-error-toast svg,
.stod-error-toast svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  fill: #DC2626;
}
.stgd-error-toast span,
.stod-error-toast span {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  flex: 1;
}
@media (max-width: 640px) {
  .stgd-container, .stod-container {
    width: 95%;
    max-height: 95vh;
    margin: 10px;
  }
  .stgd-header, .stod-header {
    padding: 30px 20px 20px;
  }
  .stgd-title, .stod-title {
    font-size: 24px;
  }
  .stgd-subtitle, .stod-subtitle {
    font-size: 14px;
  }
  .stgd-body, .stod-body {
    padding: 20px;
  }
  .stgd-actions, .stod-actions {
    flex-direction: column;
  }
  .stgd-btn, .stod-btn {
    width: 100%;
    justify-content: center;
  }
  .stgd-error-toast, .stod-error-toast {
    max-width: 90%;
    left: 5%;
    transform: translateX(0) translateY(100px);
  }
  .stgd-error-toast.stgd-show, .stod-error-toast.stod-show {
    transform: translateX(0) translateY(0);
  }
}
@media (max-height: 700px) {
  .stgd-header, .stod-header {
    padding: 30px 25px 20px;
  }
  .stgd-header-icon, .stod-header-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
  }
  .stgd-cloud-icon, .stod-cloud-icon {
    width: 40px;
    height: 40px;
  }
  .stgd-title, .stod-title {
    font-size: 24px;
  }
  .stgd-subtitle, .stod-subtitle {
    font-size: 14px;
  }
  .stgd-body, .stod-body {
    padding: 20px;
  }
}
.stgd-btn:focus,
.stgd-close:focus,
.stgd-name-input:focus,
.stod-btn:focus,
.stod-close:focus,
.stod-name-input:focus {
  outline: 2px solid #4285F4;
  outline-offset: 2px;
}
.stod-btn:focus,
.stod-close:focus,
.stod-name-input:focus {
  outline-color: #0078d4;
}
@media (prefers-contrast: high) {
  .stgd-container, .stod-container {
    border: 2px solid currentColor;
  }
  .stgd-name-input, .stod-name-input {
    border-width: 3px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stgd-btn, .stgd-container, .stgd-error-toast, .stgd-modal, .stod-btn, .stod-container, .stod-error-toast, .stod-modal {
    transition: none;
    animation: none;
  }
  .stgd-cloud, .stgd-confetti, .stgd-emoji-float, .stgd-spinner-ring, .stod-confetti, .stod-icon-float, .stod-spinner-square, .stod-square {
    animation: none;
  }
}
@keyframes qs-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes qs-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes qs-slide-in-right {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes qs-slide-out-right {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}
@keyframes qs-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .5;
  }
}
#btnSave.modified {
  position: relative;
}
#btnSave.modified::before {
  content: '●';
  position: absolute;
  top: 4px;
  right: 4px;
  color: #ef4444;
  font-size: 12px;
  animation: qs-pulse 2s ease infinite;
}
.quick-save-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .3);
  z-index: 10002;
  animation: qs-slide-in-right .3s ease;
  max-width: 360px;
}
.quick-save-toast.toast-success {
  background: #10b981;
}
.quick-save-toast.toast-error {
  background: #ef4444;
}
.quick-save-toast.toast-info {
  background: #3b82f6;
}
.quick-save-toast.toast-out {
  animation: qs-slide-out-right .3s ease forwards;
}
.qs-device-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: qs-fade-in .2s ease;
}
.qs-device-modal.qs-fade-out {
  animation: qs-fade-out .2s ease forwards;
}
.qs-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: min(500px, 92vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.qs-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.qs-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b 0, #d97706 100%);
}
.qs-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}
.qs-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  color: #6b7280;
}
.qs-callout {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}
.qs-callout-text {
  margin: 0;
  font-size: 14px;
  color: #92400e;
  line-height: 1.5;
}
.qs-meta {
  background: #f3f4f6;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
}
.qs-meta-label {
  margin: 0 0 4px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}
.qs-meta-value {
  margin: 0 0 12px;
  font-size: 14px;
  color: #1f2937;
  font-weight: 600;
  word-break: break-all;
}
.qs-meta-green {
  color: #059669;
}
.qs-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.qs-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: transform .2s, box-shadow .2s;
}
.qs-cancel-btn {
  background: #e5e7eb;
  color: #374151;
}
.qs-cancel-btn:hover {
  background: #d1d5db;
}
.qs-download-btn {
  background: linear-gradient(135deg, #10b981 0, #059669 100%);
  color: #fff;
  box-shadow: 0 2px 4px rgba(16, 185, 129, .2);
}
.qs-download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, .3);
}
.stl-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity .3s;
}
.stl-modal-overlay.active {
  display: flex;
  opacity: 1;
}
.stl-modal {
  background: #fff;
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  transform: scale(.9);
  transition: transform .3s;
  display: flex;
  flex-direction: column;
}
.stl-modal-overlay.active .stl-modal {
  transform: scale(1);
}
.stl-header {
  position: relative;
  padding: 32px 24px 24px;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  background: #fff;
}
.stl-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: 0 0;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background .2s;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.stl-close-btn:hover {
  background: #f3f4f6;
}
.stl-close-btn:active {
  transform: scale(.95);
}
.stl-close-btn svg {
  width: 20px;
  height: 20px;
}
.stl-icon-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.stl-icon {
  width: 80px;
  height: 80px;
}
.stl-title {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #1f2937;
}
.stl-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}
.stl-body {
  padding: 24px;
  background: #fff;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.stl-step {
  margin-bottom: 24px;
}
.stl-step:last-child {
  margin-bottom: 0;
}
.stl-step-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #374151;
  font-size: 15px;
}
.stl-step-icon {
  font-size: 18px;
}
.stl-name-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 15px;
  transition: all .2s;
  box-sizing: border-box;
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}
.stl-name-input:focus {
  outline: 0;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, .1);
}
.stl-name-input.error {
  border-color: #ef4444;
}
.stl-name-counter {
  text-align: right;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}
.stl-name-counter.stl-warning {
  color: #f59e0b;
  font-weight: 600;
}
.stl-error-message {
  color: #ef4444;
  font-size: 13px;
  margin-top: 4px;
  display: none;
}
.stl-save-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stl-option-card {
  display: flex;
  padding: 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all .2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.stl-option-card:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}
.stl-option-card:active {
  background: #f3f4f6;
}
.stl-option-card.stl-option-active {
  border-color: #667eea;
  background: #f0f3ff;
}
.stl-option-card input {
  margin: 0;
  margin-right: 12px;
}
.stl-option-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
}
.stl-option-icon {
  font-size: 24px;
}
.stl-option-text {
  flex: 1;
}
.stl-option-text strong {
  display: block;
  font-size: 15px;
  color: #1f2937;
  margin-bottom: 2px;
}
.stl-option-text span {
  display: block;
  font-size: 13px;
  color: #6b7280;
}
.stl-option-text small {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}
.stl-storage-status {
  font-size: 12px;
  color: #6b7280;
}
.stl-format-info {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: #f0f9ff;
  border-radius: 12px;
  margin: 20px 0;
}
.stl-format-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}
.stl-format-text {
  font-size: 14px;
  color: #0369a1;
}
.stl-status-messages {
  min-height: 40px;
  margin: 16px 0 0 0;
}
.stl-error-display,
.stl-success-message {
  display: none;
  padding: 16px;
  border-radius: 12px;
}
.stl-success-message {
  background: #f0fdf4;
  border: 1px solid #86efac;
}
.stl-success-message.active {
  display: block;
}
.stl-success-text {
  color: #166534;
  font-weight: 600;
  margin: 0 0 4px 0;
}
.stl-success-hint {
  color: #15803d;
  font-size: 13px;
  margin: 0;
}
.stl-error-display {
  background: #fef2f2;
  border: 1px solid #fca5a5;
}
.stl-error-display.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stl-error-text {
  color: #991b1b;
  margin: 0;
}
.stl-error-retry {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  touch-action: manipulation;
}
.stl-error-retry:hover {
  background: #dc2626;
}
.stl-action-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}
.stl-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  border: none;
  min-height: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.stl-btn-icon {
  width: 18px;
  height: 18px;
}
.stl-btn-cancel {
  background: #f3f4f6;
  color: #374151;
}
.stl-btn-cancel:hover {
  background: #e5e7eb;
}
.stl-btn-cancel:active {
  transform: scale(.98);
}
.stl-btn-save {
  background: linear-gradient(135deg, #667eea 0, #764ba2 100%);
  color: #fff;
}
.stl-btn-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, .4);
}
.stl-btn-save:active {
  transform: scale(.98);
  opacity: .9;
}
.stl-btn-save:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}
@keyframes stl-spin {
  to {
    transform: rotate(360deg);
  }
}
.stl-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: stl-spin .6s linear infinite;
}
.stl-body::-webkit-scrollbar {
  width: 8px;
}
.stl-body::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}
.stl-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}
.stl-body::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
@media (hover: none) and (pointer: coarse) {
  .stl-close-btn {
    min-width: 48px;
    min-height: 48px;
  }
  .stl-btn {
    min-height: 52px;
    padding: 16px 24px;
  }
  .stl-option-card input[type=radio] {
    width: 20px;
    height: 20px;
  }
  .stl-name-input:focus {
    font-size: 16px;
    border-width: 3px;
  }
  .stl-btn-save:hover {
    transform: none;
    box-shadow: none;
  }
  .stl-option-card:hover {
    border-color: #e5e7eb;
    background: #fff;
  }
  .stl-close-btn:hover {
    background: 0 0;
  }
}
@media (max-width: 640px) {
  .stl-modal {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .stl-header {
    padding: 24px 20px 20px;
  }
  .stl-title {
    font-size: 20px;
  }
  .stl-subtitle {
    font-size: 13px;
  }
  .stl-body {
    padding: 20px;
  }
  .stl-step {
    margin-bottom: 20px;
  }
  .stl-option-card {
    padding: 12px;
  }
  .stl-option-icon {
    font-size: 20px;
  }
  .stl-option-text strong {
    font-size: 14px;
  }
  .stl-option-text span {
    font-size: 12px;
  }
  .stl-format-info {
    padding: 12px;
    margin: 16px 0;
  }
  .stl-format-text {
    font-size: 13px;
  }
  .stl-action-buttons {
    flex-direction: column;
    padding: 12px 20px;
  }
  .stl-btn {
    width: 100%;
    justify-content: center;
  }
  .stl-close-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 100;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  }
}
@media (hover: none) and (pointer: coarse) and (min-width: 768px) {
  .stl-modal {
    max-width: 600px;
    max-height: 90vh;
    border-radius: 16px;
  }
}
@media (max-height: 700px) {
  .stl-header {
    padding: 20px 24px 16px;
  }
  .stl-icon {
    width: 60px;
    height: 60px;
  }
  .stl-title {
    font-size: 20px;
  }
  .stl-body {
    padding: 16px 24px;
  }
  .stl-step {
    margin-bottom: 16px;
  }
  .stl-format-info {
    margin: 12px 0;
    padding: 12px;
  }
  .stl-action-buttons {
    padding: 12px 24px;
  }
}
.stl-modal-overlay {
  -webkit-user-select: none;
  user-select: none;
}
@media (prefers-reduced-motion: reduce) {
  .stl-btn, .stl-modal, .stl-modal-overlay {
    transition: none;
    animation: none;
  }
}
.vh-toolbar-btn {
  padding: 8px 16px;
  font-size: 24px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
}
.vh-toolbar-btn:hover {
  background: #f3f4f6;
  border-color: #3b82f6;
}
/* ── Version history panel used by versionHistory.js ───────────────────── */
.vh-panel {
  position: fixed;
  top: 50%;
  right: -420px;
  transform: translateY(-50%);
  width: 400px;
  max-width: 90vw;
  max-height: 85vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  transition: right .3s ease;
}
.vh-panel.show {
  right: 20px;
}
.vh-header {
  padding: 20px 20px 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.vh-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.vh-close {
  background: 0 0;
  border: none;
  font-size: 28px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  color: #6b7280;
}
.vh-close:hover {
  background: #f3f4f6;
  color: #111827;
}
.vh-info {
  padding: 8px 20px 12px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}
.vh-info small {
  color: #6b7280;
  font-size: 12px;
}
.vh-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.vh-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.vh-empty {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}
.vh-empty p {
  margin: 0 0 8px 0;
  font-size: 16px;
}
.vh-empty small {
  font-size: 13px;
}
.vh-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  transition: all .2s;
}
.vh-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, .1);
}
.vh-item-content {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.vh-thumbnail {
  flex-shrink: 0;
  width: 80px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vh-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.vh-item-details {
  flex: 1;
  min-width: 0;
}
.vh-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.vh-item-number {
  font-weight: 600;
  color: #3b82f6;
  font-size: 13px;
}
.vh-item-time {
  font-size: 12px;
  color: #6b7280;
}
.vh-item-info {
  margin-bottom: 0;
}
.vh-item-filename {
  font-weight: 500;
  color: #111827;
  margin-bottom: 4px;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vh-item-meta {
  font-size: 12px;
  color: #9ca3af;
}
.vh-item-actions {
  display: flex;
  gap: 8px;
}
.vh-action-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
}
.vh-restore:hover {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}
.vh-delete:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}
.vh-toast {
  position: fixed;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10001;
  transition: bottom .3s ease;
}
.vh-toast.show {
  bottom: 20px;
}
.vh-toast-error {
  background: #ef4444;
}
.vh-toast-warning {
  background: #f59e0b;
}
.vh-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .2s;
}
.vh-confirm-overlay.show {
  opacity: 1;
}
.vh-confirm-dialog {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
}
.vh-confirm-message {
  margin-bottom: 20px;
  line-height: 1.5;
  white-space: pre-line;
}
.vh-confirm-buttons {
  display: flex;
  gap: 12px;
}
.vh-confirm-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
}
.vh-cancel {
  background: #f3f4f6;
  color: #374151;
}
.vh-ok {
  background: #3b82f6;
  color: #fff;
}
@media (max-width: 768px) {
  .vh-panel {
    width: 90vw;
  }
  .vh-thumbnail {
    width: 60px;
    height: 45px;
  }
}
/* ── Open-from-local modal used by openFromLocal.js ────────────────────── */
.ofl-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, .5);
  display: none;
  z-index: 10000;
  opacity: 0;
  transition: opacity .3s ease;
  align-items: center;
  justify-content: center;
}
.ofl-modal.ofl-active {
  display: flex;
  opacity: 1;
}
.ofl-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.ofl-container {
  background: #fff;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1);
  position: relative;
  display: flex;
  flex-direction: column;
}
.ofl-header {
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
  position: relative;
}
.ofl-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: 0 0;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  color: #6b7280;
  transition: all .2s;
}
.ofl-close:hover {
  background: #f3f4f6;
  color: #374151;
}
.ofl-close svg {
  width: 20px;
  height: 20px;
}
.ofl-title {
  margin: 8px 0;
  color: #1f2937;
  font-size: 1.5rem;
  font-weight: 600;
}
.ofl-subtitle {
  margin: 0;
  color: #6b7280;
  font-size: .875rem;
}
.ofl-view-toggle {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}
.ofl-toggle-btn {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
  font-size: .875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ofl-toggle-btn svg {
  width: 18px;
  height: 18px;
}
.ofl-toggle-btn.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
.ofl-toggle-btn:hover:not(.active) {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.ofl-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}
.ofl-view {
  display: none;
}
.ofl-view.active {
  display: block;
}
.ofl-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.ofl-count {
  color: #6b7280;
  font-size: .875rem;
}
.ofl-count-number {
  font-weight: 600;
  color: #1f2937;
}
.ofl-sort-controls {
  display: flex;
  gap: 8px;
}
.ofl-sort-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s;
  font-size: .875rem;
}
.ofl-sort-btn.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
.ofl-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ofl-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: all .2s;
}
.ofl-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
}
.ofl-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.ofl-item-icon {
  width: 24px;
  height: 24px;
}
.ofl-item-name {
  margin: 0 0 4px 0;
  font-size: 1rem;
  font-weight: 500;
  color: #1f2937;
}
.ofl-item-date {
  margin: 0;
  font-size: .875rem;
  color: #6b7280;
}
.ofl-item-actions {
  display: flex;
  gap: 8px;
}
.ofl-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ofl-btn svg {
  width: 16px;
  height: 16px;
}
.ofl-btn-primary {
  background: #3b82f6;
  color: #fff;
}
.ofl-btn-primary:hover {
  background: #2563eb;
}
.ofl-btn-danger {
  background: #ef4444;
  color: #fff;
}
.ofl-btn-danger:hover {
  background: #dc2626;
}
.ofl-empty,
.ofl-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.ofl-empty-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
}
.ofl-empty h3 {
  margin: 0 0 8px 0;
  color: #1f2937;
  font-size: 1.25rem;
}
.ofl-empty p {
  margin: 0;
  color: #6b7280;
}
.ofl-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}
.ofl-device-content {
  min-height: 300px;
}
.ofl-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  background: #f9fafb;
  text-align: center;
  transition: all .2s;
}
.ofl-upload-area:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}
.ofl-upload-icon {
  width: 64px;
  height: 64px;
  color: #3b82f6;
  margin-bottom: 16px;
}
.ofl-upload-area h3 {
  margin: 0 0 8px 0;
  color: #1f2937;
  font-size: 1.25rem;
}
.ofl-upload-area p {
  margin: 0 0 24px 0;
  color: #6b7280;
}
.ofl-file-info {
  margin-top: 16px;
}
.ofl-help-text {
  margin: 0;
  color: #9ca3af;
  font-size: .75rem;
}
.ofl-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  font-weight: 500;
  z-index: 10001;
  transform: translateY(100px);
  opacity: 0;
  transition: all .3s ease;
}
.ofl-toast-show {
  transform: translateY(0);
  opacity: 1;
}
.ofl-toast-success {
  background: #10b981;
}
.ofl-toast-error {
  background: #ef4444;
}
.ofl-toast-warning {
  background: #f59e0b;
}
.ofl-toast-info {
  background: #3b82f6;
}
@media (hover: none) and (pointer: coarse) {
  .ofl-item {
    min-height: 72px;
    padding: 20px 16px;
  }
  .ofl-btn {
    min-height: 48px;
    min-width: 48px;
    padding: 12px 20px;
  }
  .ofl-close {
    min-width: 48px;
    min-height: 48px;
    padding: 12px;
  }
  .ofl-toggle-btn {
    min-height: 48px;
    padding: 14px 16px;
  }
  .ofl-sort-btn {
    min-height: 40px;
    padding: 10px 16px;
  }
  .ofl-item:hover {
    border-color: #e5e7eb;
    box-shadow: none;
    transform: none;
  }
  .ofl-toggle-btn:hover:not(.active), .ofl-upload-area:hover {
    background: #fff;
    border-color: #d1d5db;
  }
  .ofl-item.ofl-touch-active, .ofl-item:active {
    background: #f3f4f6;
    border-color: #3b82f6;
    transform: scale(.98);
  }
  .ofl-btn:active {
    transform: scale(.96);
    opacity: .9;
  }
  .ofl-close:active {
    background: #e5e7eb;
    transform: scale(.9);
  }
  .ofl-toggle-btn:active {
    transform: scale(.98);
  }
  .ofl-btn, .ofl-item, .ofl-sort-btn, .ofl-toggle-btn {
    -webkit-tap-highlight-color: rgba(59, 130, 246, 0.2);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  .ofl-body, .ofl-list {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}
@media (hover: none) and (pointer: coarse) and (min-width: 768px) {
  .ofl-container {
    max-width: 600px;
  }
  .ofl-item {
    min-height: 80px;
  }
}
@media (max-width: 640px) {
  .ofl-container {
    max-width: 95vw;
  }
  .ofl-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .ofl-item-actions {
    width: 100%;
  }
  .ofl-btn {
    flex: 1;
  }
}
