:root {
  --bg-1: #1d1340;
  --bg-2: #4b2eaa;
  --panel: rgba(10, 8, 32, 0.78);
  --panel-solid: #140b36;
  --accent: #fcbf49;
  --accent-2: #f77f00;
  --good: #06d6a0;
  --danger: #ef476f;
  --dim: #a9a3cc;
  --fg: #f8fafc;
  --border: rgba(255,255,255,0.14);
}

* { box-sizing: border-box; }
/* `hidden` must always win — many overlays set display:flex/grid at class
   specificity, which otherwise overrides the UA rule `[hidden] { display: none }`. */
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  color: var(--fg);
  min-height: 100vh;
  overscroll-behavior: none;
}
a { color: var(--accent); }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #2a1d5c;
  color: var(--fg);
  padding: 10px 14px;
  transition: filter 0.1s, transform 0.05s;
}
button:hover:not(:disabled) { filter: brightness(1.15); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); color: #211a04; font-weight: 700; }
button.good    { background: var(--good); color: #052719; font-weight: 700; }
button.danger  { background: var(--danger); color: #fff; font-weight: 700; }
button.ghost   { background: transparent; border: 1px solid var(--border); }
button.big     { font-size: 1.3rem; padding: 14px 22px; }

input[type=text], input[type=number], textarea, select {
  font: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  color: var(--fg);
  min-width: 0;
  max-width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); }

h1 { font-size: 2.4rem; margin: 0 0 0.3rem; }
h2 { margin: 0 0 0.3rem; }
h3 { margin: 0 0 0.3rem; color: var(--dim); font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; }
code { background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 4px; }

.landing main { max-width: 900px; margin: 0 auto; padding: 48px 24px; text-align: center; }
@media (max-width: 600px) {
  .landing main { padding: 24px 12px; }
  .room-picker { padding: 14px; }
  h1 { font-size: 1.8rem; }
}
.subtitle { color: var(--dim); margin-bottom: 36px; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 24px 0; }
.role-card {
  display: block; padding: 24px 18px; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  transition: transform 0.15s, filter 0.15s;
}
.role-card:hover { transform: translateY(-2px); filter: brightness(1.1); }
.role-icon {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #211a04;
  font-size: 1.6rem; font-weight: 700;
  border-radius: 10px;
  margin: 0 auto 12px;
}

footer { margin-top: 24px; color: var(--dim); }

/* ---- room picker ---- */
.room-picker {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; margin: 24px 0 36px; text-align: left;
}
.room-active { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.room-active .label { color: var(--dim); font-size: 0.9rem; }
.room-active code {
  font-size: 1.25rem; font-weight: 700; padding: 3px 10px;
  background: rgba(255,255,255,0.08); letter-spacing: 0.05em;
}
.room-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.room-form label { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--dim); }
.room-form input { width: 100%; padding: 8px 10px; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; }
.room-form > button { flex-shrink: 0; }
@media (max-width: 480px) { .room-form { flex-direction: column; align-items: stretch; } .room-form > button { width: 100%; } }
.room-list-header { display: flex; justify-content: space-between; align-items: center; color: var(--dim); font-size: 0.85rem; margin-bottom: 6px; }
.room-list {
  list-style: none; padding: 4px; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 180px; overflow-y: auto;
  background: rgba(0,0,0,0.25); border: 1px solid var(--border); border-radius: 8px;
}
.room-list li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; }
.room-list li.empty { justify-content: center; color: var(--dim); font-style: italic; }
.room-list li.active { outline: 2px solid var(--accent); }
.room-list .room-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.room-list .room-info .code { font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.05em; }
.room-list .room-info .meta { color: var(--dim); font-size: 0.8rem; }
button.small { padding: 4px 10px; font-size: 0.8rem; flex-shrink: 0; }
button.ghost.small { background: transparent; color: var(--dim); border: 1px solid var(--border); }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; min-width: 0; }
.topbar .room  { color: var(--dim); min-width: 0; word-break: break-word; }
.topbar .room code { color: var(--fg); background: rgba(255,255,255,0.15); padding: 3px 8px; border-radius: 6px; margin-left: 6px; font-weight: 700; letter-spacing: 1px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.hint   { color: var(--dim); font-size: 0.9rem; }
.error  { color: var(--danger); }
.good-text { color: var(--good); }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin: 12px 0;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.row > label { display: inline-flex; align-items: center; gap: 6px; }

/* Team-tinted body background. The current side's team color washes the
   screen on both the drawer's phone (my team) and the board (active team). */
body.team-tinted {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--team-color, var(--bg-2)) 30%, var(--bg-1)) 0%,
    color-mix(in srgb, var(--team-color, var(--bg-2)) 18%, var(--bg-2)) 100%);
}
