:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #666666;
  --line: #e5e5e5;
  --soft: #f7f7f7;
  --ok: #1a7f37;
  --danger: #b42318;
  --radius: 8px;
  --font: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover { opacity: 0.7; }

.container {
  width: min(960px, calc(100% - 2rem));
  margin: 1.5rem auto 3rem;
}
.flash-wrap {
  width: min(960px, calc(100% - 2rem));
  margin: 1rem auto 0;
}
.flash {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  border: 1px solid var(--line);
  background: var(--soft);
  font-size: 0.95rem;
}
.flash-success { color: var(--ok); }
.flash-error { color: var(--danger); }

h1, h2, h3 {
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
  line-height: 1.25;
}
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.hero {
  padding: 0.5rem 0 1.25rem;
}
.hero p {
  margin: 0;
  max-width: 42rem;
  color: var(--muted);
}

.panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.panel + .panel { margin-top: 0.85rem; }
.grid-2 {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 0.85rem;
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
}

label {
  display: block;
  margin: 0.75rem 0 0.3rem;
  color: var(--muted);
  font-size: 0.9rem;
}
input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #111;
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--ink);
  cursor: pointer;
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 550;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-ghost {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line);
}
.btn-ok,
.btn-danger {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}
@media (max-width: 700px) {
  .stat-row { grid-template-columns: 1fr; }
}
.stat {
  padding: 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--soft);
}
.stat .value {
  font-size: 1.6rem;
  font-weight: 650;
  color: var(--ink);
}
.stat .label {
  color: var(--muted);
  font-size: 0.85rem;
}
.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: #ececec;
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--ink);
  transition: width 0.25s ease;
}

.code-pill {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--soft);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.table th,
.table td {
  text-align: left;
  padding: 0.5rem 0.3rem;
  border-bottom: 1px solid var(--line);
}
.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--bg);
}
.badge-ok {
  color: var(--ok);
  border-color: #c7e4cf;
}
.badge-warn {
  color: var(--muted);
}

