/* ═══════════════════════════════════════════════════
   BESPOKE MYSTERIES — GAME & ADMIN UI STYLES
   Requires: css/styles.css (for CSS custom properties)
   ═══════════════════════════════════════════════════ */

/* ─── Portal / Play page ─── */
.portal-canvas {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
}
.portal-overlay {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 40%,
    rgba(7,9,15,0.1) 0%, rgba(7,9,15,0.7) 60%, rgba(7,9,15,0.96) 100%);
  pointer-events: none; z-index: 1;
}
.portal-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center; justify-content: center;
  /* 2026-06-12 luxury audit P1-8: respect notch/home-bar insets (play.html
     now sets viewport-fit=cover). */
  padding: max(2rem, env(safe-area-inset-top, 0px)) max(2rem, env(safe-area-inset-right, 0px))
           max(2rem, env(safe-area-inset-bottom, 0px)) max(2rem, env(safe-area-inset-left, 0px));
  position: relative; z-index: 2;
  overflow-y: auto;
}
@media (max-height: 700px) {
  .portal-wrap {
    align-items: flex-start;
  }
}
.portal-card {
  width: 100%; max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  box-shadow: 0 0 80px rgba(201,168,76,0.06), 0 40px 80px rgba(0,0,0,0.45);
  display: flex; flex-direction: column;
  align-items: center; gap: 2rem; text-align: center;
}
.portal-logo { height: 48px; width: auto; opacity: 0.9; }
.portal-step { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1.5rem; transition: opacity 0.3s ease; }
.portal-step.hidden { display: none; }
.portal-eyebrow {
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.25em; text-transform: uppercase; color: var(--gold);
}
.portal-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 600; color: var(--cream); line-height: 1.2;
}
.portal-subtitle {
  font-family: var(--font-elegant); font-style: italic;
  font-size: 1rem; color: var(--muted-light); line-height: 1.6; max-width: 360px;
}
.code-input {
  width: 100%;
  background: rgba(201,168,76,0.04);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 6vw, 2.5rem); font-weight: 700;
  letter-spacing: 0.35em; text-align: center; text-transform: uppercase;
  padding: 1rem; outline: none;
  transition: border-color 0.35s, background 0.35s;
  caret-color: var(--gold);
}
.code-input:focus { border-color: var(--gold); background: rgba(201,168,76,0.07); }
.code-input::placeholder { color: var(--muted); font-size: clamp(1rem, 4vw, 1.5rem); letter-spacing: 0.2em; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}
.portal-form { width: 100%; display: flex; flex-direction: column; gap: 1rem; }
.portal-input-group { display: flex; flex-direction: column; gap: 0.4rem; text-align: left; }
.portal-label {
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); opacity: 0.85;
}
.portal-input {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: var(--radius); color: var(--cream);
  font-size: 0.97rem; font-weight: 300; font-family: var(--font-sans);
  padding: 0.85rem 1.1rem; outline: none; width: 100%;
  transition: border-color 0.3s, background 0.3s;
}
.portal-input:focus { border-color: var(--gold); background: rgba(201,168,76,0.04); }
.portal-input::placeholder { color: var(--muted); }
.portal-note { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }
.portal-error {
  font-size: 0.85rem; color: #ffcccc; text-align: center; font-weight: 500;
  padding: 0.85rem 1rem;
  background: rgba(232, 112, 112, 0.15); border: 1px solid rgba(232, 112, 112, 0.4);
  border-radius: var(--radius); display: none; width: 100%;
}
.portal-error.visible { display: block; }

