/* Queen Amara components. Needs tokens.css first. */

/* base */
.qa-root {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-ui);
  font-size: var(--fs-md);
  line-height: var(--lh-th-ui);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
.qa-root *, .qa-root *::before, .qa-root *::after { box-sizing: border-box; }
.qa-root :where(button, input, select, textarea) { font: inherit; color: inherit; }
.qa-root :where(img) { max-width: 100%; }
.qa-root :where(table) { color: inherit; font-size: inherit; font-weight: inherit; line-height: inherit; white-space: inherit; }
.qa-root [hidden] { display: none !important; }
.qa-root :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.qa-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Thai text: the browser breaks Thai by dictionary; keep it that way.
   .qa-ph keeps a short phrase on one line; use only inside p, h1-h3, label or a label span. */
.qa-ph { white-space: nowrap; }
.qa-prose { text-wrap: pretty; overflow-wrap: break-word; line-height: var(--lh-th-body); }
.qa-h { text-wrap: balance; line-height: var(--lh-th-head); }

/* type roles */
.qa-display { margin: 0; font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-display); line-height: var(--lh-th-head); text-wrap: balance; }
.qa-h1 { margin: 0; font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-3xl); line-height: var(--lh-th-head); text-wrap: balance; }
.qa-h2 { margin: 0; font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-2xl); line-height: var(--lh-th-head); text-wrap: balance; }
.qa-h3 { margin: 0; font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-xl); line-height: var(--lh-th-head); text-wrap: balance; }
.qa-body { margin: 0; font-size: var(--fs-md); line-height: var(--lh-th-body); text-wrap: pretty; }
.qa-voice { margin: 0; font-family: var(--f-th); font-weight: var(--fw-medium); font-size: var(--fs-lg); line-height: var(--lh-th-body); text-wrap: pretty; }
.qa-small { font-size: var(--fs-sm); line-height: var(--lh-th-ui); color: var(--text-muted); }
.qa-eyebrow { font-family: var(--f-roman); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--track-roman); text-transform: uppercase; color: var(--text-gold); }
.qa-roman { font-family: var(--f-roman); letter-spacing: 0.06em; }
.qa-num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.qa-muted { color: var(--text-muted); }
.qa-gold-text { color: var(--text-gold); }

.qa-rule { height: 1px; border: 0; margin: 0; background: var(--gold-rule); }
[data-theme="office"] .qa-rule { background: var(--line); }

/* materials */
.qa-mat-wall { background: var(--bg-mat); background-color: var(--bg); }
.qa-mat-panel { background: var(--surface-mat); background-color: var(--surface); }
.qa-mat-wool { background: var(--accent-mat); background-color: var(--accent); color: var(--text-on-red); }
.qa-mat-gold {
  background-color: #d9b25e;
  background-image: var(--tex-grain), var(--gold-face);
  background-size: var(--tex-grain-size), 100% 100%;
  background-blend-mode: soft-light, normal;
  color: var(--text-on-gold);
}
.qa-mat-marble { background: linear-gradient(rgba(252, 249, 243, 0.55), rgba(252, 249, 243, 0.55)), var(--tex-marble) 0 0 / var(--tex-marble-size); background-color: #efe8dc; color: #24100a; }

.qa-panel {
  background: var(--surface-mat); background-color: var(--surface);
  border: var(--border) solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2); padding: var(--sp-5);
}
[data-theme="office"] .qa-panel { border-radius: var(--r-md); }

/* buttons */
.qa-btn {
  appearance: none; position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); min-width: var(--tap); max-width: 100%;
  padding: 6px var(--sp-5); border-radius: var(--r-pill);
  border: var(--border) solid transparent; background: transparent; color: var(--text);
  font-family: var(--f-ui); font-weight: var(--fw-semibold); font-size: var(--fs-md); line-height: 1.35;
  text-align: center; text-decoration: none; cursor: pointer; user-select: none;
  touch-action: manipulation;
  transition: transform var(--dur-press) var(--ease-out), filter var(--dur-quick) var(--ease-out),
    background-color var(--dur-quick) var(--ease-out), border-color var(--dur-quick) var(--ease-out), box-shadow var(--dur-quick) var(--ease-out);
}
.qa-btn > svg { width: 20px; height: 20px; flex: 0 0 auto; }
.qa-btn:active, .qa-btn.is-pressed { transform: translateY(1px); }
.qa-btn[disabled], .qa-btn[aria-disabled="true"] { cursor: not-allowed; opacity: 0.5; transform: none; filter: saturate(0.4); }
.qa-btn--block { width: 100%; }
.qa-btn--lg { min-height: var(--tap-lg); padding-inline: var(--sp-8); font-size: var(--fs-lg); }

.qa-btn--gold {
  font-family: var(--f-th); font-size: var(--fs-lg); font-weight: var(--fw-semibold);
  color: var(--text-on-gold); border-color: #8a6420;
  background-color: #d9b25e;
  background-image: var(--tex-grain), var(--gold-face);
  background-size: var(--tex-grain-size), 100% 100%;
  background-blend-mode: soft-light, normal;
  box-shadow: var(--shadow-gold);
  overflow: hidden;
}
.qa-btn--gold::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 251, 235, 0.55) 50%, transparent 65%) -150% 0 / 250% 100% no-repeat;
  opacity: 0;
}
.qa-btn--gold:hover { filter: brightness(1.04); }
.qa-btn--gold:active, .qa-btn--gold.is-pressed {
  filter: brightness(0.93);
  box-shadow: inset 0 2px 6px rgba(70, 40, 5, 0.45), 0 2px 6px -4px rgba(0, 0, 0, 0.8);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .qa-btn--gold:hover::after { opacity: 1; animation: qa-sheen 1.4s var(--ease-in-out) 1; }
}
@keyframes qa-sheen { from { background-position: -150% 0; } to { background-position: 250% 0; } }

.qa-btn--outline { border-color: var(--line-strong); background: var(--surface-glass); color: var(--text); }
.qa-btn--outline:hover { border-color: var(--qa-gold); background-color: var(--surface-2); }
.qa-btn--outline:active, .qa-btn--outline.is-pressed { background-color: var(--surface-2); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35); }

.qa-btn--ghost { color: var(--text); font-weight: var(--fw-medium); }
.qa-btn--ghost:hover { background-color: color-mix(in srgb, var(--text) 8%, transparent); }
.qa-btn--ghost:active, .qa-btn--ghost.is-pressed { background-color: color-mix(in srgb, var(--text) 14%, transparent); }

.qa-btn--red {
  color: var(--text-on-red); border-color: rgba(217, 178, 94, 0.7);
  background: var(--accent-mat); background-color: var(--accent);
  box-shadow: var(--shadow-2);
}
.qa-btn--red:hover { filter: brightness(1.08); }
.qa-btn--red:active, .qa-btn--red.is-pressed { filter: brightness(0.9); box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5); }
[data-theme="office"] .qa-btn--red { border-color: transparent; box-shadow: var(--shadow-1); border-radius: var(--r-sm); }
[data-theme="office"] .qa-btn--red:hover { background: var(--accent-hover); filter: none; }

.qa-btn--danger { color: var(--danger); border-color: currentColor; background: transparent; }
.qa-btn--danger:hover { background: var(--danger-bg); }
[data-theme="office"] .qa-btn--outline, [data-theme="office"] .qa-btn--ghost, [data-theme="office"] .qa-btn--danger { border-radius: var(--r-sm); }
[data-theme="office"] .qa-btn--outline { background: var(--surface); }

