:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #111827;
  --mute: #6b7280;
  --line: #e5e7eb;
  --blue: #1e67ff;
  --blue-soft: #e8f0ff;
  --green: #16a34a;
  --warn-bg: #fff7e8;
  --warn-ink: #a16207;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --nav-h: 64px;
  --top-h: 52px;
  --shell-max: 480px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body {
  min-height: 100%;
  overflow-x: hidden;
}
body {
  background:
    radial-gradient(1200px 480px at 50% -120px, rgba(30, 103, 255, 0.10), transparent 60%),
    radial-gradient(900px 420px at 100% 20%, rgba(59, 130, 246, 0.06), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 400 14px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #f9fafb;
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
}
input:focus, select:focus { border-color: var(--blue); background: #fff; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--top-h);
  padding: calc(10px + var(--safe-top)) max(16px, var(--safe-right)) 10px max(16px, var(--safe-left));
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(229, 231, 235, 0.9);
  backdrop-filter: blur(12px);
}
.header-inner {
  width: min(var(--shell-max), 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.top-nav {
  display: none;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}
.top-nav button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--mute);
  font-weight: 650;
  font-size: 14px;
}
.top-nav button:hover { color: var(--ink); background: #f3f4f6; }
.top-nav button.active {
  color: var(--blue);
  background: var(--blue-soft);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #0f172a;
  min-width: 0;
}
.brand-logo {
  display: block;
  height: 36px;
  width: auto;
  max-width: min(160px, 46vw);
  object-fit: contain;
}
.login-brand {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
}
.login-brand img {
  display: block;
  width: clamp(160px, 58vw, 240px);
  height: auto;
  object-fit: contain;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mute);
  font-size: 13px;
  min-width: 0;
}
#headerUserName {
  display: inline-block;
  max-width: min(140px, 36vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 600;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-secondary { background: #eef2f7; color: #334155; }
.btn-ghost {
  background: var(--blue-soft);
  color: var(--blue);
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}
.btn-block { width: 100%; }
.btn-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }

.shell {
  width: min(var(--shell-max), 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 8px 16px calc(var(--nav-h) + var(--safe-bottom) + 24px);
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  max-width: 100%;
  min-width: 0;
}
.card + .card { margin-top: 14px; }
.card h2 { font-size: 20px; margin-bottom: 4px; }
.card .sub { color: var(--mute); margin-bottom: 14px; }
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}
.section-title strong { font-size: 18px; }
.section-title span { color: var(--mute); font-size: 13px; }
.muted { color: var(--mute); }
.invite-box {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 13px;
}
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #eef2f7;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}
.tabs button {
  min-height: 44px;
  color: var(--mute);
  font-weight: 600;
  font-size: clamp(12px, 3.4vw, 14px);
  padding: 0 4px;
}
.tabs button.active { color: var(--blue); background: transparent; }

.field { margin-bottom: 12px; }
.field input { min-height: 44px; }
.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.kv:first-child { border-top: 0; }
.kv span { color: var(--mute); }
.kv strong.online { color: var(--green); }

.mine-name-row { display: flex; align-items: center; gap: 8px; }
.mine-id-row { margin-top: 4px; color: var(--mute); font-size: 13px; }
.mine-id-row button {
  margin-left: 8px;
  color: var(--blue);
  font-size: 13px;
}
.mine-action-row { display: flex; gap: 10px; }
.mine-action-row .btn { flex: 1; min-height: 44px; }
.mine-action-row .btn-primary { flex: 1.6; }
.mine-query-result { margin-top: 10px; white-space: pre-line; font-size: 12px; }
.mine-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  padding: 16px 8px;
}
.mine-stats div + div { border-left: 1px solid var(--line); }
.mine-stats strong { display: block; font-size: 22px; }
.mine-stats span { color: var(--mute); font-size: 12px; }
.mine-menu { padding: 0; }
.mine-menu button {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.mine-menu button:last-child { border-bottom: 0; }
.mine-menu span { color: var(--mute); font-size: 13px; }
.mine-back {
  min-height: 40px;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}
.record-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.record-tabs button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--mute);
  font-size: 13px;
  font-weight: 650;
}
.record-tabs button.active {
  color: var(--blue);
  background: var(--blue-soft);
}
.record-list { display: grid; gap: 10px; }
.record-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.record-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.record-card-head strong { min-width: 0; }
.record-card-head time { color: var(--mute); font-size: 12px; white-space: nowrap; }
.record-card-body {
  margin-top: 8px;
  color: #4b5563;
  font-size: 13px;
  white-space: pre-line;
  word-break: break-all;
}
.record-copy {
  margin-top: 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}