/* Character reveal */
.character-reveal { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; width: 100%; }
.character-reveal-label { font-family: var(--font-elegant); font-style: italic; font-size: 1rem; color: var(--muted-light); }
.character-name {
  font-family: var(--font-serif); font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 700; color: var(--gold); line-height: 1.1;
  opacity: 0; transform: translateY(12px);
  will-change: opacity, transform;
  transition: opacity 0.9s ease, transform 0.9s ease, text-shadow 0.9s ease;
}
@keyframes namePulse {
  0%, 100% { text-shadow: 0 0 10px rgba(201,168,76,0.2); }
  50% { text-shadow: 0 0 30px rgba(201,168,76,0.6); }
}
.character-name.revealed { opacity: 1; transform: none; text-shadow: 0 0 20px rgba(201,168,76,0.4); animation: namePulse 4s ease-in-out infinite 1s; }
.role-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  padding: 0.4rem 1rem; border-radius: 100px;
  border: 1px solid var(--border); color: var(--cream);
  background: rgba(255,255,255,0.04);
}
.role-badge.murderer  { color: #e87070; border-color: rgba(232,112,112,0.4); background: rgba(232,112,112,0.08); }
.role-badge.victim    { color: #8BB0D4; border-color: rgba(139,176,212,0.4); background: rgba(139,176,212,0.08); }
.role-badge.inspector { color: var(--gold); border-color: var(--border); background: rgba(201,168,76,0.08); }
.role-badge.suspect   { color: #A8B8C8; border-color: rgba(168,184,200,0.4); background: rgba(168,184,200,0.08); }

/* Waiting dots */
.waiting-indicator { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding: 0.5rem 0; }
.waiting-dots { display: flex; gap: 6px; }
.waiting-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); opacity: 0.6;
  animation: dotPulse 1.4s ease-in-out infinite;
}
.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.4); box-shadow: 0 0 6px rgba(201,168,76,0.5); }
}
.waiting-label { font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }


/* ── Feature 10 (2026-06-01): portal arrival ceremony ──────────────────────
   On first load the masthead + first step settle in sequence — logo, then the
   ornament draws in (wide→settled letter-spacing), then "The Night Awaits"
   eyebrow, title, subtitle, code field, and button cascade. Gated on
   .portal-card.is-visible (added by play.js) so if JS never runs the content
   stays plainly visible — no permanently-hidden state. */
@keyframes portal-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes portal-ornament-in { from { opacity: 0; letter-spacing: 0.6em; } to { opacity: 1; letter-spacing: 0.2em; } }
.portal-card.is-visible .portal-logo                  { animation: portal-rise 0.7s ease both; }
.portal-card.is-visible .portal-ornament              { animation: portal-ornament-in 0.8s ease 0.15s both; }
.portal-card.is-visible #stepCode .portal-eyebrow     { animation: portal-rise 0.7s ease 0.32s both; }
.portal-card.is-visible #stepCode .portal-title       { animation: portal-rise 0.7s ease 0.46s both; }
.portal-card.is-visible #stepCode .portal-subtitle    { animation: portal-rise 0.7s ease 0.60s both; }
.portal-card.is-visible #stepCode .portal-input-group { animation: portal-rise 0.7s ease 0.74s both; }
.portal-card.is-visible #stepCode #codeBtn            { animation: portal-rise 0.7s ease 0.88s both; }
@media (prefers-reduced-motion: reduce) {
  .portal-card.is-visible .portal-logo,
  .portal-card.is-visible .portal-ornament,
  .portal-card.is-visible #stepCode .portal-eyebrow,
  .portal-card.is-visible #stepCode .portal-title,
  .portal-card.is-visible #stepCode .portal-subtitle,
  .portal-card.is-visible #stepCode .portal-input-group,
  .portal-card.is-visible #stepCode #codeBtn { animation: none; }
}

/* ── Feature 12 (2026-06-01): global reduced-motion backstop ───────────────
   The per-feature guards above handle the nuanced cases (keeping content
   legible while removing motion); THIS catches every remaining decorative
   animation/transition so nothing moves for players who ask for calm — the
   waiting dots, name/scan/timer pulses, shimmers, hovers, drawer slides, etc.
   Durations are near-zero (not 0) so any animationend/transitionend listener
   still fires. The portal particle canvas + haptics are gated separately in JS. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
