* {
  box-sizing: border-box;
}

:root {
  --ui-scale: 1;
  --background: #f6f4ef;
  --card: rgba(255, 255, 255, 0.92);
  --card-strong: rgba(255, 255, 255, 0.97);
  --text: #1f2933;
  --muted: #6b7280;
  --border: rgba(229, 231, 235, 0.9);
  --primary: #111827;
  --primary-hover: #374151;
  --secondary: #f3f4f6;
  --secondary-hover: #e5e7eb;
  --focus: #2563eb;
  --error: #b91c1c;
  --error-background: rgba(254, 226, 226, 0.95);
  --error-border: rgba(248, 113, 113, 0.75);
  --danger: #b91c1c;
  --danger-hover: #991b1b;
  --danger-background: rgba(254, 226, 226, 0.95);
  --danger-border: rgba(248, 113, 113, 0.75);
  --state-background: rgba(17, 24, 39, 0.96);
  --state-border: rgba(255, 255, 255, 0.18);
  --state-text: #ffffff;
  --state-muted: rgba(255, 255, 255, 0.68);
  --win-background: rgba(22, 101, 52, 0.96);
  --win-glow: rgba(74, 222, 128, 0.35);
  --loss-background: rgba(127, 29, 29, 0.96);
  --loss-glow: rgba(248, 113, 113, 0.38);
  --timer-urgent: #b91c1c;
  --timer-urgent-background: rgba(254, 226, 226, 0.96);
  --timer-urgent-border: rgba(248, 113, 113, 0.8);
  --prompt-background: rgba(255, 251, 235, 0.96);
  --prompt-border: rgba(251, 191, 36, 0.8);
  --prompt-text: #78350f;
  --guess: #1d4ed8;
  --guess-hover: #1e40af;
  --guess-border: rgba(96, 165, 250, 0.85);
  --radius: calc(18px * var(--ui-scale));
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--background);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("/background.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 100% auto;
  opacity: 1;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.42), rgba(246, 244, 239, 0.82)),
    rgba(246, 244, 239, 0.22);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: calc(16px * var(--ui-scale));
  padding: calc(24px * var(--ui-scale));
}

.card {
  width: 100%;
  max-width: calc(520px * var(--ui-scale));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: calc(32px * var(--ui-scale));
  box-shadow: 0 calc(24px * var(--ui-scale)) calc(60px * var(--ui-scale)) rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(calc(10px * var(--ui-scale)));
}

.is-hidden {
  display: none;
}

.header {
  margin-bottom: calc(28px * var(--ui-scale));
}

.eyebrow {
  margin: 0 0 calc(8px * var(--ui-scale));
  font-size: calc(0.8rem * var(--ui-scale));
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(calc(2rem * var(--ui-scale)), 6vw, calc(3rem * var(--ui-scale)));
  line-height: 1;
  letter-spacing: -0.05em;
}

h2 {
  margin: 0;
  font-size: calc(1rem * var(--ui-scale));
}

