:root {
  color-scheme: light;
  --page: #ffffff;
  --paper: #ffffff;
  --paper-soft: #fbfbfa;
  --ink: #2f2f2f;
  --muted: #787774;
  --line: #e3e2df;
  --line-strong: #d6d5d2;
  --accent: #2383e2;
  --accent-soft: #e7f3ff;
  --danger: #d44c47;
  --hunter: #0f7b8f;
  --hunted: #b66a00;
  --shadow: 0 10px 30px rgba(15, 15, 15, 0.1);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(560px, calc(100vw - 32px));
  margin: 7vh auto 0;
  padding: 28px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.brand-row,
.join-row,
.input-suffix,
.stepper,
.game-bar,
.game-bar-main,
.game-bar-actions {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 14px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #2f2f2f;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.2rem;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.entry-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-soft);
  color: var(--ink);
  outline: none;
  padding: 10px 12px;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input-suffix,
.stepper {
  gap: 8px;
}

.input-suffix input,
.stepper input {
  max-width: 92px;
}

.input-suffix span,
.stepper span {
  color: var(--muted);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f1ef;
}

.host-role-options {
  grid-template-columns: 1fr 1fr 1fr;
}

.segmented label {
  display: block;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 40px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.segmented input:checked + span {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 15, 15, 0.12);
}

.form-grid {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.join-row {
  gap: 8px;
}

.join-row input {
  text-transform: uppercase;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 13px;
  font-weight: 650;
}

button:hover {
  background: #f1f1ef;
}

.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.primary:hover {
  background: #1f1f1f;
}

.hidden {
  display: none !important;
}

.game-layout {
  min-height: 100vh;
}

.map-zone {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #dfe8dc;
}

#map {
  width: 100%;
  min-height: 100vh;
}

.game-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 600;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
}

.game-bar-main,
.game-bar-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.code-button {
  min-width: 116px;
  background: #f1f1ef;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.meta-pill,
.timer-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-soft);
  padding: 0 12px;
  font-weight: 650;
}

.timer-pill {
  gap: 10px;
}

.timer-pill span {
  color: var(--muted);
  font-size: 0.82rem;
}

.timer-pill strong {
  font-variant-numeric: tabular-nums;
}

.location-button {
  white-space: nowrap;
}

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

.host-tools {
  position: relative;
}

.host-tools summary {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  padding: 0 13px;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}

.host-tools summary::-webkit-details-marker {
  display: none;
}

.host-tools[open] {
  display: grid;
  gap: 10px;
  min-width: 290px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 8px;
}

.host-tools[open] summary {
  background: #f1f1ef;
}

.stepper button {
  min-width: 48px;
}

.map-overlay {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 500;
  display: grid;
  gap: 4px;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 14px;
}

.map-overlay span {
  color: var(--muted);
  font-size: 0.86rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 1000;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-weight: 650;
}

.leaflet-container {
  background: #dfe8dc;
  font: inherit;
}

@media (max-width: 760px) {
  .auth-panel {
    margin-top: 24px;
    padding: 20px;
  }

  .game-bar {
    align-items: stretch;
    flex-direction: column;
    left: 10px;
    right: 10px;
    top: 10px;
  }

  .game-bar-main,
  .game-bar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .timer-pill {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .location-button,
  .host-tools,
  .icon-button {
    width: 100%;
  }

  .host-tools[open] {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .join-row {
    align-items: stretch;
    flex-direction: column;
  }
}
