@font-face {
  font-family: Fraunces;
  src: url("/static/fonts/fraunces-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Fraunces;
  src: url("/static/fonts/fraunces-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/static/fonts/source-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/static/fonts/source-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1c1b19;
  --muted: #6f6a62;
  --line: #e6dfd4;
  --paper: #f4efe6;
  --panel: #fffdf9;
  --green: #3c6848;
  --green-dark: #31563c;
  --stopped: #8a4b12;
  --stopped-bg: #f8efe3;
  --running: #1d6a45;
  --running-bg: #e8f3ec;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #fff;
  color: var(--ink);
  font: 17px/1.5 "Source Sans 3", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body.is-guide {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(820px 480px at 78% 42%, rgba(255, 250, 242, 0.9), transparent 70%),
    var(--paper);
}

.shell {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  background: transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.logo {
  width: 64px;
  height: 64px;
  display: block;
}

.stepper {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stepper li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9a948a;
  font-size: 14px;
  font-weight: 600;
}

.stepper li:not(:last-child)::after {
  content: "";
  width: 42px;
  height: 1px;
  margin: 0 12px;
  background: #ddd4c8;
}

.dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #cfc6ba;
  display: grid;
  place-items: center;
  font-size: 12px;
  line-height: 1;
}

.stepper li.current { color: var(--ink); }

.stepper li.current .dot {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.stepper li.done { color: var(--green); }

.stepper li.done .dot {
  background: var(--green) center / 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.2 4.6 9 10 3' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  border-color: var(--green);
  color: transparent;
  font-size: 0;
}

.workspace {
  margin: 0;
  justify-self: end;
  color: var(--muted);
  font-size: 14px;
}

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(460px, 680px) minmax(360px, 1fr);
  gap: 36px;
  align-items: center;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 48px 8px;
  min-height: calc(100vh - 148px);
}

.copy { min-width: 0; }

.learning {
  margin: 0 0 36px;
  color: var(--muted);
  font-size: 16px;
}

.eyebrow {
  margin: 0 0 14px;
  color: #8d877d;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.guide h2 {
  margin: 0 0 16px;
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  font-size: 54px;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.guide p {
  margin: 0 0 12px;
  max-width: 36em;
  color: #3e3b36;
  font-size: 18px;
}

.panel {
  margin-top: 22px;
  padding: 18px 18px 14px;
  background: var(--panel);
  border: 1px solid #efe8de;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(90, 70, 40, 0.06);
}

.panel-lead {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-lead strong {
  display: block;
  margin-bottom: 2px;
  font-size: 16px;
}

.panel-lead p,
.panel .note,
.fine {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.glyph {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e7f0e6;
  color: var(--green);
}

.panel label {
  display: block;
  margin: 4px 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.url {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 0 12px;
  border: 1px solid #e4ddd2;
  border-radius: 10px;
  background: #fff;
}

.url input {
  width: 100%;
  border: 0;
  padding: 12px 0;
  background: transparent;
  color: var(--ink);
  font: 16px/1.4 "Source Sans 3", sans-serif;
}

.url input:focus { outline: none; }

.url a {
  color: #8a847a;
  display: grid;
  place-items: center;
}

.panel .note { margin-bottom: 16px; }

.fine {
  margin-top: 12px;
  text-align: center;
}

button.go,
a.go {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 14px 18px;
  background: var(--green);
  color: #fff;
  font: 600 16px/1 "Source Sans 3", sans-serif;
  cursor: pointer;
  text-decoration: none;
}

button.go svg { margin-left: 4px; }

button.go:hover,
a.go:hover { background: var(--green-dark); }

button.go.inline,
a.go.inline {
  width: auto;
  min-width: 160px;
  padding: 12px 18px;
}

button.go:disabled { opacity: 0.6; cursor: wait; }

#send-systems[hidden],
#systems-ask[hidden],
#start-connections[hidden],
#link-continue[hidden],
#link-skip[hidden] { display: none; }

.queue { list-style: none; margin: 8px 0 0; padding: 0; }

.queue label {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 10px 0;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid #e4ddd2;
  border-radius: 14px;
  cursor: pointer;
}

.queue label:has(input:checked) { border-color: var(--green); }

.queue input { width: 18px; height: 18px; accent-color: var(--green); }

.queue .ord {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #d9d3c9;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.queue label:has(input:checked) .ord { background: var(--green); }

.queue strong { display: block; font-size: 16px; }

.queue small { color: var(--muted); font-size: 14px; }

.link-field {
  display: block;
  margin: 16px 0 6px;
  font-size: 14px;
  font-weight: 600;
}

#link-fields input {
  width: 100%;
  border: 1.5px solid #e4ddd2;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  font: 16px/1.4 "Source Sans 3", sans-serif;
}

.textlink.disconnect {
  width: auto;
  margin: 18px 0 0;
  text-align: left;
}

.upload {
  display: block;
  margin: 18px 0 8px;
  font-size: 14px;
  font-weight: 600;
}

#systems-file,
#systems-list {
  width: 100%;
  border: 1.5px solid #e4ddd2;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: 16px/1.4 "Source Sans 3", sans-serif;
}

#systems-file { padding: 12px; }

#systems-list {
  padding: 12px 14px;
  resize: vertical;
}

.textlink {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--green);
  font: 600 14px/1 "Source Sans 3", sans-serif;
  text-align: center;
  cursor: pointer;
}

.source {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0 18px;
  padding: 16px 18px;
  background: #fff;
  border: 1.5px solid var(--green);
  border-radius: 14px;
}

.source strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.source small {
  color: var(--muted);
  font-size: 14px;
}

.source .pick {
  margin-left: auto;
  width: 22px;
  height: 22px;
  flex: none;
  border: 2px solid var(--green);
  border-radius: 50%;
  background: var(--green);
  box-shadow: inset 0 0 0 4px #fff;
}

.guide .note {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.steps {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  background: #fff;
  border: 1px solid #e4ddd2;
  border-radius: 16px;
}

.steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid #efe8de;
}

.steps li:first-child { border-top: 0; }

.steps .num {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e7f0e9;
  color: var(--green);
  font-size: 14px;
  font-weight: 600;
}

.steps strong {
  display: block;
  font-size: 16px;
}

.steps li span span {
  color: var(--muted);
  font-size: 15px;
}

#drive-result,
#drive-chosen { margin-top: 16px; }

.portal-question {
  margin: 22px 0 12px;
  font-weight: 600;
  font-size: 16px;
}

.portal {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid #e4ddd2;
  border-radius: 14px;
}

.portal.selected { border-color: var(--green); }

.portal strong { display: block; font-size: 16px; }

.portal small {
  color: var(--muted);
  font-size: 14px;
}

.portal .pick {
  margin-left: auto;
  width: 22px;
  height: 22px;
  flex: none;
  border: 2px solid var(--green);
  border-radius: 50%;
  background: var(--green);
  box-shadow: inset 0 0 0 4px #fff;
}

.portal.unavailable {
  opacity: 0.45;
  background: #f6f3ee;
  cursor: not-allowed;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border: 1.5px solid #e4ddd2;
  border-radius: 14px;
  cursor: pointer;
}

.choice:has(input:checked) { border-color: var(--green); }

.choice input {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--green);
}

.choice strong {
  font-size: 15px;
  font-weight: 600;
}

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
}

.actions .textlink {
  width: auto;
  margin: 0;
}

.scene {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 560px;
}

.scene img {
  width: min(100%, 520px);
  max-height: 72vh;
  object-fit: contain;
  display: block;
}

.preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 240px;
  margin: 0 0 14px;
  overflow: hidden;
  border: 1px solid #e4ddd2;
  border-radius: 12px;
  background: #fff;
}

.preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  background: #fff;
}

