:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #64748b;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(15, 23, 42, 0.12);
  --cyan: #06b6d4;
  --blue: #2563eb;
  --pink: #f43f5e;
  --yellow: #facc15;
  --green: #16a34a;
  --red: #dc2626;
  --violet: #7c3aed;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(6, 182, 212, 0.18), transparent 34%),
    linear-gradient(315deg, rgba(244, 63, 94, 0.18), transparent 32%),
    #f8fafc;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  animation: gridDrift 18s linear infinite;
}

@keyframes gridDrift {
  from { background-position: 0 0; }
  to { background-position: 34px 34px; }
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app {
  min-height: 100vh;
}

.landing {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 100vh;
  width: min(980px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 48px 0;
  text-align: center;
}

.landing::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  background: repeating-linear-gradient(90deg, var(--cyan) 0 90px, var(--yellow) 90px 160px, var(--pink) 160px 245px, var(--blue) 245px 340px);
  animation: belt 3.8s linear infinite;
}

body.crowd-first-visit .lang-toggle {
  display: none;
}

.landing.crowd-first-visit {
  align-content: start;
  width: min(1120px, calc(100vw - 24px));
  padding: 12px 0;
}

.landing.crowd-first-visit .brand,
.landing.crowd-first-visit .mode-switch,
.landing.crowd-first-visit .beta-info-toggle,
.landing.crowd-first-visit .bot-roster-toggle,
.landing.crowd-first-visit .bot-roster,
.landing.crowd-first-visit .test-notice,
.landing.crowd-first-visit .crowd-copy,
.landing.crowd-first-visit .crowd-warning,
.landing.crowd-first-visit .crowd-start,
.landing.crowd-first-visit .site-stats,
.landing.crowd-first-visit .quick-play-btn,
.landing.crowd-first-visit .crowd-history,
.landing.crowd-first-visit #matchPanel,
.landing.crowd-first-visit #roomPanel {
  display: none !important;
}

.landing.crowd-first-visit .crowd-panel,
.landing.crowd-first-visit .crowd-cards {
  width: 100%;
}

.landing.crowd-first-visit .crowd-card {
  min-height: calc(100dvh - 24px);
  align-content: center;
  padding: clamp(18px, 4vw, 44px);
  border-radius: 28px;
}

.landing.crowd-first-visit .crowd-card-head strong {
  font-size: clamp(32px, 6vw, 64px);
}

.landing.crowd-first-visit .crowd-card p {
  font-size: clamp(16px, 2.2vw, 24px);
  line-height: 1.45;
}

.landing.crowd-first-visit .crowd-options {
  gap: 14px;
}

.landing.crowd-first-visit .crowd-option {
  padding: clamp(14px, 2.2vw, 22px);
  border-radius: 20px;
}

.landing.crowd-first-visit .crowd-options b {
  font-size: clamp(18px, 2.4vw, 28px);
}

.landing.crowd-first-visit .crowd-options small {
  font-size: clamp(13px, 1.5vw, 17px);
}

.landing.crowd-first-visit .crowd-select-btn {
  padding: 10px 18px;
  font-size: 15px;
}

@keyframes belt {
  from { background-position: 0 0; }
  to { background-position: 340px 0; }
}

.brand {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 28px;
  text-align: left;
}

.test-notice {
  position: fixed;
  right: 18px;
  top: 164px;
  z-index: 20;
  display: grid;
  gap: 3px;
  width: min(300px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
}

.test-notice.hidden {
  display: none;
}

.test-notice-close,
.bot-roster-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  border-radius: 6px;
  line-height: 1;
}

.test-notice-close:hover,
.bot-roster-close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink);
}

.test-notice strong {
  font-size: 13px;
  font-weight: 1000;
}

.test-notice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 850;
}

.bot-roster-toggle {
  display: none;
}

.beta-info-toggle {
  display: none;
}

.bot-roster {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 18;
  pointer-events: none;
  display: grid;
  gap: 10px;
  width: min(300px, calc(100vw - 36px));
  max-height: calc(100dvh - 170px);
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.12);
  text-align: left;
  backdrop-filter: blur(10px);
}

.bot-roster-close {
  pointer-events: auto;
}

.bot-roster .panel-title {
  margin-bottom: 0;
}

.bot-list {
  display: grid;
  gap: 8px;
}

