:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1b1f27;
  --panel-border: #303642;
  --text: #f4f7fb;
  --muted: #a8b0be;
  --accent: #d43f3f;
  --accent-hover: #b93333;
  --button-dark: #2b323d;
  --button-dark-hover: #38414f;
  --focus: #f1c75b;
  --info: #2563eb;
  --info-hover: #1d4ed8;
  --success: #3a7e60;
  --success-hover: #326d53;
  --reveal: #8f6424;
  --reveal-hover: #76521e;
  --host-reveal: #6f4bb6;
  --host-reveal-hover: #5c3d98;
}

@keyframes soft-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgb(241 199 91 / 0%);
  }

  45% {
    box-shadow: 0 0 0 4px rgb(241 199 91 / 16%);
  }
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    linear-gradient(rgb(17 19 24 / 74%), rgb(17 19 24 / 74%)),
    url("wallpaper.webp") center / cover fixed no-repeat;
  color: var(--text);
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 0;
  height: calc(100dvh - var(--tool-header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.about-button {
  position: fixed;
  top: calc(var(--tool-header-height) + max(14px, env(safe-area-inset-top)));
  right: max(14px, env(safe-area-inset-right));
  z-index: 10;
  width: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgb(17 21 27 / 86%);
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 10px 24px rgb(0 0 0 / 22%);
}

.about-button:hover {
  border-color: #465164;
  background: var(--button-dark);
  color: var(--text);
}

.about-button svg {
  width: 18px;
  height: 18px;
  stroke: currentcolor;
}

.game-panel {
  width: 100%;
  padding: 28px 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: 0 20px 45px rgb(0 0 0 / 28%);
}

.home-panel,
.boot-panel,
.ended-panel {
  max-width: 420px;
}

.lobby-panel {
  max-width: 960px;
  padding: 0;
  overflow: hidden;
}

.boot-panel {
  min-height: 180px;
  display: grid;
  place-items: center;
}

.page-header {
  text-align: center;
  margin-bottom: 28px;
}

.page-header h1 {
  margin: 0 0 10px;
  font-size: clamp(1.65rem, 7.2vw, 2.4rem);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

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

.button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

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

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

.button-secondary {
  margin-top: 8px;
  background: var(--button-dark);
}

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

.button-info {
  background: var(--info);
}

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

.button-success {
  background: var(--success);
}

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

.button-reveal {
  background: var(--reveal);
}

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

.button-host-reveal {
  background: var(--host-reveal);
}

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

.button-quiet {
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--muted);
}

.button-quiet:hover:not(:disabled) {
  background: rgb(255 255 255 / 6%);
  color: var(--text);
}

.separator {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin: 28px 0;
  color: var(--muted);
}

.separator span {
  height: 1px;
  background: var(--panel-border);
}

.separator strong {
  font-size: 0.82rem;
  letter-spacing: 0;
}

.create-form,
.join-form {
  display: grid;
  gap: 16px;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-group label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.field-group input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #11151b;
  color: var(--text);
}

.field-group input::placeholder {
  color: #77808f;
}

.status-message {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--focus);
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: center;
}

.status-message:empty {
  min-height: 0;
  margin-top: 0;
}

.is-hidden {
  display: none !important;
}

.is-invisible {
  visibility: hidden !important;
  pointer-events: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip: rect(0 0 0 0);
}

.lobby-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--panel-border);
  background: #141820;
}

.lobby-code-block {
  display: grid;
  gap: 3px;
}

.lobby-code-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lobby-code-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lobby-code {
  margin: 0;
  font-size: clamp(2rem, 8vw, 2.2rem);
  line-height: 1;
  font-weight: 950;
}

.lobby-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lobby-status-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgb(74 192 132 / 42%);
  border-radius: 8px;
  color: #4ac084;
  background: rgb(74 192 132 / 9%);
  font-size: 0.84rem;
  font-weight: 850;
}

.code-toggle-button {
  width: 24px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.code-toggle-button:hover {
  color: var(--text);
  background: rgb(255 255 255 / 6%);
}

.code-toggle-button svg {
  width: 15px;
  height: 15px;
  stroke: currentcolor;
}

.lobby-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.copy-link-button {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--button-dark);
  color: var(--text);
  cursor: pointer;
  transform: translateY(2px);
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease,
    box-shadow 180ms ease;
}