.qa-iconbtn {
  appearance: none; position: relative; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-width: var(--tap); height: var(--tap); padding: 0; border-radius: var(--r-pill);
  border: var(--border) solid var(--line-strong); background: var(--surface-glass); color: var(--text);
  cursor: pointer; transition: background-color var(--dur-quick), border-color var(--dur-quick), transform var(--dur-press);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.qa-iconbtn svg { width: 20px; height: 20px; flex: 0 0 auto; }
.qa-iconbtn:hover { border-color: var(--qa-gold); }
.qa-iconbtn:active { transform: translateY(1px); }
.qa-iconbtn[aria-pressed="true"] { border-color: var(--qa-gold); background-color: color-mix(in srgb, var(--qa-gold) 22%, var(--surface-glass)); box-shadow: inset 0 0 0 1px var(--qa-gold); }
.qa-iconbtn--label { padding: 0 var(--sp-4) 0 var(--sp-3); font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap; }
@media (max-width: 599px), (max-height: 500px) {
  .qa-iconbtn--label { width: var(--tap); padding: 0; }
  .qa-iconbtn--label .qa-iconbtn__text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

.qa-btnrow { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.qa-btnrow--end { justify-content: flex-end; }
.qa-btnrow--stack { flex-direction: column; align-items: stretch; }

/* stage: the room plate behind UI */
.qa-stage {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--r-lg); border: var(--border) solid var(--line);
  min-height: 600px; background: #0b0403;
}
.qa-stage__plate { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; z-index: 0; }
.qa-stage__plate--day { display: none; }
[data-theme="light"] .qa-stage__plate--night { display: none; }
[data-theme="light"] .qa-stage__plate--day { display: block; }
.qa-stage::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: linear-gradient(180deg, rgba(10, 2, 1, 0.55), rgba(10, 2, 1, 0) 18%, rgba(10, 2, 1, 0) 50%, rgba(10, 2, 1, 0.78)); }
[data-theme="light"] .qa-stage::after { background: linear-gradient(180deg, rgba(40, 18, 8, 0.35), rgba(40, 18, 8, 0) 18%, rgba(40, 18, 8, 0) 55%, rgba(40, 18, 8, 0.6)); }
.qa-stage > :where(:not(img)) { position: relative; z-index: 1; }

.qa-topbar {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: nowrap;
  padding: max(10px, var(--safe-t)) var(--gut-r) var(--sp-3) var(--gut-l);
}
.qa-topbar__logo { display: block; flex: 0 1 auto; min-width: 64px; width: clamp(88px, 20vw, 150px); height: auto; margin-right: auto; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.85)); }
.qa-stage .qa-topbar { position: absolute; top: 0; left: 0; right: 0; }

.qa-dock {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--gut-r) var(--safe-b) var(--gut-l);
}

/* deck chooser */
.qa-decks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); width: min(660px, 100%); }
@media (max-width: 559px) { .qa-decks { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); } }
.qa-deck {
  appearance: none; position: relative; min-width: 0; min-height: var(--tap-lg);
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-2); text-align: left; cursor: pointer;
  border-radius: var(--r-md); border: var(--border) solid rgba(217, 178, 94, 0.6);
  background: var(--accent-mat); background-color: var(--accent); color: var(--text-on-red);
  box-shadow: var(--shadow-2);
  transition: transform var(--dur-quick) var(--ease-out), box-shadow var(--dur-quick), border-color var(--dur-quick);
}
.qa-deck:hover { border-color: var(--qa-gold); }
.qa-deck:active { transform: translateY(1px); }
.qa-deck[aria-checked="true"] { border-color: var(--qa-gold-hi); box-shadow: inset 0 0 0 1px var(--qa-gold-hi), 0 0 0 1px rgba(242, 216, 152, 0.4), 0 12px 30px -12px #000; }
.qa-deck__back { width: 40px; height: auto; aspect-ratio: 4 / 7; object-fit: cover; border-radius: 4px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6); }
.qa-deck__text { display: grid; gap: 2px; min-width: 0; }
.qa-deck__title { font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-lg); line-height: 1.35; color: #fff4dc; }
.qa-deck__sub { font-size: var(--fs-xs); line-height: 1.5; color: #f0dcb4; }
.qa-deck__mark { position: absolute; top: 6px; right: 8px; width: 20px; height: 20px; color: var(--qa-gold-hi); opacity: 0; }
.qa-deck[aria-checked="true"] .qa-deck__mark { opacity: 1; }
.qa-deck[aria-checked="true"] .qa-deck__text { padding-right: 18px; }

/* segmented control and spread chooser */
.qa-seg {
  display: inline-flex; flex-wrap: nowrap; gap: 3px; padding: 3px; max-width: 100%;
  border-radius: var(--r-pill); border: var(--border) solid var(--line-strong); background: var(--surface-glass);
}
.qa-seg__opt { position: relative; flex: 1 1 0; min-width: 0; display: flex; }
.qa-seg__opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.qa-seg__opt span {
  flex: 1 1 auto; display: grid; place-items: center; align-content: center; gap: 0;
  min-height: var(--tap); min-width: 0; padding: 4px var(--sp-4); border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 1.3; text-align: center; color: var(--text-muted);
  transition: background-color var(--dur-quick), color var(--dur-quick);
}
.qa-seg__opt small { display: block; font-size: var(--fs-2xs); font-weight: 400; opacity: 0.92; }
.qa-seg__opt input:checked + span { background: var(--accent-mat); background-color: var(--accent); color: var(--text-on-red); box-shadow: inset 0 0 0 1px rgba(242, 216, 152, 0.55); }
.qa-seg__opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.qa-seg__opt:hover span { color: var(--text); }
.qa-seg__opt input:checked:hover + span { color: var(--text-on-red); }
.qa-seg--spread .qa-seg__opt span { border-radius: 18px; padding-inline: var(--sp-3); }
.qa-seg--spread { border-radius: 22px; width: min(520px, 100%); }
[data-theme="office"] .qa-seg { border-radius: var(--r-sm); background: var(--surface-2); border-color: var(--line); }
[data-theme="office"] .qa-seg__opt span { border-radius: 6px; }

/* chips */
.qa-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.qa-chip {
  appearance: none; min-height: var(--tap); padding: 0 var(--sp-4); border-radius: var(--r-pill); cursor: pointer;
  border: var(--border) solid var(--line-strong); background: var(--surface-glass); color: var(--text);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.qa-chip[aria-pressed="true"] { background: var(--accent-mat); background-color: var(--accent); color: var(--text-on-red); border-color: var(--qa-gold); }

/* form fields */
.qa-field { display: grid; gap: 6px; min-width: 0; }
.qa-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted); }
.qa-help { font-size: var(--fs-xs); color: var(--text-faint); line-height: 1.5; }
.qa-error { font-size: var(--fs-xs); color: var(--danger); line-height: 1.5; font-weight: var(--fw-medium); }
.qa-input, .qa-select, .qa-textarea {
  width: 100%; min-width: 0; min-height: var(--tap); padding: 9px 14px;
  border-radius: var(--r-sm); border: var(--border) solid var(--line-strong); background: var(--field); color: var(--text);
  font-size: 16px; line-height: 1.5;
  transition: border-color var(--dur-quick), box-shadow var(--dur-quick);
}
.qa-textarea { min-height: 96px; resize: vertical; font-family: var(--f-th); font-size: var(--fs-lg); line-height: 1.6; }
.qa-input::placeholder, .qa-textarea::placeholder { color: var(--text-faint); opacity: 1; }
.qa-input:focus-visible, .qa-select:focus-visible, .qa-textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.qa-field.is-invalid .qa-input, .qa-field.is-invalid .qa-textarea, .qa-field.is-invalid .qa-select { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.qa-select {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}
.qa-field__row { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: baseline; flex-wrap: wrap; }
.qa-counter { font-size: var(--fs-xs); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.qa-otp { font-family: var(--f-num); font-size: 26px; letter-spacing: 0.4em; text-align: center; padding-inline: 0.4em 0; font-variant-numeric: tabular-nums; }

.qa-check { display: flex; align-items: flex-start; gap: var(--sp-3); min-height: var(--tap); padding: 10px 0; cursor: pointer; font-size: var(--fs-md); line-height: 1.5; }
.qa-check input { width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--accent); }
.qa-switch { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); min-height: var(--tap); cursor: pointer; }
.qa-switch__track { position: relative; flex: 0 0 auto; width: 52px; height: var(--tap); border: 0; padding: 0; background: transparent; cursor: pointer; }
.qa-switch__track::before { content: ""; position: absolute; left: 2px; right: 2px; top: 8px; height: 28px; border-radius: 14px; background: var(--line-strong); transition: background-color var(--dur-quick); }
.qa-switch__track::after { content: ""; position: absolute; top: 11px; left: 5px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); transition: transform var(--dur-quick) var(--ease-out); }
.qa-switch__track[aria-checked="true"]::before { background: var(--accent); }
.qa-switch__track[aria-checked="true"]::after { transform: translateX(20px); }

