/* ==========================================================================
   Ashish Vegan Logo Quiz - Modern Responsive Image Viewer
   Designed for Mobile & Desktop with Light Theme First & Dark Theme Switch
   ========================================================================== */

:root {
  /* Brand Green Palette */
  --brand-50: #ecfdf5;
  --brand-100: #d1fae5;
  --brand-200: #a7f3d0;
  --brand-300: #6ee7b7;
  --brand-400: #34d399;
  --brand-500: #10b981;
  --brand-600: #059669;
  --brand-700: #047857;
  --brand-800: #065f46;
  --brand-900: #064e3b;
  --brand-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --brand-glow: rgba(16, 185, 129, 0.25);

  /* Light Theme (Default & Primary) */
  --bg-app: #f4f6fb;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-input: #f8fafc;
  --bg-stage: #ffffff;
  --bg-chip: #e6f9f0;
  --text-chip: #065f46;
  --border-chip: #a7f3d0;
  
  --text-main: #0f172a;
  --text-sub: #475569;
  --text-muted: #94a3b8;
  --border-subtle: #e2e8f0;
  --border-focus: #10b981;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-stage: 0 20px 30px -10px rgba(15, 23, 42, 0.08), 0 0 1px 1px rgba(0, 0, 0, 0.04);
  --shadow-btn: 0 4px 14px rgba(16, 185, 129, 0.35);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-app: #0a0f1d;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f293d;
  --bg-input: #1a2234;
  /* Logo Stage remains crisp white/light so logos with dark artwork are clearly visible */
  --bg-stage: #ffffff;
  --bg-chip: rgba(16, 185, 129, 0.15);
  --text-chip: #34d399;
  --border-chip: rgba(52, 211, 153, 0.3);
  
  --text-main: #f8fafc;
  --text-sub: #cbd5e1;
  --text-muted: #64748b;
  --border-subtle: #243046;
  --border-focus: #34d399;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 20px -5px rgba(0, 0, 0, 0.6);
  --shadow-stage: 0 20px 35px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
  --shadow-btn: 0 4px 14px rgba(16, 185, 129, 0.45);
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  line-height: 1.5;
  overflow-x: hidden;
}

/* App Wrapper */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  backdrop-filter: blur(8px);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.15));
  transition: transform var(--transition-bounce);
}

.brand-section:hover .brand-logo-img {
  transform: scale(1.05);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-badge {
  background: var(--brand-500);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-sub);
}

/* Header Action Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-app);
  color: var(--brand-600);
  border-color: var(--brand-400);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(0);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* --------------------------------------------------------------------------
   Progress Bar
   -------------------------------------------------------------------------- */
.progress-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}

.progress-track {
  position: relative;
  flex: 1;
  height: 8px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0.05%;
  background: var(--brand-gradient);
  border-radius: var(--radius-full);
  transition: width 200ms ease-out;
}

.progress-percentage {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-600);
  min-width: 48px;
  text-align: right;
  font-feature-settings: "tnum";
}

/* --------------------------------------------------------------------------
   Main Stage (Card & Image Presentation)
   -------------------------------------------------------------------------- */
.main-stage-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stage-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-stage);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

/* Stage Header: Chip and Quick Tools */
.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* Logo Number Chip */
.logo-chip-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-chip);
  color: var(--text-chip);
  border: 1px solid var(--border-chip);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.1);
  transition: all var(--transition-fast);
}

.logo-chip-pulse {
  width: 8px;
  height: 8px;
  background-color: var(--brand-500);
  border-radius: 50%;
  box-shadow: 0 0 0 0 var(--brand-glow);
  animation: chipPulse 2s infinite;
}

@keyframes chipPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.logo-total-chip {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stage-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stage-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.stage-mini-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--brand-400);
  color: var(--brand-600);
}

.stage-mini-btn.active {
  background: var(--brand-50);
  border-color: var(--brand-400);
  color: var(--brand-700);
}

/* Image Presentation Stage */
.stage-canvas {
  position: relative;
  width: 100%;
  height: 380px;
  background: var(--bg-stage);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
  user-select: none;
  touch-action: pan-y pinch-zoom;
  /* Subtle light pattern to verify transparent elements without darkening logos */
  background-image: radial-gradient(var(--border-subtle) 0.75px, transparent 0.75px);
  background-size: 16px 16px;
}

/* Stage Background Modes */
.stage-canvas.checkerboard {
  background-image: 
    linear-gradient(45deg, #f1f5f9 25%, transparent 25%), 
    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #f1f5f9 75%), 
    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.stage-canvas.pure-white {
  background-image: none;
  background-color: #ffffff;
}

.logo-display-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 220ms ease, transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.05));
  will-change: transform, opacity;
}