.subtitle {
  margin: calc(14px * var(--ui-scale)) 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.room-form {
  display: grid;
  gap: calc(18px * var(--ui-scale));
}

.optional-label {
  float: right;
  color: var(--muted);
  font-weight: 500;
}

.field {
  display: grid;
  gap: calc(8px * var(--ui-scale));
}

label {
  font-size: calc(0.9rem * var(--ui-scale));
  font-weight: 650;
}

input,
select {
  width: 100%;
  height: calc(46px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: calc(12px * var(--ui-scale));
  padding: 0 calc(14px * var(--ui-scale));
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

input::placeholder {
  color: #9ca3af;
}

input:focus,
select:focus {
  outline: calc(3px * var(--ui-scale)) solid rgba(37, 99, 235, 0.16);
  border-color: var(--focus);
}

input:disabled,
select:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: calc(4px * var(--ui-scale)) 0;
}

.button {
  height: calc(46px * var(--ui-scale));
  border: 0;
  border-radius: calc(12px * var(--ui-scale));
  padding: 0 calc(18px * var(--ui-scale));
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 120ms ease,
    transform 120ms ease,
    opacity 120ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-primary {
  color: white;
  background: var(--primary);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.button-secondary {
  color: var(--text);
  background: var(--secondary);
}

.button-secondary:hover:not(:disabled) {
  background: var(--secondary-hover);
}

.button-danger {
  color: white;
  background: var(--danger);
}

.button-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: calc(12px * var(--ui-scale));
  align-items: end;
}

.room-code-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: calc(16px * var(--ui-scale));
  margin-bottom: calc(24px * var(--ui-scale));
  padding: calc(16px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: calc(14px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.7);
}

.room-code-panel span {
  color: var(--muted);
  font-weight: 650;
}

.room-code-panel strong {
  font-size: calc(1.7rem * var(--ui-scale));
  letter-spacing: 0.16em;
}

.lobby-section {
  margin-bottom: calc(24px * var(--ui-scale));
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: calc(12px * var(--ui-scale));
  margin-bottom: calc(12px * var(--ui-scale));
}

.player-requirements {
  color: var(--muted);
  font-size: calc(0.75rem * var(--ui-scale));
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: calc(8px * var(--ui-scale));
}

.player-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: calc(42px * var(--ui-scale));
  padding: calc(10px * var(--ui-scale)) calc(12px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: calc(12px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.66);
  font-weight: 650;
}

.host-badge {
  color: var(--muted);
  font-size: calc(0.8rem * var(--ui-scale));
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lobby-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(12px * var(--ui-scale));
}

.game-shell {
  width: min(calc(1640px * var(--ui-scale)), calc(100vw - calc(48px * var(--ui-scale))));
  height: auto;
  display: grid;
  grid-template-columns: calc(280px * var(--ui-scale)) minmax(calc(520px * var(--ui-scale)), 1fr) minmax(calc(500px * var(--ui-scale)), calc(560px * var(--ui-scale)));
  gap: calc(18px * var(--ui-scale));
  align-items: stretch;
}

.game-shell.is-hidden {
  display: none;
}

.left-panel,
.right-panel,
.chat-panel {
  min-height: 0;
}

.left-panel,
.right-panel {
  display: grid;
  gap: calc(18px * var(--ui-scale));
}

.left-panel {
  grid-template-rows: auto auto 1fr;
}

.right-panel {
  grid-template-rows: 1fr;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--card-strong);
  border: 1px solid var(--border);
  border-radius: calc(26px * var(--ui-scale));
  padding: calc(26px * var(--ui-scale));
  box-shadow: 0 calc(28px * var(--ui-scale)) calc(80px * var(--ui-scale)) rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(calc(12px * var(--ui-scale)));
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: calc(18px * var(--ui-scale));
  margin-bottom: calc(22px * var(--ui-scale));
  padding-bottom: calc(18px * var(--ui-scale));
  border-bottom: 1px solid var(--border);
}

.mini-card,
.game-state-card,
.timer-card {
  min-height: 0;
  border-radius: calc(24px * var(--ui-scale));
  backdrop-filter: blur(calc(12px * var(--ui-scale)));
}

.mini-card,
.timer-card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: calc(20px * var(--ui-scale));
  box-shadow: 0 calc(22px * var(--ui-scale)) calc(60px * var(--ui-scale)) rgba(15, 23, 42, 0.11);
}

.timer-card.is-replay {
  display: grid;
  place-items: center;
  min-width: calc(126px * var(--ui-scale));
}

.timer-card.is-replay .mini-label,
.timer-card.is-replay .timer-text {
  display: none;
}

.replay-button {
  width: 100%;
}

.role-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(243, 244, 246, 0.92));
}

.game-state-card {
  position: relative;
  overflow: hidden;
  min-height: calc(170px * var(--ui-scale));
  padding: calc(22px * var(--ui-scale));
  background:
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.42), transparent 42%),
    var(--state-background);
  border: 1px solid var(--state-border);
  color: var(--state-text);
  box-shadow: 0 calc(30px * var(--ui-scale)) calc(90px * var(--ui-scale)) rgba(15, 23, 42, 0.32);
}

