/* ===========================================================
   Imposter Game — Shared Components
   =========================================================== */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: var(--border-w-lg) solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
  font-size: 1.05rem;
  padding: 14px 28px;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform .15s var(--ease-smooth), box-shadow .15s var(--ease-smooth), opacity .15s;
  user-select: none;
  white-space: nowrap;
}
.btn:hover { transform: translate(2px, 2px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: var(--shadow-md); }
.btn:focus-visible { outline-offset: 4px; }

.btn-block { width: 100%; }
.btn-lg { padding: 18px 36px; font-size: 1.3rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 10px 18px; font-size: .9rem; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }

.btn-amber { background: var(--accent-amber); color: var(--on-accent); }
.btn-coral { background: var(--accent-coral); color: var(--on-accent); }
.btn-teal  { background: var(--accent-teal); color: var(--on-accent); }
.btn-blue  { background: var(--accent-blue); color: var(--on-accent); }
.btn-violet{ background: var(--accent-violet); color: var(--on-accent); }
.btn-ghost { background: transparent; box-shadow: none; border-color: var(--ink); }
.btn-ghost:hover { background: rgba(0,0,0,.05); transform: none; }

.btn-icon {
  width: 52px; height: 52px; padding: 0; border-radius: var(--radius-sm);
}

/* ---------- Cards / Panels ---------- */
.panel {
  background: var(--surface);
  border: var(--border-w-lg) solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sticker-md);
}

.tag-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  padding: 8px 18px;
  line-height: 1.25;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  background: var(--accent-amber);
  overflow: visible;
  white-space: nowrap;
  max-width: 100%;
}

.tag-label--players {
  background: var(--accent-amber);
}

.tag-label--settings {
  background: var(--accent-violet);
  color: #fff;
}

/* ---------- Inputs ---------- */
.field {
  border: var(--border-w-lg) solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 800;
  color: var(--ink);
  padding: 14px 18px;
  font-size: 1.05rem;
  width: 100%;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s, background .12s;
}
.field:focus {
  outline: none;
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 0 var(--ink);
  background: color-mix(in srgb, var(--brand-yellow) 18%, var(--surface));
}
.field:focus-visible {
  outline: 3px solid var(--brand-cyan-muted);
  outline-offset: 2px;
}
.field::placeholder { color: #9a9aa3; font-weight: 700; }

.sr-only:focus,
.sr-only:focus-visible {
  position: fixed;
  inset-block-start: max(8px, env(safe-area-inset-top));
  inset-inline-start: max(8px, env(safe-area-inset-left));
  z-index: 100;
  width: auto;
  height: auto;
  clip: auto;
  padding: 8px 12px;
  background: var(--surface);
  border: var(--border-w) solid var(--ink);
  font-weight: 800;
}

html.nav-drawer-open {
  overflow: hidden;
}

/* ---------- Header / Nav ---------- */
.site-header {
  --header-bar-h: 4.5rem;
  background: var(--surface);
  width: calc(100% - 24px);
  max-width: 1200px;
  margin: 14px auto 0;
  border: var(--border-w-lg) solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sticker-md);
  padding-block: 0;
  padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right));
  min-height: var(--header-bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: max(12px, env(safe-area-inset-top));
  z-index: 50;
}
.site-header.site-header--app {
  --header-bar-h: 4.75rem;
  width: 100%;
  max-width: none;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 3px solid var(--ink);
  background: var(--bg-base);
  top: 0;
  padding-block: max(0px, env(safe-area-inset-top)) 0;
  padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right));
}
.brand {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  min-height: var(--header-bar-h);
  font-weight: 900;
  font-size: 1.25rem;
}
.brand-mark {
  height: var(--header-bar-h);
  width: auto;
  max-width: min(28rem, 68vw);
  display: block;
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
@media (min-width: 860px) {
  .site-header { --header-bar-h: 5rem; }
  .site-header.site-header--app { --header-bar-h: 5.25rem; }
  .brand-mark { max-width: min(32rem, 42vw); }
}
.footer-brand .brand-mark {
  height: 3.25rem;
  max-width: 16rem;
}
.lang-toggle__icon { flex-shrink: 0; }

/* Lucide inline icons (marketing + app shell) */
.ui-icon { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.ui-icon svg { width: 1.25rem; height: 1.25rem; stroke-width: 2.25; }
.ui-icon--sm svg { width: 1rem; height: 1rem; stroke-width: 2.25; }
.ui-icon--btn svg { width: 1.15rem; height: 1.15rem; }
.ui-icon--hero svg { width: 2.75rem; height: 2.75rem; stroke-width: 2.5; }
.nav-links { display: none; align-items: center; gap: 4px; }
@media (min-width: 860px) {
  .nav-links { display: flex; }
}
.nav-links a {
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: .95rem;
  border: var(--border-w) solid transparent;
  transition: all .15s;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--accent-amber);
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.lang-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  min-width: 44px;
  min-height: 44px;
  font-weight: 900;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s;
}
.lang-toggle:hover { transform: translateY(-2px); }

.site-header .header-actions > .btn-sm {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 859px) {
  .site-header .header-actions > .lang-toggle {
    display: none;
  }
}

.menu-toggle {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
@media (min-width: 860px) { .menu-toggle { display: none; } }

.mobile-nav {
  display: none;
  position: fixed; inset: 0; z-index: 60;
  background: rgba(22,22,26,.55);
  backdrop-filter: blur(4px);
}
.mobile-nav.open { display: block; }
.mobile-nav-panel {
  position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: min(80vw, 320px);
  background: var(--surface);
  border-inline-end: var(--border-w-lg) solid var(--ink);
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto;
}
.mobile-nav__close {
  align-self: flex-end;
  min-width: 44px;
  min-height: 44px;
}
.mobile-nav__prefs .lang-toggle {
  width: 100%;
  justify-content: center;
}
.mobile-nav__section {
  display: flex; flex-direction: column; gap: 10px;
}
.mobile-nav__section + .mobile-nav__section {
  padding-top: 14px;
  border-top: 2px dashed rgba(22, 22, 26, .15);
}
.mobile-nav__label {
  margin: 0 0 4px;
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .65;
}
.mobile-nav a {
  padding: 14px 16px; font-weight: 900; font-size: 1.1rem;
  border: var(--border-w) solid var(--ink); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.mobile-nav__legal a {
  font-size: .95rem;
  font-weight: 800;
  opacity: .92;
}
.mobile-nav a.active {
  background: var(--accent-amber);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  padding: 50px 0 30px;
}
.footer-panel {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  border: var(--border-w-lg) solid var(--ink);
  box-shadow: var(--shadow-lg);
}
.footer-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: 1fr;
}
@media (min-width: 1200px) {
  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr 0.9fr;
    align-items: start;
  }
}
.footer-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-width: 0;
}
.footer-brand { margin-bottom: 12px; }
.footer-brand-desc {
  margin: 0 0 16px;
  opacity: .85;
  max-width: 36ch;
  line-height: 1.5;
}
.footer-play-cta { margin-top: 4px; align-self: flex-start; }
.footer-col-title {
  margin: 0 0 12px;
  font-size: 1rem;
  width: 100%;
}
.footer-link-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}
.footer-link-list a {
  display: block;
  width: 100%;
  line-height: 1.45;
  font-weight: 700;
}
@media (max-width: 1199px) {
  .site-footer .footer-grid {
    text-align: start;
  }
  .footer-col--brand {
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
  }
  .footer-col + .footer-col {
    padding-top: 4px;
  }
}
@media (max-width: 560px) {
  .footer-col,
  .footer-col--brand {
    align-items: center;
    text-align: center;
  }
  .footer-brand-desc { max-width: none; }
  .footer-play-cta { align-self: center; }
  .footer-link-list { align-items: center; }
  .footer-link-list a { width: auto; }
}
.footer-panel a:hover { color: var(--accent-amber); }
.footer-bottom {
  margin-top: 30px; padding-top: 20px;
  border-top: 2px solid rgba(255,255,255,.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: .85rem;
  opacity: .75;
}
.footer-rights { margin: 0; }

/* ---------- Player chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: var(--border-w) solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-weight: 800;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  white-space: nowrap;
}
.chip-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); }

.player-badge {
  border: var(--border-w-lg) solid var(--ink);
  border-radius: var(--radius-md);
  padding: 14px 22px;
  min-height: 52px;
  min-width: 120px;
  font-weight: 900;
  font-size: 1.1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  opacity: .45;
  transition: opacity .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.player-badge.active { opacity: 1; box-shadow: var(--shadow-md); }
.player-badge.done { background: var(--accent-teal); color: #fff; }

/* ---------- Flip Card ---------- */
.flip-card {
  perspective: 1400px;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 3 / 4;
  margin-inline: auto;
}
.flip-card-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .6s var(--ease-smooth);
  transform-style: preserve-3d;
}
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border: var(--border-w-lg) solid var(--ink);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px; text-align: center; gap: 16px;
  box-shadow: var(--shadow-lg);
}
.flip-front { background: var(--ink); color: #fff; }
.flip-back { background: var(--accent-amber); transform: rotateY(180deg); }
.flip-back.is-imposter { background: var(--accent-coral); color: #fff; }

/* ---------- Progress dots ---------- */
.progress-dots { display: flex; gap: 8px; justify-content: center; }
.progress-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--ink); background: #fff;
}
.progress-dots span.done { background: var(--accent-teal); }
.progress-dots span.current { background: var(--accent-amber); transform: scale(1.3); }

