:root {
  --bg: #050505;
  --bg-elev: #0e0e10;
  --bg-panel: rgba(18, 18, 20, 0.88);
  --red: #9b1b2a;
  --red-hot: #c42338;
  --red-dim: rgba(155, 27, 42, 0.35);
  --text: #f4f0f1;
  --muted: #9a9094;
  --line: rgba(255, 255, 255, 0.08);
  --soft: #3d8f7a;
  --hard: #c42338;
  --radius: 18px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Syne", "Outfit", sans-serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

img {
  max-width: 100%;
  display: block;
}

.bg-glow {
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(ellipse 50% 40% at 50% -10%, rgba(155, 27, 42, 0.45), transparent 60%),
    radial-gradient(ellipse 40% 35% at 85% 70%, rgba(155, 27, 42, 0.12), transparent 55%),
    radial-gradient(ellipse 35% 30% at 10% 80%, rgba(80, 20, 30, 0.2), transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: glow-drift 14s ease-in-out infinite alternate;
}

.bg-noise {
  position: fixed;
  inset: 0;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes glow-drift {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(2%) scale(1.04); }
}

.view {
  display: none;
  position: relative;
  z-index: 1;
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  animation: fade-up 0.45s ease both;
}

.view-active {
  display: block;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-hero {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.logo-hero {
  width: min(220px, 55vw);
  margin: 0 auto 0.75rem;
  filter: drop-shadow(0 12px 40px rgba(155, 27, 42, 0.45));
  animation: logo-in 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes logo-in {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.tagline {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--muted);
}

.age-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  border-style: dashed;
}

.admin-entry {
  display: inline-block;
  margin-left: 0.65rem;
  color: #6a6064;
  text-decoration: none;
  font-size: 0.78rem;
}

.admin-entry:hover {
  color: #ffb4bc;
}

.home-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.home-grid .panel h2 {
  font-size: 1.2rem;
}

.home-grid .btn-primary,
.home-grid .btn-ghost {
  margin-top: 0.25rem;
}

.stats-panel .stat-rating strong {
  color: #e8a54b;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.stack h2,
.panel h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}

input,
select {
  background: #0a0a0c;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim);
}

.code-input {
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.2s, border-color 0.2s, opacity 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--red-hot), var(--red));
  color: #fff;
  box-shadow: 0 10px 30px rgba(155, 27, 42, 0.4);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.btn-tiny {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.btn-wide {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-truth {
  flex: 1;
  min-height: 4.5rem;
  border-radius: 16px;
  background: linear-gradient(160deg, #1a3d36, #0f1f1c);
  border: 1px solid rgba(61, 143, 122, 0.45);
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-dare {
  flex: 1;
  min-height: 4.5rem;
  border-radius: 16px;
  background: linear-gradient(160deg, #4a1520, #1a080c);
  border: 1px solid rgba(196, 35, 56, 0.5);
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-reroll {
  background: transparent;
  border: 1px dashed rgba(196, 35, 56, 0.7);
  color: #ffb4bc;
}

.btn-done {
  background: linear-gradient(135deg, var(--red-hot), var(--red));
  color: #fff;
}

.hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.logo-sm {
  width: 56px;
  height: auto;
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

.room-pill {
  font-size: 0.85rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
}

.room-pill strong {
  color: var(--text);
  letter-spacing: 0.14em;
  cursor: pointer;
  border-bottom: 1px dashed rgba(255, 180, 188, 0.4);
}

.room-pill strong:hover {
  color: #ffb4bc;
}

.lobby-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1.1fr 0.9fr;
}

@media (max-width: 720px) {
  .lobby-layout {
    grid-template-columns: 1fr;
  }
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.player-list li,
.player-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.player-list .player-main {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
  width: 100%;
}

.player-list .player-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.player-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  margin: 0;
  padding-top: 0.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.player-actions .btn-tiny {
  flex: 0 0 auto;
}

.player-row.is-me {
  border-color: rgba(155, 27, 42, 0.45);
  background: rgba(155, 27, 42, 0.1);
}

.player-row.is-turn {
  border-color: rgba(61, 143, 122, 0.5);
  box-shadow: inset 3px 0 0 #3d8f7a;
}

.player-row.is-target {
  border-color: rgba(232, 165, 75, 0.45);
  box-shadow: inset 3px 0 0 #e8a54b;
}

.player-row.is-off {
  opacity: 0.5;
}

.player-list .name-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.player-list .name {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-list .you-pill {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  color: #ffb4bc;
  background: rgba(155, 27, 42, 0.28);
  border: 1px solid rgba(196, 35, 56, 0.4);
}

.player-list .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0;
}

.tag {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  line-height: 1.2;
  white-space: nowrap;
}

.tag-host {
  border-color: rgba(155, 27, 42, 0.55);
  color: #ffb4bc;
  background: rgba(155, 27, 42, 0.15);
}

.tag-gm {
  border-color: rgba(120, 170, 255, 0.5);
  color: #b8d4ff;
  background: rgba(70, 110, 200, 0.18);
}

.tag-admin {
  border-color: rgba(232, 165, 75, 0.5);
  color: #ffd59a;
  background: rgba(232, 165, 75, 0.12);
}

.tag-turn {
  border-color: rgba(61, 143, 122, 0.55);
  color: #9be7d0;
  background: rgba(61, 143, 122, 0.15);
}

.tag-target {
  border-color: rgba(232, 165, 75, 0.55);
  color: #ffd59a;
  background: rgba(232, 165, 75, 0.12);
}

.tag-busy {
  border-color: rgba(232, 165, 75, 0.65);
  color: #e8a54b;
  background: rgba(232, 165, 75, 0.12);
}

.tag-gender {
  border-color: rgba(180, 140, 200, 0.45);
  color: #e2c4f0;
  background: rgba(140, 100, 170, 0.12);
}

.tag-off {
  opacity: 0.75;
}

.side-timers {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}
.side-timers h4 {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffb4bc;
}
.side-timers ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.side-timers li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(155, 27, 42, 0.18);
  border: 1px solid rgba(196, 35, 56, 0.35);
  font-size: 0.85rem;
}
.side-timer-left {
  font-variant-numeric: tabular-nums;
  color: #e8a54b;
}

.side-players {
  position: sticky;
  top: 0.75rem;
}

.side-players h3 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.side-players .player-list .avatar {
  width: 34px;
  height: 34px;
  margin-top: 0.1rem;
}

#view-game {
  width: min(1100px, calc(100% - 2rem));
  display: none;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
  align-items: start;
}

#view-game.view-active {
  display: grid;
}

#view-game > .topbar {
  grid-column: 1 / -1;
}

@media (max-width: 800px) {
  #view-game.view-active {
    grid-template-columns: 1fr;
  }
  .side-players {
    order: 2;
  }
}

.game-stage {
  min-height: 420px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.turn-banner {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
}

.choice-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}

.target-btn {
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}

.target-btn:hover {
  border-color: var(--red);
  background: rgba(155, 27, 42, 0.15);
}
.target-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(232, 165, 75, 0.35);
}

.card-reveal {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 1.5rem 1.35rem 1.75rem;
  background:
    linear-gradient(160deg, rgba(155, 27, 42, 0.22), transparent 50%),
    #0c0c0e;
  border: 1px solid rgba(155, 27, 42, 0.4);
  animation: card-pop 0.5s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.card-reveal::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -40px;
  width: 160px;
  height: 160px;
  background: url("/img/logo.png") center / contain no-repeat;
  opacity: 0.08;
  pointer-events: none;
}

@keyframes card-pop {
  from { opacity: 0; transform: rotateX(8deg) scale(0.96); }
  to { opacity: 1; transform: rotateX(0) scale(1); }
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.badge-level[data-level="soft"] {
  border-color: rgba(61, 143, 122, 0.55);
  color: #9be7d0;
}

.badge-level[data-level="hard"] {
  border-color: rgba(196, 35, 56, 0.7);
  color: #ff8a96;
}

.badge-warn {
  border-color: #e8a54b;
  color: #ffd59a;
}

.card-target {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-text {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.2rem, 3.5vw, 1.65rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.reveal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.waiting-pulse {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--red-dim);
  border-top-color: var(--red-hot);
  animation: spin 0.9s linear infinite;
  margin: 2rem auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toasts {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(320px, calc(100% - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: none;
  background: rgba(14, 14, 16, 0.95);
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.35s ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.phase[hidden],
[hidden] {
  display: none !important;
}

.btn-danger {
  border-color: rgba(196, 35, 56, 0.55) !important;
  color: #ff8a96 !important;
  background: rgba(196, 35, 56, 0.12) !important;
}

.btn-danger:hover {
  background: rgba(196, 35, 56, 0.28) !important;
}

.btn-vote {
  border: 1px solid rgba(232, 165, 75, 0.55);
  color: #ffd59a;
  background: rgba(232, 165, 75, 0.08);
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  font-weight: 600;
}

.btn-vote:hover:not(:disabled) {
  background: rgba(232, 165, 75, 0.18);
}

.btn-vote.is-voted,
.btn-vote:disabled {
  opacity: 0.55;
  cursor: default;
}

.badge-vote {
  border-color: rgba(120, 160, 255, 0.55);
  color: #b9ccff;
}

.vote-bar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.vote-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.vote-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e8a54b, var(--red-hot));
  transition: width 0.35s ease;
}

.vote-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.side-hint {
  margin-top: 0.75rem;
}

.choice-sub {
  margin: 0 0 0.5rem;
}

.btn-truth,
.btn-dare {
  flex-direction: column;
  gap: 0.2rem;
}

.choice-label {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
}

.btn-truth .choice-sub,
.btn-dare .choice-sub {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  font-family: var(--font);
}

.game-stage {
  position: relative;
  overflow: hidden;
}

.game-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(155, 27, 42, 0.06), transparent 70%);
  pointer-events: none;
  animation: sheen 7s ease-in-out infinite;
}

@keyframes sheen {
  0%, 100% { opacity: 0.35; transform: translateX(-8%); }
  50% { opacity: 0.8; transform: translateX(8%); }
}

.game-stage > * {
  position: relative;
  z-index: 1;
}

.target-btn {
  position: relative;
  overflow: hidden;
}

.target-btn::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 70px;
  height: 70px;
  background: radial-gradient(circle, rgba(155, 27, 42, 0.25), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
}

.target-btn:hover::after {
  opacity: 1;
}

.panel {
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.home-grid .panel:hover {
  border-color: rgba(155, 27, 42, 0.35);
  transform: translateY(-2px);
}

.logo-sm {
  transition: transform 0.35s ease;
}

.logo-sm:hover {
  transform: scale(1.06) rotate(-3deg);
}

.turn-banner {
  background: linear-gradient(90deg, rgba(155, 27, 42, 0.18), transparent);
  border-left: 3px solid var(--red);
  padding: 0.65rem 0.9rem;
  border-radius: 0 12px 12px 0;
}


/* === Dock / sheets / chat / cam / timer === */
body.has-dock { padding-bottom: 6.25rem; }

.dock {
  position: fixed;
  left: 50%;
  bottom: max(0.85rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(28,28,32,0.96), rgba(10,10,12,0.98));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 18px 50px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(18px);
}

.dock-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-width: 4.4rem;
  padding: 0.55rem 0.75rem;
  border-radius: 16px;
  color: #cfc8cb;
  background: transparent;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.dock-btn:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.dock-btn-main {
  min-width: 5.2rem;
  background: linear-gradient(135deg, rgba(196,35,56,0.35), rgba(155,27,42,0.55));
  color: #fff;
  border: 1px solid rgba(255,140,150,0.25);
}

.dock-btn-main:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, rgba(196,35,56,0.5), rgba(155,27,42,0.7));
}

.dock-btn-ptt {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid rgba(88, 160, 255, 0.3);
  background: rgba(60, 100, 180, 0.12);
}

.dock-btn-ptt.is-talking {
  background: linear-gradient(165deg, rgba(61, 143, 122, 0.5), rgba(40, 90, 75, 0.28));
  border-color: rgba(100, 220, 170, 0.7);
  box-shadow: 0 0 0 2px rgba(100, 220, 170, 0.22);
  color: #fff;
  transform: scale(1.05);
}

.dock-btn-ptt.is-denied {
  border-color: rgba(196, 35, 56, 0.55);
  opacity: 0.7;
}

.dock-ico { font-size: 1.05rem; line-height: 1; }
.dock-lbl { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.dock-badge {
  position: absolute;
  top: 0.2rem;
  right: 0.35rem;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--red-hot);
  color: #fff;
  font-size: 0.62rem;
  font-style: normal;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #121214;
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: calc(4.9rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 1.25rem));
  max-height: min(68vh, 560px);
  z-index: 45;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(155,27,42,0.22), transparent 55%),
    rgba(12,12,14,0.98);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 28px 80px rgba(0,0,0,0.65);
  animation: sheet-in 0.28s cubic-bezier(0.2,0.9,0.2,1) both;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.05rem 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sheet-head strong {
  display: block;
  font-family: var(--display);
  font-size: 1.05rem;
}

.sheet-sub {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.sheet-close {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}

.sheet-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.sheet-body { padding: 1rem; overflow: auto; }

.sheet-chat { height: min(68vh, 560px); }

.chat-log {
  flex: 1;
  overflow: auto;
  padding: 0.9rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.15), transparent 30%);
}

.chat-bubble {
  max-width: 88%;
  align-self: flex-start;
  padding: 0.55rem 0.75rem 0.65rem;
  border-radius: 14px 14px 14px 4px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.06);
}

.chat-bubble.mine {
  align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(145deg, rgba(196,35,56,0.35), rgba(155,27,42,0.22));
  border-color: rgba(255,140,150,0.22);
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.2rem;
  font-size: 0.68rem;
  color: #ffb4bc;
}

.chat-meta time { color: var(--muted); }
.chat-body { font-size: 0.92rem; line-height: 1.35; word-break: break-word; }

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.25);
}