.gift-log-title { margin: 16px 4px 8px; font-size: 15px; font-weight: 700; }
.transfer-amount { font-weight: 700; white-space: nowrap; }
.transfer-amount.out { color: #b45309; }
.transfer-amount.in { color: #047857; }
.mine-gift-amount { display: flex; gap: 8px; margin-bottom: 12px; }
.mine-gift-amount input { flex: 1; min-height: 44px; }
.mine-gift-amount button {
  min-width: 64px;
  border-radius: 10px;
  background: #f3f4f6;
  font-weight: 650;
}
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f59e0b;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 700;
}
.tag {
  display: inline-flex;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.stat {
  background: #f3f7ff;
  border-radius: 12px;
  padding: 14px 6px;
  text-align: center;
  min-width: 0;
}
.stat strong {
  display: block;
  color: var(--blue);
  font-size: clamp(16px, 5vw, 22px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.stat span { color: var(--mute); font-size: 11px; }

.invitee-list {
  display: grid;
  gap: 8px;
}
.invitee-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fafb;
}
.invitee-id {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invitee-meta {
  grid-column: 1 / -1;
  color: var(--mute);
  font-size: 12px;
}
.invitee-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  white-space: normal;
  text-align: right;
  max-width: 46vw;
  line-height: 1.25;
}
.invitee-badge.rewarded {
  background: #e7f8ee;
  color: var(--green);
}
.invitee-badge.pending {
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.invitee-badge.activated {
  background: var(--blue-soft);
  color: var(--blue);
}
.invitee-empty {
  padding: 16px 0;
  text-align: center;
  font-size: 12px;
}

.project-card {
  margin-bottom: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.project-status {
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}
.project-expiry {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.project-expiry strong {
  color: var(--blue);
  font-size: 20px;
  font-weight: 700;
}
#modeSegment button.locked {
  opacity: .35;
  text-decoration: line-through;
}

.lottery-festive {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 18px 14px 16px;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 214, 102, 0.55), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(255, 180, 120, 0.4), transparent 26%),
    linear-gradient(180deg, #e4453c 0%, #d62f2a 48%, #c52020 100%);
  color: #fff;
  box-shadow: 0 14px 28px rgba(180, 40, 30, 0.28);
}
.lottery-festive-decor {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(255,255,255,0.18) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 22%, rgba(255,230,140,0.35) 0 3px, transparent 4px),
    radial-gradient(circle at 40% 8%, rgba(255,255,255,0.16) 0 2px, transparent 3px);
  opacity: 0.9;
}
.lottery-title-wrap {
  position: relative;
  z-index: 1;
  margin: 4px auto 12px;
  width: fit-content;
  max-width: 100%;
  padding: 10px 22px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #4b2d8f, #2f1a66);
  box-shadow:
    inset 0 0 0 3px #7a5cc8,
    0 0 0 4px rgba(255, 214, 102, 0.35),
    0 8px 16px rgba(20, 10, 40, 0.25);
}
.lottery-title-wrap::before,
.lottery-title-wrap::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 6px;
  border-radius: 999px;
  background:
    radial-gradient(circle, #ffe28a 0 2px, transparent 3px) 0 0 / 12px 6px repeat-x;
}
.lottery-title-wrap::before { top: 5px; }
.lottery-title-wrap::after { bottom: 5px; }
.lottery-title {
  margin: 0;
  text-align: center;
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #ffe566;
  text-shadow:
    0 2px 0 #b71c1c,
    0 4px 0 #8e1212,
    0 8px 14px rgba(0, 0, 0, 0.28);
}
.lottery-rules {
  position: relative;
  z-index: 1;
  margin: 0 auto 14px;
  width: min(360px, 100%);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  line-height: 1.55;
  background: rgba(160, 20, 20, 0.18);
}
.lottery-rules b { color: #ffe566; }
.lottery-rules button {
  width: 20px;
  height: 20px;
  margin-left: 6px;
  border-radius: 50%;
  border: 0;
  background: #ffe566;
  color: #b71c1c;
  font-weight: 900;
  vertical-align: middle;
}
.flip7-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  max-width: 420px;
  margin: 0 auto;
  border-radius: 14px;
  background: rgba(120, 12, 12, 0.28);
  border: 1px solid rgba(255, 220, 160, 0.28);
}
.flip7-card {
  aspect-ratio: 0.78;
  perspective: 900px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}
.flip7-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.flip7-card.is-flipped .flip7-inner,
.flip7-card.is-revealed .flip7-inner {
  transform: rotateY(180deg);
}
.flip7-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  box-shadow: 0 8px 16px rgba(80, 10, 10, 0.28);
}
.flip7-back {
  background:
    radial-gradient(circle at 50% 42%, #fff6d5 0 34%, transparent 35%),
    linear-gradient(160deg, #f8e7b0 0%, #e8c56a 48%, #d4a84a 100%);
  border: 2px solid rgba(255, 248, 220, 0.7);
}
.flip7-seal {
  width: 54%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 35% 30%, #fff8e2, #f0d27a 55%, #c8922e);
  border: 3px solid rgba(170, 90, 20, 0.35);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.25);
  color: #9a3412;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 900;
}
.flip7-front {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #fffdf5, #ffe7a8);
  color: #7c2d12;
  border: 2px solid #f5d67a;
}
.flip7-front .prize-name {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  word-break: break-word;
}
.flip7-front .prize-payload {
  margin-top: 4px;
  font-size: 11px;
  color: #a16207;
}
.flip7-card.is-won .flip7-front {
  background: linear-gradient(180deg, #fff7cc, #ffd666);
  box-shadow: 0 0 0 2px #fff, 0 10px 20px rgba(255, 200, 60, 0.45);
}
.flip7-card.is-miss .flip7-front {
  background: linear-gradient(180deg, #fff, #f3f4f6);
  color: #6b7280;
  border-color: #e5e7eb;
}
.flip7-card:disabled { cursor: default; }
.flip7-card.is-pending .flip7-inner {
  animation: flip7Pulse 0.7s ease infinite;
}
@keyframes flip7Pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.lottery-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 12px auto 0;
  max-width: 420px;
}
.lottery-actions button {
  color: #ffe9a8;
  font-size: 13px;
  font-weight: 700;
  min-height: 32px;
  white-space: nowrap;
}
.lottery-hint {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
}

.prize-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.prize-chips span {
  background: #f3f4f6;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: #374151;
}
.history-item {
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
}
.history-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.history-item strong {
  display: block;
  min-width: 0;
}
.history-item time {
  flex: 0 0 auto;
  color: var(--mute);
  font-size: 12px;
  white-space: nowrap;
}
.history-item small { color: var(--mute); }
.history-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}
.history-pager button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: #f3f4f6;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}
.history-pager button:disabled {
  opacity: 0.4;
}
.history-pager span {
  color: var(--mute);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  min-height: var(--nav-h);
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.04);
}
.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: calc(var(--nav-h) - 4px);
  min-width: 0;
  padding: 0 2px;
  color: #9ca3af;
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
}
.bottom-nav button.active { color: var(--blue); }
.bottom-nav svg { width: 22px; height: 22px; flex: 0 0 auto; }

.empty-home {
  min-height: 42vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.empty-home h2 { font-size: 24px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 18px);
  transform: translateX(-50%) translateY(20px);
  z-index: 50;
  max-width: min(90vw, 360px);
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: rgba(185, 28, 28, 0.95); }

/* Room stage */
.room-stage .hero {
  text-align: center;
  padding: 10px 0 16px;
}
.room-stage .hero-label { color: var(--mute); font-size: 12px; }
.room-stage .hero strong {
  display: block;
  font-size: clamp(28px, 10vw, 40px);
  letter-spacing: 2px;
  margin: 6px 0;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.queue-list { display: grid; gap: 8px; margin: 10px 0 14px; }
.queue-item {
  display: flex;
  justify-content: space-between;
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
}
.queue-item .pending { color: var(--mute); font-weight: 500; }
.timer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.timer strong { font-size: 22px; color: var(--blue); }
.status-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--mute);
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  margin-right: 6px;
}
.dot.ok { background: var(--green); }
.dot.warn { background: #f59e0b; }
.choice {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.choice-2 { grid-template-columns: 1fr 1fr; }
.choice-4 { grid-template-columns: 1fr 1fr; }
.choice button {
  min-height: 44px;
  border-radius: 10px;
  background: #f3f4f6;
  color: #475569;
  font-weight: 600;
  padding: 0 8px;
}
.choice button.active { background: var(--blue-soft); color: var(--blue); }
.collision-field {
  width: 100%;
  max-width: 100%;
  margin: 4px 0 14px;
}
.toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fafb;
  box-sizing: border-box;
  cursor: pointer;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
}
.collision-toggle-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.collision-toggle-copy strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.collision-toggle-copy small {
  font-size: 12px;
  line-height: 1.35;
}
.toggle-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--blue);
  writing-mode: horizontal-tb;
}
.formation-progress { margin: 12px 0; }
.formation-track {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}
.formation-track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue);
}
.ops-actions { display: grid; gap: 10px; }
.ops-actions-primary { margin: 4px 0 8px; }
.btn-open {
  min-height: 50px;
  font-size: 16px;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px rgba(30, 103, 255, 0.22);
}
.control-block { margin-bottom: 12px; }
.control-label {
  color: var(--mute);
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 8px;
}
.route-hint { display: block; margin: 8px 0 0; font-size: 12px; line-height: 1.4; }
.card-meta {
  margin-top: 12px;
  font-size: 12px;
  display: grid;
  gap: 4px;
}
.more-options {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fafb;
  overflow: hidden;
}
.more-options > summary {
  list-style: none;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--secondary, #5d5b55);
  color: var(--mute);
  font-size: 13px;
  font-weight: 650;
  user-select: none;
}
.more-options > summary::-webkit-details-marker { display: none; }
.more-options > summary::after {
  content: "▾";
  margin-left: auto;
  color: #9ca3af;
  font-size: 12px;
}
.more-options[open] > summary {
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.more-options[open] > summary::after { content: "▴"; }
.more-options-body { padding: 12px 14px 14px; }

.home-project {
  display: grid;
  gap: 0;
  min-width: 0;
}
.room-controls { min-width: 0; }

.login-only .bottom-nav,
.login-only .app-header { display: none !important; }
.login-only .shell {
  width: min(420px, 100%);
  padding: 24px 16px calc(24px + var(--safe-bottom));
  min-height: 100svh;
  display: grid;
  align-content: center;
}
.login-only #page-login {
  width: 100%;
}
.login-only #page-login h2 { text-align: center; }
.login-only #page-login .sub { text-align: center; }

