:root {
  color-scheme: light;
  --bg-top: #d9f6ff;
  --bg-bottom: #87c78c;
  --panel: rgba(255, 252, 239, 0.88);
  --panel-border: rgba(64, 85, 31, 0.24);
  --text: #20311f;
  --accent: #ffe35b;
  --accent-strong: #ffcb2f;
  --shadow: rgba(21, 38, 24, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow: hidden;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.75), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(255, 241, 183, 0.65), transparent 24%),
    linear-gradient(180deg, var(--bg-top) 0%, #b6e7b5 38%, var(--bg-bottom) 100%);
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: absolute;
  inset: auto;
  border-radius: 999px;
  pointer-events: none;
}

.app-shell::before {
  width: 26rem;
  height: 26rem;
  left: -6rem;
  bottom: -10rem;
  background: rgba(255, 255, 255, 0.14);
  filter: blur(10px);
}

.app-shell::after {
  width: 20rem;
  height: 20rem;
  right: -4rem;
  top: 6rem;
  background: rgba(255, 230, 125, 0.18);
  filter: blur(12px);
}

.game-root {
  position: absolute;
  inset: 0;
}

.game-root canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.info-toggle {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 4;
  width: 3.1rem;
  height: 3.1rem;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  line-height: 1;
}

.overlay {
  position: absolute;
  left: 1rem;
  top: 4.9rem;
  z-index: 3;
  width: min(26rem, calc(100vw - 2rem));
  max-height: calc(100vh - 6rem);
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--panel-border);
  border-radius: 1.4rem;
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px var(--shadow);
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.4rem) scale(0.98);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    width 180ms ease,
    padding 180ms ease,
    background 180ms ease;
}

.app-shell.info-open .overlay {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.overlay.is-compact {
  width: min(22rem, calc(100vw - 2rem));
  background: rgba(255, 252, 239, 0.8);
}

.overlay::-webkit-scrollbar {
  width: 0.7rem;
}

.overlay::-webkit-scrollbar-thumb {
  background: rgba(71, 96, 34, 0.28);
  border-radius: 999px;
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(32, 49, 31, 0.68);
}

.overlay h1 {
  margin: 0.2rem 0 0.25rem;
  font-size: clamp(2.6rem, 6vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0.05em;
}

.lead {
  margin: 0 0 0.9rem;
  max-width: 34ch;
  font-size: 0.98rem;
  line-height: 1.45;
}

.status-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.status-grid div {
  padding: 0.7rem 0.8rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.48);
}

.status-grid dt {
  margin: 0 0 0.2rem;
  font-size: 0.73rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(32, 49, 31, 0.62);
}

.status-grid dd {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
}

.status-wide {
  grid-column: 1 / -1;
}

.roster-block {
  margin-top: 0.9rem;
  padding: 0.75rem 0.8rem 0.55rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.48);
}

.roster-heading {
  margin-bottom: 0.45rem;
  font-size: 0.73rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(32, 49, 31, 0.62);
}

.player-roster {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.player-roster li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.48rem 0.55rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.52);
  font-size: 0.92rem;
  line-height: 1.3;
}

.player-roster li.is-empty {
  justify-content: flex-start;
  color: rgba(32, 49, 31, 0.72);
}

.player-roster li.is-it {
  background: rgba(255, 235, 103, 0.45);
}

.roster-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.roster-swatch {
  width: 0.9rem;
  height: 0.9rem;
  flex: none;
  border-radius: 999px;
  border: 2px solid rgba(22, 31, 17, 0.2);
}

.roster-label {
  display: block;
  font-weight: 700;
}

.roster-controller {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(32, 49, 31, 0.74);
}

.roster-state {
  flex: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(32, 49, 31, 0.68);
}

.overlay-actions {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.15rem;
  font: inherit;
  font-weight: 700;
  color: #2a2f0f;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow:
    inset 0 -2px 0 rgba(73, 53, 0, 0.18),
    0 10px 18px rgba(126, 112, 19, 0.2);
  cursor: pointer;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

@media (max-width: 720px) {
  .info-toggle {
    left: 0.75rem;
    top: 0.75rem;
  }

  .overlay {
    left: 0.75rem;
    top: 4.5rem;
    width: calc(100vw - 1.5rem);
    max-height: calc(100vh - 5.25rem);
    padding: 0.9rem;
  }

  .status-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .lead {
    max-width: none;
  }
}
