/* SLAY page rules. The colours, fonts, top bar, panels, chips, buttons and
   inputs come from theme.css, which is the Debug Derby theme copied unchanged
   (DebugDerby src/shared/theme.css). Keep theme.css identical to its source;
   anything SLAY-specific belongs in this file. */

html, body { height: 100%; }

/* The theme styles inputs by type; these pages use bare <input> for text. */
input:not([type]) {
  font: inherit; padding: 7px 8px; background: #0e1430; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
}

.hidden { display: none !important; }
.error { color: var(--pink); }
.chip:empty { display: none; }
.hud { display: flex; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }

button.danger { background: #c92a2a; color: #fff; }

/* ── Student game page ─────────────────────────────── */
#game-root {
  display: flex; flex-direction: column;
  align-items: center;
  padding: 12px;
  gap: 12px;
}

.stage {
  position: relative;
  width: 960px; max-width: 100%;
}
#arena {
  display: block; width: 100%; height: auto;
  background: #0e1430;
  border: 2px solid var(--line); border-radius: var(--radius);
}

.overlay {
  position: absolute; inset: 0;
  background: rgba(11,16,36,.88);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
  text-align: center; padding: 24px;
  font-size: 28px; font-weight: 700; letter-spacing: 1px;
  border-radius: var(--radius);
}
.overlay .sub { font-size: 18px; font-weight: 400; opacity: .9; max-width: 600px; }

.modal {
  position: absolute; inset: 50% auto auto 50%;
  transform: translate(-50%,-50%);
  background: var(--panel); border: 1px solid var(--line);
  padding: 22px; border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  min-width: 320px; max-width: 90%;
}
.modal h2 { margin: 0 0 8px; font-size: 20px; color: #fff; }
.modal h3 { margin: 12px 0 4px; font-size: 15px; color: var(--yellow); }
.modal label { display: block; margin: 12px 0; }
/* The theme makes labels 13px and inputs inherit it. The name box is the first
   thing a student types into: keep it 16px (also stops phones zooming in). */
.modal input { font-size: 16px; }
.modal > button + button { margin-left: 8px; }

/* Plasma rifle fire button — touch devices only (keyboards use Space). */
.plasma-btn {
  display: none;
  position: absolute; right: 14px; bottom: 14px;
  width: 72px; height: 72px; border-radius: 50%;
  font-size: 32px; line-height: 1; padding: 0;
  background: rgba(11,16,36,.7); border: 2px solid var(--yellow);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.plasma-btn.cooling { opacity: .35; border-color: var(--line); }
@media (pointer: coarse) {
  .plasma-btn { display: block; }
}

.footer-row {
  display: flex; align-items: center; gap: 8px;
  width: 960px; max-width: 100%;
}
.message-bar {
  flex: 1;
  min-height: 24px;
  background: var(--panel-2);
  color: var(--yellow);
  padding: 6px 12px; border-radius: 8px;
  margin: 0;
}
.message-bar:empty { visibility: hidden; }
.build-version {
  color: var(--muted);
  font: 12px ui-monospace, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  padding: 6px 8px;
  user-select: all;
}

#leaderboard ol { padding-left: 20px; max-height: 220px; overflow-y: auto; }
#leaderboard li { padding: 2px 0; }

/* Poll overlay on the game canvas */
.poll-overlay {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 2px solid var(--yellow);
  border-radius: var(--radius); padding: 14px 18px; min-width: 320px; max-width: 600px;
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
  z-index: 10;
}
.poll-overlay h3 { margin: 0 0 10px; font-size: 16px; }
.poll-overlay .poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-overlay button {
  padding: 8px 12px; border: 1px solid var(--line);
  background: #0e1430; font-weight: 600; text-align: left;
}
.poll-overlay button:hover:not(:disabled) { border-color: var(--yellow); }
.poll-overlay .poll-picked { margin: 0; font-weight: 700; }
.poll-overlay .poll-closing { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

.ship-grid {
  display: grid;
  grid-template-columns: repeat(4, 56px);
  grid-template-rows: repeat(2, 56px);
  gap: 8px;
  margin: 12px 0;
  justify-content: center;
}
.ship-grid button {
  width: 56px; height: 56px;
  font-size: 32px;
  line-height: 1;
  padding: 0;
  border: 2px solid var(--line);
  background: #0e1430;
}
.ship-grid button.selected {
  border-color: var(--yellow);
  background: var(--panel-2);
}
.ship-grid button:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

/* ── Teacher page ──────────────────────────────────── */
#teacher-root {
  max-width: 860px; margin: 0 auto;
  padding: 14px 16px 40px;
}
#control-panel { display: flex; flex-direction: column; gap: 12px; }
.big-button {
  display: block; width: 100%;
  padding: 28px;
  font-size: 22px; font-weight: 800; letter-spacing: 1px;
  border-radius: var(--radius);
  background: #c92a2a; color: #fff;
}
.big-button.resumed { background: #2b8a3e; }
.row { align-items: end; margin: 10px 0; }
.row .grow { flex: 1; display: flex; flex-direction: column; gap: 3px; }
/* Inputs inside a label would inherit the label's 13px; match the others. */
.row label input, .row label select { font-size: 15px; }
.poll-opt { flex: 1; min-width: 140px; }
#poll-active-question { font-weight: 700; margin: 0 0 8px; }
#end-poll-btn { margin-top: 8px; }
#tuning-status { margin-left: 8px; color: var(--green); }
#live-top { margin: 0; padding-left: 20px; }
.muted { color: var(--muted); }

.roster { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; padding-right: 8px; }
.roster-row { display: flex; align-items: center; gap: 8px; background: #0e1430; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); }
.roster-name { min-width: 110px; font-weight: 600; }
.roster-msg { flex: 1; min-width: 0; }
.roster-row button { padding: 6px 10px; font-size: 13px; }
.pause-personal { background: #c92a2a; color: #fff; }
.pause-personal.paused { background: #2b8a3e; }

.activity-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.activity-dot.green  { background: var(--green); }
.activity-dot.yellow { background: var(--yellow); }
.activity-dot.red    { background: var(--pink); }

.roster-stat { font: 12px ui-monospace, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; opacity: .85; }

.roster-name.editable { cursor: pointer; }
.roster-name.editable:hover { text-decoration: underline; }
.roster-row input.roster-name-input { width: 100px; padding: 4px 6px; }
.roster-row .rename-btn {
  background: transparent; border: 1px solid var(--line);
  padding: 2px 6px; font-size: 12px; line-height: 1;
  opacity: .55; transition: opacity .15s;
  flex: none;
}
.roster-row .rename-btn:hover { opacity: 1; border-color: var(--yellow); }

.poll-tally-bar { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.poll-tally-label { min-width: 100px; }
.poll-tally-fill { background: var(--yellow); height: 16px; border-radius: 6px; }
.poll-tally-count { min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.poll-tally-total { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.contributors-list { margin: 0; padding-left: 0; list-style: none; }
.contributors-list li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.contributors-list .contrib-name { font-weight: 700; color: var(--yellow); }
.contributors-list .contrib-version { font: 11px ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }

#tuning-fields fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
}
#tuning-fields legend {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 0 4px;
}
.tuning-field {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  margin: 4px 6px 4px 0;
}
.tuning-field input { width: 90px; padding: 4px 6px; }