@media (max-width: 480px) {
  .shell { padding-left: 12px; padding-right: 12px; }
  .card { padding: 16px; }
  .section-title { flex-wrap: wrap; }
  .invitee-row { grid-template-columns: minmax(0, 1fr); }
  .invitee-badge { max-width: 100%; text-align: left; justify-self: start; }
  #headerUserName { max-width: min(96px, 28vw); }
}

@media (min-width: 768px) {
  :root {
    --shell-max: 920px;
    --top-h: 64px;
  }
  .shell {
    padding: 20px 24px 40px;
  }
  .header-inner { width: min(var(--shell-max), 100%); }
  .top-nav { display: flex; }
  .bottom-nav { display: none !important; }
  .choice-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .collision-field { max-width: none; }
  .collision-toggle-copy strong { font-size: 15px; }
  .login-only .shell { width: min(460px, 100%); }
  .login-only #page-login { box-shadow: 0 16px 48px rgba(15, 23, 42, 0.08); }
  .stat span { font-size: 12px; }
  .invitee-badge { white-space: nowrap; max-width: none; }
  /* Desktop: keep more options open by default for mouse users */
  .more-options { border-color: transparent; background: transparent; }
  .more-options > summary { display: none; }
  .more-options-body { display: block !important; padding: 0; }
  .more-options #routeGroupField,
  .more-options .collision-field,
  .more-options .card-meta {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f9fafb;
    padding: 12px 14px;
    margin-bottom: 12px;
  }
  .flip-grid { grid-template-columns: repeat(3, 1fr); max-width: 560px; }
  #page-lottery:not(.hidden) {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 14px;
    align-items: start;
  }
  #page-lottery .card:first-child { grid-row: 1 / span 2; }
}