.preview-status {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 253, 249, 0.88);
  color: var(--muted);
  font-size: 15px;
}

.preview-status[hidden] { display: none; }

.links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.links .textlink {
  width: auto;
  margin: 0;
}

.markline {
  margin: 18px 0 28px;
  text-align: center;
  color: #9a948a;
  font-size: 13px;
}

.markline span {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.markline span::before,
.markline span::after {
  content: "";
  width: 42px;
  height: 1px;
  background: #ddd4c8;
}

body:not(.is-guide) .scene,
body:not(.is-guide) .markline,
body:not(.is-guide) .stepper,
body:not(.is-guide) #workspace-label {
  display: none;
}

body:not(.is-guide) .shell {
  display: flex;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

body:not(.is-guide) .stage {
  display: block;
  max-width: 760px;
  padding: 28px 20px 64px;
}

.ask, .turn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
}

.ask h2 {
  margin: 22px 0 8px;
  font: 600 22px/1.25 "Source Sans 3", sans-serif;
}

.ask > h2:first-child { margin-top: 0; }

.lead, .empty {
  margin: 0 0 16px;
  color: var(--muted);
}

.status {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--stopped-bg);
  color: var(--stopped);
}

.status.running {
  background: var(--running-bg);
  color: var(--running);
}

.ask label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.ask input, textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea { resize: vertical; }

#connect-form, #google-form { margin: 0 0 20px; }

.steps {
  margin: 0 0 4px;
  padding-left: 1.2em;
}

.steps li { margin: 0 0 8px; }

.row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.ask button,
.thread button {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  background: #111;
  color: #fff;
  font: 600 15px/1 "Source Sans 3", sans-serif;
  cursor: pointer;
}

.form-error { margin: 0; color: #8d2b2b; }

#records {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

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

.record h3 { margin: 0 0 4px; font-size: 14px; }
.record p { margin: 0; color: var(--muted); font-size: 14px; }
.record .from {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.thread { margin-top: 28px; }
.turn { margin-top: 12px; }

.turn h3 {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.turn p { margin: 0 0 14px; white-space: pre-wrap; }
.turn p:last-child { margin-bottom: 0; }
.turn .stopped, .turn .unreachable { color: var(--stopped); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; justify-items: start; }
  .stepper { flex-wrap: wrap; }
  .workspace { justify-self: start; }
  .stage { grid-template-columns: 1fr; min-height: 0; padding: 12px 20px 8px; }
  .scene { display: none; }
  .guide h2 { font-size: 40px; }
}