.bot-list div {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 2px 9px;
  align-items: center;
  padding: 8px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.9);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.bot-list span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: linear-gradient(135deg, #fff7ad, #a7f3d0);
  font-size: 22px;
}

.bot-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 1000;
}

.bot-list em,
.bot-roster p {
  margin: 0;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 850;
}

.bot-roster p {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.1);
  color: #155e75;
  font-weight: 1000;
}

.mark {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border: 4px solid #fff;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--cyan), var(--blue) 52%, var(--pink));
  color: #fff;
  font-size: 42px;
  font-weight: 1000;
  box-shadow: var(--shadow);
  transform: rotate(-5deg);
  animation: logoPop 2.6s ease-in-out infinite;
}

@keyframes logoPop {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  50% { transform: rotate(3deg) translateY(-6px); }
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(48px, 9vw, 96px);
  line-height: 0.9;
  letter-spacing: 0;
}

.brand p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.join {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px 68px;
  gap: 12px;
  width: min(760px, 100%);
  margin: 14px 0 24px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.mode-switch {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 14px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.mode-switch button,
.join-feedback {
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 1000;
}

.mode-switch button.active,
.join-feedback {
  background: var(--ink);
  color: #fff;
}

.join input,
.chat-form input {
  min-width: 0;
  border: 2px solid transparent;
  border-radius: 14px;
  background: #fff;
  padding: 15px 16px;
  color: var(--ink);
  outline: none;
}

.join input:focus,
.chat-form input:focus {
  border-color: var(--cyan);
}

.join button,
.chat-form button,
.leave-btn {
  min-height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  color: #fff;
  font-weight: 1000;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.name-editor {
  margin: 10px 0 16px;
}

.name-display-view {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.8);
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.name-display {
  font-size: 20px;
  font-weight: 1000;
  color: var(--ink);
}

.name-edit-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.1s;
}

.name-edit-btn:hover {
  background: rgba(15, 23, 42, 0.05);
}

.join-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 24px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--pink), var(--blue));
  color: #fff;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 1000;
  border-radius: 16px;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.primary-btn:active {
  transform: scale(0.98);
}

.secondary {
  background: transparent;
  color: var(--muted);
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 1000;
  border-radius: 16px;
  border: 0;
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.secondary:hover {
  background: rgba(15, 23, 42, 0.05);
  color: var(--ink);
}

.join-feedback {
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 1000;
  border-radius: 16px;
  padding: 12px 16px;
  transition: color 0.1s, background 0.1s;
}

.join-feedback:hover {
  background: #020617;
  color: #fff;
}

.match-panel,
.crowd-panel {
  width: min(900px, 100%);
}

.crowd-panel {
  display: grid;
  gap: 12px;
  text-align: left;
}

.crowd-copy {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.crowd-warning {
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
  font-size: 13px;
  font-weight: 1000;
}

.site-stats {
  justify-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
}

.crowd-start {
  justify-self: center;
  border: 0;
  border-radius: 999px;
  padding: 11px 22px;
  background: var(--ink);
  color: #fff;
  font-weight: 1000;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.quick-play-btn {
  justify-self: stretch;
  border: 0;
  border-radius: 999px;
  padding: 12px 30px;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  color: #fff;
  font-size: 15px;
  font-weight: 1000;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.22);
}

.quick-play-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(140px, 1fr);
  gap: 10px;
  align-items: stretch;
}

.quick-play-name-editor,
.quick-play-name-editor .name-display-view {
  margin: 0;
}

.quick-play-name-editor .name-display-view {
  height: 100%;
}

@media (max-width: 560px) {
  .quick-play-row {
    grid-template-columns: minmax(0, 1.6fr) minmax(104px, 0.9fr);
  }
}

.crowd-cards {
  display: grid;
  gap: 12px;
}

.crowd-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.crowd-card-stage {
  display: grid;
  perspective: 1200px;
}

.crowd-card-face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.28s ease;
}

.crowd-card-previous {
  opacity: 0;
  pointer-events: none;
  transform: rotateY(12deg) translateX(18px) scale(0.98);
}

.crowd-card-stage.show-previous .crowd-card-current {
  opacity: 0;
  pointer-events: none;
  transform: rotateY(-12deg) translateX(-18px) scale(0.98);
}

