:root {
  --bg-primary: #18181b;
  --bg-secondary: #27272a;
  --bg-tertiary: #3f3f46;
  --bg-elevated: #202024;
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  
  /* Python Branding */
  --accent-py-blue: #387eb8;
  --accent-py-yellow: #ffd43b;
  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --accent-success: #16a34a;
  --accent-danger: #ef4444;
  --accent-warning: #f59e0b;

  --border-color: #3f3f46;
  --border-subtle: #2d2d30;
  --console-bg: #0f1115;
  --console-border: #23252b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #52525b;
}

/* Header & Toolbar */
header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  z-index: 50;
  height: 48px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

.logo-icon {
  background: linear-gradient(135deg, #387eb8 50%, #ffd43b 50%);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.logo-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, #60a5fa, #fde047);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-tag {
  font-size: 10px;
  font-weight: 600;
  background-color: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.lesson-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-nav {
  background-color: var(--bg-primary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  width: 28px;
  height: 29px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-nav:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border-color: var(--accent-primary);
}

.dropdown {
  background-color: var(--bg-primary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  max-width: 310px;
  text-overflow: ellipsis;
  transition: border-color 0.15s ease;
}

.dropdown:hover, .dropdown:focus {
  border-color: var(--accent-primary);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
}

.autorun-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.autorun-toggle:hover {
  color: var(--text-main);
  border-color: #52525b;
}

.autorun-toggle input {
  accent-color: #0284c7;
  cursor: pointer;
}

.btn {
  background-color: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background-color: #52525b;
  border-color: #71717a;
}

.btn-primary {
  background-color: #0284c7;
  border-color: #0369a1;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #0369a1;
  border-color: #075985;
}

.btn-success {
  background-color: #16a34a;
  border-color: #15803d;
  color: #ffffff;
}

.btn-success:hover {
  background-color: #15803d;
  border-color: #166534;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-main);
}

.btn-icon-run {
  background: rgba(2, 132, 199, 0.2);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-weight: 700;
}

.btn-icon-run:hover {
  background: #0284c7;
  color: #fff;
}

/* Main Split Container */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.left-pane {
  width: 48%;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
}

.pane-resizer {
  width: 6px;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  cursor: col-resize;
  position: relative;
  z-index: 10;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.pane-resizer:hover, .pane-resizer.dragging {
  background-color: var(--accent-primary);
}

.pane-resizer-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 24px;
  background-color: var(--text-dim);
  border-radius: 2px;
}

.right-pane {
  flex: 1;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-secondary);
  overflow: hidden;
}

/* Tab Bar */
.tab-bar {
  display: flex;
  justify-content: space-between;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 8px;
  height: 36px;
  align-items: center;
}

.tab-bar-left {
  display: flex;
  gap: 4px;
  height: 100%;
  align-items: flex-end;
}

.tab-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-bottom: none;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background-color: var(--bg-primary);
  color: var(--text-main);
  border-color: var(--border-color);
}

.tab-pill {
  font-size: 10px;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 700;
}

.tab-tag {
  font-size: 11px;
}

.tag-py { color: #fde047; }
.tag-task { color: #38bdf8; }
.tag-stdin { color: #a78bfa; }

/* Editor Container */
.editor-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.editor-pane {
  display: none;
  width: 100%;
  height: 100%;
}

.editor-pane.active {
  display: block;
}

.CodeMirror {
  height: 100% !important;
  font-family: "Cascadia Code", "Fira Code", Consolas, Menlo, monospace !important;
  font-size: 13.5px !important;
  line-height: 1.55 !important;
}

/* Task & Theory Pane */
.task-pane {
  display: none;
  padding: 20px 24px;
  overflow-y: auto;
  height: 100%;
  color: #e2e8f0;
  user-select: text;
}

.editor-container .task-pane.active {
  display: block;
}

.task-pane h2 {
  font-size: 1.35rem;
  color: #38bdf8;
  margin-bottom: 6px;
}

.theory-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.task-pane p {
  font-size: 13.5px;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 12px;
}

.task-pane code {
  background: #090d16;
  color: #fde047;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12.5px;
  border: 1px solid rgba(253, 224, 71, 0.2);
}

.task-pane ul, .task-pane ol {
  margin-left: 20px;
  margin-bottom: 16px;
  font-size: 13.5px;
  line-height: 1.6;
}

.task-pane li {
  margin-bottom: 6px;
}

/* Tasks Card */
.tasks-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
}

.tasks-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid #334155;
  padding-bottom: 8px;
}

.tasks-card-title {
  font-weight: 700;
  font-size: 14px;
  color: #f8fafc;
}

.tasks-card-counter {
  font-size: 11px;
  background: #0284c7;
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.task-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  transition: all 0.15s ease;
}

.task-item.completed {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(20, 83, 45, 0.2);
}

.task-item.completed .task-label {
  color: #86efac;
  text-decoration: line-through;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #22c55e;
}

.task-label {
  font-weight: 600;
  font-size: 13px;
  color: #f1f5f9;
  cursor: pointer;
}

.task-desc {
  font-size: 12.5px;
  color: #94a3b8;
  margin-top: 4px;
  margin-left: 24px;
}

.task-hint {
  margin-top: 6px;
  margin-left: 24px;
}

.task-hint details {
  background: rgba(14, 165, 233, 0.05);
  border: 1px dashed rgba(56, 189, 248, 0.3);
  border-radius: 4px;
  padding: 4px 8px;
}

.task-hint summary {
  font-size: 11.5px;
  font-weight: 600;
  color: #38bdf8;
  cursor: pointer;
  outline: none;
}

.task-hint p {
  margin: 6px 0 2px 0;
  font-size: 12px;
  color: #cbd5e1;
}

.task-actions-bar {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Stdin Pane */
.stdin-pane {
  display: none;
  flex-direction: column;
  height: 100%;
  padding: 16px;
}

.editor-container .stdin-pane.active {
  display: flex;
}

.stdin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: #94a3b8;
}

.stdin-hint {
  font-size: 11px;
  color: #64748b;
}

.stdin-textarea {
  flex: 1;
  background-color: var(--console-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: #38bdf8;
  font-family: monospace;
  font-size: 13px;
  padding: 12px;
  outline: none;
  resize: none;
  user-select: text;
}

.stdin-textarea:focus {
  border-color: var(--accent-primary);
}

/* Output Header & Tabs */
.output-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  height: 36px;
  flex-shrink: 0;
}

.output-tabs {
  display: flex;
  gap: 4px;
  height: 100%;
  align-items: flex-end;
}

.output-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-bottom: none;
  transition: all 0.15s ease;
}

.output-tab-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.04);
}

