:root {
  --bg: #07090a;
  --surface: #0c1110;
  --surface-raised: #111917;
  --line: #1d2a26;
  --text: #b8f5c8;
  --text-dim: #5f8a70;
  --green: #39d98a;
  --amber: #f2b33d;
  --red: #ff5d5d;
  --cyan: #5cc8ff;
  --glow: 0 0 12px rgb(57 217 138 / 0.25);
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius: 6px;
  --gap: 12px;
  --fast: 120ms;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background:
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.015) 0 1px, transparent 1px 3px),
    radial-gradient(circle at 50% -20%, #0f2a20 0%, var(--bg) 55%);
  color: var(--text);
  font: 14px/1.5 var(--mono);
  padding: 16px;
}

.site, .site-foot {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}
.site { justify-content: space-between; gap: 12px; padding: 2px 2px 14px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text-dim); text-decoration: none; }
.brand img { flex: none; border-radius: 7px; box-shadow: var(--glow); }
.brand h1 { margin: 0; font-size: clamp(15px, 2.4vw, 21px); font-weight: 500; letter-spacing: -0.01em; }
.brand b { color: var(--green); font-weight: 700; text-shadow: var(--glow); }
.repo {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--fast), color var(--fast), box-shadow var(--fast);
}
.repo:hover, .repo:focus-visible { outline: none; border-color: var(--green); color: var(--green); box-shadow: var(--glow); }
.site-actions { display: flex; gap: 8px; flex: none; }
.site-foot { justify-content: center; padding: 16px 0 4px; font-size: 12px; }
.site-foot a { color: var(--text-dim); text-decoration: none; }
.site-foot a:hover, .site-foot a:focus-visible { color: var(--green); outline: none; text-shadow: var(--glow); }

.window {
  max-width: 1280px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.55), inset 0 1px 0 rgb(255 255 255 / 0.03);
  overflow: hidden;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--line);
}

.dots { display: flex; gap: 7px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #2a3632; }
.dots i:first-child { background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:last-child { background: #28c840; }
.title { color: var(--green); text-shadow: var(--glow); font-weight: 600; }
.mode { margin-left: auto; color: var(--text-dim); font-size: 12px; }

.panel { padding: 14px 16px; }
.prompt { margin: 0 0 10px; color: var(--green); text-shadow: var(--glow); }
.prompt::after { content: "_"; animation: blink 1.1s steps(1) infinite; margin-left: 2px; }
.hint { margin: 0; color: var(--text-dim); font-size: 12px; }
.error, .notice.error { color: var(--red); }
.notice { margin: 0; padding: 8px 16px; border-bottom: 1px solid var(--line); color: var(--cyan); }
.notice.ok { color: var(--green); }

.row { display: flex; gap: var(--gap); flex-wrap: wrap; }
.row input { flex: 1 1 280px; }

input, select, button {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 10px;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: var(--glow);
}
input[type="number"] { width: 110px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--green); padding: 0; }

button { cursor: pointer; background: var(--surface-raised); }
button:hover { border-color: var(--green); color: var(--green); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--green); color: var(--bg); border-color: var(--green); font-weight: 700; }
button.primary:hover { color: var(--bg); box-shadow: var(--glow); }
button.danger:hover { border-color: var(--red); color: var(--red); }
button.ghost { background: transparent; color: var(--text-dim); }

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
}
.status b, .status code { color: var(--text); font-weight: 600; }
.status code { word-break: break-all; }
.status .grow { flex: 1 1 260px; }
.badge { font-weight: 700; letter-spacing: 0.04em; }
.badge.online { color: var(--green); text-shadow: var(--glow); }
.badge.offline { color: var(--red); }

.columns {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  min-height: 70vh;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-right: 1px solid var(--line);
}
.options > label { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--text-dim); }
.tasks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 0; padding: 0; border: 0; }
.tasks label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--text-dim); }
.checks label { display: flex; gap: 5px; align-items: center; color: var(--text); }

.preview {
  margin: 4px 0 0;
  padding: 10px;
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--amber);
  white-space: pre-wrap;
  word-break: break-all;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.log { display: flex; flex-direction: column; min-width: 0; }
.log-head { display: flex; align-items: center; gap: 14px; }
.log-head .prompt { margin: 0; flex: 1; }
.log-head label { color: var(--text-dim); display: flex; gap: 5px; align-items: center; }
.lines {
  flex: 1;
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 72vh;
  min-height: 320px;
  white-space: pre-wrap;
  word-break: break-word;
}
.lines span { display: block; }
.lines .warning { color: var(--amber); }
.lines .error { color: var(--red); }
.lines .remote { color: var(--cyan); }
.lines .info { color: var(--text); }

.lang { display: flex; gap: 2px; margin-left: 10px; }
.lang button { padding: 2px 8px; font-size: 12px; background: transparent; color: var(--text-dim); }
.lang button.active { color: var(--bg); background: var(--green); border-color: var(--green); }

.settings { border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.settings .log-head { gap: 10px; }
.settings-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 2fr); gap: 14px; align-items: start; }
.group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(0 0 0 / 0.2);
}
.group h2 { margin: 0; font-size: 13px; font-weight: 700; color: var(--amber); letter-spacing: 0.03em; }
.group label { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); align-items: center; gap: 10px; color: var(--text-dim); }
.group input { width: 100%; min-width: 0; }
.group > p { margin: 0; }
.display b { color: var(--text); }
#display-note.ok { color: var(--green); }
#display-note.problem { color: var(--amber); }
.language-note { border-top: 1px dashed var(--line); padding-top: 8px; color: var(--amber); }
.notes { margin: 0; padding: 0; list-style: none; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.notes li { word-break: break-all; }
.notes .info { color: var(--text-dim); }
.notes .ok { color: var(--green); }
.notes .problem { color: var(--amber); }
.notes .problem::before { content: "! "; }

.deploy { border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.deploy .log-head { gap: 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs button.active { border-color: var(--green); color: var(--green); box-shadow: var(--glow); }
.field {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 5% 8.888%,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 5% 8.888%,
    var(--bg);
  touch-action: none;
}
.field img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; opacity: 0.85; }
.bar-zone {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(135deg, rgb(255 93 93 / 0.28) 0 8px, rgb(255 93 93 / 0.12) 8px 16px);
  border-top: 1px dashed var(--red);
}
.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 700;
  line-height: 24px;
  cursor: grab;
  color: var(--bg);
  border: 2px solid var(--bg);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.6);
  touch-action: none;
}
.pin:active { cursor: grabbing; }
.pin.deploy { background: var(--amber); }
.pin.spells { background: var(--cyan); }
.pin.points { background: var(--green); }
.pin.selected { outline: 2px solid #fff; outline-offset: 2px; }
.pin:hover { color: var(--bg); border-color: #fff; }

[hidden] { display: none !important; }

@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .prompt::after { animation: none; }
  * { transition: none !important; }
}

@media (max-width: 860px) {
  body { padding: 8px; }
  .columns { grid-template-columns: 1fr; }
  .options { border-right: 0; border-bottom: 1px solid var(--line); }
  .lines { max-height: 60vh; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  a.repo span { display: none; }
  .group label { grid-template-columns: 1fr; gap: 4px; }
}
