* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  background: #2b3a1f;
  color: #1c2317;
}

#board {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: grab;
}
#board:active { cursor: grabbing; }

.hidden { display: none !important; }

/* overlays (setup + scoreboard) */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 30, 12, 0.78);
  z-index: 20;
}
.panel {
  background: #f4efe2;
  border-radius: 14px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  min-width: 320px;
}
.panel h1 { margin-bottom: 12px; color: #7a3b1f; }
.panel p { margin-bottom: 16px; color: #4a4234; }
.panel .hint { font-size: 12px; color: #8a8270; margin-top: 18px; }
.btnrow { display: flex; gap: 10px; justify-content: center; }
.btnrow button, #playAgain {
  font-size: 20px;
  padding: 12px 22px;
  border: none;
  border-radius: 8px;
  background: #7a3b1f;
  color: #fff;
  cursor: pointer;
}
.btnrow button:hover, #playAgain:hover { background: #964b28; }
#playAgain { margin-top: 18px; font-size: 16px; }

/* online lobby */
.vsbot, .online {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid #d8d0bd;
}
.vsbot > p, .online > p { margin-bottom: 10px; font-size: 14px; color: #6a624f; }
.hostrow { display: flex; gap: 8px; align-items: center; justify-content: center; }
.hostrow label { font-size: 14px; color: #6a624f; }
.hostrow select {
  font-size: 16px;
  padding: 8px 8px;
  border: 2px solid #c5bca5;
  border-radius: 8px;
  background: #fff;
  color: #3a3424;
  cursor: pointer;
}
#hostBtn {
  font-size: 16px;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  background: #7a3b1f;
  color: #fff;
  cursor: pointer;
}
#hostBtn:hover { background: #964b28; }
.joinrow { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.joinrow input {
  width: 96px;
  font-size: 18px;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
  padding: 8px 10px;
  border: 2px solid #c5bca5;
  border-radius: 8px;
  background: #fff;
  color: #3a3424;
}
.joinrow button {
  font-size: 16px;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  background: #7a3b1f;
  color: #fff;
  cursor: pointer;
}
.joinrow button:hover { background: #964b28; }
.netstatus { min-height: 18px; margin-top: 12px; font-size: 13px; color: #3a4a24; font-weight: 600; }
.netstatus.error { color: #b23; }
.you { font-size: 11px; font-weight: 700; color: #7a3b1f; }

#finalScores { list-style: none; text-align: left; margin: 12px 0; }
#finalScores li { padding: 6px 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }

/* in-game sidebar */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#sidebar {
  pointer-events: auto;
  position: absolute;
  top: 14px; left: 14px;
  width: 250px;
  background: rgba(244, 239, 226, 0.96);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.4);
}
#sidebar h2 { color: #7a3b1f; margin-bottom: 6px; }
#sidebar h3 { margin: 12px 0 4px; font-size: 13px; color: #6a624f; text-transform: uppercase; letter-spacing: 0.05em; }
.status { font-size: 13px; font-weight: 600; color: #3a4a24; margin-bottom: 10px; min-height: 18px; }

.tilebox { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
#preview { border: 2px solid #7a5a26; border-radius: 6px; background: #7bbf5a; width: 90px; height: 90px; }
.tilecontrols { display: flex; flex-direction: column; gap: 6px; }
.tilecontrols button {
  font-size: 13px;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: #7a3b1f;
  color: #fff;
  cursor: pointer;
}
.tilecontrols button:disabled { background: #b6ab95; cursor: default; }
.tilecontrols button:not(:disabled):hover { background: #964b28; }
.tilesleft { font-size: 12px; color: #5a5240; }

.player {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  grid-template-areas: "swatch name score" "swatch meeples builder";
  align-items: center;
  gap: 2px 8px;
  padding: 5px 6px;
  border-radius: 6px;
  margin-bottom: 3px;
}
.player.active { background: rgba(122, 59, 31, 0.16); outline: 2px solid #7a3b1f; }
.swatch { grid-area: swatch; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,0.3); display: inline-block; }
.pname { grid-area: name; font-weight: 600; }
.pscore { grid-area: score; font-weight: 700; font-size: 16px; }
.pmeeples { grid-area: meeples; font-size: 11px; line-height: 1; letter-spacing: -2px; color: #4a4234; }
.pbuilder { grid-area: builder; justify-self: end; align-self: center; font-size: 12px; }

.log { font-size: 11px; color: #5a5240; max-height: 130px; overflow: hidden; }
.log div { padding: 1px 0; border-bottom: 1px solid rgba(0,0,0,0.06); }