.logo-display-img.animating-in {
  opacity: 1;
  transform: scale(1);
}

.logo-display-img.animating-out-left {
  opacity: 0;
  transform: translateX(-30px) scale(0.95);
}

.logo-display-img.animating-out-right {
  opacity: 0;
  transform: translateX(30px) scale(0.95);
}

.logo-display-img.zoomed {
  cursor: zoom-out;
  transform: scale(1.6);
  z-index: 10;
}

/* Loading & Skeleton Overlay */
.stage-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.stage-loader.visible {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--brand-100);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loader-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-sub);
}

/* Touch Gestures Guide for Mobile */
.swipe-indicator {
  position: absolute;
  bottom: 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Primary Navigation Controls (Previous & Next)
   -------------------------------------------------------------------------- */
.primary-nav-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.85rem;
  align-items: center;
  margin-top: 0.75rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  user-select: none;
  min-height: 52px;
}

.nav-btn-prev {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.nav-btn-prev:hover:not(:disabled) {
  background: var(--bg-surface-elevated);
  border-color: var(--brand-500);
  color: var(--brand-600);
  transform: translateX(-2px);
  box-shadow: var(--shadow-md);
}

.nav-btn-next {
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-btn);
}

.nav-btn-next:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateX(2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.nav-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(1);
}

.nav-btn svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.3;
}

.nav-center-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* --------------------------------------------------------------------------
   Jump & Explorer Control Panel
   -------------------------------------------------------------------------- */
.explorer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.explorer-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.explorer-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.explorer-title svg {
  color: var(--brand-500);
  width: 18px;
  height: 18px;
}

/* Jump Input & Scrub Bar */
.jump-input-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.jump-input-wrapper {
  position: relative;
  flex: 1;
}

.jump-input-prefix {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  pointer-events: none;
}

.jump-number-input {
  width: 100%;
  padding: 0.7rem 0.85rem 0.7rem 2.2rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  font-family: inherit;
  transition: all var(--transition-fast);
  outline: none;
}

.jump-number-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: var(--bg-surface);
}

.jump-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.15rem;
  background: var(--brand-500);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.jump-submit-btn:hover {
  background: var(--brand-600);
  transform: translateY(-1px);
}

.jump-submit-btn:active {
  transform: translateY(0);
}

/* Scrub Range Slider */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.logo-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.logo-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand-500);
  border: 3px solid #ffffff;
  box-shadow: var(--shadow-md);
  cursor: grab;
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.logo-range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: var(--brand-600);
}

.logo-range-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.25);
}

.logo-range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand-500);
  border: 3px solid #ffffff;
  box-shadow: var(--shadow-md);
  cursor: grab;
  transition: transform var(--transition-fast);
}

/* Quick Jump Pill Buttons */
.quick-jump-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.quick-jump-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-right: 0.25rem;
}

.pill-jump-btn {
  padding: 0.32rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-sub);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pill-jump-btn:hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
  color: var(--brand-700);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Autoplay & Utility Toolbar
   -------------------------------------------------------------------------- */
.utility-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toolbar-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--brand-400);
  color: var(--brand-600);
}

.toolbar-btn.playing {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

.speed-select {
  padding: 0.35rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.speed-select:focus {
  border-color: var(--brand-500);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.app-footer {
  margin-top: auto;
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.footer-text {
  font-size: 0.82rem;
  color: var(--text-sub);
}

.footer-link {
  color: var(--brand-600);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--brand-700);
  text-decoration: underline;
}

.footer-shortcuts-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.kbd {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   Toast Notification
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 200ms ease;
}

.toast-container.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-icon {
  color: var(--brand-400);
}

/* --------------------------------------------------------------------------
   Modal Dialogs (Help / Shortcuts)
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal-dialog {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.shortcuts-table td {
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.shortcuts-table td:last-child {
  text-align: right;
}

/* --------------------------------------------------------------------------
   Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .app-container {
    padding: 0.65rem 0.75rem 1.5rem;
  }

  .app-header {
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-lg);
  }

  .brand-logo-img {
    height: 32px;
  }

  .brand-title {
    font-size: 1rem;
  }

  .stage-canvas {
    height: 290px;
    padding: 1rem;
  }

  .primary-nav-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  .nav-btn {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    min-height: 48px;
  }

  .nav-center-tools {
    grid-column: span 2;
    justify-content: center;
    order: 3;
    margin-top: 0.25rem;
  }

  .quick-jump-pills {
    justify-content: flex-start;
  }

  .utility-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .toolbar-group {
    justify-content: space-between;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .stage-canvas {
    height: 360px;
  }
}

@media (min-width: 1025px) {
  .stage-canvas {
    height: 420px;
  }
}
