/* Shared styles for every quiz screen. Colours, type, spacing and shapes come only
   from /design/tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--surface-000);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--ink-muted); }
.eyebrow {
  font-size: var(--t-label); line-height: var(--lh-label); font-weight: 700;
  letter-spacing: var(--track-label);
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.tick { width: 1em; height: 1em; flex: none; vertical-align: -0.12em; }

/* ---- Buttons: the 67deg cut on the right edge, fill painted on ::before so the
   focus ring isn't clipped ---- */
.btn {
  --cut: var(--btn-cut-md);
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) calc(var(--space-6) + var(--cut)) var(--space-2) var(--space-6);
  border: 0; background: none; cursor: pointer;
  color: var(--on-teal); font-weight: 500; text-align: center; text-decoration: none;
  border-radius: var(--radius-sm);
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--teal);
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%);
  transition: background var(--ease-fast);
}
.btn.secondary { color: var(--surface-000); }
.btn.secondary::before { background: var(--graphite); }
.btn:disabled { cursor: default; color: var(--ink-muted); }
.btn:disabled::before { background: var(--surface-200); }
.btn.tap { --cut: var(--btn-cut-tap); min-height: var(--tap-min); }
.btn.lg { --cut: var(--btn-cut-lg); min-height: calc(var(--space-16) + var(--space-2)); font-size: var(--t-lead); }
.btn.block { display: flex; width: 100%; }

.text-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-2);
  border: 0; background: none; cursor: pointer;
  color: var(--teal-ink); font-weight: 500; text-decoration: none;
}
.text-btn:disabled { color: var(--ink-muted); cursor: default; }

/* Plain bordered button for admin choices and danger actions */
.choice {
  min-height: 44px; padding: var(--space-2) var(--space-4);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-000); color: var(--ink); cursor: pointer; font-weight: 500;
  text-align: left;
}
.choice[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
.choice:disabled { color: var(--ink-muted); background: var(--surface-100); border-color: var(--line); cursor: default; }
.choice.danger { color: var(--danger); }

/* ---- Form fields ---- */
.field { display: grid; gap: var(--space-2); }
.field > span { font-weight: 500; }
.input {
  width: 100%; min-height: var(--tap-min); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-000); font-size: var(--t-body);
}
select.input {
  appearance: none; -webkit-appearance: none; padding-right: var(--space-12);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 6l5 5 5-5' fill='none' stroke='%231f2124' stroke-width='2' stroke-linecap='square'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--space-4) center; background-size: 16px;
}
textarea.input { min-height: 88px; resize: vertical; line-height: var(--lh-body); }
.form-error { color: var(--danger); font-weight: 500; }

/* ---- Letter badges: squares ---- */
.badge {
  display: inline-grid; place-items: center; flex: none;
  width: 2em; height: 2em;
  background: var(--graphite); color: var(--surface-000); font-weight: 600; line-height: 1;
}

/* ---- Connection bar ---- */
.conn {
  position: sticky; top: 0; z-index: 10;
  padding: var(--space-2) var(--space-4); padding-top: calc(var(--space-2) + env(safe-area-inset-top));
  background: var(--warning-surface); color: var(--ink); font-size: var(--t-small); line-height: var(--lh-small);
  font-weight: 500; text-align: center; border-bottom: 1px solid var(--line);
}

/* ---- Slim header (participant, admin) ---- */
.bar {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 56px; padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.bar img { height: 24px; width: auto; display: block; }
.bar .name { font-size: var(--t-small); line-height: var(--lh-small); font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.bar .right { margin-left: auto; font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-muted); white-space: nowrap; }

/* ---- Graphite band with the corner cut ---- */
.band { position: relative; overflow: hidden; background: var(--graphite); color: var(--on-graphite); }
.corner-cut { position: absolute; right: 0; bottom: 0; display: block; }

/* ---- Confirm dialog: never closes on an outside click; explicit close button ---- */
.modal {
  width: min(440px, calc(100vw - 2 * var(--space-4))); padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-000); color: var(--ink);
}
.modal::backdrop { background: rgb(31 33 36 / 0.55); }
.modal-head { display: flex; align-items: flex-start; gap: var(--space-4); padding: var(--space-4) var(--space-4) 0 var(--space-6); }
.modal-head h2 { font-size: var(--t-lead); line-height: var(--lh-lead); font-weight: 600; padding-top: var(--space-2); }
.modal-close {
  margin-left: auto; flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-sm); background: var(--danger); color: var(--surface-000); cursor: pointer;
}
.modal-body { padding: var(--space-2) var(--space-6) var(--space-6); color: var(--ink-muted); }
.modal-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); padding: 0 var(--space-6) var(--space-6); }
