/* Phone remote chrome, shared by every game. Controls a game does not
 * declare are removed from the DOM, so the grid simply closes up. */
:root {
  --bg: #0b0d12;
  --bg-lift: #151923;
  --fg: #f2f4f8;
  --dim: #7b8496;
  --accent: #ffcc33;
  --good: #4ade80;
  --bad: #ff4d4d;
  --line: #232936;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; margin: 0; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: Archivo, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- pairing ---------- */

#pair {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}
#pair[hidden] { display: none; }
#pair h1 {
  font-size: 19px;
  color: var(--dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  margin: 0 0 24px;
}
#code-input {
  font-family: inherit;
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-align: center;
  width: 100%;
  max-width: 300px;
  padding: 16px 8px;
  color: var(--accent);
  background: var(--bg-lift);
  border: 2px solid var(--line);
  border-radius: 14px;
  outline: none;
}
#code-input:focus { border-color: var(--accent); }
#pair-go {
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  margin-top: 20px;
  width: 100%;
  max-width: 300px;
  min-height: 56px;
  border-radius: 14px;
  border: none;
  background: var(--fg);
  color: var(--bg);
}
#pair-note { margin-top: 18px; font-size: 13px; color: var(--dim); line-height: 1.5; }

/* ---------- header ---------- */

#head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

#pos { font-size: 19px; font-weight: 800; color: var(--dim); font-variant-numeric: tabular-nums; }
#pos b { color: var(--fg); }

#clock {
  font-size: 30px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  min-width: 2.4ch;
  text-align: right;
}
#clock[data-warn="1"] { color: var(--bad); }

#room-tag { font-size: 11px; letter-spacing: 0.14em; color: #39415a; text-transform: uppercase; }

/* ---------- answer preview ---------- */

#preview {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 16px;
  text-align: center;
}

#preview-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

#preview-answer {
  font-size: 30px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1.15;
}

#preview-state {
  font-size: 12px;
  color: #39415a;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

#pad {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-lift);
  border-top: 1px solid var(--line);
}

#pad button {
  font-family: inherit;
  font-weight: 800;
  font-size: 16px;
  color: var(--fg);
  background: #1b2130;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 60px;
  padding: 0 4px;
  line-height: 1;
}

#pad button:active { background: #252c3d; transform: translateY(1px); }

#b-prev  { grid-column: span 1; }
#b-timer { grid-column: span 2; background: var(--fg); color: var(--bg); border-color: var(--fg); }
#b-next  { grid-column: span 1; }
#b-reset { grid-column: span 1; }
#b-shuffle  { grid-column: span 1; }

#b-reveal {
  grid-column: span 4;
  border-color: var(--accent);
  color: var(--accent);
  font-size: 17px;
}
#b-reveal[data-on="1"] { background: var(--accent); color: var(--bg); }

#b-auto { grid-column: span 2; font-size: 13px; letter-spacing: 0.08em; }
#b-auto[aria-pressed="true"] { background: var(--good); color: var(--bg); border-color: var(--good); }

.slider, #hold-wrap, #dur-wrap {
  grid-column: span 3;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1b2130;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  min-height: 60px;
}
.slider input {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  outline: none;
}
.slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}
.slider input::-moz-range-thumb {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}
.slider span { font-size: 13px; font-weight: 800; color: var(--accent); min-width: 3ch; text-align: right; }
