:root {
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --bg-app: #0f172a;
  --panel-bg: #1e293b;
  --panel-border: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --danger: #ef4444;
  --success: #22c55e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  width: 100vw;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.app-header {
  height: 54px;
  background: #0b1120;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

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

.brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.badge-wasm {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* 3-Pane Layout */
.app-layout {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

/* Left Pane: Mode & Preset Category */
.left-pane {
  width: 290px;
  background: var(--panel-bg);
  border-right: 1px solid var(--panel-border);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
}

.search-box input {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.cat-item:hover, .cat-item.active {
  background: #334155;
  color: var(--text-primary);
}

.cat-item.active {
  border-left: 3px solid var(--accent);
}

/* Center Pane: Dropzone & Live Inspector */
.center-pane {
  flex: 1;
  background: #090d16;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dropzone {
  border: 2px dashed #475569;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.5);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

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

.dropzone h2 {
  margin: 8px 0 4px 0;
  font-size: 1.15rem;
}

.dropzone p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0;
}

/* Right Pane: Settings & Export */
.right-pane {
  width: 320px;
  background: var(--panel-bg);
  border-left: 1px solid var(--panel-border);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
}

/* Telemetry & Diff Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #1e293b;
  border: 1px solid var(--panel-border);
  width: 90vw;
  max-width: 1100px;
  height: 85vh;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
}

.telemetry-gauge {
  display: flex;
  align-items: center;
  gap: 16px;
}

.telemetry-time {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
}

.modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 20px;
  gap: 12px;
}

.modal-tabs {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
}

.modal-tab {
  padding: 6px 14px;
  border-radius: 6px;
  background: #0f172a;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.modal-tab.active {
  background: var(--accent);
  color: #0b1120;
}

.diff-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  overflow: hidden;
}

.diff-pane {
  background: #0f172a;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  overflow-y: auto;
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #0b1120;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #334155;
  color: var(--text-primary);
}