/* captions over the room */
.qa-caption { display: flex; justify-content: center; padding: 0 var(--gut-r) 0 var(--gut-l); pointer-events: none; transition: opacity var(--dur-fade) var(--ease-out); }
.qa-caption p { margin: 0; max-width: 40rem; text-align: center; font-family: var(--f-th); font-weight: var(--fw-medium); font-size: clamp(16px, 0.9vw + 11px, 20px); line-height: 1.7; text-wrap: balance; }
.qa-caption span { background: rgba(14, 3, 2, 0.74); color: #fbf1e1; padding: 3px 10px; border-radius: var(--r-xs); -webkit-box-decoration-break: clone; box-decoration-break: clone; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }

/* timer pill and credit chip */
.qa-credit, .qa-timer {
  display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-4) 0 var(--sp-2);
  border-radius: var(--r-pill); border: var(--border) solid var(--line-strong); background: var(--surface-glass); color: var(--text);
  font-weight: var(--fw-semibold); font-size: var(--fs-sm); white-space: nowrap;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
button.qa-credit { appearance: none; cursor: pointer; }
.qa-credit__coin { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; background-image: var(--tex-grain), var(--gold-logo); background-size: var(--tex-grain-size), 100% 100%; background-blend-mode: soft-light, normal; box-shadow: inset 0 0 0 2px rgba(122, 87, 22, 0.75), inset 0 0 0 4px rgba(255, 241, 194, 0.55), 0 1px 3px rgba(0, 0, 0, 0.6); }
.qa-credit b, .qa-timer b { font-family: var(--f-num); font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
@media (max-width: 359px) { .qa-timer__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
.qa-timer__ring { width: 28px; height: 28px; flex: 0 0 auto; transform: rotate(-90deg); }
.qa-timer__ring circle { fill: none; stroke-width: 3; }
.qa-timer__ring .track { stroke: rgba(217, 178, 94, 0.25); }
.qa-timer__ring .left { stroke: var(--qa-gold); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.qa-timer.is-low { background: var(--accent-mat); background-color: var(--accent); color: var(--text-on-red); border-color: var(--qa-gold-hi); }
.qa-timer.is-low .qa-timer__ring .left { stroke: var(--qa-gold-hi); }
@media (prefers-reduced-motion: no-preference) {
  .qa-timer.is-low { animation: qa-breathe 2.4s var(--ease-in-out) infinite; }
}
@keyframes qa-breathe { 50% { box-shadow: 0 0 0 4px rgba(242, 216, 152, 0.25), 0 0 18px rgba(196, 46, 34, 0.55); } }

/* banner for timed notices */
.qa-banner {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  border: var(--border) solid var(--line-strong); background: var(--surface-glass); color: var(--text);
  box-shadow: var(--shadow-2); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.qa-banner__text { flex: 1 1 14em; min-width: 0; margin: 0; font-size: var(--fs-md); line-height: 1.5; }
.qa-banner__text b { font-family: var(--f-th); font-size: var(--fs-lg); }
.qa-banner--warn { border-color: var(--qa-gold-hi); }

/* card meaning reveal */
.qa-reveal { display: grid; gap: var(--sp-5); align-items: start; }
.qa-reveal__card { margin: 0; justify-self: center; width: min(240px, 62vw); }
.qa-reveal__card img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 5; object-fit: cover; border-radius: 10px; border: 3px solid transparent; background: var(--gold-logo) border-box; box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.9); }
.qa-reveal__card.is-reversed img { transform: rotate(180deg); }
.qa-reveal__body { display: grid; gap: var(--sp-3); min-width: 0; }
.qa-reveal__pos { font-size: var(--fs-sm); color: var(--text-gold); font-weight: var(--fw-medium); }
.qa-reveal__name { margin: 0; font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-2xl); line-height: var(--lh-th-head); }
.qa-reveal__latin { font-family: var(--f-roman); font-size: var(--fs-sm); letter-spacing: var(--track-roman); color: var(--text-muted); }
@media (min-width: 600px) {
  .qa-reveal { grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: var(--sp-8); }
  .qa-reveal__card { width: 100%; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .qa-reveal { grid-template-columns: auto minmax(0, 1fr); }
  .qa-reveal__card { width: auto; }
  .qa-reveal__card img { width: auto; max-height: 70svh; }
}

/* badges */
.qa-badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: var(--fw-semibold); line-height: 1.4; white-space: nowrap;
  border: var(--border) solid currentColor; background: transparent; color: var(--text-muted);
}
.qa-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.qa-badge--plain::before { display: none; }
.qa-badge--ok { color: var(--ok); background: var(--ok-bg); }
.qa-badge--warn { color: var(--warn); background: var(--warn-bg); }
.qa-badge--danger { color: var(--danger); background: var(--danger-bg); }
.qa-badge--info { color: var(--info); background: var(--info-bg); }
.qa-badge--gold { color: var(--text-on-gold); border-color: #8a6420; background-image: var(--tex-grain), var(--gold-face); background-size: var(--tex-grain-size), 100% 100%; background-blend-mode: soft-light, normal; }
.qa-badge--gold::before { display: none; }
[data-theme="office"] .qa-badge { border-color: transparent; }

/* sheet: bottom sheet on phones, dialog on tablets, side panel on desktop or short screens */
.qa-sheet-wrap {
  position: fixed; inset: 0; z-index: var(--z-sheet);
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--backdrop); overscroll-behavior: contain;
  animation: qa-fade var(--dur-panel) var(--ease-out);
}
.qa-sheet {
  position: relative; width: 100%; max-width: var(--sheet-max);
  max-height: calc(var(--vh-full) - var(--safe-t) - 24px); overflow: auto; overscroll-behavior: contain;
  background: var(--sheet-mat); background-color: var(--surface-sheet); color: var(--text);
  border: var(--border) solid var(--line-strong); border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-3);
  padding: var(--sp-6) var(--gut-r) calc(var(--safe-b) + var(--sp-2)) var(--gut-l);
  display: grid; gap: var(--sp-4); align-content: start;
  animation: qa-rise var(--dur-panel) var(--ease-sheet);
}
.qa-sheet::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line-strong); opacity: 0.6; }
.qa-sheet__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-3); align-items: start; }
.qa-sheet__title { margin: 0; font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-xl); line-height: var(--lh-th-head); text-wrap: balance; }
.qa-sheet__note { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.6; text-wrap: pretty; }
.qa-sheet__foot { display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: flex-end; }
@media (min-width: 600px) and (min-height: 501px) {
  .qa-sheet-wrap { align-items: center; padding: var(--sp-6); }
  .qa-sheet { border-radius: var(--r-lg); border-bottom: var(--border) solid var(--line-strong); padding: var(--sp-8); max-height: calc(var(--vh-full) - 48px); animation-name: qa-pop; }
  .qa-sheet::before { display: none; }
}
@media (min-width: 1024px) and (min-height: 501px) {
  .qa-sheet-wrap--side { justify-content: flex-end; align-items: stretch; padding: 0; }
  .qa-sheet-wrap--side .qa-sheet { max-width: var(--side-max); max-height: none; height: 100%; border-radius: 0; border-width: 0 0 0 var(--border); padding-top: max(var(--sp-8), var(--safe-t)); animation-name: qa-slide; }
}
@media (max-height: 500px) {
  .qa-sheet-wrap { justify-content: flex-end; align-items: stretch; }
  .qa-sheet { max-width: min(var(--side-max), 100% - 48px); max-height: none; height: 100%; border-radius: 0; border-width: 0 0 0 var(--border); padding: max(var(--sp-4), var(--safe-t)) max(var(--sp-5), env(safe-area-inset-right, 0px)) var(--sp-4) var(--sp-5); animation-name: qa-slide; }
  .qa-sheet::before { display: none; }
}
[data-theme="office"] .qa-sheet { border-color: var(--line); }
@keyframes qa-fade { from { opacity: 0; } }
@keyframes qa-rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes qa-pop { from { transform: scale(0.97); opacity: 0; } }
@keyframes qa-slide { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .qa-sheet-wrap, .qa-sheet { animation-duration: 120ms; animation-name: qa-fade; }
}
.qa-sheet--demo { position: relative; animation: none; max-height: none; overflow: visible; border-radius: var(--r-lg); border-bottom: var(--border) solid var(--line-strong); padding: var(--sp-6) var(--sp-4); max-width: 100%; }
.qa-sheet--demo::before { display: none; }