.game-state-card.is-your-action {
  background:
    linear-gradient(135deg, rgba(219, 234, 254, 0.98), rgba(239, 246, 255, 0.92));
  border-color: rgba(37, 99, 235, 0.75);
  color: var(--text);
  box-shadow: 0 calc(24px * var(--ui-scale)) calc(70px * var(--ui-scale)) rgba(37, 99, 235, 0.18);
}

.game-state-card.is-your-action::before {
  border-color: rgba(37, 99, 235, 0.2);
}

.game-state-card.is-your-action .mini-label {
  color: #1d4ed8;
}

.game-state-card.is-your-action .game-state-text {
  color: #1e3a8a;
}

@keyframes action-nudge-left {
  0%,
  70%,
  100% {
    transform: translateX(0);
  }

  84% {
    transform: translateX(calc(-8px * var(--ui-scale)));
  }
}

.game-state-card.is-your-action {
  animation: action-nudge-left 2s ease-in-out infinite;
}

.game-state-card::before {
  content: "";
  position: absolute;
  inset: calc(14px * var(--ui-scale));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: calc(18px * var(--ui-scale));
  pointer-events: none;
}

.game-state-card.is-win {
  background:
    radial-gradient(circle at top right, var(--win-glow), transparent 42%),
    var(--win-background);
}

.game-state-card.is-loss {
  background:
    radial-gradient(circle at top right, var(--loss-glow), transparent 42%),
    var(--loss-background);
}

.game-state-card .mini-label {
  color: var(--state-muted);
}

.mini-card h2 {
  margin-bottom: calc(12px * var(--ui-scale));
}

