/* Chooser: the access card on the home page and the dedicated /chooser screen. Colours follow the day's
   theme; gestures are contained only on the /chooser surface. */

/* ---------- home: access card (no game surface here) ---------- */
.chooser-card { width: min(1240px, calc(100% - 32px)); margin: 8px auto 0; padding: clamp(16px, 2.6vw, 28px); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; border: var(--panel-border); border-radius: var(--radius-card); background: var(--surface); color: var(--on-surface); box-shadow: var(--panel-frame), var(--shadow); }
.chooser-card h2 { margin: 0; color: inherit; font-family: var(--display); font-size: clamp(30px, 5vw, 56px); line-height: 1; letter-spacing: .02em; }
.chooser-card p { margin: 6px 0 0; font-size: clamp(16px, 2vw, 20px); font-weight: 700; }
.chooser-card .btn { flex: 0 0 auto; }
/* A smaller sign on the home page (same letters, still breakable): the page stays short. */
html[data-theme] #menu-view > .hero { grid-template-columns: minmax(0, 1fr); padding: 16px 0 20px; gap: 0; }
html[data-theme] #menu-view > .hero .hero-sign { padding-top: 16px; padding-bottom: 12px; }
html[data-theme] #menu-view > .hero .marquee { font-size: calc(var(--sign-size) * .66); }
html[data-theme] #menu-view > .hero .sign-plate { margin-top: 8px; }
html[data-theme="xp"] #menu-view > .hero .hero-sign { padding-top: 38px; }
@media (max-width: 640px) {
  html[data-theme] #menu-view > .hero { padding: 8px 0 14px; }
  html[data-theme] #menu-view > .hero .marquee { font-size: clamp(30px, 10vw, 46px); }
  html[data-theme] #menu-view > .hero .sign-kicker { display: none; }
  .chooser-card { width: calc(100% - 24px); }
  .chooser-card .btn { width: 100%; }
}

/* ---------- /chooser ---------- */
html.chooser-lock, html.chooser-lock body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.chooser-page { margin: 0; min-height: 100dvh; }
.chooser-stage { position: fixed; inset: 0; color: var(--on-bg); }
/* The bar floats over the surface: only its link takes touches, the rest of the screen plays. */
.chooser-bar { position: absolute; z-index: 40; top: 0; left: 0; right: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left)); pointer-events: none; }
.chooser-bar h1 { margin: 0; font-family: var(--display); font-size: clamp(20px, 3vw, 30px); line-height: 1; color: var(--on-bg); }
.chooser-bar p { margin: 0; font-weight: 700; color: var(--on-bg); }
.chooser-exit { pointer-events: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 12px 4px 6px; border-radius: 999px; background: var(--surface); color: var(--on-surface); border: var(--panel-border); font-weight: 700; text-decoration: none; touch-action: manipulation; }
.chooser-exit-logo { width: 28px; height: 28px; object-fit: contain; }
.chooser-exit:focus-visible { outline: 3px solid var(--focus, currentColor); outline-offset: 3px; }
.chooser-surface { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; isolation: isolate; outline: none; }
.chooser-message { position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(560px, calc(100% - 32px)); text-align: center; pointer-events: none; z-index: 5; }
#chooser-status { margin: 0; padding: 10px 14px; border-radius: var(--radius, 10px); background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--on-surface); font-weight: 800; font-size: clamp(16px, 2.2vw, 20px); }
#chooser-note { margin: 6px 0 0; font-size: 14px; color: var(--on-bg); opacity: .85; }
#chooser-countdown { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 60; font: 900 clamp(90px, 24vmin, 220px)/1 var(--display, sans-serif); color: var(--on-bg); text-shadow: 0 3px 0 var(--bg-color, #000), 0 0 24px var(--bg-color, #000); }

