/* ==========================================================================
   4-Bit Synchronous Counter - Professional CSS Design System
   Digital Electronics Virtual Laboratory
   Matching Asynchronous Counter Master Reference UI/UX
   ========================================================================== */

:root {
  /* Core Color Palette */
  --bg-dark: #090d16;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(51, 65, 85, 0.6);
  --border-glow: rgba(0, 240, 255, 0.3);

  --primary-cyan: #00f0ff;
  --primary-blue: #3b82f6;
  --accent-purple: #a855f7;
  --status-green: #10b981;
  --status-amber: #f59e0b;
  --status-red: #ef4444;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Fira Code', monospace;

  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(0, 240, 255, 0.15);
  --shadow-amber-glow: 0 0 20px rgba(245, 158, 11, 0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* Reset & Global Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(0, 240, 255, 0.06) 0%, transparent 40%),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Card Component (Glassmorphism) */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: rgba(0, 240, 255, 0.25);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-header h2, .card-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header h2 svg, .card-header h3 svg {
  color: var(--primary-cyan);
}

/* Badges */
.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.blue {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge.purple {
  background: rgba(168, 85, 247, 0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.mono-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--primary-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.lab-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary-cyan);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.app-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-header .subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.status-summary-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.4);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.green {
  background-color: var(--status-green);
  box-shadow: 0 0 8px var(--status-green);
}

.status-dot.amber {
  background-color: var(--status-amber);
  box-shadow: 0 0 10px var(--status-amber);
  animation: pulse-dot 0.8s infinite alternate;
}

@keyframes pulse-dot {
  from { opacity: 0.5; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.2); }
}

.status-text {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Toolbar Controls */
.toolbar-section {
  padding: 1rem 1.25rem;
}

.toolbar-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-blue), #2563eb);
  color: #fff;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #60a5fa, var(--primary-blue));
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(51, 65, 85, 0.7);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(71, 85, 105, 0.9);
}

.btn-accent {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #fff;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.btn-accent:hover:not(:disabled) {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

.sliders-group {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.slider-control {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 180px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #1e293b;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary-cyan);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-cyan);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Banner Section (Displays) */
.banner-section {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 1.5fr;
  gap: 1rem;
}

.display-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.binary-display-wrapper {
  display: flex;
  gap: 0.6rem;
}

.bit-box {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.25rem;
  text-align: center;
  transition: all 0.2s ease;
}

.bit-box.high {
  border-color: var(--primary-cyan);
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.2);
}

.bit-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-bottom: 0.1rem;
}

.bit-val {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.bit-box.high .bit-val {
  color: var(--primary-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.large-val {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-blue);
  text-align: center;
  padding-top: 0.2rem;
}

.large-val.hex-val {
  color: var(--accent-purple);
}

.ripple-state-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.status-indicator-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  text-align: center;
  transition: all 0.2s ease;
}

.status-indicator-box.counting {
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.5);
  box-shadow: var(--shadow-glow);
}

.status-indicator-box.resetting {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
}

.status-title {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  color: var(--status-green);
}

.status-indicator-box.counting .status-title {
  color: var(--primary-cyan);
}

.status-indicator-box.resetting .status-title {
  color: var(--status-red);
}

.status-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Workspace Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 1.25rem;
}

/* Circuit Schematic Workspace */
.schematic-card {
  display: flex;
  flex-direction: column;
}

.circuit-container {
  position: relative;
  background: #060911;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.circuit-legend {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.color-dot.line-high { background-color: var(--primary-cyan); box-shadow: 0 0 6px var(--primary-cyan); }
.color-dot.line-low { background-color: #475569; }
.color-dot.line-clk-bus { background-color: var(--status-amber); box-shadow: 0 0 6px var(--status-amber); }

.svg-scroll-wrapper {
  width: 100%;
  overflow-x: auto;
}

#circuitSvg {
  display: block;
  min-width: 850px;
}

.schematic-footnote {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.6);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary-blue);
}

/* Monitors Column */
.monitors-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.monitor-card {
  padding: 1rem;
}

.clock-probes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
}

.probe-item {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  transition: all 0.2s ease;
}

.probe-item.active-edge {
  border-color: var(--status-amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.probe-name {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-weight: 600;
}

.probe-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.probe-badge.low {
  background: #1e293b;
  color: #64748b;
}

.probe-badge.high {
  background: rgba(0, 240, 255, 0.15);
  color: var(--primary-cyan);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
}

.probe-badge.rising {
  background: rgba(245, 158, 11, 0.25);
  color: var(--status-amber);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

/* Synchronous Toggle Conditions Monitor */
.toggle-conditions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.tc-item {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: all 0.2s ease;
}

.tc-item.active-toggle {
  border-color: var(--primary-cyan);
  background: rgba(0, 240, 255, 0.08);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.tc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tc-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-blue);
}

.tc-eq {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

.tc-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.tc-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  padding: 0.15rem;
  border-radius: 3px;
  background: #1e293b;
  color: #64748b;
  margin-top: 0.1rem;
}

.tc-badge.active {
  background: var(--status-amber);
  color: #000;
  box-shadow: 0 0 8px var(--status-amber);
}

/* FF Hardware State Cards */
.ff-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.ff-status-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem;
  transition: all 0.2s ease;
}

.ff-status-card.active-toggling {
  border-color: var(--status-amber);
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.ff-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ff-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-blue);
}