.output-tab-btn.active {
  background-color: var(--console-bg);
  color: var(--text-main);
  border-color: var(--border-color);
}

.badge-counter {
  font-size: 10px;
  background: #ef4444;
  color: #fff;
  padding: 1px 5px;
  border-radius: 8px;
  font-weight: 700;
  display: none;
}

.badge-counter.visible {
  display: inline-block;
}

.badge-tag {
  font-size: 9.5px;
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 1px 5px;
  border-radius: 4px;
}

.output-actions {
  display: flex;
  gap: 6px;
}

/* Visual Viewport & Split Console */
.visual-viewport {
  flex: 1;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background-color: var(--console-bg);
}

.visual-viewport.hidden {
  display: none !important;
}

.output-view {
  display: none;
  flex: 1;
  overflow: hidden;
  position: relative;
  background-color: var(--console-bg);
}

.output-view.active {
  display: flex;
  flex-direction: column;
}

/* Horizontal Resizer between Visual Viewport and Console */
.console-resizer {
  height: 6px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  cursor: row-resize;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}

.console-resizer.hidden {
  display: none !important;
}

.console-resizer:hover, .console-resizer.dragging {
  background-color: var(--accent-primary);
}

.console-resizer-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 2px;
  background-color: var(--text-dim);
  border-radius: 2px;
}