.chat-form input {
  flex: 1;
  border-radius: 999px;
  padding: 0.75rem 1rem;
}

.btn-send {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--red-hot), var(--red));
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(155,27,42,0.4);
}

.seg-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.25rem;
  border-radius: 14px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.06);
}

.seg {
  padding: 0.65rem;
  border-radius: 11px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
}

.seg.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(196,35,56,0.55), rgba(155,27,42,0.75));
  box-shadow: 0 6px 16px rgba(155,27,42,0.3);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.toggle-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--text);
}

.toggle-row strong { display: block; font-size: 0.9rem; }
.toggle-row small { color: var(--muted); font-size: 0.75rem; }
.toggle-row input { width: 1.15rem; height: 1.15rem; accent-color: var(--red-hot); }

.check-row {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.65rem !important;
  color: var(--text);
  font-size: 0.88rem;
}
.check-row input { width: auto; margin-top: 0.2rem; }

.suggest-host { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 0.35rem; }
.suggest-host h3 { margin: 0; font-size: 0.95rem; font-family: var(--display); }
.suggest-item {
  display: flex; justify-content: space-between; gap: 0.6rem;
  padding: 0.75rem; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.07); background: rgba(255,255,255,0.03);
}
.suggest-item p { margin: 0.35rem 0; font-size: 0.9rem; }
.suggest-actions { display: flex; flex-direction: column; gap: 0.35rem; }

