* {
  box-sizing: border-box;
}

html {
  background: #fff;
  color: #000;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 16px;
  line-height: 1.5;
}

body {
  margin: 0 auto;
  max-width: 680px;
  padding: 0 16px 32px;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px 16px;
  padding: 16px 0;
  border-bottom: 1px solid #000;
}

.site-header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

main {
  padding-top: 16px;
}

/* Phones: the name on its own row, the buttons on the next (owner decision). */
@media (max-width: 480px) {
  .site-header-right .identifier {
    flex-basis: 100%;
  }
}

/* Progress trail at the page bottom: small, grey, centered; the current item is black, the arrows step
   through the chain and go pale at either end. */
.trail {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 8px;
  margin-top: 24px;
  padding-top: 8px;
  border-top: 1px solid #ccc;
  font-size: 12px;
  color: #888;
}

.trail a {
  color: #888;
}

.trail-current {
  color: #000;
  text-decoration: underline;
}

.trail-arrow {
  padding: 8px 12px;
  font-size: 16px;
  text-decoration: none;
}

.trail-arrow.is-off {
  color: #ccc;
}

p.is-verified,
ol.is-verified {
  border: 1px solid #080;
  border-radius: 2px;
  padding: 8px 12px 8px 32px;
  margin: 0 0 16px;
}

p.is-verified {
  padding-left: 12px;
}

/* In-app archive: a full-screen dialog over the stage, so typed answers stay. Pinch-zoom works as on any
   page; a tap on an image toggles its natural size inside the scrollable dialog. */
.archive-dialog {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 16px;
  border: 0;
  background: #fff;
  color: #000;
  overflow: auto;
  font: inherit;
}

.archive-dialog .actions {
  margin: 0 0 16px;
}

.archive-item img[data-zoom] {
  cursor: zoom-in;
}

.archive-item img.zoomed {
  width: auto;
  max-width: none;
  cursor: zoom-out;
}

.panel {
  border: 1px solid #000;
  border-radius: 2px;
  padding: 16px;
}

.panel + .panel {
  margin-top: 16px;
}

label {
  display: block;
  margin-bottom: 8px;
}

input,
select,
button {
  font: inherit;
  font-size: 16px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #000;
  border-radius: 2px;
  background: #fff;
  color: #000;
}

input,
select {
  width: 100%;
}

img {
  max-width: 100%;
}

button {
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: #000;
  color: #fff;
}

:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.identifier {
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #000;
  border-radius: 2px;
  color: #000;
  text-decoration: none;
}

.btn:hover,
.btn:focus-visible {
  background: #000;
  color: #fff;
}

/* Header buttons are compact on purpose (owner decision after the phone test): the 44px target applies to forms. */
.site-header .btn {
  min-height: 32px;
  padding: 0 8px;
  font-size: 13px;
}

/* Live field check (owner decision): a text input turns green once the server accepts its value. */
input.is-verified {
  border-color: #080;
  box-shadow: inset 0 0 0 1px #080;
}

/* The red RESET button and the green verified border are the only colours in the app (owner decisions, CLAUDE.md). */
.btn-reset {
  background: #800;
  color: #fff;
}

.btn-reset:hover,
.btn-reset:focus-visible {
  background: #fff;
  color: #800;
}

.status {
  min-height: 1.5em;
  margin: 8px 0;
  white-space: pre-line;
}

[hidden] {
  display: none !important;
}

/* Motion (owner decision, mobile first): a fade-in on each page, a rise for each revealed block, a verdict
   glyph that flashes after an answer. Reduced motion keeps the fades, drops movement. No @view-transition: the
   cross-document transition left WebKit pages unresponsive after the first playtest deploy. */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@keyframes flash {
  0% { opacity: 0; transform: scale(0.6); }
  20% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.15); }
}

main {
  animation: fade-in 0.25s ease-out;
}

/* Ending and restore texts: the newest block is on top, earlier ones move down. DOM order stays chronological. */
[data-reveal] {
  display: flex;
  flex-direction: column-reverse;
  gap: 16px;
}

[data-reveal] > .panel {
  margin: 0;
  animation: rise 0.4s ease-out;
}

.flash {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: min(85vw, 85vh);
  line-height: 1;
  animation: flash 1.2s ease-out forwards;
}

.flash-ok {
  color: #080;
}

.flash-fail {
  color: #800;
}

/* Reduced motion (iOS "Reduce Motion" is common): keep the fades and the verdict glyph, drop the movement
   and scaling. Hiding them entirely left phones with no feedback at all (owner decision). */
@keyframes still-fade {
  0% { opacity: 0; }
  20% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] > .panel {
    animation: fade-in 0.4s ease-out;
  }

  .flash {
    animation: still-fade 1.2s ease-out forwards;
  }
}

.hint {
  font-size: 14px;
}

ul {
  padding-left: 24px;
}

/* Stage forms */
form > input,
form > .chain {
  margin-bottom: 16px;
}

/* Stage 1: one bordered flow diagram, four nodes of one width joined by arrows. */
.route {
  display: flex;
  flex-direction: column;
  align-items: center;
  list-style: none;
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid #000;
  border-radius: 2px;
}

.route .node {
  width: 100%;
  max-width: 280px;
}

.route .node-fixed {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #000;
  border-radius: 2px;
  font-family: system-ui, sans-serif;
  font-weight: bold;
  letter-spacing: 0.1em;
  text-align: center;
}

.route .node label {
  margin-bottom: 4px;
  font-size: 14px;
  text-align: center;
}

.route .node input {
  text-align: center;
}

.route .arrow {
  line-height: 1;
  padding: 8px 0;
}

/* Stage 2: five selects, wrapping to two rows on narrow screens. */
.chain {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chain span {
  flex: 1 1 72px;
  min-width: 0;
}

.chain select {
  padding: 0 4px;
}

/* ARCHIVE page: images fill the column, never wider. */
.archive-item {
  margin: 16px 0 0;
}

.archive-item img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #000;
  border-radius: 2px;
}

.archive-item figcaption {
  margin-top: 4px;
  font-size: 14px;
}

/* Owner export page: the sessions table scrolls sideways on a phone instead of breaking the layout. */
.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  font-size: 14px;
  white-space: nowrap;
}

th,
td {
  padding: 4px 8px;
  border: 1px solid #000;
  text-align: left;
}

.events,
.options {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.suffixed {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.suffixed input {
  flex: 1 1 0;
  min-width: 0;
}

.suffixed label {
  margin: 0;
}

.events button,
.options button {
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  white-space: normal;
}

button[disabled],
button[aria-disabled="true"] {
  opacity: 0.4;
  cursor: default;
}

button[disabled]:hover,
button[aria-disabled="true"]:hover {
  background: #fff;
  color: #000;
}

.sequence {
  min-height: 1.5em;
  margin: 0 0 16px;
  padding-left: 32px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
