:root {
  --soil: #6b4f2a;
  --leaf: #6aa84f;
  --leaf-dark: #3d6b2f;
  --cream: #fff6e0;
  --ink: #2b1d12;
  --gold: #f4d35e;
  --barn: #8b3a2a;
  --menu-sky: 272px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: Nunito, system-ui, sans-serif;
  background: #3d6b2f;
  color: var(--ink);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  position: relative;
  overflow: auto;
}

.sun {
  position: absolute;
  top: 8%;
  right: 12%;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe27a, #f4a261 70%);
  box-shadow: 0 0 80px #f4a261aa;
}

.field-bg {
  position: absolute;
  inset: 45% 0 0;
  background: repeating-linear-gradient(
    90deg,
    #5c8c3e 0 48px,
    #6aa84f 48px 96px
  );
}

.home-screen {
  display: block;
  height: 100%;
  overflow: auto;
  background: #3d6b2f;
}

.home-screen .sun {
  top: 18px;
  right: 8%;
  width: 120px;
  height: 120px;
}

.home-screen .field-bg {
  inset: var(--menu-sky, 200px) 0 0;
}

.home-shell {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 32px));
  min-height: 100%;
  padding: 0 0 28px;
  display: flex;
  flex-direction: column;
}

.lobby-layout {
  margin: 0 auto;
}

.home-brand {
  height: var(--menu-sky, 200px);
  padding: 20px 0 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  box-sizing: border-box;
  color: var(--cream);
  text-shadow: 0 3px 0 #2b1d1266;
}

.home-brand-text {
  min-width: 0;
}

.home-brand .eyebrow {
  color: #ffe27a;
  margin-bottom: 2px;
}

.home-brand h1 {
  margin: 0 0 6px;
  font-size: clamp(34px, 4.6vw, 48px);
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: #fff8ea;
}

.home-brand .lede {
  margin: 0;
  max-width: 34em;
  color: #efe4c8;
  font-weight: 800;
}

.home-brand .code-row {
  margin: 0 0 6px;
  align-items: flex-end;
}

.home-brand #roomCode {
  margin: 0;
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.2em;
  font-size: clamp(34px, 4.6vw, 48px);
  line-height: 0.95;
  color: #fff8ea;
}

.settings-launch {
  background: var(--cream);
  white-space: nowrap;
  padding: 10px 16px;
  font-size: 15px;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.home-body {
  display: grid;
  grid-template-columns: 240px 1fr 1fr;
  gap: 16px;
  align-items: stretch;
  padding-top: 18px;
}

.customize-body {
  grid-template-columns: 260px minmax(0, 420px);
  justify-content: start;
  align-items: start;
}

#customize .home-shell {
  width: min(840px, calc(100% - 32px));
}

.settings-body,
.waiting-body {
  grid-template-columns: 1fr 1fr;
}

.servers-body {
  grid-template-columns: 1fr;
}

.identity-card,
.play-card {
  margin: 0;
  width: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 18px;
}

.pane-kicker {
  margin: 0 0 6px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 800;
  color: var(--barn);
}

.pane-title {
  margin: 0;
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
}

.pane-hint {
  margin: 8px 0 16px;
  color: #7a5a3a;
  font-weight: 700;
  font-size: 14px;
}

.you-look {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: #5d8f3d;
  text-align: center;
  padding: 18px 12px 14px;
  margin-bottom: 14px;
}

.you-look-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.you-look-text strong {
  font-size: 16px;
  color: #fff8ea;
}

.you-look-text em {
  font-style: normal;
  font-weight: 800;
  font-size: 12px;
  color: #e8f5c8;
}

.mini-preview {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 4px solid var(--ink);
  display: inline-block;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  box-shadow: 0 6px 0 #2b1d12;
}

.you-name {
  margin: 0;
}

.you-name input {
  margin-top: 6px;
}

.host-card {
  overflow: visible;
  z-index: 2;
}

.host-card .dropdown {
  margin-bottom: 12px;
  z-index: 8;
}

.host-card .check-btn {
  margin: 0 0 14px;
}

.play-card .primary {
  margin-top: auto;
}

.waiting-body .hint {
  margin-bottom: 12px;
}

.join-card #code {
  width: 100%;
  margin: 0 0 12px;
  min-height: 64px;
  font-size: 30px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  text-align: center;
  padding: 12px 8px 12px 20px;
}