/* login: provider buttons keep each provider's own look; only the frame is themed */
.qa-auth { display: grid; gap: var(--sp-3); }
.qa-auth__or { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--sp-3); color: var(--text-muted); font-size: var(--fs-sm); }
.qa-auth__or::before, .qa-auth__or::after { content: ""; height: 1px; background: var(--line); }
.qa-auth__terms { margin: 0; font-size: var(--fs-xs); line-height: 1.6; color: var(--text-faint); text-align: center; text-wrap: pretty; }
.qa-auth__terms a { color: var(--text-muted); text-underline-offset: 2px; }
.qa-auth__frame { padding: var(--sp-3); border-radius: var(--r-md); border: var(--border) solid var(--line); background: color-mix(in srgb, var(--bg) 40%, transparent); display: grid; gap: var(--sp-3); }

.prov-btn {
  appearance: none; position: relative; display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: var(--tap); margin: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.prov-btn--line {
  background: #06C755; color: #ffffff; border: 0; border-radius: 6px; padding: 0 16px 0 60px;
  font-family: Helvetica, Arial, var(--f-ui); font-weight: 700; font-size: 15px;
}
.prov-btn--line .prov-btn__icon { position: absolute; left: 0; top: 0; bottom: 0; width: 44px; display: flex; align-items: center; justify-content: center; border-right: 1px solid rgba(0, 0, 0, 0.08); }
.prov-btn--line .prov-btn__icon img { width: 30px; height: 30px; }
.prov-btn--line:hover { background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), #06C755; }
.prov-btn--line:active { background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), #06C755; }
.prov-btn--google {
  background: #FFFFFF; color: #1F1F1F; border: 1px solid #747775; border-radius: 4px; padding: 0 12px;
  font-family: "Google Sans", Roboto, Arial, var(--f-ui); font-weight: 500; font-size: 14px; line-height: 20px; letter-spacing: 0.25px;
}
.prov-btn--google:hover { background: linear-gradient(rgba(48, 48, 48, 0.08), rgba(48, 48, 48, 0.08)), #FFFFFF; }
.prov-btn--google:active { background: linear-gradient(rgba(48, 48, 48, 0.12), rgba(48, 48, 48, 0.12)), #FFFFFF; }
.prov-btn--google-dark { background: #131314; color: #E3E3E3; border: 1px solid #8E918F; }
.prov-btn--google-dark:hover { background: linear-gradient(rgba(227, 227, 227, 0.08), rgba(227, 227, 227, 0.08)), #131314; }
.prov-btn__g { width: 20px; height: 20px; flex: 0 0 auto; margin-right: 0; }
.prov-btn--apple {
  border-radius: 6px; padding: 0 16px; border: 1px solid #000; background: #000; color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, var(--f-ui); font-weight: 500; font-size: 19px;
}
.prov-btn--apple-white { background: #fff; color: #000; border-color: #fff; }
.prov-btn--apple-outline { background: #fff; color: #000; border-color: #000; }
.prov-btn__apple { width: 15px; height: 18px; flex: 0 0 auto; }
.prov-btn--phone { border-radius: 6px; }
.prov-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
/* night frame takes the white Apple button, day frame the black one, per Apple's guidance */
.qa-apple-day { display: none; }
[data-theme="light"] .qa-apple-day, [data-theme="office"] .qa-apple-day { display: flex; }
[data-theme="light"] .qa-apple-night, [data-theme="office"] .qa-apple-night { display: none; }

/* wallet */
.qa-packs-box { container-type: inline-size; min-width: 0; }
.qa-packs { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); padding-top: 10px; }
@container (min-width: 440px) { .qa-packs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 640px) { .qa-packs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (min-width: 900px) { .qa-packs { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.qa-pack { position: relative; display: flex; min-width: 0; }
.qa-pack input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.qa-pack__face {
  flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 var(--sp-3); align-items: center; min-width: 0; min-height: 64px;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); text-align: left;
  border: var(--border) solid var(--line-strong); background: var(--surface-glass); color: var(--text);
  transition: border-color var(--dur-quick), box-shadow var(--dur-quick), transform var(--dur-quick);
}
.qa-pack__name { font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-lg); line-height: 1.35; }
.qa-pack__mins { grid-column: 1; font-size: var(--fs-sm); line-height: 1.5; color: var(--text-muted); }
.qa-pack__price { grid-column: 2; grid-row: 1 / span 2; font-family: var(--f-num); font-weight: var(--fw-semibold); font-size: var(--fs-lg); color: var(--text-gold); font-variant-numeric: tabular-nums; }
.qa-pack__per { grid-column: 1; font-size: var(--fs-xs); color: var(--text-faint); }
.qa-pack__tag { grid-column: 1; justify-self: start; margin-top: 4px; }
.qa-pack__ribbon { position: absolute; top: -10px; right: 12px; z-index: 1; pointer-events: none; }
@container (min-width: 440px) {
  .qa-pack__face { grid-template-columns: minmax(0, 1fr); text-align: center; justify-items: center; align-content: start; min-height: 132px; padding-top: var(--sp-5); }
  .qa-pack__price, .qa-pack__mins, .qa-pack__per, .qa-pack__tag { grid-column: 1; grid-row: auto; justify-self: center; }
  .qa-pack__ribbon { right: auto; left: 50%; transform: translateX(-50%); }
}
.qa-pack input:checked + .qa-pack__face { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel), var(--shadow-2); background-color: var(--surface-2); }
.qa-pack input:focus-visible + .qa-pack__face { outline: 2px solid var(--focus); outline-offset: 2px; }
.qa-pack:hover .qa-pack__face { border-color: var(--qa-gold); }

.qa-methods { display: grid; gap: var(--sp-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.qa-method { position: relative; display: flex; }
.qa-method input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.qa-method__face {
  flex: 1 1 auto; min-width: 0; min-height: 60px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px var(--sp-3);
  padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-3); border-radius: var(--r-md);
  border: var(--border) solid var(--line-strong); background: var(--surface-glass);
}
.qa-method__dot { grid-row: span 2; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); }
.qa-method__name { font-weight: var(--fw-semibold); font-size: var(--fs-md); line-height: 1.4; }
.qa-method__sub { font-size: var(--fs-xs); color: var(--text-faint); line-height: 1.4; }
.qa-method input:checked + .qa-method__face { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel); }
.qa-method input:checked + .qa-method__face .qa-method__dot { border-color: var(--sel); background: radial-gradient(circle, var(--sel) 0 4px, transparent 5px); }
.qa-method input:focus-visible + .qa-method__face { outline: 2px solid var(--focus); outline-offset: 2px; }

.qa-qr { display: grid; gap: var(--sp-4); justify-items: center; text-align: center; }
.qa-qr__card { width: min(280px, 100%); border-radius: var(--r-md); overflow: hidden; background: #fff; color: #111; box-shadow: var(--shadow-3); }
.qa-qr__head { background: #f3efe8; color: #3b2a1e; padding: 8px 12px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); border-bottom: 1px solid #e2d8c8; }
.qa-qr__img { display: block; width: 100%; height: auto; padding: 8px 16px 0; }
.qa-qr__meta { padding: 4px 16px 14px; display: grid; gap: 2px; font-size: var(--fs-sm); color: #333; }
.qa-qr__amount { font-family: var(--f-num); font-weight: 600; font-size: 24px; color: #111; font-variant-numeric: tabular-nums; }
.qa-qr__sample { position: static; margin: 0 0 12px; }
.qa-wait { display: inline-flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); }

.qa-result { display: grid; gap: var(--sp-3); justify-items: center; text-align: center; padding: var(--sp-6) var(--sp-4); }
.qa-result__seal { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background-image: var(--tex-grain), var(--gold-logo); background-size: var(--tex-grain-size), 100% 100%; background-blend-mode: soft-light, normal; box-shadow: inset 0 0 0 3px rgba(122, 87, 22, 0.7), inset 0 0 0 6px rgba(255, 241, 194, 0.5), var(--shadow-2); color: #3a2405; }
.qa-result__seal svg { width: 34px; height: 34px; }
.qa-result__seal--fail { background: var(--accent-mat); background-color: var(--accent); color: var(--qa-gold-hi); box-shadow: inset 0 0 0 3px rgba(217, 178, 94, 0.7), var(--shadow-2); }
.qa-result__big { font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-2xl); line-height: 1.3; }

/* closing state when credit runs out */
.qa-closing { display: grid; gap: var(--sp-4); justify-items: center; text-align: center; max-width: 30rem; margin-inline: auto; padding: var(--sp-6) var(--sp-5); border-radius: var(--r-lg); background: rgba(14, 3, 2, 0.8); border: var(--border) solid var(--line-strong); color: #fbf1e1; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.qa-closing { --text-gold: #ecc977; }
[data-theme="light"] .qa-closing { background: rgba(251, 246, 238, 0.92); color: #24100a; --text-gold: #6e4c12; }
.qa-closing .qa-voice { font-size: var(--fs-xl); }

/* loading, empty, error */
.qa-lamp { width: 72px; height: 96px; border-radius: 36px; overflow: hidden; flex: 0 0 auto; background: #120604 var(--tex-flame) 0 0 / auto 100% no-repeat; -webkit-mask: radial-gradient(closest-side, #000 62%, transparent); mask: radial-gradient(closest-side, #000 62%, transparent); }
.qa-lamp--sm { width: 30px; height: 40px; border-radius: 15px; }
@media (prefers-reduced-motion: no-preference) {
  .qa-lamp { animation: qa-flame 8s steps(63) infinite; }
}
@keyframes qa-flame { to { background-position: 100% 0; } }
.qa-state { display: grid; gap: var(--sp-3); justify-items: center; text-align: center; padding: var(--sp-8) var(--sp-4); }
.qa-state__title { margin: 0; font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-xl); line-height: 1.4; }
.qa-state__text { margin: 0; max-width: 26em; color: var(--text-muted); line-height: 1.7; text-wrap: pretty; }
.qa-state__backs { position: relative; width: 120px; height: 110px; }
.qa-state__backs img { position: absolute; top: 0; width: 56px; aspect-ratio: 4 / 7; height: auto; border-radius: 4px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6); }
.qa-state__backs img:nth-child(1) { left: 12px; transform: rotate(-9deg); }
.qa-state__backs img:nth-child(2) { left: 50px; transform: rotate(7deg); }
.qa-skel { display: grid; gap: 10px; width: 100%; }
.qa-skel i { display: block; height: 12px; border-radius: 6px; background: color-mix(in srgb, var(--qa-gold) 16%, transparent); position: relative; overflow: hidden; }
.qa-skel i:nth-child(2) { width: 82%; }
.qa-skel i:nth-child(3) { width: 64%; }
.qa-skel i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(246, 226, 160, 0.35) 50%, transparent 70%) -100% 0 / 200% 100% no-repeat; }
@media (prefers-reduced-motion: no-preference) {
  .qa-skel i::after { animation: qa-shimmer 2.2s var(--ease-in-out) infinite; }
}
@keyframes qa-shimmer { to { background-position: 200% 0; } }

/* toast and tooltip */
.qa-toasts { position: fixed; z-index: var(--z-toast); top: max(72px, calc(var(--safe-t) + 60px)); left: 50%; transform: translateX(-50%); width: min(420px, calc(100vw - 32px)); display: grid; gap: var(--sp-2); pointer-events: none; }
.qa-toast {
  pointer-events: auto; display: flex; align-items: center; gap: var(--sp-3); min-width: 0;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  border: var(--border) solid var(--line-strong); border-left-width: 4px;
  background: var(--surface-sheet); color: var(--text); box-shadow: var(--shadow-3);
  font-size: var(--fs-sm); line-height: 1.5;
}
.qa-toast p { margin: 0; flex: 1 1 auto; min-width: 0; }
.qa-toast--ok { border-left-color: var(--ok); }
.qa-toast--warn { border-left-color: var(--warn); }
.qa-toast--danger { border-left-color: var(--danger); }
.qa-toast--static { position: static; }

.qa-tipwrap { position: relative; display: inline-flex; }
.qa-tip {
  display: none; position: absolute; z-index: var(--z-tooltip); bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(240px, 70vw); padding: 6px 10px; border-radius: var(--r-sm);
  background: #241008; color: #fbf1e1; border: var(--border) solid var(--qa-gold); font-size: var(--fs-xs); line-height: 1.5; text-align: center;
  box-shadow: var(--shadow-2);
}
[data-theme="office"] .qa-tip { background: #1f1712; border-color: #1f1712; color: #fff; }
.qa-tipwrap:hover .qa-tip, .qa-tipwrap:focus-within .qa-tip, .qa-tip.is-open { display: block; }
.qa-tip--start { left: 0; transform: none; }

/* tabs */
.qa-tabs { display: flex; gap: var(--sp-1); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; border-bottom: var(--border) solid var(--line); max-width: 100%; }
.qa-tabs::-webkit-scrollbar { display: none; }
.qa-tab {
  appearance: none; flex: 0 0 auto; min-height: var(--tap); padding: 0 var(--sp-4); border: 0; background: transparent; cursor: pointer;
  color: var(--text-muted); font-size: var(--fs-md); font-weight: var(--fw-medium); white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.qa-tab:hover { color: var(--text); }
.qa-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--qa-gold); font-weight: var(--fw-semibold); }
[data-theme="office"] .qa-tab[aria-selected="true"] { border-bottom-color: var(--accent); }

/* back office */
.qa-ob { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 640px; background: var(--bg); color: var(--text); border-radius: var(--r-md); overflow: hidden; border: var(--border) solid var(--line); }
.qa-ob__head {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; min-height: 56px; padding: 6px var(--gut-r) 6px var(--gut-l);
  background: linear-gradient(rgba(74, 10, 7, 0.9), rgba(74, 10, 7, 0.9)), var(--tex-wool) 0 0 / var(--tex-wool-size); background-color: #4a0a07; color: #fbf1e1;
  border-bottom: 2px solid transparent; border-image: var(--gold-rule) 1;
}
.qa-ob__logo { width: 104px; height: auto; display: block; }
.qa-ob__app { font-size: var(--fs-sm); color: #f0dcb4; padding-left: var(--sp-3); border-left: 1px solid rgba(217, 178, 94, 0.5); }
.qa-ob__user { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.qa-ob__user .qa-iconbtn { color: #fbf1e1; background: rgba(0, 0, 0, 0.2); border-color: rgba(217, 178, 94, 0.6); }
.qa-ob__body { display: grid; grid-template-columns: minmax(0, 1fr); }
.qa-ob__nav { order: 2; position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 0 var(--gut-r) var(--safe-b) var(--gut-l); background: var(--surface); border-top: var(--border) solid var(--line); box-shadow: 0 -4px 14px -8px rgba(31, 23, 18, 0.2); }
.qa-ob__nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; min-width: 0; padding: 4px 2px; color: var(--text-muted); text-decoration: none; font-size: var(--fs-2xs); font-weight: var(--fw-medium); line-height: 1.3; text-align: center; border-top: 3px solid transparent; }
.qa-ob__nav a svg { width: 22px; height: 22px; flex: 0 0 auto; }
.qa-ob__nav a[aria-current="page"] { color: var(--accent-text); border-top-color: var(--accent); font-weight: var(--fw-semibold); }
.qa-ob__nav .is-extra { display: none; }
.qa-ob__main { padding: var(--sp-5) var(--gut-r) var(--sp-8) var(--gut-l); display: grid; gap: var(--sp-5); min-width: 0; align-content: start; }
@media (min-width: 600px) and (min-height: 501px) {
  .qa-ob__body { grid-template-columns: 72px minmax(0, 1fr); }
  .qa-ob__nav { order: 0; position: static; display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-3) var(--sp-2); border-top: 0; border-right: var(--border) solid var(--line); box-shadow: none; }
  .qa-ob__nav .is-extra { display: flex; }
  .qa-ob__nav .is-more { display: none; }
  .qa-ob__nav a { border-top: 0; border-left: 3px solid transparent; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
  .qa-ob__nav a[aria-current="page"] { border-left-color: var(--accent); background: var(--surface-2); }
  .qa-ob__main { padding: var(--sp-6) var(--sp-6) var(--sp-10); }
}
@media (min-width: 1024px) and (min-height: 501px) {
  .qa-ob__body { grid-template-columns: 220px minmax(0, 1fr); }
  .qa-ob__nav a { flex-direction: row; justify-content: flex-start; gap: var(--sp-3); min-height: var(--tap); padding: 0 var(--sp-4); font-size: var(--fs-sm); text-align: left; }
  .qa-ob__main { padding: var(--sp-6) var(--sp-8) var(--sp-10); }
}
@media (min-width: 600px) and (max-width: 1023px) and (min-height: 501px) {
  .qa-ob__nav a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
.qa-ob__title { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; }
.qa-ob__title h2 { margin: 0; font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-2xl); line-height: 1.3; }

.qa-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: var(--sp-3); align-items: end; padding: var(--sp-4); border: var(--border) solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.qa-filters__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.qa-table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border: var(--border) solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.qa-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); line-height: 1.5; }
.qa-table th, .qa-table td { padding: 10px 14px; text-align: left; vertical-align: middle; border-bottom: var(--border) solid var(--line); overflow-wrap: anywhere; }
.qa-table th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-muted); font-weight: var(--fw-semibold); font-size: var(--fs-xs); white-space: nowrap; }
.qa-table tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.qa-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qa-table .is-nowrap { white-space: nowrap; }
.qa-table .qa-btn, .qa-table .qa-badge { overflow-wrap: normal; white-space: nowrap; }
.qa-cell-trunc { display: block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-cell-sub { display: block; color: var(--text-faint); font-size: var(--fs-xs); }
@media (min-width: 600px) and (min-height: 501px) {
  .qa-table--sticky th:first-child, .qa-table--sticky td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
  .qa-table--sticky th:first-child { z-index: 2; background: var(--surface-2); }
}
@media (max-width: 599px), (max-height: 500px) {
  .qa-table--cards, .qa-table--cards tbody { display: block; }
  .qa-table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .qa-table-wrap:has(.qa-table--cards) { border: 0; background: transparent; overflow: visible; }
  .qa-table--cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--sp-3); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3); border: var(--border) solid var(--line); border-radius: var(--r-md); background: var(--surface); }
  .qa-table--cards td { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: var(--sp-2); padding: 2px 0; border: 0; grid-column: 1 / -1; text-align: left; }
  .qa-table--cards td::before { content: attr(data-label); color: var(--text-faint); font-size: var(--fs-xs); padding-top: 2px; }
  .qa-table--cards td.is-num { text-align: left; }
  .qa-table--cards td.is-head { grid-template-columns: minmax(0, 1fr); font-size: var(--fs-md); }
  .qa-table--cards td.is-head::before { display: none; }
  .qa-table--cards td.is-actions { grid-template-columns: minmax(0, 1fr); padding-top: var(--sp-2); }
  .qa-table--cards td.is-actions::before { display: none; }
  .qa-table--cards .qa-cell-trunc { max-width: 100%; }
}
.qa-pager { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-muted); }

.qa-audit { list-style: none; margin: 0; padding: 0; border: var(--border) solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.qa-audit li { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 2px var(--sp-4); padding: var(--sp-3) var(--sp-4); border-bottom: var(--border) solid var(--line); font-size: var(--fs-sm); line-height: 1.6; }
.qa-audit li:last-child { border-bottom: 0; }
.qa-audit time { color: var(--text-faint); font-variant-numeric: tabular-nums; grid-row: span 2; }
.qa-audit__what { min-width: 0; overflow-wrap: anywhere; }
.qa-audit__diff { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: var(--fw-semibold); }
.qa-audit__why { min-width: 0; color: var(--text-muted); overflow-wrap: anywhere; }
@media (max-width: 479px) {
  .qa-audit li { grid-template-columns: minmax(0, 1fr); }
  .qa-audit time { grid-row: auto; }
}

.qa-kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px var(--sp-4); margin: 0; font-size: var(--fs-sm); }
.qa-kv dt { color: var(--text-faint); }
.qa-kv dd { margin: 0; font-weight: var(--fw-semibold); overflow-wrap: anywhere; }

/* forms on phones keep the save button reachable */
@media (max-width: 599px), (max-height: 500px) {
  .qa-sheet__foot { position: sticky; bottom: calc(-1 * (var(--safe-b) + var(--sp-2))); margin: 0 calc(-1 * var(--gut-r)) calc(-1 * (var(--safe-b) + var(--sp-2))) calc(-1 * var(--gut-l)); padding: var(--sp-3) var(--gut-r) calc(var(--safe-b) + var(--sp-2)) var(--gut-l); background: var(--surface-sheet); border-top: var(--border) solid var(--line); }
}

/* paper: long reading such as consent and terms, readable in both room themes */
.qa-paper {
  background: linear-gradient(rgba(252, 249, 243, 0.82), rgba(252, 249, 243, 0.82)), var(--tex-marble) 0 0 / var(--tex-marble-size); background-color: #faf6ef;
  color: #24100a; border-radius: var(--r-md); padding: var(--sp-6) var(--sp-5); box-shadow: var(--shadow-3);
  --text: #24100a; --text-muted: #57402f; --text-faint: #6e5644; --text-gold: #6e4c12; --line: rgba(122, 87, 22, 0.32); --line-strong: #8f6c2c; --focus: #7a1a10; --field: #fff; --surface-glass: rgba(251, 246, 238, 0.86); --surface-2: #efe6d8;
  max-width: 640px; color-scheme: light;
}
.qa-paper h3 { margin: 0 0 var(--sp-2); font-family: var(--f-th); font-size: var(--fs-xl); line-height: 1.4; }
.qa-paper p, .qa-paper li { line-height: 1.75; max-width: 65ch; }
.qa-paper ul { padding-left: 1.2em; margin: var(--sp-2) 0; }

/* queue */
.qa-queue { display: grid; gap: var(--sp-3); justify-items: center; text-align: center; }
.qa-queue__no { font-family: var(--f-roman); font-weight: 600; font-size: clamp(44px, 8vw, 64px); line-height: 1; color: var(--text-gold); font-variant-numeric: lining-nums; }

/* very wide screens: real curtain fills the sides instead of stretching the room */
@media (min-width: 2200px) {
  .qa-curtain-sides { background: #120403 url("img/curtain.webp?v=9d89503887") center / cover no-repeat; }
  .qa-curtain-sides > .qa-room-frame { max-width: calc(var(--vh-full) * 16 / 9); margin-inline: auto; box-shadow: 0 0 80px 20px rgba(0, 0, 0, 0.8); }
}

/* button effects: our own buttons only, never provider buttons */
.qa-fx-sheen, .qa-fx-press, .qa-fx-glint, .qa-fx-dust { isolation: isolate; }
.qa-fx-sheen, .qa-fx-dust { overflow: hidden; }
.qa-fx-sheen::before, .qa-fx-press::before, .qa-fx-glint::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none; border-radius: inherit;
}

.qa-fx-sheen::after { display: none; }
.qa-fx-sheen::before {
  inset: 0 -60%; border-radius: 0;
  background: var(--tex-foil) 0 0 / var(--tex-foil-size);
  -webkit-mask: linear-gradient(100deg, transparent 39%, #000 47%, #000 53%, transparent 61%);
  mask: linear-gradient(100deg, transparent 39%, #000 47%, #000 53%, transparent 61%);
  opacity: 0.85; transform: translateX(calc((var(--fx-p, 0.5) - 0.5) * 45.5%));
  will-change: transform;
}
.qa-fx-sheen.is-live::before { transition: transform 90ms linear; }
.qa-btn--outline.qa-fx-sheen::before, .qa-iconbtn.qa-fx-sheen::before { opacity: 0.22; }

.qa-fx-press::before {
  inset: 0; opacity: 0; transition: opacity 90ms var(--ease-out);
  box-shadow: inset 0 3px 7px rgba(60, 32, 4, 0.6), inset 0 -2px 3px rgba(255, 244, 210, 0.4);
}
.qa-fx-press:active, .qa-fx-press.is-pressed { transform: scale(0.97) translateY(1px); }
.qa-fx-press:active::before, .qa-fx-press.is-pressed::before { opacity: 1; }
.qa-fx-press.is-stamp { animation: qa-fx-stamp 300ms var(--ease-out) 1; }
.qa-btn--outline.qa-fx-press::before, .qa-iconbtn.qa-fx-press::before { box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5); }
@keyframes qa-fx-stamp { 0% { transform: scale(0.965) translateY(1px); } 55% { transform: scale(1.012); } 100% { transform: none; } }

.qa-fx-glint::before {
  inset: 0 -30%; border-radius: 0;
  background:
    radial-gradient(22% 55% at 50% 0%, rgba(255, 248, 222, 0.95), rgba(255, 248, 222, 0) 72%),
    radial-gradient(18% 35% at 50% 100%, rgba(255, 240, 200, 0.45), rgba(255, 240, 200, 0) 72%);
  opacity: 0.6;
}
.qa-fx-glint { overflow: hidden; }
.qa-btn--outline.qa-fx-glint, .qa-iconbtn.qa-fx-glint { overflow: visible; }
.qa-btn--outline.qa-fx-glint::before, .qa-iconbtn.qa-fx-glint::before {
  inset: 0; padding: 1.5px; border-radius: inherit;
  background: radial-gradient(45% 120% at 50% 0%, rgba(255, 232, 170, 0.95), rgba(255, 232, 170, 0) 72%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

.qa-fx-dust__p {
  position: absolute; z-index: -1; pointer-events: none; border-radius: 50%;
  width: var(--s); height: var(--s); left: calc(var(--x) - var(--s) / 2); top: calc(var(--y) - var(--s) / 2);
  background:
    radial-gradient(closest-side, rgba(255, 252, 236, 0) 52%, rgba(255, 252, 236, 0.95) 68%, rgba(255, 246, 214, 0.35) 80%, rgba(110, 70, 10, 0.28) 88%, rgba(110, 70, 10, 0) 96%),
    var(--tex-dust) 0 0 / 64px, var(--tex-dust) 31px 17px / 64px;
  -webkit-mask: radial-gradient(closest-side, rgba(0, 0, 0, 0.5) 25%, #000 58%, #000 84%, transparent 100%);
  mask: radial-gradient(closest-side, rgba(0, 0, 0, 0.5) 25%, #000 58%, #000 84%, transparent 100%);
  animation: qa-fx-dust 900ms var(--ease-out) forwards;
}
@keyframes qa-fx-dust { from { transform: scale(0.1); opacity: 1; } 50% { opacity: 1; } to { transform: scale(1); opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
  .qa-fx-sheen:not(.is-live)::before { animation: qa-fx-drift 7s var(--ease-in-out) infinite; }
  .qa-fx-glint::before { animation: qa-fx-flicker 5.3s linear infinite, qa-fx-wander 13s var(--ease-in-out) infinite alternate; }
  .qa-btn--outline.qa-fx-glint::before, .qa-iconbtn.qa-fx-glint::before { animation: qa-fx-flicker 5.3s linear infinite; }
}
@keyframes qa-fx-drift { 0%, 12% { transform: translateX(-34%); } 42%, 100% { transform: translateX(34%); } }
@keyframes qa-fx-flicker {
  0% { opacity: 0.35; } 6% { opacity: 0.8; } 10% { opacity: 0.5; } 17% { opacity: 0.92; } 22% { opacity: 0.62; }
  38% { opacity: 0.78; } 45% { opacity: 0.4; } 61% { opacity: 0.86; } 69% { opacity: 0.55; } 86% { opacity: 0.72; } 100% { opacity: 0.35; }
}
@keyframes qa-fx-wander { from { transform: translateX(-16%); } to { transform: translateX(16%); } }
@media (prefers-reduced-motion: reduce) {
  .qa-fx-sheen::before { transform: translateX(-9%); transition: none; }
  .qa-fx-glint::before { opacity: 0.7; }
  .qa-fx-press:active, .qa-fx-press.is-pressed { transform: translateY(1px); }
  .qa-fx-press.is-stamp { animation: none; }
  .qa-fx-dust__p { display: none; }
  .qa-btn--gold.qa-fx-dust::before {
    content: ""; position: absolute; inset: 0 -60%; z-index: -1; pointer-events: none;
    background: var(--tex-foil) 0 0 / var(--tex-foil-size); opacity: 0.85; transform: translateX(-9%);
    -webkit-mask: linear-gradient(100deg, transparent 39%, #000 47%, #000 53%, transparent 61%);
    mask: linear-gradient(100deg, transparent 39%, #000 47%, #000 53%, transparent 61%);
  }
}

/* theme-only content */
.qa-day-only { display: none !important; }
[data-theme="light"] .qa-day-only, [data-theme="office"] .qa-day-only { display: revert !important; }
[data-theme="light"] .qa-night-only, [data-theme="office"] .qa-night-only { display: none !important; }

/* login tablet */
.qa-tablet {
  position: relative; display: grid; gap: var(--sp-4); justify-items: center; align-content: start; text-align: center;
  width: 100%; min-width: 0; padding: var(--sp-8) var(--sp-4) var(--sp-6);
  color: var(--text); background: var(--tablet-mat); background-color: var(--surface-sheet);
  border: 1px solid var(--tablet-edge); border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 5px rgba(0, 0, 0, 0.2), inset 0 0 0 6px color-mix(in srgb, var(--tablet-edge) 60%, transparent), inset 0 2px 26px rgba(0, 0, 0, 0.5), var(--shadow-3);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);
}
[data-theme="light"] .qa-tablet, [data-theme="office"] .qa-tablet {
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.35), inset 0 0 0 6px color-mix(in srgb, var(--tablet-edge) 55%, transparent), inset 0 1px 16px rgba(90, 60, 20, 0.18), var(--shadow-3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
.qa-tablet > * { margin: 0; max-width: 100%; }
.qa-tablet__close { position: absolute; top: var(--sp-3); right: var(--sp-3); }
.qa-tablet__sign { width: 148px; height: auto; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.7)) drop-shadow(0 -1px 0 rgba(255, 236, 190, 0.14)); }
[data-theme="light"] .qa-tablet__sign, [data-theme="office"] .qa-tablet__sign { filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.85)) drop-shadow(0 -1px 0 rgba(80, 40, 10, 0.28)); }
.qa-tablet__quote { display: grid; gap: var(--sp-1); }
.qa-tablet__voice { margin: 0; font-family: var(--f-th); font-weight: var(--fw-medium); font-size: var(--fs-lg); line-height: var(--lh-th-body); color: var(--text); max-width: 20em; text-wrap: pretty; }
.qa-tablet__by { font-family: var(--f-ui); font-size: var(--fs-xs); line-height: var(--lh-th-ui); color: var(--text-muted); }
.qa-tablet__title { margin: 0; font-family: var(--f-th); font-weight: var(--fw-semibold); font-size: var(--fs-xl); line-height: var(--lh-th-head); color: var(--text); }
.qa-tablet .qa-rule { width: min(160px, 60%); }
.qa-tablet__terms { font-family: var(--f-ui); font-size: var(--fs-xs); line-height: 1.6; color: var(--text-faint); text-wrap: pretty; max-width: 30em; }
.qa-tablet__terms a { font: inherit; color: var(--text-muted); text-underline-offset: 2px; white-space: nowrap; }
.qa-tablet__note { font-family: var(--f-ui); font-size: var(--fs-xs); line-height: 1.6; color: var(--text-faint); }
.qa-sheet.qa-tablet { border-bottom-width: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(var(--safe-b) + var(--sp-6)); }
@media (min-width: 600px) and (min-height: 501px) {
  .qa-sheet.qa-tablet { border-bottom-width: 1px; border-radius: var(--r-lg); padding: var(--sp-10) var(--sp-8) var(--sp-8); }
}
@media (max-height: 500px) {
  .qa-sheet.qa-tablet { border-radius: 0; padding: var(--sp-6) var(--sp-5); gap: var(--sp-3); }
  .qa-sheet.qa-tablet .qa-tablet__sign { width: 112px; }
}

/* official icon-only buttons, each seated in a gold ring outside its clear space */
.qa-coins { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--sp-1); width: 100%; max-width: 352px; }
.qa-coin { display: grid; justify-items: center; align-content: start; gap: var(--sp-2); min-width: 0; }
.qa-coin__seat {
  position: relative; display: grid; place-items: center;
  width: calc(var(--coin) + 2 * (var(--coin-clear) + var(--coin-ring))); aspect-ratio: 1;
}
.qa-coin__seat::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background-image: var(--tex-grain), var(--gold-face); background-size: var(--tex-grain-size), 100% 100%; background-blend-mode: soft-light, normal;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--coin-ring)), #000 calc(100% - var(--coin-ring) + 0.6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--coin-ring)), #000 calc(100% - var(--coin-ring) + 0.6px));
}
.qa-coin__label {
  font-family: var(--f-ui); font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: var(--lh-th-ui);
  letter-spacing: 0; color: var(--text-muted); white-space: nowrap; cursor: pointer;
}
.qa-coin__own { width: var(--coin); height: var(--coin); min-width: var(--coin); min-height: var(--coin); padding: 0; border-radius: 50%; }
.qa-coin__own svg { width: 20px; height: 20px; }

.prov-icon {
  appearance: none; position: relative; display: grid; place-items: center;
  width: var(--coin); height: var(--coin); padding: 0; margin: 0; border: 0; border-radius: 50%; cursor: pointer; text-shadow: none;
}
.prov-icon:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.prov-icon--line { background: #06C755; }
.prov-icon--line img { width: 40px; height: 40px; }
.prov-icon--line:hover { background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), #06C755; }
.prov-icon--line:active { background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), #06C755; }
.prov-icon--google { background: #131314; box-shadow: inset 0 0 0 1px #8E918F; }
.prov-icon--google:hover { background: linear-gradient(rgba(227, 227, 227, 0.08), rgba(227, 227, 227, 0.08)), #131314; }
[data-theme="light"] .prov-icon--google, [data-theme="office"] .prov-icon--google { background: #FFFFFF; box-shadow: inset 0 0 0 1px #747775; }
.prov-icon--google .prov-btn__g { width: 22px; height: 22px; }
.prov-icon--apple { background: #FFFFFF; color: #000000; }
[data-theme="light"] .prov-icon--apple, [data-theme="office"] .prov-icon--apple { background: #000000; color: #FFFFFF; }
.prov-icon--apple svg { width: 20px; height: 24px; }

/* full-width official buttons, same height; label sizes follow each provider's rule */
.qa-provs { display: grid; gap: var(--sp-3); width: 100%; max-width: 352px; }
.qa-provs .prov-btn { height: 44px; min-height: 44px; border-radius: var(--r-pill); text-shadow: none; }
.qa-provs .prov-btn--line { font-family: var(--f-ui); font-size: 15px; font-weight: var(--fw-semibold); line-height: 20px; padding-left: 56px; }
.qa-provs .prov-btn--line .prov-btn__icon { left: 6px; }
.qa-provs .prov-btn--google { font-size: 15px; line-height: 22px; }
.qa-provs .prov-btn--apple { font-size: 19px; line-height: 24px; font-weight: 500; }
.qa-provs .prov-btn--phone { font-family: var(--f-ui); font-size: 15px; font-weight: var(--fw-semibold); line-height: 20px; }
.prov-btn--google-auto { background: #131314; color: #E3E3E3; border: 1px solid #8E918F; }
.prov-btn--google-auto:hover { background: linear-gradient(rgba(227, 227, 227, 0.08), rgba(227, 227, 227, 0.08)), #131314; }
[data-theme="light"] .prov-btn--google-auto, [data-theme="office"] .prov-btn--google-auto { background: #FFFFFF; color: #1F1F1F; border-color: #747775; }
.prov-btn--apple-auto { background: #FFFFFF; color: #000000; border-color: #FFFFFF; }
[data-theme="light"] .prov-btn--apple-auto, [data-theme="office"] .prov-btn--apple-auto { background: #000000; color: #FFFFFF; border-color: #000000; }
