:root {
  color-scheme: dark;
  --bg: #121418;
  --bar: #1b1e24;
  --line: #2c313a;
  --text: #e7e4dc;
  --muted: #9a958a;
  --accent: #3f9d6a;
  --accent-2: #d7a441;
  font-family: "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand strong { font-size: 15px; letter-spacing: 0.02em; }
.brand span { color: var(--muted); font-size: 12px; }

.tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

button {
  border: 1px solid var(--line);
  background: #262a31;
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

button.primary { background: var(--accent); border-color: #2f7a50; color: #f4fff8; }
button.active { outline: 2px solid var(--accent-2); outline-offset: 1px; }
button:disabled { opacity: 0.45; cursor: default; }

.modes { display: flex; gap: 4px; }

.note {
  margin: 0;
  padding: 8px 14px;
  background: #3a2a12;
  color: #f0d7a2;
  font-size: 13px;
  border-bottom: 1px solid #6a4a1c;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.note[hidden] { display: none; }

.note .choices { display: flex; gap: 6px; flex: none; }
.note .allow { background: #3f9d6a; border-color: #2f7a50; color: #f4fff8; }
.note .decline { background: #4a3030; border-color: #7a4040; color: #ffd7d7; }

.tabs {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  background: #171a1f;
  border-bottom: 1px solid var(--line);
}

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 6px;
  padding: 6px;
}

.stage[data-mode="columns"] { grid-auto-flow: column; grid-auto-columns: 1fr; }
.stage[data-mode="rows"] { grid-auto-flow: row; grid-auto-rows: 1fr; }
.stage[data-mode="grid"] { grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; }
.stage[data-mode="auto"][data-count="1"] { grid-template-columns: 1fr; }
.stage[data-mode="auto"][data-count="2"] { grid-template-columns: 1fr 1fr; }
.stage[data-mode="auto"][data-count="3"],
.stage[data-mode="auto"][data-count="4"] { grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; }

.pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0c0d10;
  border: 1px solid var(--line);
}

.pane header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: #20242b;
  font-size: 12px;
  color: var(--muted);
}

.pane iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #000;
  min-height: 240px;
}

.stage[data-mode="single"] .pane { display: none; }
.stage[data-mode="single"] .pane.is-focus { display: flex; }