/* Always-Visible Virtual Console Pane */
.console-pane {
  height: 220px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  background-color: var(--console-bg);
  flex-shrink: 0;
}

.console-pane.full-height {
  flex: 1;
  height: auto !important;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 12px;
  background-color: #15171e;
  border-bottom: 1px solid var(--console-border);
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.console-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.console-actions {
  display: flex;
  gap: 6px;
}

/* Console Logs */
.console-logs {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: #e4e4e7;
  user-select: text;
}

.log-entry {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  word-break: break-word;
  white-space: pre-wrap;
}

.log-time {
  color: #52525b;
  font-size: 11px;
  flex-shrink: 0;
  user-select: none;
}

.log-content {
  flex: 1;
}

.log-stdout { color: #f4f4f5; }
.log-stderr {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 3px solid #ef4444;
}
.log-return { color: #fde047; }
.log-info { color: #38bdf8; }
.log-success { color: #4ade80; }
.log-empty { color: #71717a; font-style: italic; }

/* Console REPL Input Bar */
.console-input-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background-color: #141419;
  border-top: 1px solid var(--console-border);
  flex-shrink: 0;
}

.console-prompt {
  font-family: monospace;
  font-weight: 700;
  color: #38bdf8;
  font-size: 13px;
  user-select: none;
}

.console-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f4f4f5;
  font-family: monospace;
  font-size: 12.5px;
}

/* Turtle View */
.turtle-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #18181f;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 11.5px;
  flex-shrink: 0;
}

.turtle-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.turtle-speed-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #a1a1aa;
}

.turtle-speed-label input[type="range"] {
  width: 75px;
  accent-color: #38bdf8;
}

.turtle-grid-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #a1a1aa;
  cursor: pointer;
}

.turtle-status {
  color: #38bdf8;
  font-family: monospace;
  font-size: 11px;
}

.turtle-canvas-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
  background: #090a0f;
  padding: 8px;
}

#turtle-canvas {
  background: #11131a;
  border: 1px solid #272733;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  max-width: 100%;
  max-height: 100%;
}

/* Data View */
.data-header {
  padding: 7px 12px;
  background: #18181f;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  color: #94a3b8;
  flex-shrink: 0;
}

.data-content {
  flex: 1;
  padding: 14px;
  overflow: auto;
}

.data-placeholder {
  color: #64748b;
  font-size: 13px;
  text-align: center;
  margin-top: 30px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  background: #14161f;
  border: 1px solid #27273a;
  border-radius: 6px;
  overflow: hidden;
}

.data-table th {
  background: #1e2230;
  color: #38bdf8;
  text-align: left;
  padding: 8px 12px;
  font-weight: 700;
  border-bottom: 1px solid #2e3446;
}

.data-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #222634;
  color: #e2e8f0;
}

.data-table tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

/* Footer */
.app-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 4px 14px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 26px;
  flex-shrink: 0;
}

.footer-left { display: flex; align-items: center; gap: 8px; }
.footer-link { color: #38bdf8; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }
.footer-center { font-weight: 500; color: var(--text-dim); }
.footer-right { display: flex; align-items: center; gap: 8px; }
.footer-stat { font-family: monospace; color: #e2e8f0; }
.footer-sep { color: var(--border-color); }
.footer-tip kbd {
  background: #3f3f46;
  color: #f4f4f5;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
  border: 1px solid #52525b;
}

/* ==========================================================================
   Raspberry Pi & GPIO Simulator Styles
   ========================================================================== */

.rpi-tag {
  background: rgba(225, 29, 72, 0.2) !important;
  color: #fb7185 !important;
  border-color: rgba(225, 29, 72, 0.4) !important;
}

.rpi-board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #141f17;
  border-bottom: 1px solid #1e3a24;
  padding: 6px 12px;
  font-size: 12px;
  flex-shrink: 0;
}

.rpi-board-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #4ade80;
}