.copy-link-button:hover {
  background: var(--button-dark-hover);
}

.copy-link-button svg {
  grid-area: 1 / 1;
  width: 16px;
  height: 16px;
  stroke: currentcolor;
}

.copy-link-button .icon-check {
  display: none;
}

.copy-link-button.is-copied {
  border-color: rgb(241 199 91 / 50%);
  color: var(--focus);
  animation: soft-pulse 520ms ease-out;
}

.copy-link-button.is-copied .icon-link {
  display: none;
}

.copy-link-button.is-copied .icon-check {
  display: block;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.lobby-layout {
  display: grid;
  height: 560px;
  min-height: 0;
}

@media (min-width: 700px) {
  .lobby-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: stretch;
  }
}

.lobby-layout > .players-section {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  padding: 22px;
  overflow: hidden;
}

.lobby-layout > .team-config-section {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  align-content: stretch;
  padding: 22px 14px 22px 22px;
  border-left: 1px solid var(--panel-border);
  background: #11151b;
  overflow: hidden;
}

.players-section h2,
.team-config-section h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.player-count {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.players-section h3 {
  margin: 16px 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0;
}

.players-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.players-scrollbox {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: var(--panel-border) transparent;
}

.players-list li {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #11151b;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 750;
}

.player-host-label {
  margin-left: 8px;
  color: var(--focus);
  font-size: 0.84rem;
  font-weight: 800;
}

.player-info {
  min-width: 0;
  display: flex;
  align-items: center;
}

.player-action-slot {
  width: 28px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
}

.remove-player-button {
  width: 28px;
  min-height: 28px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--muted);
  cursor: pointer;
}

.remove-player-button:hover {
  color: var(--text);
  border-color: #465164;
}

.remove-player-button svg {
  width: 15px;
  height: 15px;
  stroke: currentcolor;
}

#start-game-button {
  margin-top: 0;
}

.compact-button {
  min-height: 40px;
  margin-top: 0;
  font-size: 0.94rem;
}

.team-config-section {
  margin-top: 0;
}

.rail-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.room-settings-group {
  display: grid;
  gap: 8px;
}

.team-settings-scroll {
  min-height: 0;
  display: grid;
  gap: 14px;
  align-content: start;
  margin-right: -8px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-color: #465164 transparent;
  scrollbar-gutter: stable;
}

.room-settings-card {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #171b22;
}

.room-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 7px 8px;
}

.room-setting-label {
  min-width: 0;
  color: var(--text);
  font-size: 0.88rem;
}

.room-setting-label strong {
  display: block;
  font-weight: 750;
}

.room-setting-row input {
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
  font: inherit;
  font-weight: 750;
  text-align: center;
}

.room-setting-row input:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.72;
}

.team-mode-setting-row {
  grid-template-columns: minmax(0, 1fr) minmax(144px, 1.15fr);
  padding-top: 8px;
  padding-bottom: 8px;
  border-top: 1px solid var(--panel-border);
}

.team-mode-setting-row .room-setting-label strong,
.teams-heading-row h2 {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.help-icon-button {
  width: 20px;
  min-height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: help;
}

.help-icon-button:hover {
  background: rgb(255 255 255 / 6%);
  color: var(--text);
}

.help-icon-button svg {
  width: 14px;
  height: 14px;
  stroke: currentcolor;
}

.team-mode-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.team-mode-option {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.team-mode-option.is-selected {
  border-color: rgb(241 199 91 / 44%);
  background: rgb(241 199 91 / 8%);
  color: var(--text);
}

.team-mode-option:has(input:disabled) {
  cursor: default;
  opacity: 0.72;
}

.team-mode-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
}

.help-popover {
  position: fixed;
  z-index: 100;
  width: 310px;
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #151922;
  box-shadow: 0 18px 38px rgb(0 0 0 / 42%);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.45;
}

.help-popover[data-placement="right"]::after {
  position: absolute;
  top: 17px;
  left: -5px;
  width: 8px;
  height: 8px;
  border-left: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
  background: #151922;
  content: "";
  transform: rotate(45deg);
}

.help-popover[data-placement="below"]::after {
  position: absolute;
  top: -5px;
  left: 94px;
  width: 8px;
  height: 8px;
  border-top: 1px solid var(--panel-border);
  border-left: 1px solid var(--panel-border);
  background: #151922;
  content: "";
  transform: rotate(45deg);
}

.tooltip-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
}

