/*
 * The customer app. Always dark (it's used in a dark venue), on the JOYTECH tokens in joytech.css.
 * The signal buttons and the full-screen signal use each signal's own colours (--c, --t),
 * set from config; everything else is graphite and the BEACON violet.
 */

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

body { overscroll-behavior: none; font-size: 16px; }

button { font: inherit; color: inherit; }

/* ---------- home screen ---------- */

#app {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding:
    max(14px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex: none; border-radius: 9px; }
.brand h1 { margin: 0; font-size: 1.3rem; }
.brand p { margin: 3px 0 0; font-size: 0.8rem; color: var(--muted); }

.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--button-border);
  border-radius: 8px;
  background: var(--background);
  box-shadow: var(--elev-button);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--action); }
.icon-btn svg { width: 20px; height: 20px; }

.intro { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.4; }

/* ---------- home screen: this phone's BEACON, seat and location ---------- */

.status-row { display: flex; flex-wrap: wrap; gap: 8px; }

.pass-pill,
.where-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--button-border);
  border-radius: 8px;
  background: var(--background);
  color: var(--foreground);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  box-shadow: var(--elev-button);
  cursor: pointer;
}
.pass-pill {
  flex: 1 1 100%;
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  background: var(--success-tint);
  color: var(--success-ink);
  font-weight: 600;
  box-shadow: none;
}
.pass-pill.waiting { border-color: var(--button-border); background: var(--surface); color: var(--foreground); }
.pass-pill.warn { border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-tint); color: var(--warning-ink); }
.where-chip { flex: 1 1 auto; }
.where-chip:hover { border-color: var(--action); }
.where-chip.on { border-color: color-mix(in srgb, var(--success) 40%, transparent); color: var(--success-ink); }

/* The one thing to do before the show: activate. Styled as the primary button. */
.activate-chip {
  flex: 1 1 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(to bottom, rgb(255 255 255 / 0.12), rgb(255 255 255 / 0)), var(--action);
  color: var(--action-foreground);
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: var(--elev-button-primary);
  cursor: pointer;
}
.activate-chip:active { scale: 0.98; box-shadow: none; }

.alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--surface-border);
  border-left: 4px solid var(--c, var(--mark));
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--elev-card);
}
.ab-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ab-text strong { font-size: var(--text-title); font-weight: 600; color: var(--heading); }
.ab-text span { font-size: 0.85rem; color: var(--muted); }
.alert-banner.go .ab-text span { color: var(--success-ink); font-weight: 600; }
.ab-btn {
  flex: none;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--button-border);
  border-radius: 8px;
  background: var(--background);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- signal buttons ---------- */

.grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row { display: flex; gap: 10px; flex: 1 1 0; min-height: 128px; }
.row.compact { flex: 0 0 auto; min-height: 68px; }

@media (max-height: 760px) {
  .row { min-height: 108px; }
  .row.compact { min-height: 60px; }
}

.empty { color: var(--muted); text-align: center; margin: auto; }