.crowd-card-stage.show-previous .crowd-card-previous {
  opacity: 1;
  pointer-events: auto;
  transform: rotateY(0deg) translateX(0) scale(1);
}

.landing.crowd-first-visit .crowd-card-stage {
  min-height: calc(100dvh - 36px);
}

.landing.crowd-first-visit .crowd-card-stage .crowd-card {
  min-height: calc(100dvh - 36px);
}

.crowd-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.crowd-card-head > strong {
  min-width: 0;
  flex: 1 1 auto;
}

.crowd-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

.crowd-card-head span {
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef6ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 1000;
}

.crowd-history-toggle {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  padding: 6px 10px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 12px;
  font-weight: 1000;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.crowd-history-toggle:hover {
  background: #eef6ff;
  color: #1e3a8a;
}

.share-btn {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  padding: 6px 11px;
  background: linear-gradient(135deg, #111827, #334155);
  color: #fff;
  font-size: 12px;
  font-weight: 1000;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.14);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.share-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.18);
}

.share-btn:active {
  transform: scale(0.97);
}

.share-crowd {
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}

.share-quick {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
}

.share-battle {
  background: linear-gradient(135deg, #0f172a, #f59e0b);
}

.crowd-card-head strong {
  font-size: 22px;
  font-weight: 1000;
}

.crowd-options {
  display: grid;
  gap: 8px;
}

.crowd-option {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.crowd-option.selected {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.05);
}

.crowd-option-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.crowd-select-btn {
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 1000;
  transition: transform 0.1s;
}

.crowd-select-btn:hover {
  background: var(--blue);
}

.crowd-select-btn:active {
  transform: scale(0.95);
}

.crowd-options b {
  font-size: 16px;
  font-weight: 1000;
}

.crowd-options small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 800;
}

.crowd-options span {
  position: relative;
  height: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
}

.crowd-options i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow), var(--cyan));
}

.crowd-options em {
  position: relative;
  z-index: 1;
  display: block;
  padding: 3px 8px;
  color: var(--ink);
  font-style: normal;
  font-size: 12px;
  font-weight: 1000;
}

.crowd-recent,
.crowd-history {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.crowd-recent strong,
.crowd-history strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
}

.crowd-recent span,
.crowd-history span {
  border-radius: 999px;
  padding: 5px 8px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.private-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 96px minmax(0, 1fr) 120px;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.private-form.compact-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 120px;
}

.private-form input,
.private-form select {
  min-width: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  outline: none;
}

.private-form button,
.private-head button {
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 1000;
}

.private-room-view {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  text-align: left;
}

.private-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.private-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.private-head strong {
  display: block;
  font-size: 20px;
}

.private-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.private-players,
.private-recent {
  display: grid;
  gap: 8px;
}

.private-players span,
.private-recent button {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-weight: 900;
}

.private-recent button span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.leaderboard-panel,
.players-panel,
.table-panel,
.side-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.leaderboard-panel {
  width: min(760px, 100%);
  padding: 18px;
  text-align: left;
}

.profile-panel {
  width: min(760px, 100%);
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  text-align: left;
}

.profile-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: center;
  font-weight: 1000;
}

.profile-summary > span {
  color: var(--blue);
  font-size: 20px;
  line-height: 1;
  font-weight: 1000;
}

.xp-meter,
.profile-summary .xp-head,
.profile-summary .xp-foot {
  text-align: left;
}

.xp-meter {
  margin: 8px 0 10px;
}

.xp-meter:empty {
  display: none;
}

.xp-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 1000;
}

.xp-head strong {
  flex: 0 0 auto;
  color: var(--green);
}

.xp-track {
  height: 8px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.1);
}

.xp-track div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow), var(--green), var(--cyan));
  transition: width 0.28s ease;
}

