:root {
  --bg: #12161d;
  --card: #1c222c;
  --line: #2e3745;
  --text: #f1f4f8;
  --muted: #9aa6b6;
  --accent: #ffb52e;
  --accent-ink: #2a1c00;
  --danger: #ff5d5d;
  --ok: #4bd08b;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", system-ui, sans-serif;
  overscroll-behavior: none;
}

.hidden { display: none !important; }

.screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

#mascot { width: 96px; height: 120px; margin: 0 auto; }
h1 { margin: 0; font-size: 2rem; }
h2 { margin: 0; font-size: 1.3rem; }
.tag { margin: 0; color: var(--muted); font-size: 0.95rem; }

.field {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #11151b;
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  text-align: center;
}
.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field.code { letter-spacing: 0.3em; text-transform: uppercase; font-weight: 700; }

.btn {
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #262e3b;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { min-height: 42px; padding: 6px 12px; font-size: 0.9rem; }
.btn.grow { flex: 1; }

.joinRow { display: flex; gap: 8px; }
.joinRow > * { flex: 1; min-width: 0; }

.sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.85rem; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.err { min-height: 1.2em; margin: 0; color: var(--danger); font-size: 0.9rem; }
.notice { margin: 0; padding: 10px; border-radius: 10px; background: #3a2a12; color: #ffd591; font-size: 0.9rem; }

.how { text-align: start; color: var(--muted); font-size: 0.92rem; }
.how summary { cursor: pointer; padding: 8px 0; color: var(--text); }
.how ol { margin: 0; padding-inline-start: 20px; line-height: 1.8; }

.bigCode {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  padding: 10px;
  border-radius: 14px;
  background: #11151b;
  border: 1px dashed var(--line);
  color: var(--accent);
}

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.players li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #11151b;
  border: 1px solid var(--line);
}
.players li.empty { color: var(--muted); border-style: dashed; justify-content: center; }
.players .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.players .dot.off { background: var(--danger); }
.players .who { flex: 1; text-align: start; font-weight: 600; }
.players .badge { font-size: 0.78rem; color: var(--muted); }

.settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.settings label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.settings select {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #11151b;
  color: var(--text);
  font: inherit;
  text-align: center;
}

.toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(15, 18, 24, 0.94);
  border: 1px solid var(--line);
  font-weight: 600;
  z-index: 50;
  pointer-events: none;
  text-align: center;
}
.toast.bad { border-color: var(--danger); color: #ffb3b3; }
.toast.good { border-color: var(--ok); color: #b6f3d3; }
