/**
 * PicDriver Screenshot Tools Design System
 * Modern Obsidian Dark Theme, Glassmorphism, Micro-Animations
 * Strictly Decoupled: Zero inline styles
 */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg-main: #0a0c10;
  --bg-card: #0f1219;
  --bg-card-hover: #141822;
  --bg-glass: rgba(15, 18, 25, 0.85);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  
  --accent-indigo: #6366f1;
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #a855f7;

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Container */
.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.app-header {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon-box {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-accent {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-indigo));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--text-main);
}

.badge-tag {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Tool Switcher Chips */
.tool-switcher-section {
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--border);
  background: #080a0e;
}

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

.chips-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chips-counter {
  font-size: 0.8rem;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: 600;
}

.tool-chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-indigo) transparent;
}

.tool-chips-scroll::-webkit-scrollbar {
  height: 4px;
}

.tool-chips-scroll::-webkit-scrollbar-thumb {
  background: var(--accent-indigo);
  border-radius: 4px;
}

.tool-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.tool-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: rgba(99, 102, 241, 0.4);
}

.tool-chip.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(56, 189, 248, 0.2));
  color: #fff;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

/* Active Tool Banner */
.active-tool-banner {
  background: linear-gradient(135deg, rgba(15, 18, 25, 0.95), rgba(22, 27, 38, 0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 24px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.banner-glow {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.banner-content {
  flex: 1;
}

.banner-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.banner-tag {
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.banner-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.banner-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  line-height: 1.2;
}

.banner-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 800px;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, border-color 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.3);
}

.metric-label {
  font-size: 0.72rem;
  color: var(--text-sub);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.metric-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-mono);
  line-height: 1.2;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-val span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Studio Workspace Layout */
.studio-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

@media (max-width: 1024px) {
  .studio-layout {
    grid-template-columns: 1fr;
  }
}

/* Sidebar Controls */
.sidebar-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* Dropzone */
.dropzone-box {
  border: 2px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: all 0.2s;
}

.dropzone-box:hover, .dropzone-box.drag-over {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.05);
}

.dropzone-icon {
  width: 42px;
  height: 42px;
  color: var(--accent-cyan);
  margin: 0 auto 10px;
  display: block;
}

.dropzone-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

/* Mode Navigation Tabs */
.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: #080a0e;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.mode-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  white-space: nowrap;
}

.mode-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.mode-tab-btn.active {
  background: var(--bg-card);
  color: var(--accent-cyan);
  box-shadow: var(--shadow-sm);
}

/* Tab Views */
.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control, .form-select {
  width: 100%;
  background: #080a0e;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.form-range {
  width: 100%;
  accent-color: var(--accent-indigo);
  cursor: pointer;
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-cyan);
  min-width: 44px;
  text-align: right;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), #4f46e5);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
}

.btn-full-width {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 8px;
}

.btn-flex-1 {
  flex: 1;
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }

/* Sub-section title */
.sub-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Color Picker Row */
.color-picker-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-swatch-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch-btn:hover {
  transform: scale(1.15);
}

.color-swatch-btn.active {
  border-color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Redaction list */
.redaction-list {
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #080a0e;
  padding: 6px;
}

.redaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.redaction-item:last-child {
  border-bottom: none;
}

.redaction-del-btn {
  background: transparent;
  border: none;
  color: var(--accent-rose);
  cursor: pointer;
  font-size: 0.8rem;
}

/* Stage Area (Right) */
.stage-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Visual Stage Switcher Tabs */
.vis-stage-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-card);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  width: fit-content;
}

.vis-stage-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.vis-stage-tab-btn:hover {
  color: #fff;
}

.vis-stage-tab-btn.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Visual Stage Card */
.vis-stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

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

.vis-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Canvas Viewport */
.canvas-wrapper {
  background: #08090d;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 480px;
}

.canvas-container {
  max-width: 100%;
  max-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

#screenshot-canvas {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-sm);
  max-width: 100%;
  height: auto;
  cursor: crosshair;
}

/* Viewport Toolbar */
.viewport-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.viewport-btn-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.vp-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.vp-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.zoom-level-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-cyan);
  cursor: default;
}

/* Pre-loaded Sample Strip */
.sample-strip-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 20px 0 10px;
}

.sample-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 768px) {
  .sample-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sample-thumb-card {
  background: #080a0e;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.sample-thumb-card:hover {
  border-color: var(--accent-indigo);
  transform: translateY(-2px);
}

.sample-thumb-card.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.sample-thumb-img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 6px;
}

.sample-thumb-text {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Export Bar */
.export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  background: #080a0e;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.export-chips {
  display: flex;
  gap: 8px;
}

.export-chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.export-chip-btn:hover {
  color: #fff;
  border-color: var(--accent-indigo);
}