.xp-foot {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.recent-history {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.recent-history span {
  border-radius: 999px;
  padding: 6px 9px;
  background: #eef6ff;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 900;
}

.panel-title {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
}

.result-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.leaderboard-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-title span {
  margin-right: auto;
}

.leaderboard-title button {
  border: 0;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 1000;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.leaderboard-title button.active {
  background: var(--ink);
  color: #fff;
  transform: translateY(-1px);
}

.leaderboard {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 24px;
}

.leaderboard li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.leaderboard li.self {
  margin-left: -20px;
  padding: 9px 10px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 14px;
  background: rgba(6, 182, 212, 0.08);
}

.leader-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 900;
}

.game {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 320px;
  gap: 16px;
  height: 100dvh;
  overflow: hidden;
  padding: 16px;
}

.players-panel,
.side-panel,
.table-panel {
  padding: 16px;
  min-height: 0;
}

.players-panel,
.table-panel {
  overflow: auto;
}

  .side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    width: min(84vw, 330px);
    padding: 10px;
    border-radius: 18px 0 0 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: -18px 0 42px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(14px);
    transform: translateX(calc(100% + 16px));
    transition: transform 0.2s ease;
  }

  .side-panel.expanded {
    transform: translateX(0);
  }

.players-list {
  display: grid;
  gap: 10px;
}

.player {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 12px;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.player:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.player.newcomer {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18), 0 10px 22px rgba(239, 68, 68, 0.14);
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7ad, #ffd166);
  font-size: 25px;
}

.name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 1000;
}

.sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mobile-player-score {
  display: none;
}

.lock {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #cbd5e1;
}

.lock.done {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.12);
}

.round-delta {
  position: absolute;
  right: 8px;
  bottom: 7px;
  border-radius: 999px;
  padding: 3px 6px;
  background: #fff;
  font-size: 12px;
  font-weight: 1000;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}

.round-delta.good {
  color: var(--green);
}

.round-delta.bad {
  color: var(--red);
}

.empty-room,
.waiting-card,
.status-arena {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 2px dashed rgba(37, 99, 235, 0.28);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
}

.status-arena {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 150px;
  border-style: solid;
  background:
    radial-gradient(circle at 18% 20%, rgba(250, 204, 21, 0.18), transparent 34%),
    radial-gradient(circle at 80% 70%, rgba(6, 182, 212, 0.18), transparent 32%),
    #fff;
}

.empty-icon {
  font-size: 28px;
}

.table-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.mobile-leave {
  display: none;
}

.phase {
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 1000;
}

.meta {
  color: var(--muted);
  font-weight: 800;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stats span {
  border-radius: 999px;
  padding: 8px 11px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 1000;
  box-shadow: inset 0 0 0 1px var(--line);
}

#chosenCount {
  background: linear-gradient(135deg, var(--yellow), #fb923c);
  color: #111827;
  box-shadow: 0 10px 22px rgba(250, 204, 21, 0.28);
}

.progress-track {
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
}

.progress-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--blue));
  transition: width 0.22s linear;
}

.question {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 20px 0;
}

.question h2 {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.question h2:empty {
  display: none;
}

.options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.balance-note {
  border-radius: 12px;
  padding: 9px 12px;
  background: rgba(34, 197, 94, 0.12);
  color: #14532d;
  font-size: 14px;
  font-weight: 900;
}

.option {
  display: grid;
  gap: 9px;
  min-height: 102px;
  padding: 16px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.option:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: 0 18px 28px rgba(6, 182, 212, 0.16);
}

.option.selected {
  border-color: var(--pink);
  box-shadow: 0 18px 28px rgba(244, 63, 94, 0.18);
}

.option:disabled {
  cursor: default;
}

.option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.option-label {
  min-width: 0;
  font-size: 22px;
  font-weight: 1000;
}

.rule-text {
  color: #334155;
  font-size: 15px;
  line-height: 1.42;
  font-weight: 750;
}

.score-pill {
  flex: 0 0 auto;
  min-width: 54px;
  border-radius: 999px;
  padding: 6px 9px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  font-weight: 1000;
}

.score-pill.good {
  background: var(--green);
}

.score-pill.bad {
  background: var(--red);
}

.session-summary {
  display: grid;
  gap: 6px;
}

.session-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.session-summary-row > button {
  min-width: 0;
}

.dilemma-rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
}

.session-summary-row .dilemma-rating {
  margin-top: 0;
}

.dilemma-rating button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 1000;
}

.dilemma-rating button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.1);
}

.dilemma-rating button:disabled {
  opacity: 0.45;
  cursor: default;
}

.end-summary {
  display: grid;
  gap: 14px;
  align-content: start;
  width: min(760px, 100%);
}

.end-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 1000;
}

.end-score {
  color: var(--ink);
  font-size: clamp(42px, 8vw, 82px);
  line-height: 1;
  font-weight: 1000;
}