.ff-state-tag {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background: #1e293b;
  color: #64748b;
}

.ff-status-card.active-toggling .ff-state-tag {
  background: var(--status-amber);
  color: #000;
}

.ff-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ff-row {
  display: flex;
  justify-content: space-between;
}

.ff-row .mono {
  font-family: var(--font-mono);
  font-weight: 700;
}

.val-high {
  color: var(--primary-cyan);
}

/* State & Transient Path Tracker */
.state-path-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.state-step-box {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: 6px;
  text-align: center;
}

.state-step-box.active-box {
  border-color: var(--primary-cyan);
  background: rgba(0, 240, 255, 0.08);
}

.state-box-title {
  display: block;
  font-size: 0.62rem;
  color: var(--text-dim);
}

.state-box-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
}

.state-arrow {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.transient-trail-wrapper {
  background: rgba(6, 9, 17, 0.8);
  border: 1px dashed var(--border-color);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.trail-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.trail-sequence {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.trail-chip {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: #1e293b;
  color: var(--text-muted);
}

.trail-chip.active {
  background: var(--primary-cyan);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 8px var(--primary-cyan);
}

/* Real-Time Waveform Timing Section */
.timing-section {
  display: flex;
  flex-direction: column;
}

.timing-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.timing-diagram-container {
  display: flex;
  background: #05070e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 220px;
}

.timing-labels-col {
  width: 110px;
  background: rgba(15, 23, 42, 0.95);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-cyan);
  z-index: 2;
}

.sig-label {
  display: flex;
  align-items: center;
}

.timing-canvas-wrapper {
  flex: 1;
  overflow-x: auto;
  position: relative;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 100%;
}

#timingSvg {
  display: block;
}

.timing-caption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* Data & Educational Grid */
.data-edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.table-scroll-container {
  max-height: 380px;
  overflow-y: auto;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.truth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  text-align: center;
}

.truth-table th {
  position: sticky;
  top: 0;
  background: #0f172a;
  color: var(--primary-cyan);
  font-weight: 700;
  padding: 0.6rem 0.4rem;
  border-bottom: 2px solid var(--border-color);
  z-index: 10;
}

.truth-table td {
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.truth-table tr:hover {
  background: rgba(30, 41, 59, 0.5);
}

.truth-table tr.active-row {
  background: rgba(0, 240, 255, 0.12) !important;
  font-weight: 700;
}

.truth-table tr.active-row td {
  color: var(--primary-cyan);
}

.comparison-container {
  overflow-x: auto;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.comparison-table th {
  background: #0f172a;
  color: var(--text-main);
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
}

.comparison-table td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: top;
  color: var(--text-muted);
}

.highlight-warn {
  color: var(--status-amber);
  font-weight: 600;
}

.highlight-success {
  color: var(--status-green);
  font-weight: 600;
}

/* Educational Theory Section */
.theory-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.theory-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.theory-card.full-width {
  grid-column: span 2;
}

.theory-card h4 {
  font-size: 0.95rem;
  color: var(--primary-cyan);
  margin-bottom: 0.4rem;
}

.theory-card p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.theory-card ul {
  padding-left: 1.2rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.theory-card li {
  margin-bottom: 0.25rem;
}

.pro-con-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.pro-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.6rem;
  border-radius: 6px;
}

.con-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 0.6rem;
  border-radius: 6px;
}

.app-badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.app-chip {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
}

.app-title {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary-blue);
  margin-bottom: 0.2rem;
}

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

/* Footer */
.app-footer {
  text-align: center;
  padding: 1rem 0;
  color: var(--text-dim);
  font-size: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Responsive Adjustments */
@media (max-width: 1100px) {
  .banner-section {
    grid-template-columns: 1fr 1fr;
  }
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .data-edu-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: 0.75rem;
  }
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .banner-section {
    grid-template-columns: 1fr;
  }
  .toolbar-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .sliders-group {
    flex-direction: column;
    gap: 0.75rem;
  }
  .theory-grid {
    grid-template-columns: 1fr;
  }
  .theory-card.full-width {
    grid-column: span 1;
  }
}

/* ── Dark-First Protection: Resist Global theme.css Light Overrides ── */
html[data-theme="light"],
html:not([data-theme="dark"]) {
  --bg-dark:       #090d16 !important;
  --bg-card:       rgba(15, 23, 42, 0.90) !important;
  --bg-card-hover: rgba(30, 41, 59, 0.95) !important;
  --border-color:  rgba(51, 65, 85, 0.6)  !important;
  --text-main:     #f8fafc !important;
  --text-muted:    #94a3b8 !important;
  --text-dim:      #64748b !important;
}

html[data-theme="light"],
html[data-theme="light"] body,
html:not([data-theme="dark"]) body {
  background-color: #090d16 !important;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(0, 240, 255, 0.06) 0%, transparent 40%),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px) !important;
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px !important;
  color: #f8fafc !important;
}
