/* 登入／大廳（不改動牌桌既有風格，僅疊加閘門層） */
.gate {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(42, 110, 72, 0.45), transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(20, 50, 40, 0.5), transparent 50%),
    linear-gradient(160deg, #0f2a1c 0%, #1a3d2a 45%, #0c1f16 100%);
}

.gate__panel {
  width: min(420px, 100%);
  padding: 32px 28px 28px;
  border: 1px solid rgba(240, 230, 210, 0.18);
  border-radius: 12px;
  background: rgba(12, 28, 20, 0.82);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  color: #f0e6d2;
  text-align: center;
}

.gate__brand {
  margin: 0;
  font-family: 'Noto Serif TC', serif;
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 2.6rem);
  letter-spacing: 0.12em;
}

.gate__tag {
  margin: 8px 0 28px;
  opacity: 0.75;
  font-size: 0.95rem;
}

.gate__section {
  display: grid;
  gap: 14px;
}

/* 依 body[data-gate] 強制三畫面互斥，避免 hidden 被其他 CSS 蓋掉 */
body[data-gate='login'] #gateLogin {
  display: grid !important;
}
body[data-gate='login'] #gateLobby,
body[data-gate='login'] #app {
  display: none !important;
}

body[data-gate='lobby'] #gateLobby {
  display: grid !important;
}
body[data-gate='lobby'] #gateLogin,
body[data-gate='lobby'] #app {
  display: none !important;
}

body[data-gate='play'] #gate {
  display: none !important;
}
/* 必須維持 .app 的 grid，右側 info-panel 才會出現 */
body[data-gate='play'] #app {
  display: grid !important;
}

.gate__section[hidden] {
  display: none !important;
}

.gate__lobby-title {
  margin: 0 0 4px;
  font-family: 'Noto Serif TC', serif;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.gate__hint {
  margin: 0;
  opacity: 0.85;
  font-size: 0.92rem;
}

.gate__label {
  display: grid;
  gap: 6px;
  text-align: left;
  font-size: 0.9rem;
}

.gate__label input {
  padding: 10px 12px;
  border: 1px solid rgba(240, 230, 210, 0.25);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  font: inherit;
}

.gate__error {
  margin: 12px 0 0;
  color: #ffb4a8;
  font-size: 0.88rem;
}

.gate__error[hidden] {
  display: none !important;
}

.gate__profile {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 10px 4px 6px;
}

.gate__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(240, 230, 210, 0.35);
}

.gate__name {
  font-weight: 600;
  font-size: 1.1rem;
}

.gate__stats {
  margin-top: 4px;
  font-size: 0.85rem;
  opacity: 0.8;
  line-height: 1.45;
}

.gate__modes {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.btn--block {
  width: 100%;
}

.btn--ghost {
  margin-top: 8px;
  background: transparent;
  border-color: transparent;
  opacity: 0.75;
}

.btn--ghost:hover {
  opacity: 1;
}

.gate__google {
  min-height: 44px;
  display: grid;
  place-items: center;
}

body.is-playing .gate {
  display: none;
}

.info-header__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.net-lamp {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 1px solid rgba(240, 230, 210, 0.35);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.net-lamp--idle {
  background: #3b82f6;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.25),
    0 0 8px rgba(59, 130, 246, 0.65);
}

.net-lamp--busy {
  background: #ef4444;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.25),
    0 0 8px rgba(239, 68, 68, 0.75);
}

/* 等待 Server 回覆：全透明遮罩，只擋操作、不灰化畫面 */
.app {
  position: relative;
}

.net-lock {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: block;
  margin: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: wait;
  pointer-events: auto;
}

.net-lock[hidden] {
  display: none !important;
}

.net-lock__hint {
  display: none;
}

body.is-net-locked {
  cursor: wait;
}