.end-correction {
  color: var(--muted);
  font-size: 13px;
  font-weight: 1000;
}

.end-hero {
  display: grid;
  gap: 8px;
  padding: 24px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(250, 204, 21, 0.2), transparent 42%),
    linear-gradient(315deg, rgba(6, 182, 212, 0.18), transparent 40%),
    #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.1);
}

.end-home {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 9px 13px;
  background: var(--ink);
  color: #fff;
  font-weight: 1000;
}

.end-ranking {
  display: grid;
  gap: 7px;
}

.end-ranking span {
  display: grid;
  grid-template-columns: 38px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.end-ranking span.winner {
  box-shadow: inset 0 0 0 2px rgba(250, 204, 21, 0.85), 0 10px 24px rgba(250, 204, 21, 0.18);
}

.end-ranking em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 1000;
}

.end-ranking b {
  font-size: 22px;
}

.end-ranking small {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.end-ranking strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 1000;
}

.session-summary [data-snapshot] {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  text-align: left;
}

.session-summary [data-snapshot]:hover {
  box-shadow: inset 0 0 0 2px var(--cyan);
}

.option.spectator {
  opacity: 0.82;
  background: linear-gradient(135deg, #fff, #f8fbff);
}

.pulse-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.42);
  animation: pulse 1.5s ease-out infinite;
}

@keyframes pulse {
  to { box-shadow: 0 0 0 14px rgba(6, 182, 212, 0); }
}

.result-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.option-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.option-counts span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 9px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12px;
  font-weight: 900;
}

.option-counts strong {
  color: var(--blue);
}

.chat-preview {
  display: none;
}

.game[data-phase="ended"] .stats,
.game[data-phase="ended"] .progress-track {
  display: none;
}

.game[data-phase="ended"] {
  grid-template-columns: minmax(0, 900px);
  align-content: center;
  justify-content: center;
}

.game[data-phase="ended"] .players-panel,
.game[data-phase="ended"] .side-panel {
  display: none;
}

.game[data-phase="ended"] .table-panel {
  min-height: auto;
  padding: 22px;
}

.game[data-phase="ended"] .topbar {
  border-bottom: 0;
  padding-bottom: 4px;
}

.game[data-phase="ended"] .question {
  padding: 8px 0 0;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(80px, auto) auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.result-row:last-child {
  border-bottom: 0;
}

.delta.good {
  color: var(--green);
}

.delta.bad {
  color: var(--red);
}

.side-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.compact {
  font-size: 13px;
}

.chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
}

.chat-log {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  background: #fff;
}

.chat-msg {
  margin-bottom: 10px;
  font-size: 13px;
}

.chat-msg.system {
  border-radius: 999px;
  padding: 7px 9px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.chat-msg.system .sub {
  display: inline;
  margin-left: 6px;
}

.chat-name {
  color: var(--chat-name-color, var(--ink));
  font-weight: 1000;
}

.chat-preview .chat-name {
  display: inline;
}

.chat-close {
  display: none;
}

.chat-empty {
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 120px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 8px;
  margin-top: 10px;
}

.leave-btn {
  padding: 12px;
  background: linear-gradient(135deg, #334155, #111827);
}

.popover {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 280px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.popover button {
  min-width: 42px;
  height: 38px;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 20px;
}

.float-effect {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  font-size: 32px;
  transform: translate(-50%, 0);
  animation: floatEffect 1.15s ease-out forwards;
  filter: drop-shadow(0 8px 8px rgba(15, 23, 42, 0.18));
}

@keyframes floatEffect {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.5) rotate(-12deg); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -72px) scale(1.35) rotate(14deg); }
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
}

.feedback-fab {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 35;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 11px 17px;
  background: linear-gradient(135deg, #111827, var(--blue) 58%, var(--pink));
  color: #fff;
  font-size: 14px;
  font-weight: 1000;
  letter-spacing: 0;
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.24), 0 8px 18px rgba(15, 23, 42, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.feedback-fab::before {
  content: "!";
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--yellow);
  color: #111827;
  font-size: 14px;
  font-weight: 1000;
}

.feedback-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(37, 99, 235, 0.3), 0 12px 24px rgba(15, 23, 42, 0.22);
}

.feedback-fab:active {
  transform: scale(0.97);
}

.snapshot-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(8px);
}