.mini-label {
  margin: 0 0 calc(12px * var(--ui-scale));
  color: var(--muted);
  font-size: calc(0.75rem * var(--ui-scale));
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-state-text {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--state-text);
  font-size: calc(1.65rem * var(--ui-scale));
  font-weight: 850;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.role-text {
  margin: 0;
  color: var(--text);
  font-size: calc(1.45rem * var(--ui-scale));
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.timer-card {
  flex: 0 0 auto;
  min-width: calc(126px * var(--ui-scale));
  padding: calc(14px * var(--ui-scale)) calc(16px * var(--ui-scale));
  border-radius: calc(18px * var(--ui-scale));
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.timer-card .mini-label {
  margin-bottom: calc(6px * var(--ui-scale));
  font-size: calc(0.68rem * var(--ui-scale));
}

.timer-text {
  margin: 0;
  color: var(--text);
  font-size: calc(2rem * var(--ui-scale));
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.timer-card.is-urgent {
  border-color: var(--timer-urgent-border);
  background: var(--timer-urgent-background);
}

.timer-card.is-urgent .mini-label,
.timer-card.is-urgent .timer-text {
  color: var(--timer-urgent);
}

.message-list {
  flex: 1 1 0;
  min-height: 0;
  margin: 0 0 calc(18px * var(--ui-scale));
  padding: 0;
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: calc(12px * var(--ui-scale));
}

.message-list li {
  max-width: 78%;
  padding: calc(12px * var(--ui-scale)) calc(14px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: calc(16px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.76);
  line-height: 1.45;
  box-shadow: 0 calc(10px * var(--ui-scale)) calc(24px * var(--ui-scale)) rgba(15, 23, 42, 0.05);
}

.message-list li.system-message {
  max-width: 100%;
  color: var(--muted);
  background: rgba(243, 244, 246, 0.75);
  font-weight: 700;
  text-align: center;
}

.message-list li.question-message {
  background: rgba(239, 246, 255, 0.96);
}

.message-list li.answer-message {
  align-self: flex-end;
  background: rgba(255, 255, 255, 0.92);
}

.message-list li.temporary-message {
  align-self: stretch;
  max-width: 100%;
  padding: calc(16px * var(--ui-scale));
  border-color: var(--prompt-border);
  background: var(--prompt-background);
  color: var(--prompt-text);
  text-align: left;
}

.prompt-body {
  margin: 0 0 calc(14px * var(--ui-scale));
  color: var(--prompt-text);
  font-weight: 650;
  line-height: 1.45;
}

.belief-form {
  display: grid;
  gap: calc(12px * var(--ui-scale));
}

.belief-question {
  margin: 0;
  font-weight: 800;
}

.belief-scale {
  display: grid;
  gap: calc(7px * var(--ui-scale));
  font-weight: 750;
}

.belief-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(8px * var(--ui-scale));
}

.belief-radio {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(6px * var(--ui-scale));
  min-height: calc(42px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(10px * var(--ui-scale));
  border: 1px solid rgba(251, 191, 36, 0.55);
  border-radius: calc(10px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.58);
  font-weight: 750;
  cursor: pointer;
  text-align: center;
}

.belief-radio input {
  width: auto;
  height: auto;
}

.spy-belief-location-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(8px * var(--ui-scale));
}

.spy-belief-location-option {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale));
  min-height: calc(42px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(10px * var(--ui-scale));
  border: 1px solid rgba(251, 191, 36, 0.55);
  border-radius: calc(10px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.58);
  font-weight: 750;
  cursor: pointer;
}

.spy-belief-location-option input {
  width: auto;
  height: auto;
}

.location-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(8px * var(--ui-scale));
  max-height: calc(220px * var(--ui-scale));
  overflow-y: auto;
}

.check-row {
  display: flex;
  align-items: center;
  gap: calc(8px * var(--ui-scale));
  min-height: calc(38px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(10px * var(--ui-scale));
  border: 1px solid rgba(251, 191, 36, 0.55);
  border-radius: calc(10px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.58);
  font-weight: 750;
}

.check-row input {
  width: auto;
  height: auto;
}

.prompt-actions,
.vote-actions {
  display: flex;
  gap: calc(10px * var(--ui-scale));
  margin-top: calc(14px * var(--ui-scale));
}

.chat-controls {
  display: grid;
  grid-template-columns: calc(190px * var(--ui-scale)) 1fr auto;
  gap: calc(10px * var(--ui-scale));
  padding-top: calc(18px * var(--ui-scale));
  border-top: 1px solid var(--border);
}

.chat-controls.is-answer-mode,
.chat-controls.is-discussion {
  grid-template-columns: 1fr auto;
}

.chat-controls.is-answer-mode #answerer,
.chat-controls.is-discussion #answerer {
  display: none;
}

.chat-controls.is-waiting {
  grid-template-columns: 1fr auto;
}

.chat-controls.is-waiting #answerer {
  display: none;
}

.compact-list,
.location-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: calc(8px * var(--ui-scale));
}

.compact-list li,
.location-list li {
  padding: calc(10px * var(--ui-scale)) calc(11px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: calc(12px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.66);
  font-weight: 700;
}

.player-row,
.location-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: calc(10px * var(--ui-scale));
}

.location-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: calc(10px * var(--ui-scale));
  min-height: calc(56px * var(--ui-scale));
}

