:root {
  color-scheme: light;
  --white: #FFFFFF;
  --yellow: #EFC100;
  --black: #000000;
  --disabled: #B8B8B8;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  color: var(--black);
  background: var(--white);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 280px;
  background: var(--white);
  color: var(--black);
  font: 1rem/1.45 Arial, Helvetica, sans-serif;
}

button, input, textarea, select {
  font: inherit;
  color: var(--black);
}

button, a, input, textarea, select, summary {
  -webkit-tap-highlight-color: var(--yellow);
}

button, a { touch-action: manipulation; }

button {
  min-width: 44px;
  min-height: 48px;
  padding: 10px 16px;
  border: 2px solid var(--black);
  border-radius: 14px;
  background: var(--white);
  color: var(--black);
  cursor: pointer;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  color: var(--black);
  background: var(--disabled);
  border-color: var(--disabled);
  cursor: not-allowed;
}

button.primary {
  width: 100%;
  min-height: 56px;
  background: var(--yellow);
  border-color: var(--black);
  font-weight: 700;
}

button.primary:disabled { background: var(--disabled); }

button.secondary {
  width: 100%;
  min-height: 48px;
  background: var(--white);
}

button.quiet {
  background: var(--white);
  border-color: var(--white);
  text-decoration: underline;
  text-underline-offset: 4px;
}

button.quiet:disabled {
  background: var(--disabled);
  border-color: var(--disabled);
}

a {
  color: var(--black);
  text-underline-offset: 4px;
}

a:visited { color: var(--black); }

:focus-visible {
  outline: 3px solid var(--black);
  outline-offset: 3px;
}

button:focus-visible, a:focus-visible {
  box-shadow: 0 0 0 6px var(--yellow);
}

[tabindex="-1"]:focus { outline: none; }

::selection {
  color: var(--black);
  background: var(--yellow);
}

input::placeholder, textarea::placeholder {
  color: var(--black);
  opacity: 1;
}

h1, h2, h3, p {
  margin: 0 0 14px;
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(1.5rem, 6vw, 2rem);
  line-height: 1.15;
}

h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
strong { font-weight: 700; }

#JOYELY-app, body > noscript > main {
  max-width: 660px;
  margin-inline: auto;
  padding:
    max(12px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
}

.brand-header {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wordmark {
  font-size: 1.15rem;
  letter-spacing: .07em;
}

.progress-marker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: 4px 0;
  font-weight: 700;
  cursor: default;
  user-select: none;
}

.progress-marker span {
  padding: 3px 5px;
  border-bottom: 3px solid var(--white);
}

.progress-marker span[aria-current="step"] {
  background: var(--yellow);
  border-bottom-color: var(--black);
}

.flow-navigation {
  min-height: 48px;
  display: flex;
  align-items: center;
}

.card {
  /*
   * The same four grid tracks are used by every screen, including TALK.
   * Long choices/copy scroll within their own slot; the acknowledgement
   * and action tracks never jump when an answer appears.
   */
  height: max(55rem, calc(100svh - 10rem));
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1.18fr) 6rem 8rem;
  gap: 14px;
  padding: 18px;
  border: 2px solid var(--black);
  border-radius: 22px;
  background: var(--white);
}

.slot {
  min-width: 0;
  min-height: 0;
}

.slot-copy,
.slot-input,
.slot-ack {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--black) var(--white);
  scrollbar-width: thin;
  scroll-padding-block: 8px;
}

.slot-copy { padding: 3px; }
.slot-input { padding: 5px; }

.slot-ack {
  padding: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.slot-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
}

.slot-actions > button { flex-shrink: 0; }

.step-label {
  font-weight: 700;
  letter-spacing: .07em;
  margin-bottom: 12px;
}

.chair {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: contain;
  margin: 0 auto 14px;
}

.chair.small { height: 64px; }

.memory {
  padding-left: 12px;
  border-left: 4px solid var(--yellow);
}

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

.choice {
  width: 100%;
  min-height: 48px;
  border-radius: 999px;
  text-align: left;
  background: var(--white);
}

.choice[aria-pressed="true"] {
  background: var(--yellow);
  font-weight: 700;
}

.choice[aria-pressed="true"]::before {
  content: "✓ ";
}

.text-field { margin-top: 12px; }

.text-field label,
.emotion-picker > label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

input[type="text"],
input[type="search"],
input[type="password"],
input[type="email"],
textarea,
select {
  width: 100%;
  min-height: 52px;
  border: 2px solid var(--black);
  border-radius: 12px;
  background: var(--white);
  color: var(--black);
  padding: 12px;
  caret-color: var(--black);
}

input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

textarea {
  display: block;
  min-height: 150px;
  resize: vertical;
}

.journal-field textarea { min-height: 260px; }

.measurement {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.measurement legend {
  padding: 0;
  margin-bottom: 4px;
  font-weight: 700;
}

.measurement p { margin-bottom: 2px; }

.scale-row {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) 1.5rem;
  align-items: center;
  gap: 8px;
}

.scale-row > span:last-child { text-align: right; }

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  height: 44px;
  margin: 0;
  padding: 0;
  background: var(--white);
  cursor: pointer;
  accent-color: var(--yellow);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border: 0;
  background: var(--black);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border: 0;
  background: var(--black);
}

input[type="range"]::-moz-range-progress {
  height: 4px;
  background: var(--black);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -10px;
  border: 2px solid var(--black);
  border-radius: 50%;
  background: var(--yellow);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 2px solid var(--black);
  border-radius: 50%;
  background: var(--yellow);
}

/* An untouched range has no visible selected thumb and records null. */
input[type="range"].untouched::-webkit-slider-thumb {
  visibility: hidden;
}

input[type="range"].untouched::-moz-range-thumb {
  visibility: hidden;
}

.anchors { margin: 0; }

.emotion-picker {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.emotion-picker > label { margin-bottom: 0; }

.emotion-options {
  flex: 1;
  min-height: 100px;
  overflow: auto;
  padding: 4px;
  overscroll-behavior: contain;
}

.emotion-picker > .choice,
.emotion-picker > input,
.emotion-picker > .text-field {
  flex-shrink: 0;
}

.emotion-picker .text-field { margin-top: 0; }

.results {
  font-variant-numeric: tabular-nums;
  margin-bottom: 24px;
}

.results p {
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.global-status {
  margin: 8px 0;
  padding: 10px;
  border: 2px solid var(--black);
}

.global-status:empty { display: none; }

.app-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
}

.app-footer p { margin: 0; }

.support-route {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  margin-block: 10px;
  border: 2px solid var(--black);
  border-radius: 12px;
}

dialog {
  width: min(600px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 22px;
  border: 2px solid var(--black);
  border-radius: 18px;
  color: var(--black);
  background: var(--white);
  overflow: auto;
}

dialog::backdrop { background: var(--white); }

body.support-open { overflow: hidden; }

.data-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.data-list > li {
  border-bottom: 2px solid var(--black);
  padding: 12px 0;
}

summary {
  min-height: 48px;
  padding: 8px 0;
  cursor: pointer;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
}

.bridge-copy a {
  display: inline-block;
  min-height: 44px;
  padding: 8px 4px;
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 359px) {
  .card { padding: 12px; gap: 10px; }
  .progress-marker { gap: 2px; }
  .progress-marker span { padding-inline: 3px; }
}

@media (min-width: 600px) {
  .card { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}