:root {
  color-scheme: dark;
  --bg: #14120e;
  --panel: #211d17;
  --line: #3c3429;
  --text: #f4efe6;
  --muted: #a89b8b;
  --accent: #e0a45a;
  --online: #9cbe86;
  --offline: #8d8378;
  --danger: #e08b78;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

header, .workspace, .gate {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  padding: 28px 0 12px;
}

h1, h2 { margin: 0; font-weight: 560; letter-spacing: -0.03em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.15rem; }

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#status { margin: 0; color: var(--muted); }

.gate, .focus, .tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.gate {
  max-width: 420px;
  margin-top: 24px;
  padding: 24px;
  display: grid;
  gap: 14px;
}

.gate p { margin: 0; color: var(--muted); line-height: 1.45; }

label { display: grid; gap: 6px; color: var(--muted); font-size: 0.85rem; }

input, button {
  font: inherit;
  color: var(--text);
}

input {
  border: 1px solid var(--line);
  background: #16130f;
  border-radius: 10px;
  padding: 10px 12px;
}

button {
  border: 0;
  background: var(--accent);
  color: #2a1c0b;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
}

button:disabled { opacity: 0.45; cursor: default; }

.error { min-height: 1.2em; color: var(--danger); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  padding-bottom: 32px;
  align-items: start;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.tile {
  padding: 10px;
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border-radius: 18px;
  display: grid;
  gap: 8px;
}

.tile img, #screen {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: #0c0b09;
  border-radius: 12px;
}

.tile strong { display: block; font-size: 0.95rem; }
.tile span, .meta { color: var(--muted); font-size: 0.78rem; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--offline);
}

.dot.online { background: var(--online); }

.focus { padding: 16px; display: grid; gap: 12px; position: sticky; top: 16px; }
.focus-head, .keys, .text-form { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.screen-button { padding: 0; background: transparent; border-radius: 12px; }
.keys button, #release { background: transparent; color: var(--text); border: 1px solid var(--line); }
.text-form { display: grid; grid-template-columns: 1fr auto; }
#focus-hint { margin: 0; color: var(--muted); font-size: 0.85rem; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .focus { position: static; }
}
