/* Project Geb — Phase 2b web board. Deliberately plain: big readable
   tiles, no framework, no fancy anything. */

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  padding: 12px 16px 24px;
  background: #f4f1e8;
  color: #1c1917;
}

header h1 { margin: 4px 0; font-size: 26px; }

#status-line {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 10px;
}

#banner {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  padding: 14px;
  border-radius: 10px;
  margin-bottom: 12px;
}
#banner.won  { background: #bbf7d0; color: #14532d; border: 3px solid #16a34a; }
#banner.lost { background: #fecaca; color: #7f1d1d; border: 3px solid #dc2626; }

main {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
#board-wrap { flex: 1 1 auto; min-width: 0; }
#side { flex: 0 0 330px; }

/* --- the board ------------------------------------------------------ */

/* The board's column count and pixel width are set from JS (app.js
   fitBoard): the grid scales so the whole map fits the viewport, and
   --cell carries the resulting cell size for glyph scaling. */
#board {
  display: grid;
  gap: 3px;
}

.tile {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell, 40px) * 0.6);
  position: relative;
  user-select: none;
}
.t-plain  { background: #b9e39b; }
.t-tree   { background: #5da24a; }
.t-forest { background: #3f7a37; }
.t-rock   { background: #b8b2a7; }
.t-water  { background: #7dd3fc; }
.tile.exit { background: #fcd34d; }

/* reachability hint (the server still validates every move) */
.tile.reachable {
  box-shadow: inset 0 0 0 3px #ffffff, inset 0 0 14px #ffffff;
  cursor: pointer;
  filter: brightness(1.12);
}
.tile.reachable:hover { filter: brightness(1.25); }

/* the current player's tile: preselected */
.tile.current { box-shadow: inset 0 0 0 4px #111827; }

.token {
  width: 82%;
  height: 82%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell, 40px) * 0.52);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(0, 0, 0, 0.35);
  line-height: 1;
}
.token.giant {
  background: #fee2e2;
  border-color: #ef4444;
  text-shadow: none;
}
.token.down { opacity: 0.5; filter: grayscale(0.8); }

/* --- controls -------------------------------------------------------- */

#controls { margin: 14px 0 6px; display: flex; gap: 10px; flex-wrap: wrap; }
#controls button {
  font-size: 18px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  border: 2px solid #44403c;
  background: #fff;
  cursor: pointer;
}
#controls button:hover:not(:disabled) { background: #fef3c7; }
#controls button:disabled { opacity: 0.45; cursor: default; }

#note { min-height: 22px; font-size: 16px; font-weight: 600; color: #b91c1c; }
.hint-text { color: #57534e; max-width: 980px; }

/* --- side panel ------------------------------------------------------ */

#quest-status {
  font-size: 16px;
  font-weight: 600;
  background: #fff;
  border: 2px solid #44403c;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

.card {
  background: #fff;
  border: 2px solid #44403c;
  border-left-width: 10px;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 16px;
}
.card .card-name { font-size: 18px; font-weight: 700; margin-bottom: 2px; }
.card .badge {
  display: inline-block;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  margin-top: 4px;
}
.badge.safe   { background: #bbf7d0; color: #14532d; }
.badge.across { background: #bfdbfe; color: #1e3a8a; }
.badge.down   { background: #fecaca; color: #7f1d1d; }
.badge.turn   { background: #fde68a; color: #713f12; }

#side h2 { margin: 14px 0 6px; font-size: 18px; }

#log {
  height: 320px;
  overflow-y: auto;
  background: #1c1917;
  color: #e7e5e4;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 900px) {
  main { flex-direction: column; }
  #side { flex: 1 1 auto; width: 100%; }
}

/* --- lobby, join, share bar, selector (Phase 4c) --------------------- */

#share-bar {
  background: #fef3c7;
  border: 2px solid #d97706;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
  word-break: break-all;
}
#share-bar button { margin-left: 8px; font-weight: 600; cursor: pointer; }
#copy-note { color: #14532d; }

#lobby, #join-panel {
  background: #fff;
  border: 2px solid #44403c;
  border-radius: 10px;
  padding: 16px 20px;
  max-width: 640px;
}
#lobby input, #join-panel input {
  font-size: 17px;
  padding: 6px 10px;
  border: 2px solid #44403c;
  border-radius: 6px;
  margin-left: 6px;
}
#lobby button, #join-panel button {
  font-size: 18px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  border: 2px solid #44403c;
  background: #fff;
  cursor: pointer;
  margin: 4px 6px 4px 0;
}
#lobby button:hover:not(:disabled), #join-panel button:hover:not(:disabled) { background: #fef3c7; }
#join-panel button:disabled { opacity: 0.45; cursor: default; }
#lobby-note, #join-note { color: #b91c1c; font-weight: 600; }

#selector h2 { margin: 4px 0 4px; }
#select-status { color: #57534e; margin: 0 0 10px; }
#roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.roster-card {
  text-align: left;
  background: #fff;
  border: 2px solid #44403c;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
}
.roster-card:hover:not(:disabled) { background: #fef3c7; }
.roster-card:disabled { cursor: default; opacity: 0.85; }
.roster-card .roster-name { font-size: 19px; font-weight: 700; }
.roster-card .roster-stats { font-weight: 600; color: #44403c; margin: 2px 0; }
.roster-card .roster-ability { font-size: 14px; color: #57534e; }
.roster-card .roster-claim { font-weight: 700; margin-top: 6px; }
.roster-card.mine { border-color: #16a34a; background: #f0fdf4; }
.roster-card.taken { opacity: 0.55; }

.badge.you { background: #ddd6fe; color: #4c1d95; }

/* Event replay: the dice toast floats over the board's top-right;
   the board wrap anchors it. */
#board-wrap { position: relative; }
#dice-toast {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  background: rgba(28, 25, 23, 0.92);
  color: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: calc(var(--cell, 40px) * 0.42);
  font-weight: 700;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