.location-name-line {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: calc(10px * var(--ui-scale));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-name-line,
.location-name-line {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-action-slot,
.player-action-slot {
  width: calc(34px * var(--ui-scale));
  height: calc(34px * var(--ui-scale));
}

.location-action-slot.is-hidden-action {
  display: none;
}

.secret-location-badge {
  flex: 0 0 auto;
  margin-left: auto;
  padding: calc(3px * var(--ui-scale)) calc(7px * var(--ui-scale));
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
  font-size: calc(0.66rem * var(--ui-scale));
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.accuse-button,
.guess-button {
  width: 100%;
  height: 100%;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: calc(10px * var(--ui-scale));
  color: white;
  cursor: pointer;
  transition:
    background 120ms ease,
    opacity 120ms ease,
    transform 120ms ease;
}

.accuse-button {
  border: 1px solid var(--danger-border);
  background: var(--danger);
}

.guess-button {
  border: 1px solid var(--guess-border);
  background: var(--guess);
}

.accuse-button:hover:not(:disabled) {
  background: var(--danger-hover);
}

.guess-button:hover:not(:disabled) {
  background: var(--guess-hover);
}

.accuse-button:active:not(:disabled),
.guess-button:active:not(:disabled) {
  transform: translateY(1px);
}

.accuse-button:disabled,
.guess-button:disabled {
  cursor: not-allowed;
  opacity: 0.32;
}

.tooltip-wrap {
  position: relative;
  display: inline-grid;
}

.tooltip-wrap::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  bottom: calc(100% + calc(8px * var(--ui-scale)));
  z-index: 30;
  width: max-content;
  max-width: calc(240px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale)) calc(10px * var(--ui-scale));
  border-radius: calc(10px * var(--ui-scale));
  background: rgba(17, 24, 39, 0.96);
  color: white;
  font-size: calc(0.78rem * var(--ui-scale));
  font-weight: 750;
  line-height: 1.25;
  box-shadow: 0 calc(14px * var(--ui-scale)) calc(34px * var(--ui-scale)) rgba(15, 23, 42, 0.26);
  opacity: 0;
  transform: translateY(calc(4px * var(--ui-scale)));
  pointer-events: none;
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.tooltip-wrap:hover::after,
.tooltip-wrap:focus-within::after {
  opacity: 1;
  transform: translateY(0);
}

.material-symbols-rounded {
  font-size: calc(20px * var(--ui-scale));
  line-height: 1;
}

.location-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.location-list li.is-own-location {
  border-color: rgba(124, 58, 237, 0.72);
  background:
    linear-gradient(135deg, rgba(237, 233, 254, 0.98), rgba(245, 243, 255, 0.94));
  box-shadow: 0 calc(14px * var(--ui-scale)) calc(34px * var(--ui-scale)) rgba(124, 58, 237, 0.16);
}

.locations-card {
  display: flex;
  flex-direction: column;
  align-self: start;
}

.locations-card .location-list {
  min-height: auto;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: calc(24px * var(--ui-scale));
}

.modal-overlay.is-hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(calc(4px * var(--ui-scale)));
}

.confirmation-modal {
  position: relative;
  z-index: 1;
  width: min(calc(430px * var(--ui-scale)), calc(100vw - calc(48px * var(--ui-scale))));
  padding: calc(26px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: calc(24px * var(--ui-scale));
  background: var(--card-strong);
  box-shadow: 0 calc(34px * var(--ui-scale)) calc(100px * var(--ui-scale)) rgba(15, 23, 42, 0.36);
}

.confirmation-modal h2 {
  margin: 0 0 calc(12px * var(--ui-scale));
  font-size: calc(1.7rem * var(--ui-scale));
  letter-spacing: -0.04em;
}

.modal-copy {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.5;
}

.modal-copy strong {
  color: var(--text);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(12px * var(--ui-scale));
  margin-top: calc(22px * var(--ui-scale));
}

.modal-close {
  position: absolute;
  top: calc(14px * var(--ui-scale));
  right: calc(14px * var(--ui-scale));
  width: calc(34px * var(--ui-scale));
  height: calc(34px * var(--ui-scale));
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: var(--secondary);
  font-size: calc(1.35rem * var(--ui-scale));
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--secondary-hover);
}

.status {
  position: fixed;
  left: 50%;
  bottom: calc(24px * var(--ui-scale));
  z-index: 90;
  display: none;
  width: min(calc(680px * var(--ui-scale)), calc(100vw - calc(48px * var(--ui-scale))));
  margin: 0;
  padding: calc(14px * var(--ui-scale)) calc(16px * var(--ui-scale));
  border-radius: calc(14px * var(--ui-scale));
  border: 1px solid var(--error-border);
  background: var(--error-background);
  color: var(--error);
  font-size: calc(0.95rem * var(--ui-scale));
  font-weight: 700;
  line-height: 1.45;
  box-shadow: 0 calc(20px * var(--ui-scale)) calc(60px * var(--ui-scale)) rgba(15, 23, 42, 0.2);
  transform: translateX(-50%);
  pointer-events: none;
}

.status.is-visible {
  display: block;
}

.status::before {
  content: "Error: ";
  font-weight: 800;
}

.room-id-badge {
  position: fixed;
  right: calc(18px * var(--ui-scale));
  bottom: calc(18px * var(--ui-scale));
  z-index: 70;
  margin: 0;
  padding: calc(8px * var(--ui-scale)) calc(11px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-strong);
  color: var(--muted);
  font-size: calc(0.75rem * var(--ui-scale));
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 calc(12px * var(--ui-scale)) calc(34px * var(--ui-scale)) rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(calc(10px * var(--ui-scale)));
}

.disclaimer-badge {
  position: fixed;
  left: calc(18px * var(--ui-scale));
  bottom: calc(18px * var(--ui-scale));
  z-index: 70;
  max-width: min(calc(520px * var(--ui-scale)), calc(100vw - calc(170px * var(--ui-scale))));
  margin: 0;
  padding: calc(8px * var(--ui-scale)) calc(11px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-strong);
  color: var(--muted);
  font-size: calc(0.75rem * var(--ui-scale));
  font-weight: 750;
  line-height: 1.35;
  box-shadow: 0 calc(12px * var(--ui-scale)) calc(34px * var(--ui-scale)) rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(calc(10px * var(--ui-scale)));
}

.help-button {
  position: fixed;
  top: calc(24px * var(--ui-scale));
  left: calc(24px * var(--ui-scale));
  z-index: 75;
  width: calc(42px * var(--ui-scale));
  height: calc(42px * var(--ui-scale));
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-strong);
  color: var(--text);
  font: inherit;
  font-size: calc(1.1rem * var(--ui-scale));
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 calc(14px * var(--ui-scale)) calc(38px * var(--ui-scale)) rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(calc(10px * var(--ui-scale)));
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease,
    opacity 120ms ease;
}

