:root {
  --bg: #0b0c10;
  --fg: #e8e6e3;
  --accent: #c9a227;
  --muted: #9aa0a6;
  --panel: #151821;
  --ok: #6bcb77;
  --warn: #e6b422;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.45;
  padding: 1rem 1.25rem 3rem;
  max-width: 40rem;
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: #fff; color: #000; padding: 0.5rem; }
h1 { color: var(--accent); margin: 0 0 0.25rem; font-size: 1.75rem; }
h2, h3 { margin: 0.75rem 0 0.4rem; }
#status { color: var(--muted); min-height: 1.4em; }
.banner {
  background: #2a2110;
  border: 1px solid var(--accent);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  border-radius: 8px;
}
.banner.warn { border-color: var(--warn); background: #2a2410; }
.hint, .muted { color: var(--muted); font-size: 0.95rem; }
.you-line, .room-line { font-size: 1.1rem; margin: 0.35rem 0; }
.room-line { color: var(--accent); font-weight: 600; }
#island-list { list-style: none; padding: 0; margin: 0.5rem 0; }
#island-list li { margin: 0.65rem 0; }
#island-list button {
  width: 100%;
  text-align: left;
  padding: 1.1rem 1.15rem;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid #333;
  border-radius: 12px;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
}
#island-list button:hover, #island-list button:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
}
.roster-panel {
  background: var(--panel);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 0.85rem 0;
  border: 1px solid #333;
}
#roster-list { list-style: none; padding: 0; margin: 0.4rem 0 0; }
#roster-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid #2a2e38;
  font-size: 1.05rem;
}
#roster-list li:last-child { border-bottom: none; }
#roster-list .you { color: var(--ok); font-weight: 700; }
#roster-list .host::after { content: " · host"; color: var(--accent); font-weight: 500; }
label { display: block; margin: 0.55rem 0; }
input[type="text"] {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #444;
  background: #0f1117;
  color: var(--fg);
  font-size: 1rem;
}
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.65rem 0; }
.primary-row { margin-top: 1rem; }
button {
  background: #3d4f6f;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}
button.primary {
  background: var(--accent);
  color: #111;
  font-size: 1.15rem;
  padding: 0.85rem 1.25rem;
  flex: 1 1 auto;
  min-width: 10rem;
}
button:focus { outline: 3px solid #fff; outline-offset: 2px; }
.social button { background: #2d3a52; }
.log, .score, .invite, .voice-line {
  background: var(--panel);
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  white-space: pre-wrap;
  margin: 0.5rem 0;
}
.invite { border: 1px dashed var(--accent); }
.score, .voice-line { color: var(--ok); font-weight: 600; }
footer { margin-top: 2rem; color: var(--muted); font-size: 0.85rem; padding-bottom: 5rem; }

#version-line { color: var(--muted); font-size: 0.9rem; margin: 0.15rem 0; }
.mode-line { color: var(--ok); font-weight: 650; margin: 0.35rem 0; }
.phone-banner {
  margin: 0.4rem 0 0;
  padding: 0.55rem 0.7rem;
  background: #1e2a18;
  border: 1px solid var(--ok);
  border-radius: 10px;
  color: var(--fg);
  font-size: 0.92rem;
  line-height: 1.35;
}
.big-btn {
  width: 100%;
  min-height: 3.2rem;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
}
.enter-game-pulse {
  animation: enterPulse 1.6s ease-in-out infinite;
}
@keyframes enterPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(107, 203, 119, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(107, 203, 119, 0.12); }
}
.phone-enter-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 0.65rem 0.85rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, transparent, #0b0c10 35%);
  pointer-events: none;
}
.phone-enter-bar button {
  pointer-events: auto;
  width: 100%;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
#game-panel {
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}
#game-panel[hidden] { display: none !important; }
.game-live {
  background: var(--panel);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
}
#touch-layer {
  position: relative;
  flex: 1 1 auto;
  min-height: 60vh;
  height: 60vh;
  margin-top: 0.5rem;
  border: 1px dashed #444;
  border-radius: 12px;
  touch-action: none;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}
.s-hint {
  font-size: 1.05rem;
  font-weight: 600;
}
.phone-enter-bar { display: none !important; } /* shell 8: S-in-air replaces fixed bar */
#top-zone, #bottom-zone {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.75rem;
}
#top-zone {
  top: 0;
  height: 50%;
  border-bottom: 1px dashed #3a4;
  background: rgba(30, 40, 55, 0.35);
}
#bottom-zone {
  bottom: 0;
  height: 50%;
  background: rgba(30, 50, 35, 0.35);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
#roster-count { font-weight: 600; color: var(--fg); }

/* Remote WebRTC audio host — never display, never nest under [hidden] panels */
#remote-audio {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}