button.ghost {
  width: 100%;
  margin-top: 10px;
  background: #fff;
  font-size: 14px;
}

@media (max-width: 900px) {
  .home-body,
  .customize-body,
  .settings-body,
  .waiting-body {
    grid-template-columns: 1fr 1fr;
  }
  .identity-card {
    grid-column: 1 / -1;
  }
  .you-look {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    padding: 12px 14px;
  }
  .mini-preview {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 640px) {
  .home-body,
  .customize-body,
  .settings-body,
  .waiting-body,
  .servers-body {
    grid-template-columns: 1fr;
  }
}

.card {
  position: relative;
  width: min(440px, calc(100% - 32px));
  background: var(--cream);
  border-radius: 28px;
  padding: 32px 28px;
  box-shadow: 0 24px 0 #2b1d1233, 0 30px 60px #0004;
  border: 4px solid #2b1d12;
}

.home-body > .card {
  width: auto;
}

.public-card h2 {
  margin: 4px 0 12px;
  font-size: 22px;
}

.public-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: min(52vh, 480px);
  overflow: auto;
}

.public-list li {
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.public-list li.empty {
  cursor: default;
  background: #efe4c8;
}

.public-list .meta {
  display: block;
  font-size: 12px;
  color: #5c4633;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  color: var(--barn);
}

h1 {
  margin: 6px 0 8px;
  font-size: 42px;
  font-weight: 900;
  line-height: 0.95;
}

.lede,
.hint {
  color: #5c4633;
  margin: 0 0 18px;
}

label {
  display: block;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 16px;
}

.check-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: #fff;
  margin: 4px 0 16px;
  box-shadow: 0 4px 0 var(--ink);
}

.check-btn .tick {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  line-height: 0;
}

.check-btn.on .tick {
  background: var(--gold);
}

.check-btn.on .tick::after {
  content: "";
  width: 6px;
  height: 11px;
  margin-top: -1px;
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: rotate(40deg);
}

.field-label {
  font-weight: 800;
  font-size: 13px;
  margin: 0 0 6px;
}

.dropdown {
  position: relative;
  margin-bottom: 14px;
}

.drop-btn {
  width: 100%;
  text-align: left;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drop-btn::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid var(--ink);
}

.drop-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff6e0;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 6px 0 var(--ink);
  z-index: 20;
  overflow: auto;
  max-height: 240px;
}

.drop-menu button {
  width: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  text-align: left;
  border-bottom: 2px dashed #d9c7a2;
}

.drop-menu button:last-child {
  border-bottom: 0;
}

.drop-menu button:hover,
.drop-menu button.active {
  background: var(--gold);
}

.host-settings {
  margin-top: 4px;
}

.guest-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
  box-shadow: 0 4px 0 var(--ink);
}

.stat-row span {
  color: #7a5a3a;
}

.stat-row strong {
  font-size: 18px;
}

.wait-banner {
  margin: auto 0 0;
  text-align: center;
  background: var(--gold);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 900;
  box-shadow: 0 4px 0 var(--ink);
  color: var(--ink);
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(
    ellipse at center,
    rgba(80, 0, 0, 0) 38%,
    rgba(140, 8, 8, 0.42) 78%,
    rgba(90, 0, 0, 0.72) 100%
  );
  animation: hurtPulse 0.7s ease-in-out infinite alternate;
}

@keyframes hurtPulse {
  from {
    opacity: 0.5;
  }
  to {
    opacity: 1;
  }
}

.skin-label {
  font-weight: 800;
  font-size: 13px;
  margin: 0 0 8px;
}

.settings-card {
  width: min(480px, calc(100% - 32px));
}

.vol-block {
  margin-bottom: 22px;
}

.vol-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.vol-head .field-label {
  margin: 0;
}

.slider-pct {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #5c4633;
}

.slider {
  touch-action: none;
  cursor: pointer;
  padding: 10px 0;
  outline: none;
}

.slider-track {
  position: relative;
  height: 16px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
}

.slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40%;
  background: var(--gold);
  border-radius: 999px;
  pointer-events: none;
}

.slider-thumb {
  position: absolute;
  top: 50%;
  left: 40%;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -14px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--ink);
  pointer-events: none;
}