.cam-stage {
  display: flex;
  justify-content: center;
  margin: 0 0 0.85rem;
  animation: cam-burst 0.55s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.cam-stage[hidden] {
  display: none !important;
}

.phone-modal {
  width: min(220px, 58vw);
}

.phone-shell {
  position: relative;
  padding: 0.55rem;
  border-radius: 2rem;
  background:
    linear-gradient(160deg, #3a3a40 0%, #151518 42%, #0a0a0c 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 28px 50px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(155, 27, 42, 0.22);
}

.phone-screen {
  position: relative;
  overflow: hidden;
  border-radius: 1.55rem;
  aspect-ratio: 9 / 16;
  background: #050505;
  border: 1px solid rgba(0, 0, 0, 0.65);
}

.phone-screen video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0a0a0c;
}

.phone-notch {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  width: 42%;
  height: 1.05rem;
  border-radius: 999px;
  background: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.phone-speaker {
  width: 28%;
  height: 0.22rem;
  border-radius: 999px;
  background: #1a1a1e;
}

.phone-camera-dot {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #4a6a9a, #152033 70%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.phone-home {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 0.45rem;
  transform: translateX(-50%);
  width: 34%;
  height: 0.28rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.phone-btn {
  position: absolute;
  background: linear-gradient(90deg, #2a2a2e, #18181b);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.phone-btn-silent {
  left: -0.14rem;
  top: 18%;
  width: 0.18rem;
  height: 1.1rem;
}

.phone-btn-vol-up {
  left: -0.14rem;
  top: 28%;
  width: 0.18rem;
  height: 1.6rem;
}

.phone-btn-vol-down {
  left: -0.14rem;
  top: 40%;
  width: 0.18rem;
  height: 1.6rem;
}

.phone-btn-power {
  right: -0.14rem;
  top: 32%;
  width: 0.18rem;
  height: 2.2rem;
}

.cam-live {
  position: absolute;
  top: 2rem;
  left: 0.55rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ff8a96;
}

.cam-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #ff3b4e;
  box-shadow: 0 0 0 0 rgba(255, 59, 78, 0.6);
  animation: pulse-dot 1.2s infinite;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 78, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(255, 59, 78, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 78, 0); }
}

.cam-note {
  position: absolute;
  z-index: 2;
  left: 0.55rem;
  right: 0.55rem;
  bottom: 1.15rem;
  margin: 0;
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #ffb4bc;
  backdrop-filter: blur(8px);
}

.cam-ask-banner {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.cam-ask-banner[hidden] {
  display: none !important;
}
.cam-ask-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.15rem 1.2rem 1.25rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 180, 188, 0.28);
  background:
    linear-gradient(165deg, rgba(155, 27, 42, 0.22), transparent 45%),
    #141014;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.cam-ask-card strong {
  font-family: var(--display);
  font-size: 1.15rem;
}
.cam-ask-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}
.cam-ask-banner[data-state="denied"] .cam-ask-card {
  border-color: rgba(232, 165, 75, 0.4);
}