.tooltip-option {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #0d1117;
}

.tooltip-option strong {
  color: var(--focus);
  font-size: 0.82rem;
  font-weight: 850;
}

.tooltip-option span {
  color: var(--muted);
}

.teams-help-popover {
  gap: 6px;
}

.teams-help-copy {
  color: var(--muted);
}

.teams-help-copy.tooltip-option {
  color: var(--muted);
}

#max-players-input {
  appearance: textfield;
  -moz-appearance: textfield;
}

#max-players-input::-webkit-inner-spin-button,
#max-players-input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.teams-heading-row {
  min-height: 32px;
}

.teams-header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--info);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.teams-header-action:hover {
  background: var(--info-hover);
  color: var(--text);
}

.team-config-scroll {
  min-height: 0;
  overflow: visible;
}

.team-config-list {
  display: grid;
  gap: 5px;
  align-content: start;
}

.team-config-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 32px;
  align-items: end;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #171b22;
}

.team-config-readonly-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 44px;
  padding: 9px 12px;
}

.readonly-team-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readonly-team-count {
  min-width: 30px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: right;
}

.team-config-fields {
  display: contents;
}

.team-config-row label {
  display: grid;
  gap: 3px;
  color: var(--muted);
}

.team-config-row label span {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.team-config-row label.team-visibility-toggle {
  grid-column: 1 / -1;
  min-height: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 1px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: none;
}

.team-config-row label.team-visibility-toggle.is-reserved {
  visibility: hidden;
}

.team-visibility-toggle small {
  margin-left: auto;
  color: #858e9f;
  font-size: 0.68rem;
  line-height: 1.2;
}

.team-visibility-toggle input:disabled {
  opacity: 0.45;
}

.team-config-row input[type="text"],
.team-config-row input[type="number"] {
  width: 100%;
  min-height: 32px;
  padding: 6px 7px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--text);
  font-weight: 750;
}

.team-config-row input[type="text"]:focus,
.team-config-row input[type="number"]:focus {
  border-color: #465164;
}

.team-count-input::placeholder {
  font-size: 0.72rem;
  font-weight: 800;
}

.team-count-input {
  appearance: textfield;
  -moz-appearance: textfield;
}

.team-count-input::-webkit-inner-spin-button,
.team-count-input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.team-config-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.remove-team-button {
  position: static;
  align-self: end;
  width: 32px;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #0d1117;
  color: var(--muted);
  cursor: pointer;
}

.remove-team-button:hover {
  color: var(--text);
  border-color: #465164;
}

.remove-team-button svg {
  width: 14px;
  height: 14px;
  stroke: currentcolor;
}

.inline-status {
  min-height: 24px;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--focus);
  font-size: 0.86rem;
  line-height: 1.35;
  text-align: center;
}

.inline-status:empty {
  min-height: 18px;
}

.team-config-footer {
  display: grid;
  gap: 8px;
  padding-top: 8px;
  margin-top: 0;
  border-top: 1px solid var(--panel-border);
}

.host-action-stack {
  display: grid;
  gap: 12px;
}

.team-config-footer .button-secondary,
.host-action-stack .button-secondary {
  margin-top: 0;
}

.team-config-section.player-action-rail .room-settings-group,
.team-config-section.player-action-rail .team-settings-scroll,
.team-config-section.player-action-rail .teams-heading-row,
.team-config-section.player-action-rail .team-config-scroll,
.team-config-section.player-action-rail #team-config-status {
  display: none;
}

.team-config-section.player-action-rail {
  grid-template-rows: minmax(0, 1fr) auto;
}

.team-config-section.player-action-rail .team-config-footer {
  grid-row: 2;
}