@media (min-width: 1024px) {
  :root { --shell-max: 1080px; }
  .home-project {
    grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.35fr);
    gap: 16px;
    align-items: start;
  }
  .home-project > .project-card {
    margin-bottom: 0;
    position: sticky;
    top: calc(var(--top-h) + var(--safe-top) + 16px);
  }
  .home-project > .room-stage { margin-top: 0; }
  .brand-logo { height: 42px; max-width: 190px; }
  .room-stage .hero strong { font-size: 48px; }
  .btn-open { min-height: 52px; font-size: 17px; }
}


/* 一键开房下方使用说明 — 醒目折叠 */
.usage-guide {
  margin: 12px 0 4px;
  border: 2px solid #f59e0b;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffbeb 0%, #fff7ed 100%);
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.18);
}
.usage-guide > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 800;
  font-size: 15px;
  color: #b45309;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.usage-guide > summary span {
  flex: 1;
  min-width: 0;
  line-height: 1.45;
}
.usage-guide > summary::-webkit-details-marker { display: none; }
.usage-guide > summary::after {
  content: "▾";
  font-size: 14px;
  color: #d97706;
  transition: transform 0.2s ease;
}
.usage-guide:not([open]) > summary::after {
  transform: rotate(-90deg);
}
.usage-guide-body {
  padding: 0 14px 14px;
  border-top: 1px dashed rgba(245, 158, 11, 0.45);
}
.usage-guide-body p {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #92400e;
}
.usage-guide-cmds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.usage-guide-cmd {
  margin-top: 8px !important;
  display: inline-block;
  padding: 8px 14px;
  border-radius: 10px;
  background: #f97316;
  color: #fff !important;
  font-size: 16px !important;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}
