
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  color-scheme: dark;
  --bg: #17191b;
  --panel: #1d2022;
  --panel-soft: #222629;
  --line: #343a3d;
  --text: #d4d9d8;
  --muted: #899493;
  --faint: #626d6c;
  --accent: #9ab9b2;
  --accent-strong: #bfd5ce;
  --danger: #d28e83;

  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

/* Header and footer */

.topbar,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px clamp(18px, 4vw, 54px);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
}

.topbar {
  border-bottom: 1px solid var(--line);
}

.wordmark {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: .12em;
}

.wordmark span {
  color: var(--accent);
}

.top-meta,
.eyebrow,
.footer,
.side-footer,
.count {
  font-size: 10px;
  letter-spacing: .09em;
}

.footer {
  border-top: 1px solid var(--line);
  color: var(--faint);
}

/* Main layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  width: min(1120px, calc(100% - 36px));
  min-height: calc(100vh - 112px);
  margin: 0 auto;
}

.main-panel {
  padding: clamp(36px, 7vw, 84px) clamp(24px, 6vw, 76px) 60px 0;
}

.stage {
  max-width: 660px;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
}

h1 {
  margin: 12px 0 26px;
  color: #e3e7e5;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -.045em;
}

.prose {
  max-width: 62ch;
  margin: 0 0 14px;
  color: #b8c0be;
}

/* Form and prompts */

.prompt {
  margin-top: 42px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.prompt-label {
  margin: 0 0 15px;
  color: var(--text);
}

.field {
  width: 100%;
  padding: 12px 13px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid #41494a;
  border-radius: 2px;
  outline: none;
}

.field:focus {
  border-color: var(--accent);
}

textarea.field {
  min-height: 130px;
  resize: vertical;
}

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

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.option:hover {
  border-color: #647773;
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: #252e2d;
}

.option input {
  accent-color: var(--accent);
}

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

.primary {
  min-width: 145px;
  padding: 11px 16px;
  border: 1px solid #718d86;
  border-radius: 2px;
  background: #344742;
  color: #e3ebe7;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size: 11px;
}

.primary:hover {
  background: #40564f;
}

.primary:disabled {
  opacity: .55;
  cursor: wait;
}

.hint {
  color: var(--faint);
  font-size: 11px;
}

/* Response sidebar */

.responses-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 36px 0 20px 23px;
  border-left: 1px solid var(--line);
}

.responses-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.count {
  color: var(--faint);
}

.response-list {
  flex: 1;
  padding-top: 22px;
}

.empty-log {
  color: var(--faint);
  font-size: 12px;
}

.log-entry {
  padding: 0 0 17px;
  margin-bottom: 16px;
  border-bottom: 1px solid #2c3234;
}

.log-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.log-value {
  margin-top: 4px;
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.side-footer {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--faint);
}

.complete-mark {
  color: var(--accent-strong);
}

.error {
  margin-top: 20px;
  padding: 10px 12px;
  border-left: 2px solid var(--danger);
  color: #e2aaa0;
  background: #2a2221;
  font-size: 12px;
}

/* Semantic keywords */

.tagged-word {
  color: var(--tag-color);
  font-weight: 600;
}

/* Button-based choices */

.button-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 9px;
}

.button-option {
  position: relative;
  min-width: 0;
}

.choice-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.choice-button {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.choice-button:hover,
.button-option:focus-within .choice-button {
  border-color: #647773;
}

.choice-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: #252e2d;
  color: var(--accent-strong);
}

.option-tags,
.choice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.option-tag,
.choice-tag {
  color: var(--tag-color);
  border: 1px solid var(--tag-color);
  background: color-mix(in srgb, var(--tag-color) 12%, transparent);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1.4;
}

/* Choice detail tooltips */

.choice-details {
  position: fixed;
  z-index: 5;
  width: min(360px, calc(100vw - 48px));
  max-height: 600px;
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid #596663;
  border-radius: 2px;
  background: #202526;
  box-shadow: 0 10px 28px #0009;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translateY(-3px);
  transition: opacity .12s, transform .12s, visibility .12s;
}

.button-option .choice-details {
  width: min(520px, calc(100vw - 48px));
}

.button-option:hover .choice-details,
.button-option:focus-within .choice-details,
.option:hover .choice-details {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.choice-detail {
  display: grid;
  grid-template-columns: 120px minmax(100, 1fr);
  column-gap: 8px;
  border-bottom: 1px solid #343d3e;
  font-size: 11px;
  line-height: 1.45;
}

.choice-detail:last-child {
  border-bottom: 0;
}

.choice-detail-name {
  color: var(--muted);
}

.choice-detail-value {
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Mobile layout */

@media (max-width: 720px) {
  .layout {
    display: flex;
    flex-direction: column;
  }

  .main-panel {
    padding: 38px 0 42px;
  }

  .responses-panel {
    min-height: auto;
    padding: 18px 0 16px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .response-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .log-entry {
    margin: 0;
  }

  .side-footer {
    margin-top: 18px;
  }

  .footer {
    gap: 12px;
    flex-wrap: wrap;
  }
}

/* Touch tooltip behavior */

@media (hover: none) {
  .choice-details {
    position: static;
    display: none;
    width: 100%;
    margin-top: 6px;
    pointer-events: auto;
  }

  .button-option .choice-details {
    width: 100%;
  }

  .button-option:focus-within .choice-details,
  .option:focus-within .choice-details {
    display: block;
  }
}