.team-config-section.team-config-readonly-mode .teams-header-action,
.team-config-section.team-config-readonly-mode #teams-help-button,
.team-config-section.team-config-readonly-mode #team-config-status {
  display: none;
}

.team-config-section.team-config-readonly-mode .team-config-scroll {
  margin-right: 0;
  padding-right: 0;
  scrollbar-gutter: auto;
}

.lobby-panel > #lobby-status-message {
  width: calc(100% - 44px);
  margin-left: 22px;
  margin-right: 22px;
}

.started-panel {
  width: min(100%, 540px);
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: start;
  gap: 12px;
  overflow: visible;
}

.ended-panel {
  min-height: 240px;
  display: grid;
  align-items: center;
  align-content: center;
  gap: 18px;
  overflow: hidden;
}

.started-panel.is-hidden,
.ended-panel.is-hidden {
  display: none;
}

.started-title {
  margin: 0;
  font-size: clamp(1.15rem, 4.5vw, 1.35rem);
  line-height: 1.15;
  white-space: nowrap;
}

.started-header {
  margin: 0;
  text-align: center;
}

.ended-panel .page-header {
  margin-bottom: 0;
}

.ended-panel .page-header h1 {
  margin-bottom: 8px;
  font-size: clamp(1.65rem, 7vw, 2.3rem);
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(4 6 10 / 68%);
}

.confirm-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 20px 45px rgb(0 0 0 / 35%);
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
  text-align: center;
}

.about-dialog {
  width: min(100%, 500px);
  gap: 14px;
  padding: 24px 22px 22px;
}

.about-label {
  margin: 0;
  padding-right: 28px;
  color: #ff1313d9;
  font-size: 0.89rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.about-copy {
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.about-copy p {
  margin: 0;
}

.about-copy p:nth-child(3) {
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
}

.about-disclaimer {
  padding-top: 12px;
  border-top: 1px solid var(--panel-border);
  color: #858e9f;
  font-size: 0.78rem;
  line-height: 1.45;
}

.about-close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #11151b;
  color: var(--muted);
  cursor: pointer;
}

.about-close-button:hover {
  border-color: #465164;
  color: var(--text);
}

.about-close-button svg {
  width: 16px;
  height: 16px;
  stroke: currentcolor;
}

.confirm-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.confirm-dialog-actions .button {
  margin-top: 0;
}

#back-to-main-button {
  width: 100%;
  min-width: 0;
  margin-top: 0;
}

.started-reveal {
  min-height: 352px;
  display: grid;
  grid-template-rows: 136px 204px;
  gap: 12px;
  overflow: hidden;
}

.shared-assignments-panel {
  min-height: 472px;
  display: grid;
  grid-template-rows: 136px minmax(0, 324px);
  gap: 12px;
  overflow: hidden;
}

.started-reveal.is-concealed {
  visibility: visible;
}

.reveal-card {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #11151b;
  text-align: center;
  overflow: visible;
}

.reveal-card-inner {
  min-height: 92px;
  display: grid;
  place-items: center;
}

.reveal-hidden {
  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;
  gap: 8px;
  max-width: 280px;
}

.privacy-icon {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  justify-self: center;
  border: 1px solid rgb(241 199 91 / 30%);
  border-radius: 8px;
  background: rgb(241 199 91 / 8%);
  color: var(--focus);
}

.privacy-icon svg {
  width: 21px;
  height: 21px;
  stroke: currentcolor;
}

.reveal-hidden-copy {
  display: grid;
  gap: 3px;
  margin: 0;
}

.reveal-hidden-copy strong {
  font-size: 0.98rem;
}

.reveal-hidden-copy span {
  color: var(--muted);
  font-size: 0.86rem;
}

.reveal-team {
  width: 100%;
  min-height: 92px;
  display: grid;
  gap: 10px;
  align-content: center;
  justify-items: center;
}

.team-name {
  margin: 0;
  max-width: 100%;
  overflow-wrap: normal;
  white-space: nowrap;
  font-size: 2.7rem;
  line-height: 1;
  font-weight: 950;
}

.compact-list {
  min-height: 0;
}