@keyframes cam-burst {
  0% { opacity: 0; transform: translateY(12px) scale(0.92); filter: brightness(1.5); }
  55% { opacity: 1; transform: translateY(0) scale(1.02); filter: brightness(1.08); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
}

.cam-stage.cam-pop {
  animation: cam-burst 0.55s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.timer-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 0.15rem 0 0.75rem;
}
.timer-wrap[hidden] {
  display: none !important;
}

.timer-ring {
  position: relative;
  width: 118px;
  height: 118px;
}

.timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: rgba(255,255,255,0.08);
  stroke-width: 8;
}

.timer-fg {
  fill: none;
  stroke: url(#none);
  stroke: #c42338;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.2s linear, stroke 0.2s;
}

.timer-urgent .timer-fg { stroke: #e8a54b; }
.timer-done .timer-fg { stroke: #3d8f7a; }

.timer-readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}

.timer-readout strong {
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.timer-readout span,
.timer-caption {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.timer-caption { margin: 0; }

.badge-cam {
  border-color: rgba(255, 90, 110, 0.65);
  color: #ff8a96;
  background: rgba(196,35,56,0.15);
}

.badge-timer {
  border-color: rgba(232,165,75,0.65);
  color: #ffd59a;
  background: rgba(232,165,75,0.12);
}

.btn-danger {
  border-color: rgba(196, 35, 56, 0.55) !important;
  color: #ff8a96 !important;
  background: rgba(196, 35, 56, 0.12) !important;
}
.btn-danger:hover { background: rgba(196, 35, 56, 0.28) !important; }

.btn-vote {
  border: 1px solid rgba(232, 165, 75, 0.55);
  color: #ffd59a;
  background: rgba(232, 165, 75, 0.08);
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  font-weight: 600;
}
.btn-vote:hover:not(:disabled) { background: rgba(232, 165, 75, 0.18); }
.btn-vote.is-voted, .btn-vote:disabled { opacity: 0.55; cursor: default; }

.badge-vote { border-color: rgba(120, 160, 255, 0.55); color: #b9ccff; }

.vote-bar { display: flex; flex-direction: column; gap: 0.4rem; }
.vote-track { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.vote-fill {
  height: 100%; width: 0%; border-radius: inherit;
  background: linear-gradient(90deg, #e8a54b, var(--red-hot));
  transition: width 0.35s ease;
}
.vote-label { margin: 0; font-size: 0.8rem; color: var(--muted); }

.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
textarea {
  background: #0a0a0c; border: 1px solid var(--line); border-radius: 12px;
  padding: 0.75rem 0.9rem; outline: none; resize: vertical; min-height: 88px;
  font: inherit; color: inherit;
}
textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-dim); }

/* Chat rail droite + timer box + genre */
body.has-chat-rail {
  padding-right: min(320px, 34vw);
}

.chat-rail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(300px, 34vw);
  z-index: 30;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(22,12,14,0.98), rgba(8,8,10,0.99));
  border-left: 1px solid rgba(255,255,255,0.08);
  box-shadow: -20px 0 60px rgba(0,0,0,0.35);
}

.chat-rail[hidden],
.chat-form[hidden],
.dock[hidden],
.chat-disabled-note[hidden] {
  display: none !important;
}

.chat-rail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.chat-rail-head strong {
  font-family: var(--display);
  font-size: 1rem;
}

.chat-rail-head p {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-rail-close[hidden] {
  display: none !important;
}

.chat-rail .chat-log {
  flex: 1;
  min-height: 0;
}

.chat-rail .chat-form {
  margin-top: auto;
}

/* ===== Mobile ===== */
@media (max-width: 860px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  .view {
    width: calc(100% - 1.25rem);
    padding: 0.85rem 0 5.75rem;
  }

  .brand-hero {
    padding: 0.75rem 0 0.5rem;
  }

  .logo-hero {
    width: min(160px, 48vw);
  }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .panel {
    padding: 1rem;
  }

  .discord-bar {
    margin-bottom: 0.75rem;
    padding: 0.85rem;
  }

  .discord-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-discord {
    width: 100%;
    justify-content: center;
  }

  .discord-identity {
    width: 100%;
  }

  .discord-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .stats-panel {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
  }

  .stat strong {
    font-size: 1.15rem;
  }

  body.has-dock {
    padding-bottom: calc(5.25rem + env(safe-area-inset-bottom));
  }

  #view-game.view-active {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  }

  body.has-chat-rail {
    padding-right: 0;
  }

  /* Chat = sheet, pas un bandeau permanent */
  .chat-rail {
    top: auto !important;
    left: 0.5rem !important;
    right: 0.5rem !important;
    bottom: calc(4.85rem + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    height: min(52vh, 380px) !important;
    max-height: calc(100dvh - 6.5rem);
    border-left: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    z-index: 46;
    transform: translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .chat-rail.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .chat-rail[hidden] {
    display: none !important;
  }

  .dock {
    bottom: max(0.65rem, env(safe-area-inset-bottom));
    left: 50%;
    right: auto;
    width: auto;
    max-width: calc(100% - 1rem);
    gap: 0.2rem;
    padding: 0.3rem;
  }

  .dock-btn {
    min-width: 3.6rem;
    padding: 0.45rem 0.55rem;
  }

  .dock-btn-ptt {
    min-width: 4.2rem;
  }

  .dock-btn-ptt.is-talking .dock-lbl::after {
    content: "…";
  }

  .dock-btn-main {
    min-width: 4.2rem;
  }

  .dock-lbl {
    font-size: 0.6rem;
  }

  .sheet {
    width: calc(100% - 1rem);
    bottom: calc(4.85rem + env(safe-area-inset-bottom));
    max-height: min(70dvh, 520px);
  }

  #view-game {
    width: calc(100% - 1.25rem);
    gap: 0.65rem;
  }

  #view-game.view-active {
    grid-template-columns: 1fr;
  }

  .side-players {
    order: -1;
    position: static;
    padding: 0.75rem;
  }

  .side-players h3 {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
  }

  .side-players .player-list {
    display: flex;
    flex-direction: row;
    gap: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .side-players .player-row {
    flex: 0 0 auto;
    width: min(200px, 72vw);
    scroll-snap-align: start;
    padding: 0.55rem 0.65rem;
  }

  .side-players .player-list .avatar {
    width: 30px;
    height: 30px;
  }

  .side-hint {
    display: none;
  }

  .game-stage {
    min-height: 0;
    padding: 0.85rem;
    gap: 0.65rem;
    border-radius: 16px;
  }

  /* Carte défi : dans le flux, pas de overlay fixe */
  #phase-reveal.reveal-sheet:not([hidden]) {
    position: static;
    max-height: none;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  #phase-reveal .reveal-sheet-inner {
    gap: 0.55rem;
  }

  #phase-reveal .reveal-sheet-scroll {
    overflow: visible;
    padding: 0;
  }

  #phase-reveal .reveal-sheet-footer {
    padding: 0;
    border-top: none;
    background: transparent;
    backdrop-filter: none;
  }

  #phase-reveal .reveal-actions {
    margin-top: 0.35rem;
    gap: 0.45rem;
  }

  #phase-reveal .reveal-action-row {
    grid-template-columns: 1fr 1fr;
  }

  #phase-reveal .card-reveal {
    padding: 1rem 0.95rem 1.1rem;
    border-radius: 14px;
  }

  #phase-reveal .card-text {
    font-size: 1.05rem;
    line-height: 1.42;
    max-height: min(36dvh, 280px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.15rem;
  }

  #phase-reveal .vote-bar {
    margin-top: 0.5rem;
  }

  .gm-wait-hint {
    font-size: 0.78rem;
    padding: 0.45rem 0.55rem;
    border-radius: 10px;
    background: rgba(61, 143, 122, 0.1);
    border: 1px solid rgba(61, 143, 122, 0.22);
  }

  .turn-banner {
  .cam-stage {
    position: fixed;
    top: max(0.65rem, env(safe-area-inset-top));
    right: 0.65rem;
    left: auto;
    margin: 0;
    z-index: 44;
    width: min(42vw, 168px);
  }

  .cam-stage.is-collapsed {
    width: auto;
  }

  .cam-stage.is-collapsed .phone-shell,
  .cam-stage.is-collapsed .cam-live,
  .cam-stage.is-collapsed .cam-note {
    display: none;
  }

  .cam-stage.is-collapsed .cam-mobile-sheet {
    width: auto;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .cam-mobile-sheet {
    position: relative;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  }

  .cam-sheet-close {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    z-index: 5;
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
  }

  .phone-modal {
    width: 100%;
  }

  .phone-shell {
    padding: 0.35rem;
    border-radius: 1.35rem;
  }

  .phone-shell .phone-btn {
    display: none;
  }

  .phone-notch {
    width: 36%;
    height: 0.85rem;
  }

  .turn-banner {
    font-size: 0.95rem;
    padding: 0.55rem 0.7rem;
  }

  .card-reveal {
    padding: 1.1rem 1rem 1.25rem;
    border-radius: 16px;
  }

  .card-text {
    font-size: 1.05rem;
  }

  .choice-row {
    flex-direction: column;
  }

  .choice-row .btn {
    width: 100%;
  }

  .target-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }

  .target-btn {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  .timer-box {
    min-width: 0;
    width: 100%;
    padding: 0.75rem;
  }

  .timer-digits {
    font-size: 1.85rem;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .lobby-layout {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .toasts {
    left: 0.75rem;
    right: 0.75rem;
    top: max(0.75rem, env(safe-area-inset-top));
  }

  .toast {
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dock-btn {
    min-width: 3.25rem;
  }
}

.timer-wrap { margin: 0.35rem 0 0.75rem; }
.timer-wrap[hidden] { display: none !important; }
.timer-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(155,27,42,0.25), rgba(20,20,22,0.9));
  border: 1px solid rgba(196,35,56,0.4);
  min-width: min(260px, 90%);
}
.timer-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffb4bc;
}
.timer-digits {
  font-family: "Outfit", ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  font-stretch: normal;
  font-variation-settings: normal;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0.04em;
  line-height: 1.15;
  transform: none;
  scale: none;
  text-rendering: geometricPrecision;
  color: #fff;
}
.timer-bar {
  width: min(220px, 70%);
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.timer-bar i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e8a54b, #c42338);
  transition: width 0.1s linear;
}
.timer-urgent .timer-digits { color: #e8a54b; }
.timer-done .timer-digits { color: #9be7d0; }
.timer-done .timer-bar i { background: #3d8f7a; }
.cible-note { margin: 0.65rem 0 0; color: #ffb4bc; }

body.has-dock.has-chat-rail .dock {
  right: auto;
}

/* Discord banner (home) */
.discord-bar {
  max-width: 720px;
  margin: 0 auto 1rem;
  padding: 1rem 1.15rem;
}
.discord-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.discord-row[hidden],
#discord-guest[hidden],
#discord-user[hidden] {
  display: none !important;
}
.discord-copy strong {
  display: block;
  font-size: 1rem;
}
.discord-copy .hint {
  margin: 0.25rem 0 0;
}
.discord-ready {
  margin: 0.2rem 0 0;
  color: #9be7d0 !important;
}
.discord-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.discord-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.btn-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: #5865f2;
  color: #fff !important;
  border: none;
  text-decoration: none;
  padding: 0.75rem 1.15rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.35);
}
.btn-discord:hover {
  filter: brightness(1.08);
  color: #fff !important;
}
.btn-discord .discord-ico,
.btn-discord svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  display: block;
  flex: 0 0 18px;
}
@media (max-width: 560px) {
  .discord-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-discord {
    width: 100%;
  }
}

.stats-panel {
  max-width: 720px;
  margin: 0 auto 1rem;
}
.stats-panel[hidden] {
  display: none !important;
}
.stats-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}
.stats-sub {
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.stat {
  text-align: center;
  padding: 0.7rem 0.4rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
}
.stat strong {
  display: block;
  font-size: 1.25rem;
  font-family: var(--display);
  color: #ffb4bc;
}
.stat span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stats-leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.stats-leaderboard li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  font-size: 0.88rem;
}
.stats-leaderboard .rank {
  width: 1.4rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.stats-leaderboard .score {
  margin-left: auto;
  color: #e8a54b;
  font-weight: 600;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #2b2d31;
  border: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}
.avatar-lg { width: 44px; height: 44px; }
.avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #ffb4bc;
  background: rgba(155, 27, 42, 0.45);
}