.help-button:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 calc(18px * var(--ui-scale)) calc(44px * var(--ui-scale)) rgba(15, 23, 42, 0.22);
}

.help-button:active {
  transform: translateY(1px);
}

@keyframes help-button-pulse {
  0%,
  100% {
    border-color: rgba(37, 99, 235, 0.45);
    box-shadow:
      0 calc(14px * var(--ui-scale)) calc(38px * var(--ui-scale)) rgba(15, 23, 42, 0.16),
      0 0 0 0 rgba(37, 99, 235, 0.28);
  }

  50% {
    border-color: rgba(37, 99, 235, 0.85);
    box-shadow:
      0 calc(18px * var(--ui-scale)) calc(48px * var(--ui-scale)) rgba(37, 99, 235, 0.22),
      0 0 0 calc(10px * var(--ui-scale)) rgba(37, 99, 235, 0);
  }
}

.help-button.is-pulsing {
  background:
    linear-gradient(135deg, rgba(219, 234, 254, 0.98), rgba(239, 246, 255, 0.92));
  border-color: rgba(37, 99, 235, 0.75);
  color: #1d4ed8;
  animation: help-button-pulse 1.8s ease-in-out infinite;
}

.help-button.is-pulsing:hover {
  animation: none;
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.help-modal-card {
  width: 50vw;
  height: 56vh;
  max-width: none;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  row-gap: calc(28px * var(--ui-scale));
  overflow: hidden;
}

.help-page-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: calc(18px * var(--ui-scale));
  align-items: center;
  min-height: 0;
}

.help-pages {
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.help-page {
  height: 100%;
  min-height: 0;
  text-align: left;
}

.help-page:not(.is-active) {
  display: none;
}

.help-page h2 {
  margin: 0;
  font-size: clamp(calc(1.7rem * var(--ui-scale)), 3vw, calc(2.35rem * var(--ui-scale)));
  letter-spacing: -0.055em;
}

.help-page-content {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: calc(22px * var(--ui-scale));
  min-height: 0;
}

.help-page-header {
  text-align: center;
}

.help-page-header .mini-label {
  margin-bottom: calc(8px * var(--ui-scale));
}

.help-intro-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: calc(14px * var(--ui-scale));
}

