/* Connect kiosk: the sign-up screen people use at events.
   Brand colours are set by kiosk.js as --brand, --brand-ink (text on brand), --brand-dark and --brand-tint. */

:root {
  --brand: #2F6FED;
  --brand-ink: #ffffff;
  --brand-dark: #1f55c4;
  --brand-tint: #eef3fe;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --line: #d0d5dd;
  --line-soft: #eaecf0;
  --bg: #f2f4f7;
  --surface: #ffffff;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body { font-size: 18px; line-height: 1.45; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: var(--brand-dark); }

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

/* ---------------------------------------------------------------- layout */

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) calc(20px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(20px + var(--safe-left));
}

.screen-brand {
  background: var(--bg);
  background: linear-gradient(180deg, var(--brand-tint) 0%, var(--bg) 70%);
}

.card {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 12px 32px -8px rgba(16, 24, 40, .12);
  padding: 40px 44px 36px;
}

.card-narrow { max-width: 520px; }

@media (max-width: 600px) {
  .screen { padding: calc(12px + var(--safe-top)) calc(12px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(12px + var(--safe-left)); justify-content: flex-start; }
  .card { padding: 28px 22px 24px; border-radius: 20px; }
}

/* ---------------------------------------------------------------- brand header */

.brand-head { margin-bottom: 28px; }
.brand-head .logo, .brand-head .wordmark { max-width: min(240px, calc(100% - 56px)); }

.logo {
  display: block;
  max-height: 72px;
  max-width: 240px;
  width: auto;
  height: auto;
  margin-bottom: 24px;
  object-fit: contain;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 24px;
}

.wordmark-badge {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand); color: var(--brand-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; letter-spacing: .02em;
}

h1 {
  font-size: clamp(30px, 4.6vw, 44px);
  line-height: 1.12;
  letter-spacing: -.02em;
  margin: 0 0 12px;
  font-weight: 800;
  color: var(--ink);
  text-wrap: balance;
}

.lead {
  font-size: clamp(18px, 2.4vw, 22px);
  color: var(--ink-2);
  margin: 0;
}

h2 { font-size: 24px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.01em; }
h3 { font-size: 18px; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }

/* ---------------------------------------------------------------- form */

.form { display: grid; gap: 20px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; gap: 20px; } }

.field { display: grid; gap: 8px; align-content: start; }
.field-label { font-weight: 650; font-size: 17px; color: var(--ink-2); }
.field-label .opt { font-weight: 400; color: var(--muted); }

.input {
  width: 100%;
  min-height: 62px;
  padding: 14px 18px;
  font-size: 20px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: #98a2b3; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px var(--danger-bg); }

.input-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 34px;
  letter-spacing: .35em;
  text-align: center;
  text-transform: uppercase;
  min-height: 76px;
  padding-left: .35em;
}

.field-error {
  display: flex; gap: 8px; align-items: flex-start;
  color: var(--danger); font-size: 16px; font-weight: 500;
}
.field-error svg { flex: none; margin-top: 2px; }

