:root {
  --bg: #0e1014;
  --panel: #161922;
  --panel-2: #1d2130;
  --line: #262b3a;
  --text: #e8eaf0;
  --muted: #8b93a7;
  --accent: #7c5cff;
  --accent-2: #a78bfa;
  --ok: #34d399;
  --err: #f87171;
  --warn: #fbbf24;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1b1730 0%, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  font-size: 26px;
  color: var(--accent-2);
  text-shadow: 0 0 18px rgba(124, 92, 255, .6);
}
h1 { font-size: 17px; margin: 0; font-weight: 600; letter-spacing: .2px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); transition: .3s; }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.err { background: var(--err); box-shadow: 0 0 10px var(--err); }
.dot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 22px;
  padding: 22px 32px 40px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0)) , var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.field-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--muted);
  margin: 18px 0 8px;
}
.field-label:first-child { margin-top: 0; }

.scenarios { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.scenario {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font: inherit;
  transition: .18s;
}
.scenario:hover { border-color: #3a4160; transform: translateY(-1px); }
.scenario.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 6px 22px -10px var(--accent);
  background: linear-gradient(180deg, rgba(124,92,255,.16), rgba(124,92,255,.04));
}
.scenario b { display: block; font-size: 14px; margin-bottom: 3px; }
.scenario span { color: var(--muted); font-size: 12px; }

.hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.hint.small { font-size: 11.5px; }

textarea, input[type=number], select {
  width: 100%;
  background: #0f1219;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  outline: none;
  transition: border-color .15s;
}
textarea { resize: vertical; min-height: 96px; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); }

.row { display: flex; gap: 12px; }
.col { flex: 1; }

.ref-block { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.fast-toggle { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); }
.fast-toggle input { accent-color: var(--accent); }
.ref-body { margin-top: 12px; }
.ref-body input[type=file] { font-size: 12px; color: var(--muted); }
#refPreview {
  display: block;
  max-width: 100%;
  max-height: 190px;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
}
input[type=range] { width: 100%; accent-color: var(--accent); }

button.primary {
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #5b3df0);
  color: white;
  font: 600 15px/1 inherit;
  cursor: pointer;
  transition: .18s;
}
button.primary:hover { filter: brightness(1.1); }
button.primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }

.legal { color: #5c6377; font-size: 11px; margin: 12px 0 0; text-align: center; }

.results { min-height: 420px; }
.results-head { display: flex; align-items: center; justify-content: space-between; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.work { color: var(--warn); border-color: #4a3d1a; }
.badge.done { color: var(--ok); border-color: #1c4a3a; }
.badge.err { color: var(--err); border-color: #4a2222; }

.mount { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 14px; }
.empty {
  width: 100%;
  min-height: 300px;
  display: grid;
  place-items: center;
  color: #4b5266;
  border: 1px dashed var(--line);
  border-radius: 14px;
  font-size: 14px;
}

figure.shot { margin: 0; flex: 1 1 320px; max-width: 100%; }
figure.shot img {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  display: block;
}
figure.shot figcaption { display: flex; gap: 13px; margin-top: 8px; font-size: 12px; }
figure.shot a { color: var(--accent-2); text-decoration: none; }
figure.shot a:hover { text-decoration: underline; }

.prompt-box { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.prompt-box summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.prompt-box pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f1219;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-size: 12.5px;
  color: #c7cbe0;
  margin: 10px 0 6px;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.18);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
  vertical-align: -4px;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- авторизация --- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 16, .88);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 50;
}
.login-card {
  width: min(420px, 90vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 30px;
  text-align: center;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.8);
}
.login-logo {
  font-size: 40px;
  color: var(--accent-2);
  text-shadow: 0 0 24px rgba(124, 92, 255, .7);
  margin-bottom: 8px;
}
.login-card h2 { font-size: 18px; margin: 0 0 6px; }
.login-card .primary { margin-top: 18px; }
.code {
  font: 700 34px/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 10px;
  color: var(--accent-2);
  background: #0f1219;
  border: 1px dashed var(--accent);
  border-radius: 12px;
  padding: 14px;
  margin: 12px 0;
}
.userChip, #userChip {
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text);
}
button.logout {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
button.logout:hover { color: var(--text); border-color: #3a4160; }

button.secondary {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: 500 14px/1 inherit;
  cursor: pointer;
}
button.secondary:hover { border-color: #3a4160; }

.code-fallback {
  margin-top: 16px;
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.code-fallback summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

#pendingBanner {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #4a3d1a;
  background: rgba(251, 191, 36, .06);
  border-radius: 12px;
  color: var(--text);
}
#pendingBanner p { margin: 6px 0; }

.error-text { color: var(--err); font-size: 13px; margin-top: 12px; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .topbar { padding: 14px 16px; }
}