.help-info-tile {
  min-width: 0;
  padding: calc(18px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: calc(18px * var(--ui-scale));
  background:
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.22), transparent 42%),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 calc(14px * var(--ui-scale)) calc(34px * var(--ui-scale)) rgba(15, 23, 42, 0.08);
}

.help-tile-icon {
  width: calc(42px * var(--ui-scale));
  height: calc(42px * var(--ui-scale));
  display: grid;
  place-items: center;
  border-radius: calc(14px * var(--ui-scale));
  background: rgba(219, 234, 254, 0.95);
  color: #1d4ed8;
}

.help-tile-heading {
  display: flex;
  align-items: center;
  gap: calc(10px * var(--ui-scale));
  margin-bottom: calc(14px * var(--ui-scale));
}

.help-tile-icon .material-symbols-rounded {
  font-size: calc(24px * var(--ui-scale));
}

.help-info-tile h3 {
  margin: 0;
  font-size: calc(1rem * var(--ui-scale));
  letter-spacing: -0.025em;
}

.help-info-tile p {
  margin: 0;
  color: var(--muted);
  font-size: calc(0.9rem * var(--ui-scale));
  font-weight: 650;
  line-height: 1.45;
}

.help-faq-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(14px * var(--ui-scale));
}

.help-question-card {
  position: relative;
  min-height: calc(112px * var(--ui-scale));
  padding: calc(18px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: calc(18px * var(--ui-scale));
  background:
    radial-gradient(circle at top right, rgba(251, 191, 36, 0.2), transparent 42%),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 calc(14px * var(--ui-scale)) calc(34px * var(--ui-scale)) rgba(15, 23, 42, 0.08);
  overflow: hidden;
  cursor: help;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.help-question-card:hover,
.help-question-card:focus {
  transform: translateY(calc(-2px * var(--ui-scale)));
  border-color: rgba(251, 191, 36, 0.75);
  box-shadow: 0 calc(18px * var(--ui-scale)) calc(42px * var(--ui-scale)) rgba(15, 23, 42, 0.12);
  outline: none;
}

.help-question-card h3 {
  margin: 0;
  font-size: calc(1rem * var(--ui-scale));
  letter-spacing: -0.025em;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.help-question-card p {
  position: absolute;
  inset: calc(18px * var(--ui-scale));
  display: flex;
  align-items: center;
  margin: 0;
  color: var(--muted);
  font-size: calc(0.9rem * var(--ui-scale));
  font-weight: 650;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(calc(8px * var(--ui-scale)));
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.help-question-card:hover h3,
.help-question-card:focus h3 {
  opacity: 0;
  transform: translateY(calc(-8px * var(--ui-scale)));
}

.help-question-card:hover p,
.help-question-card:focus p {
  opacity: 1;
  transform: translateY(0);
}

.help-page-arrow {
  width: calc(42px * var(--ui-scale));
  height: calc(42px * var(--ui-scale));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--secondary);
  color: var(--text);
  cursor: pointer;
  transition:
    background 120ms ease,
    color 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}

.help-page-arrow .material-symbols-rounded {
  font-size: calc(28px * var(--ui-scale));
  line-height: 1;
}

.help-page-arrow:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.help-page-arrow:active {
  transform: translateY(1px);
}

.help-page-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: calc(7px * var(--ui-scale));
  margin-top: 0;
}

.help-page-dot {
  width: calc(8px * var(--ui-scale));
  height: calc(8px * var(--ui-scale));
  border: 0;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.35);
  cursor: pointer;
  transition:
    width 120ms ease,
    background 120ms ease,
    transform 120ms ease;
}

.help-page-dot.is-active {
  width: calc(22px * var(--ui-scale));
  background: #1d4ed8;
}

.help-page-dot:hover {
  transform: scale(1.15);
}

.consent-section {
  display: grid;
  gap: calc(10px * var(--ui-scale));
  padding: calc(14px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: calc(14px * var(--ui-scale));
  background: rgba(255, 255, 255, 0.62);
}

.consent-title {
  margin: 0;
  color: var(--muted);
  font-size: calc(0.75rem * var(--ui-scale));
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.consent-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: calc(10px * var(--ui-scale));
  align-items: flex-start;
  color: var(--text);
  font-size: calc(0.78rem * var(--ui-scale));
  font-weight: 650;
  line-height: 1.35;
  cursor: pointer;
}

.consent-row input {
  width: calc(16px * var(--ui-scale));
  height: calc(16px * var(--ui-scale));
  margin-top: calc(2px * var(--ui-scale));
  padding: 0;
  cursor: pointer;
}

.contact-badge {
  position: fixed;
  left: calc(18px * var(--ui-scale));
  top: calc(18px * var(--ui-scale));
  z-index: 70;
  margin: 0;
  padding: calc(8px * var(--ui-scale)) calc(11px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-strong);
  color: var(--muted);
  font-size: calc(0.75rem * var(--ui-scale));
  font-weight: 750;
  line-height: 1.35;
  box-shadow: 0 calc(12px * var(--ui-scale)) calc(34px * var(--ui-scale)) rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(calc(10px * var(--ui-scale)));
}

.player-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: calc(6px * var(--ui-scale));
}

.emote-picker {
  position: relative;
  width: calc(34px * var(--ui-scale));
  height: calc(34px * var(--ui-scale));
  display: inline-grid;
}

.emote-button {
  width: 100%;
  height: 100%;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: calc(10px * var(--ui-scale));
  background: var(--secondary);
  color: var(--muted);
  cursor: default;
}

.emote-button:hover {
  background: var(--secondary);
}

.emote-button:active {
  transform: translateY(1px);
}

.emote-popover {
  position: absolute;
  right: 0;
  bottom: 100%;
  z-index: 45;
  display: none;
  grid-template-columns: repeat(3, calc(34px * var(--ui-scale)));
  gap: calc(6px * var(--ui-scale));
  padding: calc(8px * var(--ui-scale));
  border: 1px solid var(--border);
  border-radius: calc(14px * var(--ui-scale));
  background: var(--card-strong);
  box-shadow: 0 calc(18px * var(--ui-scale)) calc(44px * var(--ui-scale)) rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(calc(10px * var(--ui-scale)));
}

.emote-picker:not(.is-closed):hover .emote-popover {
  display: grid;
}

.emote-option {
  width: calc(34px * var(--ui-scale));
  height: calc(34px * var(--ui-scale));
  padding: calc(5px * var(--ui-scale));
  border: 0;
  border-radius: calc(10px * var(--ui-scale));
  background: transparent;
  cursor: pointer;
}

.emote-option:hover {
  background: var(--secondary);
}

.emote-option picture,
.emote-option img {
  display: block;
  width: 100%;
  height: 100%;
}

.emote-option img {
  object-fit: contain;
}

.emote-play-slot {
  display: none;
  width: calc(34px * var(--ui-scale));
  height: calc(34px * var(--ui-scale));
  place-items: center;
  pointer-events: none;
}

.emote-play-slot:not(:empty) {
  display: inline-grid;
}

.emote-burst {
  width: calc(34px * var(--ui-scale));
  height: calc(34px * var(--ui-scale));
  display: inline-grid;
  place-items: center;
  animation: emote-pop 4000ms ease forwards;
  pointer-events: none;
}

.emote-burst picture,
.emote-burst img {
  display: block;
  width: 100%;
  height: 100%;
}

.emote-burst img {
  object-fit: contain;
}

.emote-button.is-playing {
  border-color: transparent;
  background: transparent;
}

@keyframes emote-pop {
  0% {
    opacity: 0;
    transform: translateY(calc(8px * var(--ui-scale))) scale(0.7) rotate(-8deg);
  }

  18% {
    opacity: 1;
    transform: translateY(calc(-4px * var(--ui-scale))) scale(1.2) rotate(6deg);
  }

  45% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }

  100% {
    opacity: 0;
    transform: translateY(calc(-12px * var(--ui-scale))) scale(0.85) rotate(4deg);
  }
}