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

:root {
  --bg: #eef2f6;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #6b7885;
  --accent: #0e7c86;
  --accent-dark: #0a5960;
  --cyan-row: #d8f5f9;      /* set-start rows */
  --winner-bg: #1e9e4a;     /* winner cell: green bg, white text */
  --full-fg: #1d4ed8;       /* full cell: blue text, white bg */
  --line: #dbe3ea;
  --danger: #c62828;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: linear-gradient(135deg, #0e7c86, #0a4f66);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { font-size: 20px; font-weight: 600; letter-spacing: .5px; }
.topbar-info { font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar-info .who { background: rgba(255,255,255,.16); padding: 3px 10px; border-radius: 20px; }
.topbar-info .admin-badge { background: #ffb300; color: #4a3200; padding: 2px 8px; border-radius: 20px; font-weight: 600; font-size: 12px; }
.topbar-info button {
  background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff;
  border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 12px;
}
.topbar-info button:hover { background: rgba(255,255,255,.15); }

#app { max-width: 980px; margin: 24px auto; padding: 0 14px; }

.card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(15,40,60,.08);
  padding: 26px;
}
.screen.card { max-width: 520px; margin: 40px auto; }
.screen h1 { font-size: 24px; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

.field { margin: 14px 0; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 11px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: #fbfdfe;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); border-color: transparent; }

.btn-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn {
  padding: 11px 18px; font-size: 15px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #f4f7fa; color: var(--ink); font-weight: 600;
}
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.ghost { background: transparent; }
.btn.winner-btn { background: var(--winner-bg); border-color: var(--winner-bg); color: #fff; }
.btn.full-btn { background: #fff; border: 2px solid var(--full-fg); color: var(--full-fg); }
.btn.hunt-btn { background: linear-gradient(135deg, #f7b733, #fc4a1a); border-color: #fc4a1a; color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.error { color: var(--danger); font-size: 14px; margin-top: 10px; }
.hidden { display: none !important; }

/* new game player rows */
.player-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.player-row input[type=text] {
  flex: 1; padding: 10px 12px; font-size: 15px; border: 1px solid var(--line); border-radius: 8px;
}
.player-row .admin-pick { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer; }

/* pick-your-name grid */
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.pick-grid button {
  padding: 20px 10px; font-size: 17px; font-weight: 600; border-radius: 10px;
  border: 1px solid var(--line); background: #f6f9fb; cursor: pointer;
}
.pick-grid button:hover { background: var(--cyan-row); }
.pick-grid .crown { font-size: 13px; color: #a07800; display: block; margin-top: 4px; }

/* ============ game board ============ */
.board-wrap { padding: 0; overflow: auto; max-height: calc(100vh - 170px); }
#board { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 430px; }

#board th, #board td {
  text-align: center; padding: 9px 8px; border-bottom: 1px solid var(--line);
  font-size: 15px; white-space: nowrap;
}

/* first two sticky lines */
#board thead tr:first-child th {
  position: sticky; top: 0; z-index: 20;
  background: #10323e; color: #fff; font-size: 15px; padding: 11px 8px;
}
#board thead tr:first-child th .wins { color: #7fd8e2; font-weight: 700; }
#board thead tr:nth-child(2) th {
  position: sticky; top: 41px; z-index: 20;
  background: #eaf1f5; font-size: 16px; font-weight: 700; padding: 9px 8px;
  border-bottom: 2px solid #b9c8d2;
}
#board thead tr:nth-child(2) th.neg { color: var(--winner-bg); }

td.round-no { font-weight: 700; color: var(--muted); width: 44px; }

/* set-start rows: light cyan */
tr.set-start td { background: var(--cyan-row); }

/* score cells */
td.cell { cursor: default; min-width: 58px; }
td.cell.editable { cursor: pointer; }
td.cell.editable:hover { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
td.cell.empty.editable { color: #9fb0bd; }
td.cell .eff { display: block; font-size: 11px; color: var(--muted); }

/* winner: green background, white foreground */
td.cell.winner { background: var(--winner-bg) !important; color: #fff; font-weight: 700; }
td.cell.winner .eff { color: #d3f5df; }
/* full: blue foreground, white background */
td.cell.full { background: #fff !important; color: var(--full-fg); font-weight: 700; }
/* hunt: festive gold-to-orange */
td.cell.hunt {
  background: linear-gradient(135deg, #f7b733, #fc4a1a) !important;
  color: #fff; font-weight: 700; text-shadow: 0 1px 2px rgba(120,40,0,.35);
}
td.cell.hunt .eff { color: #ffe9c2; }

/* locked rows */
tr.locked td { opacity: .45; }
tr.locked td.cell { cursor: not-allowed; }

/* glock column */
td.glock-col { width: 96px; }
.glock-controls { display: inline-flex; align-items: center; gap: 6px; }
.glock-controls .gbtn {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; font-size: 16px; font-weight: 700; cursor: pointer; line-height: 1;
  color: var(--accent-dark);
}
.glock-controls .gbtn:hover { background: var(--cyan-row); }
.glock-controls .gbtn:disabled { opacity: .35; cursor: not-allowed; }
.glock-val {
  min-width: 34px; padding: 2px 8px; border-radius: 12px; font-weight: 700; font-size: 14px;
  background: #f2f6f8; color: var(--muted);
}
.glock-val.active { background: #7b2d8e; color: #fff; }

.hint { max-width: 980px; margin: 12px auto; text-align: center; }
.tag { padding: 1px 8px; border-radius: 10px; font-weight: 600; font-size: 13px; }
.winner-tag { background: var(--winner-bg); color: #fff; }
.full-tag { background: #fff; color: var(--full-fg); border: 1px solid var(--full-fg); }
.hunt-tag { background: linear-gradient(135deg, #f7b733, #fc4a1a); color: #fff; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,30,40,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal { width: 340px; }
.modal h2 { font-size: 18px; margin-bottom: 10px; }
.modal .btn { flex: 1; padding: 10px 8px; font-size: 14px; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #323c46; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.3); z-index: 200; max-width: 90vw;
}
.toast.err { background: var(--danger); }

@media (max-width: 640px) {
  .card { padding: 18px; }
  #board { min-width: 0; }
  #board th, #board td { font-size: 12px; padding: 6px 2px; }
  #board thead tr:first-child th { font-size: 12px; padding: 8px 2px; }
  #board thead tr:nth-child(2) th { font-size: 13px; padding: 7px 2px; top: 33px; }
  td.round-no { width: 26px; }
  td.cell { min-width: 40px; }
  td.cell .eff { font-size: 10px; }
  td.glock-col { width: 74px; }
  .glock-controls { gap: 3px; }
  .glock-controls .gbtn { width: 22px; height: 22px; font-size: 13px; }
  .glock-val { min-width: 22px; padding: 1px 5px; font-size: 11px; }
  .board-wrap { border-radius: 8px; }
}