.chat-msg {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
}
.chat-msg .avatar { width: 22px; height: 22px; margin-top: 2px; }

.chat-disabled-note {
  margin: 0.5rem 0.85rem 0.85rem;
  text-align: center;
}

.admin-discord-block {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.5rem;
}
.dock-me {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.dock-me .avatar { width: 22px; height: 22px; }

/* ===== Code du salon copiable (même masqué) ===== */
.code-copy {
  cursor: pointer;
  border-bottom: 1px dashed rgba(255, 180, 188, 0.45);
  transition: color 0.2s, border-color 0.2s;
}
.code-copy:hover {
  color: #ffb4bc;
  border-color: #ffb4bc;
}

/* ===== Niveau ultra ===== */
.badge-level[data-level="ultra"] {
  border-color: rgba(206, 90, 255, 0.7);
  color: #e8b4ff;
  background: rgba(150, 60, 210, 0.16);
}

.seg-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

.check-row span {
  display: block;
}
.check-hint {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.3;
}

/* ===== Chrono de désignation ===== */
.pick-timer {
  margin: -0.35rem 0 0;
  align-self: flex-start;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffd59a;
  background: rgba(232, 165, 75, 0.12);
  border: 1px solid rgba(232, 165, 75, 0.4);
  font-variant-numeric: tabular-nums;
}
.pick-timer.is-urgent {
  color: #ff8a96;
  background: rgba(196, 35, 56, 0.16);
  border-color: rgba(196, 35, 56, 0.5);
  animation: pick-pulse 1s ease-in-out infinite;
}
@keyframes pick-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===== Joueurs : exclusion + fiche ===== */
.btn-kick {
  padding: 0.28rem 0.55rem;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}
.player-row.is-clickable {
  cursor: pointer;
}
.player-row.is-clickable:hover {
  border-color: rgba(155, 27, 42, 0.45);
  background: rgba(155, 27, 42, 0.09);
}

/* ===== Votes sur les suggestions ===== */
.suggest-info {
  min-width: 0;
  flex: 1;
}
.sug-votes {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding: 0.2rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.sug-vote-btn {
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.15s;
  position: relative;
}
.sug-vote-btn::after {
  content: attr(data-count);
  position: absolute;
  bottom: -0.15rem;
  right: -0.15rem;
  min-width: 0.95rem;
  height: 0.95rem;
  padding: 0 0.2rem;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 0.95rem;
  text-align: center;
  background: #1a1214;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sug-vote-btn:active {
  transform: scale(0.94);
}
.sug-vote-up:hover {
  color: #9be7d0;
  border-color: rgba(61, 143, 122, 0.45);
  background: rgba(61, 143, 122, 0.2);
}
.sug-vote-down:hover {
  color: #ff8a96;
  border-color: rgba(196, 35, 56, 0.45);
  background: rgba(196, 35, 56, 0.2);
}
.sug-score {
  min-width: 2rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sug-score.is-up { color: #9be7d0; }
.sug-score.is-down { color: #ff8a96; }

.tag-couple {
  border-color: rgba(232, 120, 160, 0.55);
  color: #ffb6c8;
  background: rgba(196, 60, 110, 0.15);
}

.build-badge {
  position: fixed;
  left: max(0.5rem, env(safe-area-inset-left));
  bottom: max(0.4rem, env(safe-area-inset-bottom));
  z-index: 5;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  font-size: 0.58rem;
  font-family: ui-monospace, monospace;
  color: rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.25);
  pointer-events: none;
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sfx-toggle {
  position: fixed;
  top: max(0.65rem, env(safe-area-inset-top));
  right: max(0.65rem, env(safe-area-inset-right));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 8, 10, 0.72);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.sfx-toggle:hover {
  color: var(--text);
  border-color: rgba(255, 180, 188, 0.35);
}
.sfx-toggle.is-muted {
  opacity: 0.55;
}
.sfx-toggle.is-muted span:first-child {
  filter: grayscale(1);
}

.badge-gender[data-gender="male"] {
  border-color: rgba(120, 170, 255, 0.55);
  color: #b9ccff;
  background: rgba(80, 120, 220, 0.18);
}
.badge-gender[data-gender="female"] {
  border-color: rgba(232, 120, 160, 0.55);
  color: #ffb6c8;
  background: rgba(196, 60, 110, 0.18);
}

.btn-couple {
  border-color: rgba(232, 120, 160, 0.5) !important;
  color: #ffb6c8 !important;
  background: rgba(196, 60, 110, 0.12) !important;
}

.btn-couple:hover:not(:disabled) {
  background: rgba(196, 60, 110, 0.28) !important;
}

.reveal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.reveal-sheet-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}

.reveal-sheet-scroll {
  min-height: 0;
}

.reveal-sheet-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gm-wait-hint {
  margin: 0;
  text-align: center;
  color: #9be7d0;
  font-size: 0.85rem;
}

.btn-gm-validate {
  min-height: 3.35rem;
  font-size: 1.05rem;
}

.reveal-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.reveal-action-row .btn {
  width: 100%;
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 16px;
  font-weight: 650;
}

.btn-ico {
  font-size: 1.1rem;
  opacity: 0.9;
}

.btn-game-main {
  min-height: 3.15rem;
  border-radius: 16px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn-vote {
  border: 1px solid rgba(232, 165, 75, 0.55);
  color: #ffd59a;
  background: rgba(232, 165, 75, 0.1);
}

.btn-reroll {
  border: 1px solid rgba(155, 120, 255, 0.45);
  color: #d4c4ff;
  background: rgba(120, 90, 220, 0.12);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  font-weight: 650;
}

.btn-done {
  border: 1px solid rgba(61, 143, 122, 0.55);
  color: #9be7d0;
  background: linear-gradient(135deg, rgba(61, 143, 122, 0.28), rgba(61, 143, 122, 0.12));
  border-radius: 16px;
  padding: 0.95rem 1.2rem;
  font-weight: 700;
}

.btn-done:hover {
  background: linear-gradient(135deg, rgba(61, 143, 122, 0.4), rgba(61, 143, 122, 0.18));
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.choice-gender-hint {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 0.8rem;
}

.btn-truth,
.btn-dare {
  min-height: 5.5rem;
  border-radius: 20px;
  padding: 1rem 0.85rem;
}

.btn-truth {
  border: 1px solid rgba(120, 170, 255, 0.45);
  background: linear-gradient(165deg, rgba(80, 120, 220, 0.28), rgba(40, 60, 120, 0.12));
}

.btn-dare {
  border: 1px solid rgba(196, 35, 56, 0.55);
  background: linear-gradient(165deg, rgba(196, 35, 56, 0.32), rgba(90, 20, 30, 0.14));
}

.sug-couple-hint code {
  color: #ffb6c8;
}

@media (max-width: 520px) {
  .reveal-action-row {
    grid-template-columns: 1fr;
  }
}

/* ===== Notation fin de partie ===== */
.rating-panel {
  max-width: 620px;
  margin: 0 auto;
}
.rating-list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.75rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.rating-who {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.rating-who .name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stars {
  display: flex;
  gap: 0.15rem;
  margin-left: auto;
}
.star-btn {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  font-size: 1.15rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.18);
  transition: color 0.15s ease, transform 0.15s ease, background 0.2s;
}
.star-btn:hover:not(:disabled) {
  color: #ffd59a;
  background: rgba(232, 165, 75, 0.12);
  transform: translateY(-1px);
}
.star-btn.is-on {
  color: #e8a54b;
  text-shadow: 0 0 12px rgba(232, 165, 75, 0.45);
}
.star-btn:disabled {
  cursor: default;
  opacity: 0.75;
}
.rating-done-note {
  color: #9be7d0 !important;
}

/* ===== Fiche joueur (modal) ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal[hidden] {
  display: none !important;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 4, 0.72);
  backdrop-filter: blur(6px);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(84vh, 620px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  animation: modal-in 0.24s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
}
.ps-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-right: 2.25rem;
}
.ps-head strong {
  display: block;
  font-family: var(--display);
  font-size: 1.1rem;
}
.ps-head .hint {
  margin: 0.1rem 0 0;
}
.ps-grid {
  grid-template-columns: repeat(3, 1fr);
}
.stat-rating strong {
  color: #e8a54b;
}
body.modal-open {
  overflow: hidden;
}

/* ===== Home : panneaux plus compacts et lisibles ===== */
.home-grid .panel {
  padding: 1.1rem 1.15rem;
}
.discord-bar {
  background:
    linear-gradient(120deg, rgba(88, 101, 242, 0.14), transparent 55%),
    var(--bg-panel);
  border-color: rgba(88, 101, 242, 0.28);
}
.stats-panel .stat {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
}
.stats-panel .stat:hover {
  border-color: rgba(155, 27, 42, 0.35);
}

@media (max-width: 860px) {
  .home-grid .panel {
    padding: 0.95rem 1rem;
  }
  .discord-bar {
    padding: 0.8rem 0.9rem;
  }
  .rating-panel {
    padding: 1rem;
  }
  .rating-row {
    padding: 0.55rem 0.6rem;
    gap: 0.5rem;
  }
  .stars {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .star-btn {
    flex: 1;
    height: 2.4rem;
    font-size: 1.25rem;
  }
  .modal {
    align-items: flex-end;
    padding: 0.75rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }
  .modal-card {
    width: 100%;
    max-height: 80dvh;
    padding: 1rem;
  }
  .ps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .pick-timer {
    align-self: stretch;
    text-align: center;
  }
  .player-actions {
    align-self: flex-start;
  }
  .suggest-item {
    flex-direction: column;
  }
  .suggest-actions {
    flex-direction: row;
  }
  .suggest-actions .btn {
    flex: 1;
  }
}
