:root {
  color-scheme: light;
  --bg: #eef2f8;
  --panel: #ffffff;
  --text: #152033;
  --muted: #647087;
  --line: #dce3ee;
  --primary: #2857e8;
  --primary-soft: #e8edff;
  --ok: #18794e;
  --ok-soft: #e6f6ee;
  --warn: #9a6700;
  --warn-soft: #fff6db;
  --danger: #c62828;
  --danger-soft: #fdeaea;
  --ink: #101828;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #d8e0ee;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 28px;
  padding: 28px 32px;
  align-items: center;
}

.director {
  background: #101828;
  color: #e8edf5;
  border-radius: 20px;
  padding: 22px 20px 18px;
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.28);
}

.director h1 {
  margin: 4px 0 8px;
  font-size: 1.35rem;
}

.director h2 {
  margin: 18px 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #98a2b3;
}

.director-kicker,
.director-hint,
.director-doc,
.director-lead,
.director-links {
  color: #98a2b3;
  font-size: 0.86rem;
  line-height: 1.5;
}

.director-kicker {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: #7a93ff;
}

.director-lead { margin: 0 0 8px; }
.director-doc { margin: 0; }
.director-doc code { color: #cdd5e0; font-size: 0.78rem; }
.director-links { margin: 16px 0 0; }
.director-links a { color: #9cb3ff; }

.chip-list,
.jump-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip,
.jump {
  border: 1px solid #344054;
  background: #1d2939;
  color: #e4e7ec;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.chip.active {
  background: #2857e8;
  border-color: #2857e8;
}

.jump.active {
  background: #344054;
}

.director-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

button.ghost {
  background: transparent;
  border: 1px solid #475467;
  color: #e4e7ec;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

.phone-wrap {
  display: grid;
  place-items: center;
}

.phone-shell {
  width: min(390px, 100%);
  height: min(820px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 10px solid #101828;
  border-radius: 38px;
  background: var(--bg);
  box-shadow: 0 28px 80px rgba(16, 24, 40, 0.24);
}

.phone-notch {
  display: grid;
  place-items: center;
  height: 18px;
  background: #101828;
}

.phone-notch span {
  width: 72px;
  height: 5px;
  border-radius: 999px;
  background: #344054;
}

.phone-status {
  display: flex;
  justify-content: space-between;
  padding: 6px 18px 0;
  font-size: 0.72rem;
  color: var(--muted);
}

.phone-screen {
  flex: 1;
  overflow: auto;
  padding: 8px 16px 20px;
}

.screen-kicker {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.screen-title {
  margin: 4px 0 6px;
  font-size: 1.45rem;
}

.screen-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.progress-dots {
  display: flex;
  gap: 5px;
  margin: 0 0 14px;
}

.progress-dots i {
  width: 18px;
  height: 4px;
  border-radius: 99px;
  background: #d0d5dd;
}

.progress-dots i.done { background: var(--primary); }
.progress-dots i.now { background: #9cb3ff; }

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  font-size: 0.8rem;
  color: var(--muted);
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.btn,
.btn-secondary,
.btn-danger,
.btn-ghost {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn { background: var(--primary); color: #fff; }
.btn[disabled],
.btn-secondary[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-secondary { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-row { display: grid; gap: 8px; margin-top: 14px; }
.btn-row.inline { grid-template-columns: 1fr 1fr; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
}

.card.selectable { cursor: pointer; }
.card.selectable:hover,
.card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.card-title { font-weight: 650; margin: 0 0 4px; }
.card-meta { margin: 0; color: var(--muted); font-size: 0.82rem; }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.check:last-child { border-bottom: 0; }
.check input { margin-top: 3px; }
.check p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }

.status-list { display: grid; gap: 8px; }

.status-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d0d5dd;
}

.dot.wait { background: #d0d5dd; }
.dot.run { background: #f5c518; box-shadow: 0 0 0 4px #fff6db; }
.dot.ok { background: var(--ok); }
.dot.fail { background: var(--danger); }

.banner {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.86rem;
  line-height: 1.45;
  margin: 8px 0 12px;
}

.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.fail { background: var(--danger-soft); color: var(--danger); }
.banner.info { background: var(--primary-soft); color: #1d3fad; }

.device-pulse {
  width: 88px;
  height: 88px;
  margin: 12px auto 16px;
  border-radius: 50%;
  background: radial-gradient(circle, #7a93ff 0%, #2857e8 55%, transparent 56%);
  position: relative;
}

.device-pulse::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(40, 87, 232, 0.25);
  animation: pulse 1.4s ease-out infinite;
}

@keyframes pulse {
  to { transform: scale(1.35); opacity: 0; }
}

.script-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  min-height: 168px;
  line-height: 1.7;
  font-size: 1.02rem;
}

.script-box .done { color: var(--ok); }
.script-box .now {
  background: #dbe4ff;
  border-radius: 4px;
  padding: 0 2px;
}

.twin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.twin .card { margin: 0; text-align: center; }
.twin .live { color: var(--ok); font-weight: 650; }

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.metric b { display: block; font-size: 1.15rem; }
.metric span { color: var(--muted); font-size: 0.75rem; }

.bar {
  height: 8px;
  background: #e4e7ec;
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0 14px;
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2857e8, #6b8bff);
  width: 0;
}

.preview.locked {
  opacity: 0.72;
  position: relative;
}

.lock-tag {
  display: inline-block;
  font-size: 0.7rem;
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: 99px;
  padding: 2px 8px;
  margin-left: 6px;
}

.home-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.home-nav span {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 4px;
}

.home-nav span.on {
  color: var(--primary);
  border-color: #b8c7ff;
  background: var(--primary-soft);
}

.toast {
  position: sticky;
  bottom: 0;
  margin-top: 12px;
  background: #101828;
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.84rem;
}

.tiny { font-size: 0.78rem; color: var(--muted); }
.hidden { display: none !important; }

@media (max-width: 860px) {
  .stage {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .director { order: 2; }
  .phone-shell { height: min(760px, calc(100vh - 24px)); }
}