#teammates-section {
  min-height: 0;
}

.teammates-card {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #151922;
  overflow: hidden;
}

.shared-teams-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #151922;
  overflow: hidden;
}

.shared-teams-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shared-teams-header h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.shared-assignments-list {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
  margin-right: -8px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-color: var(--panel-border) transparent;
}

.shared-team-block {
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #11151b;
}

.shared-team-block.is-your-team {
  border-color: rgb(241 199 91 / 42%);
}

.shared-team-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.shared-team-heading h4 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 0.96rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-team-heading span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.shared-player-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shared-player-list li {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #171b22;
  font-size: 0.9rem;
  font-weight: 700;
}

.shared-player-list .is-you {
  border-color: rgb(241 199 91 / 48%);
  color: var(--focus);
}

.teammates-card.is-locked {
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.teammates-placeholder {
  display: grid;
  justify-items: center;
  gap: 9px;
}

.mate-placeholder {
  max-width: 240px;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.teammates-result {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

#teammates-section h3 {
  margin: 0;
  color: var(--muted);
}

#teammates-section .players-list {
  min-height: 0;
  align-content: start;
  overflow-y: auto;
  padding: 0 4px 0 0;
  scrollbar-color: var(--panel-border) transparent;
}

#teammates-section .players-list li {
  min-height: 36px;
  padding: 8px 11px;
}

.started-actions {
  display: grid;
  gap: 12px;
}

.started-actions.is-shared-mode {
  grid-template-columns: minmax(0, 1fr);
}

.started-host-actions {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #151922;
}

.started-host-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.started-host-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.started-action-slot {
  min-height: 48px;
  display: grid;
}

.started-action-slot > .button {
  grid-area: 1 / 1;
  width: 100%;
  margin-top: 0;
}

#reveal-team-button,
#hide-team-button,
#started-end-game-button,
#started-leave-game-button {
  margin-top: 0;
}

.started-panel > #started-status-message {
  min-height: 0;
  margin-top: 0;
}

@media (max-width: 360px) {
  .page-shell {
    padding: 16px 12px;
  }

  .game-panel {
    padding: 24px 16px;
  }

  .lobby-panel {
    padding: 0;
  }

  .confirm-dialog-actions {
    grid-template-columns: 1fr;
  }

  .started-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 699px) {
  body {
    background:
      linear-gradient(rgb(17 19 24 / 74%), rgb(17 19 24 / 74%)),
      url("wallpaper-mobile.webp") center / cover no-repeat;
  }

  .page-shell {
    align-items: flex-start;
    height: auto;
    min-height: calc(100dvh - var(--tool-header-height));
    padding-top: 16px;
  }

  .about-button {
    top: calc(var(--tool-header-height) + max(10px, env(safe-area-inset-top)));
    right: max(10px, env(safe-area-inset-right));
    width: 32px;
    min-height: 32px;
    background: rgb(17 21 27 / 72%);
  }

  .about-button svg {
    width: 16px;
    height: 16px;
  }

  .lobby-panel {
    overflow: visible;
  }

  .lobby-topbar {
    align-items: flex-start;
    padding: 16px;
  }

  .lobby-layout {
    height: auto;
    min-height: 0;
  }

  .lobby-layout > .players-section,
  .lobby-layout > .team-config-section {
    height: auto;
    overflow: visible;
  }

  .lobby-layout > .players-section {
    padding: 16px;
  }

  .lobby-layout > .team-config-section {
    padding: 16px 10px 16px 16px;
    border-left: 0;
    border-top: 1px solid var(--panel-border);
  }

  .players-scrollbox {
    max-height: 260px;
    min-height: 156px;
  }

  .team-config-scroll {
    max-height: none;
    overflow: visible;
  }

  .team-settings-scroll {
    margin-right: 0;
    overflow: visible;
    padding-right: 0;
    scrollbar-gutter: auto;
  }

  .team-config-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: #11151b;
  }

  .started-panel {
    min-height: 0;
    overflow: visible;
  }

  .shared-assignments-list {
    grid-template-columns: 1fr;
  }

  .started-panel,
  .ended-panel {
    margin-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