.slider:focus-visible .slider-thumb {
  box-shadow: 0 0 0 3px var(--gold), 0 3px 0 var(--ink);
}

.customize-picks .skin-picker {
  gap: 8px;
  margin-bottom: 14px;
}

.customize-picks .skin-picker:last-child {
  margin-bottom: 0;
}

.preview-wrap {
  background: #5d8f3d;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 8px 8px 4px;
  text-align: center;
  flex: none;
}

.preview-name {
  margin: 0 0 6px;
  font-weight: 900;
  color: #fff8ea;
  font-size: 14px;
}

#preview {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  background: transparent;
}

.customize-picks .pane-title {
  font-size: 22px;
}

.skin-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  padding: 4px 2px;
}

.skin-swatch {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  height: auto;
  border-radius: 50%;
  border: 3px solid var(--ink);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 3px 0 var(--ink);
}

.skin-swatch.selected {
  box-shadow: 0 0 0 3px var(--gold), 0 3px 0 var(--ink);
  outline: none;
}

input {
  width: 100%;
  margin-top: 6px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 800;
  background: #fff;
}

.join-row {
  display: flex;
  gap: 8px;
}

.join-row input {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 20px;
  text-align: center;
}

button {
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 900;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--ink);
}

button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

button.primary {
  width: 100%;
  background: var(--gold);
}

button.danger {
  width: 100%;
  background: #ee6c4d;
  color: #fff;
  margin: 10px 0;
}

button.skin-swatch {
  width: 100%;
  height: auto;
  min-width: 0;
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 0;
  box-shadow: 0 3px 0 var(--ink);
}

button.skin-swatch:active {
  transform: none;
}

.or {
  text-align: center;
  font-weight: 800;
  margin: 14px 0 10px;
  color: #7a5a3a;
}

.error {
  color: #b42318;
  font-weight: 800;
}

.toasts {
  position: fixed;
  right: 24px;
  bottom: 24px;
  left: auto;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100% - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 800;
  box-shadow: 0 6px 0 var(--ink);
  animation: toastIn 0.22s ease-out;
}

.toast.error {
  background: #fde8e4;
  color: #8a1f14;
}

.toast.success {
  background: #d7efb8;
  color: #1e441b;
}

.toast.out {
  animation: toastOut 0.2s ease-in forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

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

.code-row h2 {
  margin: 0;
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.28em;
  font-size: 36px;
}

#playerList {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}

#playerList li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  padding: 8px 0;
  border-bottom: 2px dashed #d9c7a2;
}

.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  box-shadow: inset 0 -6px 0 #0002;
}

#gameWrap {
  position: fixed;
  inset: 0;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #3d6b2f;
  cursor: none;
}

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud-top {
  display: flex;
  gap: 10px;
  padding: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.pill {
  pointer-events: none;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 900;
  box-shadow: 0 4px 0 var(--ink);
}

.board {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 220px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 800;
  font-size: 13px;
}

.board .title {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--barn);
  margin-bottom: 6px;
}

.board .row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
}

.board .me {
  background: #f4d35e66;
  margin: 0 -6px;
  padding: 3px 6px;
  border-radius: 8px;
}

.banner {
  width: min(520px, calc(100% - 32px));
  margin: 8px auto 0;
  text-align: center;
  background: #ee6c4d;
  color: #fff;
  font-weight: 900;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 10px 14px;
  animation: pulse 0.8s ease-in-out infinite alternate;
}

@keyframes pulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.03);
  }
}

.shop,
.pause,
.pause button,
.shop button {
  cursor: pointer;
}

.shop {
  cursor: auto;
  pointer-events: auto;
  position: absolute;
  left: 16px;
  bottom: 16px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 6px 0 var(--ink);
}

.shop p {
  margin: 0 0 8px;
  font-weight: 900;
}

.shop button {
  display: block;
  width: 220px;
  margin-top: 8px;
  background: #cfe7b4;
}

.shop button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.pause {
  position: absolute;
  inset: 0;
  background: #2b1d1288;
  display: grid;
  place-items: center;
  z-index: 5;
}

.pause-card button {
  width: 100%;
  margin-top: 10px;
}

#rankings {
  padding-left: 22px;
  font-weight: 800;
}

#rankings li {
  margin: 8px 0;
}