.rpi-anim-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.rpi-anim-badge.running {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
  border-color: rgba(234, 179, 8, 0.4);
}

.rpi-board-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 11px;
}

.rpi-live-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #86efac;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
}

.rpi-live-toggle input {
  accent-color: #22c55e;
  cursor: pointer;
}

.rpi-container {
  flex: 1;
  display: flex;
  overflow: auto;
  padding: 10px;
  gap: 12px;
  background: #090d0b;
}

.rpi-stage {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  align-content: start;
}

.rpi-component-card {
  background: rgba(18, 28, 22, 0.9);
  border: 1px solid #233e2c;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.rpi-component-card.full-width {
  grid-column: 1 / -1;
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: #86efac;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 5px;
  margin-bottom: 8px;
}

.card-hint {
  font-size: 10px;
  font-weight: 400;
  color: #64748b;
}

.btn-mini {
  background: rgba(255,255,255,0.06);
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  cursor: pointer;
}

.btn-mini:hover {
  background: #334155;
}

/* LEDs & Traffic Lights */
.traffic-lights-housing {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 4px 0;
}

.led-socket {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.led-socket:hover {
  background: rgba(255,255,255,0.04);
}

.rpi-led {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #334155;
  transition: all 0.12s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}

.led-label {
  font-size: 10px;
  color: #cbd5e1;
  font-weight: 600;
}

.led-state-pill {
  font-size: 9px;
  font-family: monospace;
  padding: 1px 5px;
  border-radius: 4px;
  background: #1e293b;
  color: #64748b;
  font-weight: 700;
}

.led-state-pill.high {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.led-red { background: #450a0a; }
.led-red.lit {
  background: radial-gradient(circle at 35% 35%, #fecaca, #ef4444 60%, #b91c1c);
  border-color: #fca5a5;
  box-shadow: 0 0 14px #ef4444, 0 0 28px rgba(239, 68, 68, 0.65);
}

.led-yellow { background: #451a03; }
.led-yellow.lit {
  background: radial-gradient(circle at 35% 35%, #fef08a, #eab308 60%, #a16207);
  border-color: #fef08a;
  box-shadow: 0 0 14px #eab308, 0 0 28px rgba(234, 179, 8, 0.65);
}

.led-green { background: #052e16; }
.led-green.lit {
  background: radial-gradient(circle at 35% 35%, #bbf7d0, #22c55e 60%, #15803d);
  border-color: #86efac;
  box-shadow: 0 0 14px #22c55e, 0 0 28px rgba(34, 197, 94, 0.65);
}

.led-blue { background: #082f49; }
.led-blue.lit {
  background: radial-gradient(circle at 35% 35%, #bae6fd, #0284c7 60%, #0369a1);
  border-color: #7dd3fc;
  box-shadow: 0 0 14px #0284c7, 0 0 28px rgba(2, 132, 199, 0.65);
}

/* Button & Buzzer */
.component-row {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 4px 0;
}

.button-unit, .buzzer-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.component-caption {
  font-size: 10.5px;
  color: #cbd5e1;
  font-weight: 600;
}

.pin-status-badge {
  font-size: 9.5px;
  font-family: monospace;
  padding: 2px 6px;
  border-radius: 4px;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
}

.pin-status-badge.active {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: #ef4444;
  font-weight: 700;
}

.rpi-btn-hardware {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #1e293b;
  border: 2px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.4);
  transition: all 0.1s ease;
}

.btn-cap {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f87171, #dc2626);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  transition: all 0.1s ease;
}

.rpi-btn-hardware.pressed {
  transform: translateY(2px);
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.rpi-btn-hardware.pressed .btn-cap {
  transform: scale(0.9);
  background: radial-gradient(circle at 45% 45%, #fecaca, #ef4444);
}

.rpi-buzzer {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.buzzer-hole {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #020617;
  border: 1px solid #1e293b;
}

.rpi-buzzer.buzzing {
  border-color: #eab308;
  box-shadow: 0 0 14px rgba(234, 179, 8, 0.65);
  animation: buzz-shake 0.1s infinite;
}

@keyframes buzz-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, -1px); }
  100% { transform: translate(1px, 1px); }
}

/* Ultrasonic HC-SR04 */
.sensor-unit {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hcsr04-graphic {
  background: #1e3a8a;
  border: 1px solid #3b82f6;
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  gap: 6px;
  transition: box-shadow 0.2s ease;
}

.hcsr04-graphic.ping {
  box-shadow: 0 0 14px #38bdf8;
  border-color: #7dd3fc;
}

.sonar-eye {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #94a3b8, #334155);
  border: 2px solid #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 800;
  color: #f8fafc;
}

.slider-control {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
}

.slider-Marks {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #64748b;
}

.sensor-readout {
  color: #38bdf8;
  font-family: monospace;
}

.slider-control input[type="range"] {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
}

/* DHT22 */
.dht-graphic {
  background: #0284c7;
  color: #fff;
  font-weight: 800;
  font-size: 10.5px;
  padding: 14px 8px;
  border-radius: 6px;
  border: 1px solid #38bdf8;
  letter-spacing: 0.5px;
  transition: box-shadow 0.2s ease;
}

.dht-graphic.ping {
  box-shadow: 0 0 14px #38bdf8;
}

.dht-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* LCD 16x2 */
.lcd-housing {
  background: #0f172a;
  border: 3px solid #1e293b;
  border-radius: 6px;
  padding: 8px;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.8);
}

.lcd-screen {
  background: #0284c7;
  border: 2px solid #0369a1;
  border-radius: 4px;
  padding: 6px 12px;
  font-family: "Courier New", Courier, monospace;
  font-weight: 900;
  font-size: 15px;
  line-height: 1.3;
  color: #082f49;
  text-shadow: 0 0 1px rgba(0,0,0,0.35);
  letter-spacing: 2px;
  box-shadow: 0 0 16px rgba(2, 132, 199, 0.4);
  transition: all 0.2s ease;
}

.lcd-screen.backlight-off {
  background: #334155;
  color: #1e293b;
  border-color: #475569;
  box-shadow: none;
}

.lcd-line {
  white-space: pre;
}

/* Pinout Panel */
.rpi-pinout-panel {
  width: 245px;
  background: #111a14;
  border: 1px solid #1e3a24;
  border-radius: 8px;
  padding: 8px;
  font-size: 11px;
  overflow-y: auto;
  flex-shrink: 0;
}

.pinout-title {
  font-weight: 700;
  color: #86efac;
  margin-bottom: 4px;
  font-size: 11.5px;
}

.pinout-legend {
  display: flex;
  gap: 8px;
  font-size: 9.5px;
  color: #94a3b8;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #1e3a24;
}

.leg-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.leg-item i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot-pwr { background: #f87171; }
.dot-gpio { background: #4ade80; }
.dot-act { background: #22c55e; box-shadow: 0 0 5px #22c55e; }

.pin-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pin-row {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.pin-cell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgba(255,255,255,0.02);
  font-size: 9.5px;
  font-family: monospace;
  cursor: pointer;
  border: 1px solid transparent;
}

.pin-cell:hover {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(255,255,255,0.05);
}

.pin-cell.pin-active-cell {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.45);
}

.pin-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 72px;
}

.pin-num {
  font-weight: 700;
  color: #cbd5e1;
  margin: 0 2px;
}

.pin-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #334155;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.pin-dot.active {
  background: #22c55e;
  box-shadow: 0 0 7px #22c55e;
}

.pin-power { color: #f87171; }
.pin-gnd { color: #64748b; }
.pin-gpio { color: #4ade80; }
.pin-special { color: #facc15; }

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 38px;
  right: 20px;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #38bdf8;
  box-shadow: 0 8px 20px rgba(0,0,0,0.45);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.2s ease;
}

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