.feedback-card h3 {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1;
}

.feedback-form {
  display: grid;
  gap: 12px;
}

.feedback-form select,
.feedback-form input,
.feedback-form textarea {
  min-height: 150px;
  resize: vertical;
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  outline: none;
}

.feedback-form select,
.feedback-form input {
  min-height: 46px;
  resize: none;
  background: #fff;
}

.feedback-form select:focus,
.feedback-form input:focus,
.feedback-form textarea:focus {
  border-color: var(--cyan);
}

.feedback-form button {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 1000;
}

.snapshot-card {
  position: relative;
  width: min(720px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: auto;
  border-radius: 18px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.quick-play-card {
  width: min(760px, calc(100vw - 28px));
}

.quick-play-card h3 {
  margin: 0 0 6px;
  font-size: clamp(24px, 4vw, 38px);
}

.quick-play-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.quick-play-rating {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  padding-top: 4px;
}

.quick-play-rating button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 1000;
  padding: 7px 10px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.quick-play-rating button:disabled {
  opacity: 0.65;
  cursor: default;
}

.quick-play-card p {
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 800;
}

.quick-play-card .quick-play-meta {
  margin-top: -8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 1000;
}

.quick-play-meta strong.good,
.question-sub-meta strong.good {
  color: #166534;
}

.quick-play-meta strong.bad,
.question-sub-meta strong.bad {
  color: #991b1b;
}

.quick-play-option-result {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.question-sub-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 1000;
  margin: -6px 0 12px;
}

.quick-play-options {
  display: grid;
  gap: 10px;
}

.quick-play-options button {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.quick-play-options button.selected {
  border-color: var(--ink);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.quick-play-options small {
  color: var(--muted);
  font-weight: 800;
}

.quick-play-options b,
.quick-play-options em {
  justify-self: start;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--ink);
  color: #fff;
  font-style: normal;
  font-size: 12px;
  font-weight: 1000;
}

.quick-play-options em.good {
  background: #dcfce7;
  color: #166534;
}

.quick-play-options em.bad {
  background: #fee2e2;
  color: #991b1b;
}

.quick-play-result {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.quick-play-scores,
.quick-play-rows,
.quick-play-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-play-scores span,
.quick-play-rows span {
  border-radius: 999px;
  padding: 6px 9px;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 900;
}

.quick-play-rows i {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 4px;
  border: 2px solid var(--player-color, var(--line));
  border-radius: 999px;
  font-style: normal;
}

.quick-play-actions button {
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 1000;
}

.quick-play-actions .share-btn,
.result-title-row .share-btn {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  font-size: 12px;
  padding: 7px 12px;
}

.result-title-row .share-battle {
  background: linear-gradient(135deg, #0f172a, #f59e0b);
}

.snapshot-close {
  position: sticky;
  top: 0;
  float: right;
  border-radius: 999px;
  padding: 7px 12px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 1000;
}

.snapshot-head {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.snapshot-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
}

.snapshot-head h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1;
}

.snapshot-head > strong {
  color: var(--blue);
  font-size: 24px;
}

.snapshot-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.snapshot-options div,
.snapshot-rows div {
  display: grid;
  gap: 4px;
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
}

.snapshot-options span,
.snapshot-rows small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.snapshot-rows {
  display: grid;
  gap: 8px;
}

.snapshot-rows div {
  grid-template-columns: minmax(0, 1fr) minmax(90px, auto) auto;
  align-items: center;
}

.snapshot-rows .good {
  color: var(--green);
}

.snapshot-rows .bad {
  color: var(--red);
}

@media (max-width: 1100px) {
  .game {
    grid-template-columns: minmax(0, 1fr) 290px;
  }

  .players-panel {
    grid-column: 1 / -1;
    order: 2;
  }

  .side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    width: min(84vw, 330px);
    padding: 10px;
    border-radius: 18px 0 0 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: -18px 0 42px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(14px);
    transform: translateX(calc(100% + 16px));
    transition: transform 0.2s ease;
  }

  .side-panel.expanded {
    transform: translateX(0);
  }

  .players-list {
    grid-template-columns: repeat(5, minmax(150px, 1fr));
  }

  .table-panel {
    order: 1;
  }

  .side-panel {
    order: 3;
  }
}

.option-dots {
  display: none;
}

@media (max-width: 760px) {
  .lang-toggle {
    top: 7px;
    right: 56px;
    left: auto;
  }
}
  body::before {
    background-size: 26px 26px;
  }

  .landing {
    min-height: 100dvh;
    width: min(100vw - 20px, 560px);
    padding: 18px 0 28px;
    align-content: start;
  }

  .brand {
    grid-template-columns: 50px 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }

  .mark {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    font-size: 28px;
  }

  h1 {
    font-size: 42px;
  }

  .brand p {
    font-size: 12px;
  }

  .join {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 8px 0 10px;
    padding: 8px;
    border-radius: 16px;
  }

  .join-feedback {
    border-radius: 14px;
  }

  .private-form,
  .private-form.compact-form {
    grid-template-columns: 1fr;
  }

  .test-notice {
    display: none;
    position: fixed;
    top: 144px;
    left: 8px;
    z-index: 18;
    width: min(260px, calc(100vw - 20px));
    margin-bottom: 0;
    padding: 10px 12px;
  }

  .test-notice.mobile-show {
    display: grid;
  }

  .beta-info-toggle {
    display: flex;
    position: fixed;
    top: 92px;
    left: 8px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
    align-items: center;
    justify-content: center;
    color: var(--ink);
    font-size: 22px;
    font-weight: 1000;
    z-index: 17;
    backdrop-filter: blur(10px);
  }

  .bot-roster-toggle {
    display: flex;
    position: fixed;
    top: 92px;
    right: 8px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 17;
    backdrop-filter: blur(10px);
  }

  .bot-roster {
    display: none;
    position: fixed;
    top: 144px;
    right: 8px;
    width: min(210px, calc(100vw - 20px));
    max-height: calc(100dvh - 160px);
    overflow: auto;
    padding: 8px;
    border-radius: 16px;
  }

  .bot-roster.mobile-show {
    display: grid;
  }

  .bot-list {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .bot-list div {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 7px;
  }

  .bot-list span {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .join input,
  .join button {
    min-height: 42px;
    padding: 10px 12px;
  }

  .leaderboard-panel {
    display: none;
  }

  .profile-panel {
    margin-bottom: 0;
    padding: 10px;
    border-radius: 16px;
  }

  .profile-summary {
    display: grid;
    gap: 4px;
  }

  .profile-summary > span {
    font-size: 14px;
    line-height: 1.25;
  }

  .game {
    grid-template-columns: 1fr;
    align-content: start;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    gap: 6px;
    padding: 6px;
    padding-bottom: 70px;
  }

  .table-panel {
    order: 1;
    align-self: start;
    display: block;
    padding: 8px;
    border-radius: 16px;
  }

  .players-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    padding: 10px 10px 26px;
    z-index: 20;
    overflow: visible;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
  }

  .players-panel .panel-title {
    display: none;
  }

  .side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    width: min(84vw, 330px);
    padding: 10px;
    border-radius: 18px 0 0 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: -18px 0 42px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(14px);
    transform: translateX(calc(100% + 16px));
    transition: transform 0.2s ease;
  }

  .side-panel.expanded {
    transform: translateX(0);
  }

  .players-list {
    display: flex;
    justify-content: center;
    gap: 8px;
    max-height: none;
    min-height: 54px;
    overflow: visible;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
  }

  .stats {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    gap: 5px;
  }

  .stats span {
    font-size: 11px;
    padding: 5px 7px;
  }

  .question {
    gap: 8px;
    padding: 8px 0 0;
  }

  .question h2 {
    font-size: 21px;
  }

  .options {
    gap: 8px;
  }

  .option {
    min-height: 0;
    padding: 9px 10px;
    border-radius: 12px;
    gap: 4px;
  }

  .option-label {
    font-size: 16px;
  }

  .rule-text {
    font-size: 12.5px;
    line-height: 1.32;
  }

  .option-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
  }

  .player-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
  }

  .player {
    display: block;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 2px solid var(--player-color, #fff);
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  }

  .avatar {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    font-size: 20px;
  }

  .player .name,
  .player .sub {
    display: none;
  }

  .mobile-player-score {
    position: absolute;
    left: 50%;
    bottom: -18px;
    display: block;
    transform: translateX(-50%);
    min-width: 32px;
    border-radius: 999px;
    padding: 1px 4px;
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    font-size: 10px;
    line-height: 1.25;
    font-weight: 1000;
    text-align: center;
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.12);
  }

  .lock {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 9px;
    height: 9px;
    border: 1px solid #fff;
  }

  .lock.done {
    box-shadow: none;
  }

  .round-delta {
    top: -13px;
    right: -8px;
    bottom: auto;
    transform: none;
    padding: 1px 5px;
    font-size: 10px;
    line-height: 1.25;
  }

  .chat {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    min-height: 0;
  }

  .chat .panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .chat-close {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    font-weight: 1000;
  }

  .chat-log {
    max-height: none;
    border-radius: 14px;
  }

  .chat-form {
    grid-template-columns: 1fr;
    margin-top: 6px;
  }

  .leave-btn {
    display: none;
  }

  .mobile-leave {
    display: inline-grid;
    position: fixed;
    top: 7px;
    right: 7px;
    z-index: 19;
    place-items: center;
    width: 42px;
    height: 30px;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-size: 12px;
    font-weight: 1000;
  }

  .profile-summary span {
    font-size: 28px;
    order: -1;
  }

  .recent-history {
    max-height: 60px;
    overflow: auto;
  }

  .status-arena {
    min-height: 0;
    padding: 10px 12px;
  }

  .session-summary {
    max-height: calc(100dvh - 150px);
    overflow: auto;
  }

  .session-summary-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .session-summary-row .dilemma-rating {
    justify-content: flex-start;
  }

  .dilemma-rating {
    gap: 5px;
    font-size: 11px;
  }

  .dilemma-rating button {
    padding: 4px 8px;
    font-size: 11px;
  }

  .phase {
    margin: 0;
    font-size: 13px;
  }

  .meta {
    font-size: 13px;
  }

  .progress-track {
    height: 5px;
    margin-top: 6px;
  }

  .side-panel section {
    max-height: none;
    overflow: visible;
  }

  .side-panel section.expanded,
  .side-panel section:focus-within {
    max-height: none;
  }

  .panel-title {
    margin: 0;
    padding: 4px 2px 10px;
    cursor: pointer;
  }

  .chat-preview {
    display: grid;
    gap: 3px;
    width: 100%;
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.86);
    color: #334155;
    text-align: left;
    font-size: 11px;
    line-height: 1.25;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  }

  .chat-preview span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-preview-title {
    color: var(--muted);
    font-size: 10px;
    font-weight: 1000;
  }

  .leaderboard {
    max-height: 190px;
    overflow: auto;
  }

  .status-line {
    padding: 7px 9px;
    font-size: 12px;
  }

  .score-pill {
    min-width: 48px;
    padding: 5px 7px;
    font-size: 11px;
  }

  .result-box {
    display: none !important;
  }

  .end-summary {
    gap: 8px;
  }

  .end-score {
    font-size: 34px;
  }

  .end-note {
    font-size: 11px;
  }

  .snapshot-card {
    padding: 14px;
  }

  .snapshot-head h3 {
    font-size: 24px;
  }

  .snapshot-rows div {
    grid-template-columns: 1fr auto;
  }

  .snapshot-rows small {
    grid-column: 1 / -1;
  }

  .result-row {
    grid-template-columns: 1fr auto;
  }

  .result-row span:nth-child(2) {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
  }
}

.lang-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.15s, border-color 0.15s;
}

.lang-toggle:hover {
  background: rgba(15, 23, 42, 0.06);
  border-color: var(--cyan);
}

.lang-toggle:active {
  transform: scale(0.95);
}

@media (max-width: 760px) {
  .feedback-fab {
    left: 10px;
    bottom: 10px;
    min-height: 42px;
    max-width: calc(100vw - 20px);
    padding: 9px 13px;
    font-size: 13px;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24), 0 6px 14px rgba(15, 23, 42, 0.16);
  }

  .feedback-fab::before {
    width: 20px;
    height: 20px;
    font-size: 13px;
  }

  .quick-play-title-row {
    display: grid;
    gap: 8px;
  }

  .quick-play-rating {
    padding-top: 0;
  }

  .crowd-card-head,
  .result-title-row {
    align-items: flex-start;
  }

  .crowd-card-actions {
    justify-content: flex-end;
  }

  .share-btn,
  .crowd-history-toggle {
    padding: 7px 10px;
  }
}