.rank-board {
  display: contents;
}
.rank-nums {
  display: none;
}
.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  min-width: 0;
  position: relative;
}
.rank-list.is-sorting {
  touch-action: none;
  user-select: none;
}
.rank-list:not(.rank-nums-visible) .rank-item .pos {
  visibility: hidden;
}
.rank-item.rank-press {
  background-color: #ececec !important;
}
.rank-ghost.rank-press {
  background-color: #ececec;
}
.rank-item.rank-flash {
  animation: rank-flash 2.4s ease forwards;
}
@keyframes rank-flash {
  0%,
  83% {
    background-color: #ececec;
  }
  100% {
    background-color: transparent;
  }
}
.rank-item {
  display: grid;
  grid-template-columns: 1.25rem 2.4rem minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: center;
  padding: 0.45rem 0.35rem;
  min-height: 3.1rem;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  background: transparent;
  will-change: transform;
  touch-action: manipulation;
  border-radius: 10px;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.18s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.rank-handle {
  color: #b5b5b5;
  font-size: 1.05rem;
  line-height: 1;
  letter-spacing: -0.08em;
  text-align: center;
  cursor: grab;
  user-select: none;
}
.rank-item .pos {
  font-weight: 600;
  color: #9a9a9a;
  font-size: 0.92rem;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.rank-ghost {
  position: fixed;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  display: grid;
  grid-template-columns: 1.25rem 2.4rem minmax(0, 1fr);
  gap: 0.4rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  min-height: 3.1rem;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #111;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  transform: scale(1);
  opacity: 0.98;
  list-style: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.rank-ghost .pos {
  visibility: visible !important;
  color: #9a9a9a;
  font-weight: 600;
}
.rank-ghost .rank-handle {
  color: #111;
}
.rank-item.is-dragging {
  opacity: 0;
  height: 0;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  pointer-events: none;
  margin: 0;
}
.rank-name {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body.group-rank-page .rank-list,
body.group-rank-page .rank-item,
body.group-rank-page .rank-name,
body.group-rank-page .lobby-heading {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.rank-controls {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}
.rank-controls button {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  border-radius: 8px;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
}
.rank-controls button:disabled {
  opacity: 0.3;
  cursor: default;
}
.rank-controls button:active:not(:disabled) {
  background: #e8e8e8;
}
.rank-insert-slot {
  flex-shrink: 0;
  margin: 0.1rem 0;
  border-radius: 10px;
  border: 1.5px dashed #111;
  background: rgba(0, 0, 0, 0.04);
  pointer-events: none;
  box-sizing: border-box;
}
.rank-insert-line {
  display: none;
}
.rank-ghost.is-popped {
  transform: scale(1.04);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}
.rank-ghost .rank-controls {
  display: none;
}
.rank-ghost .pos.is-live {
  transition: transform 0.12s ease;
}

html.rank-scroll-lock,
html.rank-scroll-lock body {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}
html.rank-scroll-lock body {
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
}
.rank-hero {
  padding: 0.75rem 0 0.75rem;
  position: sticky;
  top: 0;
  z-index: 15;
  background: #fff;
  border-bottom: 1px solid var(--line);
  margin: 0 -0.85rem;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}
.rank-hero h1 {
  margin: 0;
  font-size: 1.35rem;
}
.rank-desc {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.4;
}
.rank-form-full {
  width: 100%;
  max-width: none;
  margin: 0;
  padding-top: 0.75rem;
}
.rank-submit {
  position: sticky;
  bottom: 0;
  padding: 0.85rem 0 1rem;
  background: #fff;
  border-top: 1px solid var(--line);
  margin-top: 0.75rem;
  z-index: 15;
}
.rank-submit .btn {
  width: 100%;
}
body.rank-page .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0.85rem 1.5rem;
  animation: rank-page-in 0.7s ease both;
}
body.rank-page .rank-hero {
  animation: rank-soft-in 0.55s ease both;
}
body.rank-page .rank-item {
  opacity: 0;
  animation: rank-item-in 0.5s ease both;
}
body.rank-page .rank-item:nth-child(1) { animation-delay: 0.08s; }
body.rank-page .rank-item:nth-child(2) { animation-delay: 0.12s; }
body.rank-page .rank-item:nth-child(3) { animation-delay: 0.16s; }
body.rank-page .rank-item:nth-child(4) { animation-delay: 0.2s; }
body.rank-page .rank-item:nth-child(5) { animation-delay: 0.24s; }
body.rank-page .rank-item:nth-child(6) { animation-delay: 0.28s; }
body.rank-page .rank-item:nth-child(7) { animation-delay: 0.32s; }
body.rank-page .rank-item:nth-child(8) { animation-delay: 0.36s; }
body.rank-page .rank-item:nth-child(9) { animation-delay: 0.4s; }
body.rank-page .rank-item:nth-child(10) { animation-delay: 0.44s; }
body.rank-page .rank-item:nth-child(11) { animation-delay: 0.48s; }
body.rank-page .rank-item:nth-child(12) { animation-delay: 0.52s; }
body.rank-page .rank-item:nth-child(13) { animation-delay: 0.56s; }
body.rank-page .rank-item:nth-child(14) { animation-delay: 0.6s; }
body.rank-page .rank-item:nth-child(15) { animation-delay: 0.64s; }
body.rank-page .rank-submit {
  animation: rank-soft-in 0.55s ease 0.55s both;
}
@keyframes rank-page-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes rank-soft-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes rank-item-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  body.rank-page .container,
  body.rank-page .rank-hero,
  body.rank-page .rank-item,
  body.rank-page .rank-submit {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
@media (max-width: 720px) {
  body.rank-page .container,
  body.wait-page .container {
    padding-top: 0;
  }
  body.rank-page .rank-hero {
    position: sticky;
    top: 0;
  }
}

body.wait-page .container {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 100vh;
  padding: 1.25rem;
}
.wait-center {
  min-height: calc(100vh - 2.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.25rem;
  padding: 1rem 0 2rem;
}
.wait-status {
  margin: 0;
  font-size: clamp(1.2rem, 3.5vw, 1.55rem);
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.wait-sub {
  margin: -0.55rem 0 0;
  font-size: 1rem;
}
.wait-hello {
  margin: 0;
  font-size: 1.35rem;
}
.wait-meta {
  margin: 0;
  font-size: 0.98rem;
}
.gauge {
  position: relative;
  width: min(14rem, 70vw);
  aspect-ratio: 1;
}
.gauge-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.gauge-track,
.gauge-value {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
}
.gauge-track {
  stroke: #ececec;
}
.gauge-value {
  stroke: #111;
  stroke-dasharray: 326.73;
  stroke-dashoffset: calc(326.73 * (1 - var(--pct, 0) / 100));
  transition: stroke-dashoffset 0.55s ease;
}
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.gauge-pct {
  font-size: clamp(2.2rem, 8vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.gauge-unit {
  font-size: 0.55em;
  font-weight: 700;
  color: var(--ink);
  margin-left: 0.05em;
}

.code-boxes {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  width: 100%;
}
.code-box {
  width: 2.6rem;
  height: 3.1rem;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 650;
  text-transform: uppercase;
  border: 1px solid #d0d0d0;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 0;
}
.code-box:focus {
  outline: 2px solid #111;
  outline-offset: 1px;
  border-color: #111;
}

.lobby-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  align-items: start;
  min-height: calc(100vh - 7rem);
}
.lobby-left {
  min-width: 0;
}
.lobby-qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.25rem;
  position: sticky;
  top: 1rem;
}
.lobby-qr-img {
  width: 160px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.5rem;
  background: #fff;
}
.qr-code-label {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}
.lobby-code-side {
  font-size: 1.35rem;
  letter-spacing: 0.14em;
}
@media (max-width: 720px) {
  .lobby-layout {
    grid-template-columns: 1fr;
  }
  .lobby-qr-panel {
    order: -1;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 1rem;
    position: static;
  }
  .lobby-qr-img { width: 110px; }
}

.qr-box { text-align: center; padding: 0.5rem 0; }
.qr-box img {
  width: min(200px, 100%);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 0.4rem;
  background: #fff;
}

.scenario {
  border-left: 2px solid var(--line);
  padding-left: 0.75rem;
  color: var(--muted);
  margin: 0.85rem 0;
}

.live-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 0.35rem;
  vertical-align: middle;
}

.score-big {
  font-size: 1.8rem;
  font-weight: 650;
  color: var(--ink);
}

.list-cards { display: grid; gap: 0.55rem; }
.list-cards a.panel {
  display: block;
  color: inherit;
  text-decoration: none;
}
.list-cards a.panel:hover {
  background: var(--soft);
  opacity: 1;
}

code {
  font-size: 0.85em;
  background: var(--soft);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

/* Mentimeter-style join landing */
body.join-page {
  min-height: 100vh;
}
.container-join {
  width: 100%;
  margin: 0;
  min-height: 100vh;
}
.flash-wrap-join {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 2rem));
  z-index: 30;
  margin: 0;
}
.menti-brand {
  display: block;
  margin-bottom: 2rem;
}
.menti-logo {
  display: block;
  width: auto;
  height: 4.5rem;
  max-width: 100%;
  object-fit: contain;
}
.menti-card {
  width: min(420px, 100%);
}
.menti-card h1 {
  font-size: clamp(1.55rem, 4vw, 2rem);
  font-weight: 700;
  margin: 0 0 0.45rem;
}
.menti-sub {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 1rem;
}
.menti-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}
.menti-code {
  width: 100%;
  text-align: center;
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid #d0d0d0;
  background: #fff;
  color: var(--ink);
}
.menti-input {
  width: 100%;
  text-align: left;
  font-size: 1.2rem;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid #d0d0d0;
  background: #fff;
  color: var(--ink);
  position: relative;
  z-index: 1;
  -webkit-appearance: none;
  appearance: none;
}
.menti-code::placeholder {
  color: #b0b0b0;
  letter-spacing: 0.14em;
  text-transform: none;
}
.menti-input::placeholder {
  color: #b0b0b0;
}
.menti-code:focus,
.menti-input:focus {
  outline: 2px solid #111;
  outline-offset: 1px;
  border-color: #111;
}
.menti-join {
  border-radius: 999px;
  padding: 0.7rem 2.4rem;
  min-width: 8rem;
  font-weight: 650;
}
.menti-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1.25rem 4.5rem;
  text-align: left;
  width: min(420px, 100%);
  margin: 0 auto;
  transition: opacity 0.45s ease, transform 0.45s ease, filter 0.45s ease;
}
.menti-shell.is-exiting {
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  filter: brightness(0.35);
  pointer-events: none;
}
.menti-footer {
  position: absolute;
  bottom: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  margin: 0;
  text-align: left;
  color: var(--muted);
  font-size: 0.92rem;
}
.menti-footer a {
  color: var(--ink);
}

/* Facilitator lobby (participants appearing live) */
body.lobby-page {
  min-height: 100vh;
}
.lobby-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.5rem 6rem;
  width: min(960px, 100%);
  margin: 0 auto;
}
.lobby-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.lobby-session {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.lobby-heading h1 {
  font-size: clamp(1.7rem, 4.5vw, 2.3rem);
  margin: 0;
  font-weight: 700;
}
.lobby-code {
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.16em;
}
.lobby-qr {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.lobby-qr img {
  width: 120px;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 0.4rem;
  background: #fff;
}
.lobby-qr:hover img {
  border-color: #111;
}
.lobby-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 0;
}
.lobby-list,
.lobby-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  --chip-gap: 0.75rem;
  --chip-cols: 3;
  display: grid;
  grid-template-columns: repeat(var(--chip-cols), minmax(0, 1fr));
  gap: var(--chip-gap);
  width: 100%;
  align-content: start;
}
.lobby-list.select-grid {
  --chip-cols: 3;
}
.lobby-list.select-grid > li {
  min-width: 0;
  display: flex;
}
.lobby-list.select-grid .lobby-chip {
  width: 100%;
  height: 100%;
}
@media (max-width: 720px) {
  .lobby-list.select-grid {
    --chip-cols: 2;
  }
}
.teams-count {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0 0 1.1rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
  pointer-events: none;
  user-select: none;
}
.teams-count-num {
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.teams-count-label {
  font-size: 1.05rem;
  font-weight: 550;
  color: var(--muted);
}
.lobby-chip {
  position: relative;
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 14px;
  padding: 0.85rem 0.9rem;
  font-weight: 600;
  font-size: clamp(1.05rem, 1.8vw + 0.7rem, 1.55rem);
  line-height: 1.25;
  animation: chip-in 0.25s ease both;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 3.4rem;
  box-sizing: border-box;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.chip-hand {
  flex-shrink: 0;
  font-size: 1.15em;
  line-height: 1;
}
.lobby-chip.is-hand-raised:not(.is-selected) {
  background: #fff3a3;
  border-color: #e0c84a;
  color: #5c4b00;
}
.lobby-chip.is-selected .chip-hand {
  filter: grayscale(1) brightness(2);
}
.hand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1.25rem;
  width: 5.5rem;
  height: 5.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  font-size: 2.75rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.hand-btn:hover {
  background: #eee;
}
.hand-btn:active {
  transform: scale(0.94);
}
.hand-btn.is-raised {
  background: #fff3a3;
  border-color: #e0c84a;
}
.hand-hint {
  margin: 0.75rem 0 0;
  font-size: 1.05rem;
  font-weight: 550;
}
.lobby-list[data-count="1"] .lobby-chip {
  font-size: clamp(1.4rem, 3vw + 0.8rem, 2rem);
  min-height: 4.2rem;
  padding: 1.1rem 1.2rem;
}
.lobby-list[data-count="2"] .lobby-chip,
.lobby-list[data-count="3"] .lobby-chip {
  font-size: clamp(1.2rem, 2.4vw + 0.7rem, 1.7rem);
  min-height: 3.8rem;
}
.lobby-chip-lg {
  /* same size as regular chips for consistency across stages */
  font-size: inherit;
  padding: inherit;
  min-height: inherit;
}
.lobby-chip.is-done {
  background: #eaf7ee;
  border-color: #b7dfc2;
  color: #14532d;
}
.lobby-chip.is-selected {
  background: #111;
  border-color: #111;
  color: #fff;
}
.chip-check {
  display: inline-flex;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: #1a7f37;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
button.lobby-chip,
.select-chip {
  font: inherit;
  font-size: inherit;
  cursor: pointer;
  color: inherit;
}
.lobby-chip-wrap {
  display: contents;
}
.lobby-shell-scroll {
  padding-bottom: 7rem;
}
.lobby-empty {
  margin: 0.5rem 0 0;
  font-size: 1.05rem;
}
.lobby-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1rem 1.25rem 1.4rem;
  display: flex;
  justify-content: center;
  background: #fff;
  border-top: 1px solid var(--line);
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.qr-modal {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(420px, calc(100% - 2rem));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.qr-modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.qr-modal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem 1.25rem 1.25rem;
  text-align: center;
}
.qr-modal-img {
  width: min(280px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
}
.qr-modal-label {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
}
.mini-chart {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.mini-bar-row {
  display: grid;
  grid-template-columns: minmax(7rem, 1.2fr) 2fr auto;
  gap: 0.6rem;
  align-items: center;
}
.mini-bar-label {
  font-size: 0.88rem;
  color: var(--muted);
}
.mini-bar-track {
  height: 8px;
  background: #ececec;
  border-radius: 999px;
  overflow: hidden;
}
.mini-bar-fill {
  display: block;
  height: 100%;
  background: #111;
  border-radius: 999px;
  min-width: 2px;
}
.mini-bar-value {
  font-size: 0.88rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.apex-wrap {
  width: 100%;
  min-height: 240px;
  background: transparent;
}
.apex-wrap-tall {
  min-height: 420px;
}
.apex-wrap .apexcharts-canvas,
.apex-wrap .apexcharts-svg {
  background: transparent !important;
}
.results-section {
  margin: 0 0 2rem;
  padding: 0;
  background: transparent;
  border: 0;
}
.results-section h2 {
  margin-bottom: 0.35rem;
}
.charts-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.charts-split-title {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  font-weight: 650;
  color: var(--muted);
}
.rank-tables-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-top: 0.75rem;
}
.rank-compare-table {
  margin: 0;
}
.rank-compare-table .rank-num {
  width: 2.2rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.rank-compare-table tr.rank-match td {
  background: #eaf7ee;
  color: #14532d;
}
.rank-compare-table tr.rank-match .rank-num {
  color: #1a7f37;
}
@media (max-width: 820px) {
  .charts-split,
  .rank-tables-split {
    grid-template-columns: 1fr;
  }
}
.nasa-list {
  margin: 0;
  padding-left: 1.2rem;
}
@keyframes chip-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Intro / galaxy after joining */
body.intro-active {
  background: #000;
  overflow: hidden;
}
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #000;
  opacity: 0;
  transition: opacity 0.85s ease;
  pointer-events: none;
}
.intro-overlay[hidden] {
  display: none !important;
}
.intro-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.galaxy {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 55% at 50% 120%, rgba(40, 50, 120, 0.45), transparent 55%),
    radial-gradient(ellipse 50% 40% at 20% 30%, rgba(60, 30, 90, 0.25), transparent 50%),
    radial-gradient(ellipse 40% 35% at 80% 20%, rgba(20, 60, 110, 0.3), transparent 50%),
    #000;
}
.galaxy-glow {
  position: absolute;
  width: 140%;
  height: 60%;
  left: -20%;
  top: 35%;
  background: radial-gradient(ellipse at center, rgba(90, 110, 180, 0.12), transparent 65%);
  animation: galaxy-drift 28s ease-in-out infinite alternate;
  pointer-events: none;
}
.galaxy-stars {
  position: absolute;
  inset: 0;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.7);
  opacity: 0.55;
  animation: star-twinkle ease-in-out infinite;
}
.star-dim {
  background: #c8d4ff;
  box-shadow: none;
  opacity: 0.25;
  animation-name: star-twinkle-dim;
}
@keyframes star-twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
@keyframes star-twinkle-dim {
  0%, 100% { opacity: 0.12; }
  50% { opacity: 0.4; }
}
@keyframes galaxy-drift {
  from { transform: translateX(-3%) translateY(2%); }
  to { transform: translateX(3%) translateY(-2%); }
}
.intro-content {
  position: relative;
  z-index: 2;
  width: min(34rem, 100%);
  color: #f2f2f2;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease 0.35s, transform 0.7s ease 0.35s;
}
.intro-overlay.is-ready .intro-content {
  opacity: 1;
  transform: none;
}
.intro-kicker {
  margin: 0 0 1.25rem;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}
.intro-bullets {
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.intro-bullets li {
  position: relative;
  padding-left: 1.15rem;
  font-size: clamp(0.98rem, 2.4vw, 1.12rem);
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.88);
  opacity: 0;
  transform: translateY(8px);
}
.intro-overlay.is-ready .intro-bullets li {
  animation: intro-bullet-in 0.55s ease forwards;
}
.intro-overlay.is-ready .intro-bullets li:nth-child(1) { animation-delay: 0.15s; }
.intro-overlay.is-ready .intro-bullets li:nth-child(2) { animation-delay: 0.35s; }
.intro-overlay.is-ready .intro-bullets li:nth-child(3) { animation-delay: 0.55s; }
.intro-overlay.is-ready .intro-bullets li:nth-child(4) { animation-delay: 0.75s; }
.intro-overlay.is-ready .intro-bullets li:nth-child(5) { animation-delay: 0.95s; }
.intro-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #9eb4ff;
  box-shadow: 0 0 8px rgba(158, 180, 255, 0.7);
}
@keyframes intro-bullet-in {
  to { opacity: 1; transform: none; }
}
.intro-continue {
  background: #fff;
  color: #111;
  border-color: #fff;
  opacity: 0;
  transition: opacity 0.4s ease 1.3s;
}
.intro-overlay.is-ready .intro-continue {
  opacity: 1;
}
.intro-continue:disabled {
  opacity: 0.35;
}
.intro-overlay.is-ready .intro-continue:disabled {
  opacity: 0.35;
}
.intro-whiteout {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.85s ease;
}
.intro-overlay.is-leaving .intro-content {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.intro-overlay.is-leaving .galaxy {
  opacity: 0;
  transition: opacity 0.7s ease;
}
.intro-overlay.is-leaving .intro-whiteout {
  opacity: 1;
}
.intro-overlay.is-leaving .intro-continue {
  opacity: 0;
  transition: opacity 0.35s ease;
}