/* A marker much larger than the fingertip: colour and silhouette show around it. Never intercepts input. */
.chooser-marker { --size: clamp(110px, 19vmin, 150px); position: absolute; left: 0; top: 0; width: var(--size); height: var(--size); margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2); pointer-events: none; will-change: transform; color: var(--color); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--color) 70%, transparent)) drop-shadow(0 0 2px #000); }
/* The entry animation lives on the shape: the marker's own transform is its finger position. */
.chooser-marker svg { display: block; width: 100%; height: 100%; overflow: visible; animation: chooser-in 160ms ease-out; }
.chooser-marker svg > * { fill: color-mix(in srgb, var(--color) 14%, transparent); stroke: currentColor; stroke-width: 8px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chooser-number { --size: clamp(110px, 19vmin, 150px); position: absolute; left: 0; top: 0; z-index: 50; min-width: 30px; height: 30px; margin: calc(var(--size) / -2 - 6px) 0 0 calc(var(--size) / 2 - 24px); padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--color); color: #111; border: 2px solid #111; font: 900 16px/1 system-ui, sans-serif; box-shadow: 0 0 0 2px #fff; pointer-events: none; will-change: transform; }
.chooser-marker[data-winner] { filter: drop-shadow(0 0 22px var(--color)) drop-shadow(0 0 3px #000); z-index: 100 !important; }
.chooser-marker[data-winner] svg > * { fill: color-mix(in srgb, var(--color) 40%, transparent); }
.chooser-marker[data-loser] { opacity: .35; }
@keyframes chooser-in { from { transform: scale(.6); opacity: 0; } }
.chooser-stage[data-counting] .chooser-marker:not([data-winner]) { animation: chooser-pulse 800ms ease-in-out infinite; }
@keyframes chooser-pulse { 50% { filter: drop-shadow(0 0 18px var(--color)) drop-shadow(0 0 2px #000); } }

/* Result: the winner's colour spreads from the finger to the farthest corner of the viewport. */
.chooser-result { position: fixed; inset: 0; z-index: 2147483000; overflow: hidden; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); color: #111; touch-action: manipulation; }
.chooser-wave { position: absolute; left: var(--x); top: var(--y); width: var(--diameter); height: var(--diameter); border-radius: 50%; background: var(--winner-color); transform: translate(-50%, -50%) scale(0); animation: chooser-flood 700ms cubic-bezier(.2, .7, .3, 1) forwards; pointer-events: none; }
.chooser-result-card { position: relative; max-width: min(640px, 100%); padding: clamp(18px, 4vw, 30px); text-align: center; background: #fff; border: 3px solid #111; border-radius: 16px; box-shadow: 8px 8px 0 #111; opacity: 0; animation: chooser-card 220ms 520ms ease-out forwards; }
.chooser-result-card h2 { margin: 0; color: #111; font: 900 clamp(30px, 7vw, 64px)/1.05 system-ui, sans-serif; }
.chooser-result-card p { margin: 12px 0 18px; color: #111; font: 700 clamp(18px, 3vw, 24px)/1.4 system-ui, sans-serif; }
.chooser-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chooser-result-actions .btn { min-height: 48px; }
.chooser-result-actions .btn-ghost { background: #fff; color: #111; border: 2px solid #111; }
.chooser-result :focus-visible { outline: 3px solid #111; outline-offset: 4px; }
@keyframes chooser-flood { to { transform: translate(-50%, -50%) scale(1); } }
@keyframes chooser-card { to { opacity: 1; } }
/* Reduced motion: a short fade of the colour, no expansion. */
.chooser-result[data-reduced] .chooser-wave { left: 0; top: 0; width: 100%; height: 100%; border-radius: 0; transform: none; opacity: 0; animation: chooser-card 150ms ease-out forwards; }
.chooser-result[data-reduced] .chooser-result-card { animation-delay: 0ms; animation-duration: 150ms; }
@media (prefers-reduced-motion: reduce) {
  .chooser-marker svg, .chooser-stage[data-counting] .chooser-marker { animation: none !important; }
}
.day-toast { position: fixed; left: 50%; bottom: 20px; z-index: 900; transform: translateX(-50%); max-width: calc(100% - 32px); margin: 0; padding: 12px 18px; border-radius: var(--radius); background: var(--dark); color: var(--on-dark); box-shadow: var(--shadow); font-weight: 700; }

/* Development diagnostics (?diagnostico with PM_DEV_TOOLS=1): never on the public site. Touches pass
   through it to the surface except on its buttons. */
.chooser-diagnostics { position: absolute; z-index: 45; right: max(8px, env(safe-area-inset-right)); top: calc(max(10px, env(safe-area-inset-top)) + 56px); width: min(340px, calc(100% - 16px)); max-height: 55%; overflow: hidden; padding: 8px 10px; border-radius: 8px; background: rgb(0 0 0 / .78); color: #fff; font: 12px/1.35 ui-monospace, Menlo, monospace; pointer-events: none; }
.chooser-diagnostics h2 { margin: 0 0 4px; font: inherit; font-weight: 800; color: #fff; }
.chooser-diagnostics dl { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; margin: 0 0 6px; }
.chooser-diagnostics dt, .chooser-diagnostics dd { margin: 0; }
.chooser-diagnostics dd { font-weight: 800; text-align: right; }
.chooser-diagnostics ol { margin: 0 0 6px; padding-left: 0; list-style: none; max-height: 9.5em; overflow: hidden; opacity: .85; font-size: 11px; }
.chooser-diagnostics button { pointer-events: auto; min-height: 36px; margin-right: 6px; padding: 4px 10px; font: inherit; color: #111; background: #fff; border: 0; border-radius: 6px; }
.chooser-diagnostics[data-copied] [data-copy]::after { content: " ✓"; }

/* ---------- the offer of the draw by groups (after two anomalous episodes) ---------- */
.chooser-groups :focus-visible, .chooser-help :focus-visible, .chooser-qualified :focus-visible { outline: 3px solid var(--focus, currentColor); outline-offset: 3px; }
.chooser-help, .chooser-qualified { position: fixed; inset: 0; z-index: 2147482000; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: rgb(0 0 0 / .5); touch-action: manipulation; }
.chooser-help-card, .chooser-qualified-card { max-width: min(560px, 100%); padding: clamp(18px, 4vw, 28px); text-align: center; background: #fff; color: #111; border: 3px solid #111; border-radius: 16px; box-shadow: 6px 6px 0 #111; }
.chooser-help-card h2, .chooser-qualified-card h2 { margin: 0 0 10px; color: #111; font: 900 clamp(22px, 5vw, 34px)/1.15 system-ui, sans-serif; }
.chooser-help-card p, .chooser-qualified-card p { margin: 0 0 14px; color: #111; font: 600 clamp(16px, 2.6vw, 19px)/1.45 system-ui, sans-serif; }
.chooser-help .btn-ghost, .chooser-qualified .btn-ghost { background: #fff; color: #111; border: 2px solid #111; }

/* ---------- by groups: a qualification is not the result (no wave, a dashed frame in the person's colour) ---------- */
.chooser-qualified { background: rgb(0 0 0 / .35); }
.chooser-qualified-card { border: 6px dashed var(--color); box-shadow: 0 0 0 3px #111, 6px 6px 0 3px #111; }
.chooser-qualified-card .chooser-badge { font-size: inherit; }
.chooser-qualified-card .chooser-badge svg { width: 1.6em; height: 1.6em; }
.chooser-kicker { font-size: 13px !important; text-transform: uppercase; letter-spacing: .06em; opacity: .75; }
.chooser-wait:empty { display: none; }
.chooser-qualified .btn[disabled] { opacity: .45; }

.chooser-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.chooser-badge svg { flex: 0 0 auto; width: 22px; height: 22px; overflow: visible; }
.chooser-badge svg > * { fill: color-mix(in srgb, var(--color) 35%, transparent); stroke: var(--color); stroke-width: 9px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

.chooser-groups { flex: 1 0 100%; }
.chooser-setup { position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; overflow: auto; overscroll-behavior: contain; touch-action: pan-y; pointer-events: auto; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: rgb(0 0 0 / .55); }
.chooser-setup[hidden], .chooser-group-panel[hidden] { display: none; }
.chooser-setup-card { width: min(760px, 100%); padding: clamp(16px, 3vw, 26px); border: var(--panel-border); border-radius: var(--radius-card, 14px); background: var(--surface); color: var(--on-surface); box-shadow: var(--shadow); }
.chooser-setup-card h2 { margin: 0 0 10px; color: inherit; font-family: var(--display); font-size: clamp(26px, 5vw, 40px); line-height: 1.05; }
.chooser-setup-card label { display: block; font-weight: 800; font-size: 18px; }
.chooser-stepper { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.chooser-stepper .btn { min-width: 48px; min-height: 48px; font-size: 24px; }
.chooser-stepper input { width: 4.2em; min-height: 48px; text-align: center; font: 800 24px/1 system-ui, sans-serif; border: 2px solid currentColor; border-radius: 8px; background: transparent; color: inherit; }
.chooser-plan { margin: 6px 0; font-weight: 800; }
.chooser-fair { margin: 4px 0; font-size: 14px; }
.chooser-fair[hidden], .chooser-intro[hidden] { display: none; }
.chooser-intro { margin: 4px 0 8px; font-weight: 700; }

/* The panel flows under the bar; only its buttons take touches, the rest of the screen plays. */
.chooser-group-panel { margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--on-surface); }
.chooser-group-panel h2 { margin: 0 0 4px; color: inherit; font: 900 clamp(18px, 3vw, 24px)/1.1 system-ui, sans-serif; }
.chooser-chips { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; padding: 0; list-style: none; }
.chooser-chips li { padding: 2px 8px; border-radius: 999px; opacity: .7; border: 2px solid transparent; }
.chooser-chips li[data-registered] { opacity: 1; }
.chooser-chips li[data-next] { opacity: 1; border-color: currentColor; }
.chooser-qualified-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 6px 0 0; font-size: 14px; }
.chooser-qualified-line[hidden] { display: none; }
.chooser-group-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 14px; font-weight: 700; }
.chooser-group-controls .btn { pointer-events: auto; min-height: 40px; padding: 4px 12px; font-size: 14px; }
@media (max-width: 640px) {
  .chooser-group-panel { padding: 6px 8px; }
  .chooser-chips { font-size: 13px; }
}
/* The group layers live inside the bar: its text colour and margins must not leak into them. */
.chooser-groups p { color: inherit; }
.chooser-setup-card p { margin: 6px 0; }
/* Discreet in every theme: themes that dress up every <button> do not dress this one. */
