/* ── Game setup ────────────────────────────────────────────────── */

.setup {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  opacity: 0;
  transition: opacity var(--med) var(--ease);
  overflow: auto;
}
.setup[data-open="true"] { opacity: 1; }
.setup[hidden] { display: none; }

.setup-panel {
  width: min(100%, 560px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 26px 26px 22px;
  border-radius: var(--r-xl);
  background: var(--bg);
  box-shadow: var(--ring-strong), var(--lift-lg);
  transform: translateY(10px) scale(.98);
  transition: transform var(--slow) var(--spring);
}
.setup[data-open="true"] .setup-panel { transform: none; }

/* ── head ──────────────────────────────────────────────────────── */

.setup-head {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
}
.setup-mark { grid-row: 1 / 3; width: 42px; height: 42px; padding: 8px; gap: 2px; }
.setup-mark svg { width: 11px; height: 11px; }

.setup-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -.7px;
  line-height: 1.1;
}
.setup-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-3);
}

/* ── fields ────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 9px; min-width: 0; }

.field-label {
  margin: 0;
  font-family: var(--font-text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--ink-3);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
}

/* ── variant tiles ─────────────────────────────────────────────── */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 13px 14px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: var(--ring);
  text-align: left;
  transition:
    transform var(--fast) var(--spring),
    background-color var(--med) var(--ease),
    box-shadow var(--med) var(--ease);
}
.tile:hover { background: var(--surface-3); }
.tile:active { transform: scale(.985); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.tile[data-on="true"] {
  background: var(--bg);
  box-shadow: inset 0 0 0 1.5px var(--accent), var(--lift);
}

.tile-cards { display: flex; height: 26px; }
.mini-card {
  width: 17px;
  height: 24px;
  border-radius: 4px;
  background: var(--card-back-a);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 2px rgba(0, 0, 0, .09);
  transform: rotate(calc((var(--i) - 1.5) * 4deg)) translateY(calc(var(--i) * .4px));
}
.mini-card + .mini-card { margin-left: -5px; }
.tile[data-on="true"] .mini-card { background: var(--accent); }

.tile-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.2px;
  color: var(--ink);
}
.tile-blurb {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--ink-3);
}

/* ── segmented pickers ─────────────────────────────────────────── */

.segment {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  box-shadow: var(--ring);
}

.seg-btn {
  min-width: 38px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.1px;
  color: var(--ink-3);
  transition:
    background-color var(--med) var(--ease),
    color var(--med) var(--ease),
    box-shadow var(--med) var(--ease),
    transform var(--fast) var(--spring);
}
.seg-btn:hover { color: var(--ink); }
.seg-btn:active { transform: scale(.94); }
.seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg-btn[data-on="true"] {
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--ring), var(--lift);
}

/* ── note and actions ──────────────────────────────────────────── */

.setup-note {
  margin: -4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
}

.setup-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.setup-go { min-width: 160px; }
.setup-cancel[hidden] { display: none; }

@media (max-width: 560px) {
  .setup { padding: 14px; align-items: start; }
  .setup-panel { gap: 16px; padding: 20px 18px 18px; border-radius: var(--r-lg); }
  .setup-title { font-size: 23px; }
  .setup-mark { width: 38px; height: 38px; }
  .tiles { gap: 8px; }
  .tile { padding: 11px 12px 12px; gap: 6px; }
  .tile-name { font-size: 14px; }
  .tile-blurb { font-size: 11px; }
  .field-row { grid-template-columns: 1fr; gap: 14px; }
  .setup-actions { flex-direction: column-reverse; }
  .setup-go, .setup-cancel { width: 100%; }
}

@media (max-height: 700px) {
  .setup { align-items: start; }
  .setup-panel { gap: 14px; padding: 18px 18px 16px; }
  .setup-sub { display: none; }
  .tile { padding: 10px 12px 11px; }
  .tile-cards { height: 22px; }
  .mini-card { width: 15px; height: 21px; }
}

/* ── Rooms ─────────────────────────────────────────────────────── */

.mode-switch { align-self: flex-start; }

.room { display: flex; flex-direction: column; gap: 12px; }
.room[hidden] { display: none; }

.room-join { display: flex; flex-direction: column; gap: 8px; }
.room-row { display: flex; gap: 8px; }
.room-row .btn { min-width: 0; flex: none; }

.input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  box-shadow: var(--ring);
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.input::placeholder { color: var(--ink-4); }
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.input-code {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.room-live { display: flex; flex-direction: column; gap: 12px; }
.room-live[hidden] { display: none; }

.room-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.room-head-actions { display: flex; gap: 6px; }

.room-code {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 5px;
  line-height: 1.1;
  color: var(--ink);
}

.room-seats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: var(--ring);
}

.room-seat {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px 0 6px;
  border-radius: var(--r-pill);
  background: var(--bg);
  box-shadow: var(--ring);
  font-size: 13px;
}
.room-seat[data-you="true"] { box-shadow: inset 0 0 0 1.5px var(--accent); }
.room-seat[data-gone="true"] { opacity: .45; }

.room-seat .avatar { width: 28px; height: 28px; font-size: 11px; }
.room-seat-name {
  flex: 1;
  min-width: 0;
  font-family: var(--font-text);
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-seat-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--ink-3);
}
.room-seat-stack {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.room-empty {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.seg-btn[hidden] { display: none; }

.room-join[hidden],
.room-row[hidden],
.room-create[hidden] { display: none; }

/* ── Settings ──────────────────────────────────────────────────── */

.settings-panel { width: min(100%, 460px); gap: 18px; }

.opts {
  display: flex;
  flex-direction: column;
}

.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
}
.opt + .opt { border-top: 1px solid var(--line); }

.opt-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.opt-label {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.2px;
  color: var(--ink);
}
.opt-note {
  font-family: var(--font-text);
  font-size: 12px;
  color: var(--ink-3);
}

.opt-seg { flex: none; }
.opt-seg .seg-btn { min-width: 62px; font-size: 12px; }

/* the switch: a pill with a disc in it, like everything else here */
.switch {
  position: relative;
  flex: none;
  width: 50px;
  height: 30px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  box-shadow: var(--ring);
  transition: background-color var(--med) var(--ease);
}
.switch[data-on="true"] { background: var(--accent); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.switch-knob {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 24px;
  height: 24px;
  border-radius: var(--r-pill);
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .22);
  transition: transform var(--med) var(--spring);
}
.switch[data-on="true"] .switch-knob { transform: translateX(20px); }