.sig {
  position: relative;
  overflow: hidden;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  border: 0;
  border-radius: 16px;
  background: var(--c);
  color: var(--t);
  text-align: left;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: scale 0.12s ease;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 12px 28px -16px var(--c);
}
.sig:active,
.sig.holding { scale: 0.98; }
.sig:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.hold-fill {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.3);
  background: color-mix(in srgb, var(--t, #fff) 30%, transparent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.18s ease-out;
  pointer-events: none;
}
.holding .hold-fill {
  transform: scaleY(1);
  transition: transform var(--hold, 700ms) linear;
}

.sig-icon,
.sig-text { position: relative; }
.sig-icon { margin-bottom: auto; }
.sig-icon svg { display: block; width: 34px; height: 34px; }
.sig-text { display: flex; flex-direction: column; gap: 3px; }
.sig-label { font-size: 1.2rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.sig-desc { font-size: 0.78rem; font-weight: 500; line-height: 1.25; }

.sig .sig-hold {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 8px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sig.compact {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.sig.compact .sig-icon { margin: 0; }
.sig.compact .sig-icon svg { width: 28px; height: 28px; }
.sig.compact .sig-label { font-size: 1.02rem; }
.sig.compact .sig-hold { position: relative; top: auto; right: auto; margin-left: auto; flex: none; }

.foot { margin: 0; text-align: center; font-size: 0.8rem; color: var(--muted); }
.foot a { color: var(--foreground); font-weight: 600; }

/* ---------- full-screen signal ---------- */
/* Sits on the signal's own colour, so its overlays are black glass with white text, not tokens. */

.flare {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  background: #000;
  color: #fff;
  text-align: center;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.flare-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vmin;
  max-width: 100%;
}
.flare-icon svg { display: block; width: min(30vmin, 200px); height: min(30vmin, 200px); }
.flare.has-panel .flare-icon svg { width: min(20vmin, 140px); height: min(20vmin, 140px); }
.flare-text {
  margin: 0;
  max-width: 100%;
  font-size: var(--fs, 18vmin);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.flare.has-panel .flare-text { font-size: calc(var(--fs, 18vmin) * 0.82); }
.flare-label { margin: 0; font-size: clamp(1rem, 4.5vmin, 1.6rem); font-weight: 600; }
.flare-label:empty { display: none; }

.flare-hint {
  width: 100%;
  max-width: 440px;
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.35;
}

.flare-stop {
  --t: #fff;
  position: relative;
  flex: none;
  overflow: hidden;
  min-height: 48px;
  padding: 12px 28px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.flare-stop-label { position: relative; }

/* control room status on the signal screen */
.flare-panel {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  text-align: left;
}
.fp-status { margin: 0; font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.fp-status.ok { color: #7dd3b5; }
.fp-status.go { color: #7dd3b5; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.fp-status.warn { color: #f2c75c; }
.fp-status.done { color: #c3cad0; }
.fp-geo { margin: 0; font-size: 0.8rem; font-weight: 500; color: #9cc5ec; }
.fp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fp-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.fp-btn.primary { background: #fff; border-color: #fff; color: #0b0c0e; }

/* message from the control room */
.fp-message { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 10px 12px; border-radius: 8px; background: #fff; color: #0b0c0e; }
.fp-message span { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #5a646a; }
.fp-message strong { font-size: 1.1rem; font-weight: 600; line-height: 1.25; }

/* ---------- sheets ---------- */

dialog.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  margin: auto auto 0;
  padding: 22px 20px max(20px, env(safe-area-inset-bottom));
  border-width: 1px 0 0;
  border-radius: 16px 16px 0 0;
}
@media (min-width: 640px) {
  dialog.sheet { margin: auto; border-width: 1px; border-radius: 16px; }
}
dialog.sheet h2 { margin: 0 0 6px; font-size: 1.3rem; letter-spacing: -0.02em; }

.sheet-lede { margin: 0 0 14px; color: var(--muted); line-height: 1.4; font-size: 0.95rem; }
.sheet-lede:empty { display: none; }

#guideList { display: grid; gap: 10px; margin: 0 0 18px; padding-left: 1.3em; line-height: 1.4; font-size: 0.95rem; }

.sheet .btn { display: flex; width: 100%; min-height: 48px; margin-top: 10px; font-size: 1rem; }
.sheet .btn.quiet { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); font-size: 0.88rem; font-weight: 500; }

.sheet-actions { display: flex; gap: 10px; margin-top: 8px; }
.sheet-actions .btn { flex: 1; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.switch-row strong { font-weight: 600; color: var(--heading); }
.switch-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.82rem; line-height: 1.3; }
.switch-row input { flex: none; width: 24px; height: 24px; }

.status { margin: 14px 0 0; color: var(--muted); font-size: 0.85rem; }
.status:empty { display: none; }

.locate-preview {
  display: grid;
  place-items: center;
  height: 120px;
  margin: 4px 0 6px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  text-align: center;
  transition: background-color 0.2s, color 0.2s;
}

.field-label { display: block; margin: 14px 0 6px; color: var(--foreground); font-size: 0.85rem; font-weight: 500; }

.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch {
  width: 48px;
  height: 48px;
  border: 3px solid var(--raised);
  border-radius: 50%;
  outline: 2px solid var(--surface-border);
  cursor: pointer;
}
.swatch[aria-checked="true"] { outline: 3px solid var(--heading); }

.where-row { display: flex; gap: 10px; }
.where-row label { flex: 1; min-width: 0; }

.input,
#locateText { width: 100%; min-height: 48px; padding: 12px; font-size: 1rem; }
#locateText { text-transform: uppercase; }
select.input {
  appearance: none;
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

/* activation sheet */
.code-input { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600; letter-spacing: 0.12em; text-align: center; text-transform: uppercase; }
.code-input::placeholder { font-family: var(--font-sans); font-size: 1rem; font-weight: 400; letter-spacing: 0; text-transform: none; }
.pass-error { min-height: 1.3em; margin: 8px 0 0; color: var(--danger-ink); font-size: 0.9rem; font-weight: 500; }
.pass-facts { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.pass-facts li { padding: 11px 13px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface); line-height: 1.35; font-size: 0.95rem; }
.pass-facts li.good { border-color: color-mix(in srgb, var(--success) 40%, transparent); background: var(--success-tint); color: var(--success-ink); font-weight: 600; }
.pass-facts li.warn { border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: var(--warning-tint); color: var(--warning-ink); }
.geo-offer { margin: 0 0 6px; padding: 13px; border: 1px solid var(--surface-border); border-radius: 12px; }
.geo-offer p { margin: 0; line-height: 1.4; font-size: 0.95rem; }
.geo-offer strong { color: var(--heading); font-weight: 600; }