/* ---------- Timer ring ---------- */
.timer-ring { position: relative; width: 170px; height: 170px; margin-inline: auto; }
.timer-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.timer-ring circle { fill: none; stroke-width: 10; }
.timer-ring .track { stroke: #e4ded0; }
.timer-ring .progress { stroke: var(--accent-coral); stroke-linecap: round; transition: none; }
.timer-ring .timer-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  min-width: 3ch;
  line-height: 1;
}
.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---------- Misc animations ---------- */
@keyframes popIn { from { opacity:0; transform: scale(.85) translateY(10px);} to {opacity:1; transform: scale(1) translateY(0);} }
.anim-pop { animation: popIn .45s var(--ease-pop) both; }

@keyframes floaty { 0%,100%{transform: translateY(0) rotate(var(--r,0deg));} 50%{transform: translateY(-10px) rotate(var(--r,0deg));} }
.anim-float { animation: floaty 4s ease-in-out infinite; }

.fade-screen { animation: fadeScreen .4s ease both; }
@keyframes fadeScreen { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }

/* ---------- App dialog (native <dialog>, not OS popups) ---------- */
.app-dialog {
  border: none;
  padding: 0;
  margin: auto;
  background: transparent;
  max-width: min(440px, calc(100vw - 32px));
  width: 100%;
  color: var(--ink);
}
.app-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 32%, var(--bg-base));
}
.app-dialog__panel {
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: popIn .35s var(--ease-pop) both;
}
.app-dialog__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1.35;
}
.app-dialog__message {
  margin: 0;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.55;
}
.app-dialog__copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.app-dialog__copy[hidden] {
  display: none !important;
}
.app-dialog__url.field {
  font-size: 0.92rem;
  font-weight: 700;
  word-break: break-all;
  cursor: text;
}
.app-dialog__hint {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.45;
}
.app-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 4px;
}
.app-dialog__actions [hidden] {
  display: none !important;
}