.export-chip-btn.active {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Technical Comparison Table */
.table-section {
  margin: 40px 0;
}

.table-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
}

.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: var(--bg-card);
}

.matrix-table th, .matrix-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.matrix-table th {
  background: #080a0e;
  color: var(--text-sub);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.matrix-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.table-cell-cyan { color: var(--accent-cyan); }
.table-cell-emerald { color: var(--accent-emerald); }
.table-cell-amber { color: var(--accent-amber); }
.table-cell-white { color: #fff; }

.table-badge-sm {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Educational Content */
.guide-section {
  margin: 40px 0;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.guide-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
}

.guide-p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.7;
}

.guide-alert {
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid var(--accent-indigo);
  padding: 16px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 20px 0;
}

.guide-alert-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.guide-alert-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* FAQ Accordion */
.faq-section {
  margin: 40px 0 60px;
}

.faq-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 20px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item.active {
  border-color: rgba(99, 102, 241, 0.4);
}

.faq-q {
  padding: 16px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.faq-icon {
  width: 18px;
  height: 18px;
  color: var(--text-sub);
  transition: transform 0.2s;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
  color: var(--accent-cyan);
}

.faq-a {
  padding: 0 20px 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: none;
}

.faq-item.active .faq-a {
  display: block;
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  border: 1px solid var(--accent-cyan);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast-msg.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  color: var(--text-sub);
  font-size: 0.82rem;
  background: #080a0e;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--accent-cyan);
}


/* ==========================================================================
   Universal Mobile & Tablet Responsiveness Suite (320px - 1040px)
   ========================================================================== */

/* 1. Fluid Media & Canvas Scaling */
img, canvas, svg, video {
  max-width: 100% !important;
  height: auto !important;
}

/* 2. Responsive Touch-Scroll Tables */
table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

.table-responsive,
.table-container,
.table-wrap,
.table-wrapper,
.matrix-container,
.data-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 3. Tablet Breakpoint (<= 1040px) */
@media (max-width: 1040px) {
  .workspace,
  .studio-layout,
  .finder-workspace,
  .simulator-grid,
  .layout-grid,
  .remover-workspace {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .sidebar-panel,
  .controls-sidebar {
    border-left: none !important;
    border-top: 1px solid var(--border, rgba(255,255,255,0.1));
  }
}

/* 4. Mobile Portrait & Landscape (<= 768px) */
@media (max-width: 768px) {
  .site-header {
    height: auto !important;
    padding: 10px 16px !important;
  }

  .header-inner,
  .header-container {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    width: 100%;
  }

  .logo,
  .brand-logo,
  .logo-wrap {
    font-size: 1.15rem !important;
  }

  .menu-toggle {
    display: block !important;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #0a0d14;
    flex-direction: column;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
    z-index: 1000;
  }

  .nav-links.open {
    display: flex !important;
  }

  .hero {
    padding: 28px 16px 20px !important;
  }

  .hero h1 {
    font-size: clamp(1.6rem, 5.5vw, 2.3rem) !important;
    line-height: 1.2 !important;
  }

  .hero p {
    font-size: 0.92rem !important;
  }

  .page-wrapper,
  .portal-main,
  .container {
    padding: 16px 12px 40px !important;
  }

  .workspace,
  .studio-layout,
  .finder-workspace,
  .remover-workspace {
    padding: 0 !important;
    gap: 16px !important;
  }

  .panel-card,
  .results-card,
  .sidebar-panel,
  .stage-area,
  .card {
    padding: 16px 14px !important;
    border-radius: 12px !important;
  }

  .metrics-grid,
  .data-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .calc-grid,
  .features-grid,
  .steps-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .tool-chips-grid,
  .chips-bar,
  .preset-chip-group,
  .mode-tabs {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .tool-chip,
  .preset-btn,
  .mode-tab-btn {
    padding: 6px 12px !important;
    font-size: 0.78rem !important;
  }

  .btn-primary,
  .btn-secondary,
  .action-btn,
  .btn-action {
    min-height: 44px;
    width: 100%;
    justify-content: center;
  }

  .btn-group,
  .action-btns,
  .download-row {
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
  }

  table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
  }

  th, td {
    padding: 8px 10px !important;
    font-size: 0.8rem !important;
  }
}

/* 5. Small Handsets (<= 480px) */
@media (max-width: 480px) {
  .hero-pill,
  .hero-badge {
    font-size: 0.72rem !important;
    padding: 3px 10px !important;
  }

  .form-group {
    margin-bottom: 14px !important;
  }

  .form-control,
  .form-select,
  .control-input,
  .control-select,
  input[type="text"],
  input[type="number"],
  select {
    font-size: 16px !important; /* Prevents auto-zoom in iOS Safari */
    min-height: 42px;
  }

  .info-section,
  .guide-section,
  .faq-section {
    padding: 24px 12px !important;
  }
}