.usage-guide-cmds .usage-guide-cmd {
  margin-top: 0 !important;
}

/* 我的卡密列表 */
#cardList .invitee-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.08));
}
#cardList .invitee-item:last-child { border-bottom: none; }
#cardList .invitee-main { display: flex; flex-direction: column; gap: 4px; }
#cardList .invitee-main strong { font-size: 14px; }
#cardList .btn-row { justify-content: flex-end; }
#cardList button[disabled] { opacity: 0.45; cursor: not-allowed; }

.notice-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(16px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  background: rgba(15, 23, 42, 0.45);
}
.notice-modal.hidden { display: none; }
.notice-card {
  width: min(420px, 100%);
  max-height: min(78dvh, 640px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}
.notice-card h2 {
  margin: 0;
  padding: 18px 16px 8px;
  text-align: center;
  font-size: 18px;
  color: #111827;
}
.notice-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 22px 16px;
  color: #374151;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.notice-mute {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 4px 16px 12px;
  color: #6b7280;
  font-size: 13px;
}
.notice-mute input {
  width: 16px;
  height: 16px;
  margin: 0;
}
.notice-confirm {
  flex-shrink: 0;
  border: 0;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  color: #2563eb;
  font-size: 16px;
  font-weight: 600;
  min-height: 48px;
  padding: 14px;
  cursor: pointer;
}
@media (max-width: 640px) {
  .notice-card {
    width: 100%;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 14px;
  }
  .notice-card h2 {
    padding: 16px 14px 6px;
    font-size: 17px;
  }
  .notice-body {
    padding: 6px 16px 12px;
    font-size: 15px;
  }
  .notice-mute {
    padding: 2px 14px 10px;
    font-size: 14px;
  }
  .notice-mute input {
    width: 18px;
    height: 18px;
  }
}