.suggest {
  background: var(--warn-bg); color: var(--ink-2); border-radius: 12px;
  padding: 10px 14px; font-size: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.suggest button {
  border: 0; background: none; color: var(--brand-dark); font-weight: 700; text-decoration: underline; padding: 6px 2px;
}

/* topics (tick boxes as big tappable cards) */
.choices { display: grid; gap: 12px; border: 0; padding: 0; margin: 0; min-width: 0; }
.choices legend { font-weight: 650; font-size: 17px; color: var(--ink-2); margin-bottom: 10px; padding: 0; }

.choice {
  position: relative;
  display: flex; align-items: flex-start; gap: 16px;
  padding: 18px 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
  user-select: none; -webkit-user-select: none;
}
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-box {
  flex: none; width: 32px; height: 32px; border-radius: 9px;
  border: 2px solid #98a2b3; background: #fff; color: var(--brand-ink);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .15s, border-color .15s;
}
.choice-box svg { opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s; }
.choice-text { font-size: 19px; line-height: 1.35; padding-top: 2px; color: var(--ink); }
.choice:has(input:checked), .choice.checked { border-color: var(--brand); background: var(--brand-tint); }
.choice input:checked + .choice-box { background: var(--brand); border-color: var(--brand); }
.choice input:checked + .choice-box svg { opacity: 1; transform: scale(1); }
.choice input:focus-visible + .choice-box { box-shadow: 0 0 0 4px var(--brand-tint); outline: 2px solid var(--brand); outline-offset: 2px; }
.choices[aria-invalid="true"] .choice { border-color: var(--danger); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 24px;
  border-radius: 14px; border: 2px solid transparent;
  font-size: 18px; font-weight: 700; text-decoration: none;
  transition: background-color .15s, transform .05s, border-color .15s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-xl { min-height: 70px; font-size: 22px; border-radius: 16px; }
.btn-brand { background: var(--brand); color: var(--brand-ink); }
.btn-brand:hover:not(:disabled) { background: var(--brand-dark); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #1d2939; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: #f9fafb; }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecdca; }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-link { background: none; border: 0; color: var(--muted); font-weight: 600; text-decoration: underline; min-height: 48px; font-size: 16px; }

.privacy { font-size: 15px; color: var(--muted); margin: 4px 0 0; line-height: 1.5; }
.privacy strong { color: var(--ink-2); font-weight: 600; overflow-wrap: anywhere; }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.35); border-top-color: currentColor;
  animation: spin .8s linear infinite;
}
.spinner-dark { border-color: rgba(16,24,40,.12); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- thank you */

.thanks { text-align: center; padding-top: 56px; padding-bottom: 48px; position: relative; overflow: hidden; }
.tick {
  width: 116px; height: 116px; margin: 0 auto 28px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  display: flex; align-items: center; justify-content: center;
  animation: pop .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
.tick path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .45s .25s ease-out forwards; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.thanks .lead { max-width: 30ch; margin: 0 auto 32px; }
.countdown { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--line-soft); }
.countdown span { display: block; height: 100%; background: var(--brand); transform-origin: left; animation: shrink linear forwards; }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------------------------------------------------------------- status pill (staff menu, press and hold) */

.status-pill {
  position: absolute;
  top: 14px;
  right: 14px;
  min-width: 40px; height: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; border: 1px solid var(--line-soft);
  background: #fff;
  font-size: 14px; font-weight: 600; color: var(--muted);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none;
  z-index: 5;
}
.card { position: relative; }
.status-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: #12b76a; flex: none; }
.status-pill.waiting .dot { background: #f79009; }
.status-pill.offline .dot { background: #98a2b3; }
.status-pill.problem .dot { background: #f04438; }
.status-pill .hold {
  position: absolute; inset: -3px; border-radius: 999px; pointer-events: none;
  border: 3px solid var(--ink); opacity: 0; clip-path: inset(0 100% 0 0);
}
.status-pill.holding .hold { opacity: .8; animation: hold 1.5s linear forwards; }
@keyframes hold { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* ---------------------------------------------------------------- staff screens */

.staff { background: #eef0f3; }
.staff .card { max-width: 600px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }

.stack { display: grid; gap: 14px; }
.stack-lg { display: grid; gap: 24px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.status-card {
  display: flex; gap: 16px; align-items: flex-start;
  border-radius: var(--radius); padding: 18px 20px;
  background: var(--ok-bg); color: var(--ok);
}
.status-card.waiting { background: var(--warn-bg); color: var(--warn); }
.status-card.problem { background: var(--danger-bg); color: var(--danger); }
.status-card .icon { flex: none; width: 40px; height: 40px; border-radius: 50%; background: currentColor; display: flex; align-items: center; justify-content: center; }
.status-card .icon svg { color: #fff; }
.status-card h2 { color: var(--ink); font-size: 21px; margin: 0 0 2px; }
.status-card p { color: var(--ink-2); margin: 0; font-size: 16px; }

.menu-list { display: grid; gap: 10px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 64px; padding: 12px 18px;
  border: 1px solid var(--line-soft); border-radius: 14px; background: #fff;
  text-align: left; font-size: 18px; font-weight: 600; color: var(--ink);
}
.menu-item:hover:not(:disabled) { background: #f9fafb; }
.menu-item:disabled { opacity: .5; cursor: not-allowed; }
.menu-item .mi-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; background: #f2f4f7; display: flex; align-items: center; justify-content: center; color: var(--ink-2); }
.menu-item .mi-text { flex: 1; display: grid; }
.menu-item .mi-sub { font-size: 14px; font-weight: 400; color: var(--muted); }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 15px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--ink-2); word-break: break-word; }

.details { border-top: 1px solid var(--line-soft); padding-top: 16px; }
.details summary { cursor: pointer; font-weight: 600; color: var(--ink-2); min-height: 44px; display: flex; align-items: center; justify-content: space-between; list-style: none; }
.details summary::-webkit-details-marker { display: none; }
.details summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -4px 6px 0 12px; transition: transform .15s; }
.details[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }

.notice {
  border-radius: 14px; padding: 14px 16px; font-size: 16px;
  background: #f2f4f7; color: var(--ink-2);
  display: flex; gap: 12px; align-items: flex-start;
}
.notice svg { flex: none; margin-top: 2px; }
.notice-warn { background: var(--warn-bg); color: #7a2e0e; }
.notice-error { background: var(--danger-bg); color: #7a271a; }
.notice-ok { background: var(--ok-bg); color: #054f31; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: flex; gap: 14px; align-items: flex-start; font-size: 18px; }
.steps li::before {
  content: counter(step); flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.inline-icon { display: inline-flex; vertical-align: -5px; padding: 2px 4px; border-radius: 6px; background: #f2f4f7; }

/* event chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  min-height: 40px; padding: 0 14px; font-size: 15px; font-weight: 600; color: var(--ink-2);
}
.chip:hover { background: #f9fafb; }

/* form choice (radio cards) for picking a form */
.option {
  display: flex; gap: 14px; align-items: center; padding: 16px 18px;
  border: 2px solid var(--line-soft); border-radius: 14px; cursor: pointer; background: #fff;
}
.option input { width: 22px; height: 22px; accent-color: var(--ink); }
.option:has(input:checked) { border-color: var(--ink); }

/* ---------------------------------------------------------------- PIN pad */

.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 20px 0 8px; min-height: 22px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #98a2b3; transition: background-color .1s; }
.pin-dots span.on { background: var(--ink); border-color: var(--ink); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.pin-msg { text-align: center; min-height: 26px; font-size: 16px; color: var(--danger); margin-bottom: 8px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 340px; margin: 0 auto; }
.key {
  height: 72px; border-radius: 18px; border: 1px solid var(--line-soft); background: #fff;
  font-size: 28px; font-weight: 600; color: var(--ink);
  box-shadow: 0 1px 2px rgba(16,24,40,.05);
  user-select: none; -webkit-user-select: none;
}
.key:active { background: #f2f4f7; }
.key-blank { visibility: hidden; }
.key-del { font-size: 16px; display: flex; align-items: center; justify-content: center; }

/* ---------------------------------------------------------------- modal */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .15s;
}
.modal { background: #fff; border-radius: 22px; padding: 28px; max-width: 460px; width: 100%; box-shadow: 0 24px 48px -12px rgba(16,24,40,.25); }
.modal .row { margin-top: 20px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }

/* ---------------------------------------------------------------- misc */

.center { text-align: center; }
.loading { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.platform-pill { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; font-weight: 600; color: var(--muted); background: #f2f4f7; border-radius: 999px; padding: 4px 12px; }
.divider { height: 1px; background: var(--line-soft); margin: 4px 0; }
.toast {
  position: fixed; left: 50%; top: calc(16px + var(--safe-top)); transform: translateX(-50%); width: max-content;
  background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 14px; font-size: 16px; font-weight: 600;
  box-shadow: 0 12px 24px -6px rgba(16,24,40,.3); z-index: 60; animation: rise .2s ease-out;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, -10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  .tick path { stroke-dashoffset: 0; }
}
