:root {
  --bg-void: #040a14;
  --gold-pale: #fff4d2;
  --gold-bright: #f2cf82;
  --gold-main: #c89b3c;
  --gold-deep: #7a5821;

  --blue-bright: #88f7ff;
  --blue-main: #0ac8b9;

  --red-bright: #ff8598;
  --red-main: #e23854;

  --text-ivory: #f4ebd8;
  --text-sub: #b5ac98;
  --text-muted: #7b869c;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-void);
  color: var(--text-ivory);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.42;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==================== FULL-BLEED HOWLING ABYSS BACKDROP ==================== */
.abyss-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #050c18;
  background-image: url('/assets/bg_abyss.webp');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

.abyss-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(5, 13, 26, 0.14) 0%, rgba(4, 10, 20, 0.56) 76%, rgba(3, 7, 15, 0.78) 100%),
    linear-gradient(180deg, rgba(4, 10, 20, 0.38) 0%, rgba(4, 9, 18, 0.22) 45%, rgba(4, 9, 18, 0.66) 100%);
}

/* ==================== PORTRAIT APP SHELL ==================== */
.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 10px 14px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex-direction: column;
  gap: 10px;
  animation: fadeSlide 0.24s ease-out;
}

.view.active {
  display: flex;
}

.hidden {
  display: none !important;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== TOAST ==================== */
.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(18px);
  z-index: 999;
  max-width: 376px;
  width: calc(100% - 32px);
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(16, 28, 48, 0.96), rgba(8, 15, 28, 0.98));
  border: 1px solid var(--gold-main);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(242, 207, 130, 0.2), 0 12px 28px rgba(0, 0, 0, 0.72);
  color: var(--gold-pale);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: var(--red-main);
  background: linear-gradient(180deg, rgba(56, 13, 25, 0.97), rgba(28, 7, 14, 0.98));
  color: #ffd7de;
}

/* ==================== CODEX-PAINTED METALLIC BUTTON PLATES ==================== */
.btn-plate-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 760 / 144;
  min-height: 54px;
  border: none;
  padding: 0 24px;
  background-color: transparent;
  background-image: url('/assets/btn_hero_gold.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.65));
  transition: transform 0.12s ease, filter 0.18s ease, opacity 0.18s ease;
}

.btn-plate-hero span {
  pointer-events: none;
  color: #180f03;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 0 rgba(255, 246, 214, 0.72);
}

.btn-plate-hero:active:not(:disabled) {
  transform: scale(0.98);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6)) brightness(1.06);
}

.btn-plate-hero:disabled {
  opacity: 0.5;
  filter: grayscale(0.55) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
  cursor: not-allowed;
}

.play-host-dock {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-plate-dock {
  position: relative;
  width: 100%;
  aspect-ratio: 420 / 117;
  min-height: 48px;
  border: none;
  padding: 0 10px;
  background-color: transparent;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 7px 14px rgba(0, 0, 0, 0.65));
  transition: transform 0.12s ease, filter 0.18s ease, opacity 0.18s ease;
}

.btn-plate-dock.dock-crimson {
  background-image: url('/assets/btn_dock_crimson.png');
}

.btn-plate-dock.dock-gold {
  background-image: url('/assets/btn_dock_gold.png');
}

.btn-plate-dock span {
  pointer-events: none;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.btn-plate-dock.dock-crimson span {
  color: #fff3e8;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

.btn-plate-dock.dock-gold span {
  color: #1b1104;
  text-shadow: 0 1px 0 rgba(255, 245, 212, 0.65);
}

.btn-plate-dock:active:not(:disabled) {
  transform: scale(0.975);
  filter: brightness(1.06);
}

.btn-plate-dock:disabled {
  opacity: 0.48;
  filter: grayscale(0.45);
  cursor: not-allowed;
}

/* ==================== UNBROKEN DOUBLE-LAYER BEVEL PILLS (ZERO CLIPPED BORDERS!) ==================== */
.pill-bevel-btn,
.round-chip-shell,
.live-pill-shell,
.count-pill-shell,
.btn-bevel {
  display: inline-flex;
  padding: 1.5px;
  border: none;
  background: linear-gradient(180deg, #f0cf82 0%, #9b7229 55%, #d6aa52 100%);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55));
}

.pill-bevel-btn,
.btn-bevel {
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.18s ease;
}

.pill-bevel-btn:active,
.btn-bevel:active {
  transform: scale(0.97);
}

.pill-bevel-inner,
.round-chip-inner,
.live-pill-inner,
.count-pill-inner,
.btn-bevel-inner {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: linear-gradient(180deg, #132138 0%, #091222 100%);
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
  color: var(--gold-pale);
  font-family: inherit;
  font-weight: 700;
}

.pill-bevel-inner {
  padding: 6px 14px;
  font-size: 13px;
}

.round-chip-inner {
  padding: 6px 15px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.live-pill-shell {
  background: linear-gradient(180deg, #6ef5ff, #0c7e8c);
}

.live-pill-inner {
  padding: 5px 13px;
  font-size: 12px;
  color: var(--blue-bright);
  background: linear-gradient(180deg, #0d2b3a, #071925);
}

.live-pill-inner .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue-bright);
  box-shadow: 0 0 8px var(--blue-bright);
}

.live-pill-shell.offline {
  background: linear-gradient(180deg, #ff8598, #8c1c32);
}

.live-pill-shell.offline .live-pill-inner {
  background: linear-gradient(180deg, #3b101d, #200710);
  color: var(--red-bright);
}

.live-pill-shell.offline .dot {
  background: var(--red-bright);
  box-shadow: none;
}

.count-pill-inner {
  padding: 4px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  font-weight: 800;
}

.count-pill-shell.full {
  background: linear-gradient(180deg, #7ef6ff, #0a928a);
}

.count-pill-shell.full .count-pill-inner {
  color: #c2fffb;
  background: linear-gradient(180deg, #0d3a42, #072026);
}

.btn-bevel {
  width: 100%;
}

.btn-bevel-inner {
  min-height: 38px;
  padding: 7px 14px;
  font-size: 13.5px;
}

.btn-bevel-gold .btn-bevel-inner {
  background: linear-gradient(180deg, #eccd7e 0%, #ba882c 100%);
  color: #191004;
}

.btn-bevel-crimson {
  background: linear-gradient(180deg, #ff99ab, #941c34);
}

.btn-bevel-crimson .btn-bevel-inner {
  background: linear-gradient(180deg, #981d36, #5e0f20);
  color: #ffe8ec;
}

.btn-chip {
  border: 1px solid rgba(208, 164, 76, 0.45);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(19, 33, 56, 0.92), rgba(10, 19, 34, 0.96));
  color: #dfd4be;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
}

/* ==================== HOME HERO ==================== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 2px;
}

.hero-crest-wrap {
  width: 108px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: -8px;
  z-index: 2;
}

.hero-crest-img {
  width: 108px;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 18px rgba(18, 210, 232, 0.5)) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.72));
  animation: crestFloat 4.2s ease-in-out infinite;
}

@keyframes crestFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.hero-logo-wrap {
  margin: 0;
  padding: 0;
  line-height: 0;
  z-index: 2;
}

.hero-logo-img {
  width: min(286px, 75vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 16px rgba(212, 163, 66, 0.28));
}

.hero-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 220px;
  margin: 4px 0 3px;
}

.div-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(226, 185, 98, 0.85), transparent);
}

.div-diamond {
  width: 7px;
  height: 7px;
  background: var(--gold-bright);
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(242, 210, 139, 0.85);
}

.hero-sub {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-ivory);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.92);
}

/* ==================== ORNATE CHAMFERED HEXTECH FRAME ==================== */
.hex-frame {
  position: relative;
  padding: 2px;
  background: linear-gradient(145deg, #f3d691 0%, #9b732c 26%, #5c4218 52%, #b78a36 78%, #f2d28a 100%);
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% calc(100% - 16px), calc(100% - 16px) 100%, 16px 100%, 0 calc(100% - 16px), 0 16px);
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.65));
}

.hex-frame-inner {
  position: relative;
  padding: 15px 15px 17px;
  background:
    radial-gradient(circle at 50% 0%, rgba(200, 155, 60, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(11, 21, 39, 0.93) 0%, rgba(7, 13, 26, 0.96) 100%);
  clip-path: polygon(15px 0, calc(100% - 15px) 0, 100% 15px, 100% calc(100% - 15px), calc(100% - 15px) 100%, 15px 100%, 0 calc(100% - 15px), 0 15px);
}

.hex-frame-inner::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(200, 155, 60, 0.22);
  pointer-events: none;
}

.rivet {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff5d6, #b88930 68%, #5e4213);
  z-index: 4;
}
.rivet.tl { top: 9px; left: 9px; }
.rivet.tr { top: 9px; right: 9px; }
.rivet.bl { bottom: 9px; left: 9px; }
.rivet.br { bottom: 9px; right: 9px; }

.bottom-clasp {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, #fff2cc, #b8882e);
  border: 1px solid #3a260a;
  z-index: 5;
}

/* ==================== SEGMENTED HEXTECH TABS ==================== */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 2px;
  background: linear-gradient(180deg, rgba(196, 152, 68, 0.72), rgba(92, 66, 22, 0.55));
  clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 0 100%, 0 11px);
  margin-bottom: 15px;
}

.seg-btn {
  border: none;
  background: linear-gradient(180deg, #132033 0%, #0b1424 100%);
  color: #a4b0c2;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 11px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.seg-btn:first-child {
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
}

.seg-btn:last-child {
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}

.seg-btn.active {
  background: linear-gradient(180deg, #f5da94 0%, #d2a141 48%, #a67824 100%);
  color: #160e04;
  text-shadow: 0 1px 0 rgba(255, 245, 212, 0.55);
}

/* ==================== FORMS & INPUTS ==================== */
.form-stack {
  display: none;
  flex-direction: column;
  gap: 13px;
}

.form-stack.active { display: flex; }

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ornate-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--gold-bright);
}

.ornate-label.compact {
  font-size: 12px;
  margin-bottom: 2px;
}

.lbl-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 155, 60, 0.6), transparent);
}

.lbl-diamond {
  width: 5px;
  height: 5px;
  border: 1px solid var(--gold-bright);
  transform: rotate(45deg);
}

.hex-input-wrap {
  padding: 1.5px;
  background: linear-gradient(180deg, rgba(226, 185, 98, 0.72), rgba(118, 86, 32, 0.55));
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}

.hex-input-wrap:focus-within {
  background: linear-gradient(180deg, #fae2a3, #c89b3c);
}

.hex-input-wrap.sm {
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border: none;
  outline: none;
  background: linear-gradient(180deg, #060e1c 0%, #0b1629 100%);
  color: var(--text-ivory);
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 500;
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px);
}

.input::placeholder { color: #6c798f; font-size: 14px; }

.input-code {
  height: 54px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-align: center;
  color: var(--gold-pale);
  text-shadow: 0 0 14px rgba(242, 210, 139, 0.34);
}

.input-sm {
  height: 36px;
  font-size: 13px;
  padding: 0 11px;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(5, 11, 23, 0.72);
  border: 1px solid rgba(200, 155, 60, 0.25);
  border-radius: 4px;
  cursor: pointer;
}

.toggle-row input { display: none; }
.toggle-title { font-size: 13.5px; font-weight: 700; color: var(--text-ivory); }
.toggle-desc { font-size: 11.5px; color: var(--text-sub); margin-top: 1px; }

.switch {
  flex-shrink: 0;
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: #1b2a42;
  border: 1px solid rgba(200, 155, 60, 0.38);
  position: relative;
  transition: background 0.2s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #b7b0a0;
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-row input:checked + .switch {
  background: linear-gradient(90deg, #8b6520, #ddb050);
}

.toggle-row input:checked + .switch::after {
  transform: translateX(20px);
  background: #fff8e2;
}

/* ==================== RECENT CARD & BOTTOM RULES RIBBON ==================== */
.recent-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(8, 22, 38, 0.92);
  border: 1px solid rgba(10, 200, 185, 0.55);
  border-radius: 6px;
}

.recent-card .btn-bevel { width: auto; }
.recent-info { display: flex; flex-direction: column; gap: 3px; }
.recent-text { font-size: 13px; color: var(--text-ivory); }

.badge-gold-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 9px;
  background: rgba(200, 155, 60, 0.22);
  border: 1px solid rgba(212, 164, 66, 0.58);
  color: var(--gold-pale);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.rules-ribbon-shell {
  padding: 1.5px;
  background: linear-gradient(90deg, rgba(164, 122, 46, 0.7), #f0cf82 50%, rgba(164, 122, 46, 0.7));
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%);
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.6));
}

.rules-ribbon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 14px;
  background: linear-gradient(180deg, rgba(12, 22, 39, 0.96), rgba(7, 14, 26, 0.98));
  clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 50%, calc(100% - 11px) 100%, 11px 100%, 0 50%);
  font-size: 12px;
  color: var(--text-ivory);
  white-space: nowrap;
}

.ribbon-step em {
  font-style: italic;
  font-weight: 800;
  color: var(--gold-bright);
  margin-right: 2px;
}

.ribbon-dot { color: var(--gold-main); font-weight: 700; }

/* ==================== TOP BAR & LOBBY ==================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.room-id-card {
  text-align: center;
  padding: 14px 14px 16px;
}

.room-id-value {
  margin: 4px 0 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 0.2em;
  background: linear-gradient(180deg, #fff6d9 0%, #d4a13c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 12px rgba(212, 161, 60, 0.38));
}

.share-actions {
  display: grid;
  grid-template-columns: 0.85fr 1.45fr;
  gap: 8px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--gold-pale);
  letter-spacing: 0.05em;
}

.panel-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-sub); }

.progress-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue-main), var(--gold-bright));
  transition: width 0.25s ease;
}

.player-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.player-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-height: 46px;
  padding: 7px 9px;
  background: linear-gradient(180deg, rgba(16, 28, 46, 0.94), rgba(9, 17, 30, 0.96));
  border: 1px solid rgba(208, 164, 76, 0.38);
  border-radius: 5px;
}

.player-slot.empty {
  background: rgba(6, 13, 24, 0.62);
  border: 1px dashed rgba(200, 155, 60, 0.24);
  color: var(--text-muted);
  justify-content: center;
  font-size: 12px;
}

.player-slot.is-me {
  background: linear-gradient(180deg, rgba(160, 118, 42, 0.42), rgba(84, 59, 18, 0.5));
  border-color: rgba(242, 210, 139, 0.85);
}

.slot-left { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.slot-name { font-size: 13px; font-weight: 700; color: var(--text-ivory); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.mini-tag { font-size: 10px; padding: 1px 5px; font-weight: 700; border-radius: 2px; }
.tag-host { background: rgba(212, 164, 66, 0.26); color: var(--gold-pale); }
.tag-me { background: rgba(10, 200, 185, 0.26); color: var(--blue-bright); }
.tag-bot { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.tag-unlock { background: rgba(250, 204, 21, 0.2); color: #fde047; }

.slot-actions { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.slot-mini-btn {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-sub);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.slot-mini-btn.kick { color: #ff98a4; border-color: rgba(226, 56, 84, 0.48); }

.host-inner { display: flex; flex-direction: column; gap: 12px; }
.host-tools {
  padding-top: 11px;
  border-top: 1px solid rgba(200, 155, 60, 0.2);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.preadd-row { display: grid; grid-template-columns: 1fr 74px; gap: 8px; }
.tool-btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.guest-wait { text-align: center; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-sub); font-size: 13px; }
.guest-wait .btn-bevel { max-width: 180px; }

/* ==================== CODEX-PAINTED SCULPTED ARENA COMPASS ==================== */
.compass-plate {
  position: relative;
  width: 100%;
  aspect-ratio: 840 / 131;
  min-height: 54px;
  background-image: url('/assets/compass_bar.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  display: grid;
  grid-template-columns: 1fr 0.72fr 1fr;
  align-items: center;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.65));
}

.compass-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.wing-blue {
  padding-left: 10px;
  color: rgba(136, 247, 255, 0.62);
}

.wing-red {
  padding-right: 10px;
  color: rgba(255, 146, 164, 0.62);
}

.wing-blue.active-blue {
  color: #ebffff;
  text-shadow: 0 0 12px rgba(102, 247, 255, 0.95), 0 0 4px rgba(10, 200, 185, 0.9);
}

.wing-red.active-red {
  color: #fff0f2;
  text-shadow: 0 0 12px rgba(255, 110, 136, 0.95), 0 0 4px rgba(226, 56, 84, 0.9);
}

.compass-mid {
  font-size: 13px;
  color: var(--gold-pale);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}

.compass-mid.is-blue {
  color: #9bfbff;
  text-shadow: 0 0 10px rgba(72, 238, 255, 0.75);
}

.compass-mid.is-red {
  color: #ffadb9;
  text-shadow: 0 0 10px rgba(255, 92, 122, 0.78);
}

/* ==================== 3D ORNATE TAROT IDENTITY CARD (LOCKED 2:3 RATIO) ==================== */
.card-stage {
  perspective: 1600px;
  width: 100%;
}

.identity-card {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  max-height: 556px;
  margin: 0 auto;
  transform-style: preserve-3d;
  transition: transform 0.68s cubic-bezier(0.2, 0.9, 0.28, 1);
  cursor: pointer;
  user-select: none;
}

.identity-card.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  border-radius: 6px;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.78);
}

.card-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(125deg, rgba(255, 245, 210, 0.08) 0%, transparent 38%, rgba(255, 255, 255, 0.03) 56%, transparent 72%);
}

/* ---- CARD BACK (PRECISION COORDINATE-LOCKED TO ASTROLABE RING AT 46.7%) ---- */
.card-back {
  background-image: url('/assets/card_back.webp');
}

.back-top-shell {
  position: absolute;
  top: 13.5%;
  left: 50%;
  transform: translateX(-50%);
  padding: 1.5px;
  background: linear-gradient(180deg, #f2d28a, #8b6422);
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 9px 100%, 0 50%);
  white-space: nowrap;
}

.back-top-inner {
  padding: 5px 18px;
  background: linear-gradient(180deg, #101e36, #081224);
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
  color: var(--gold-pale);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

/* Dead-center inside the painted golden astrolabe ring (46.7% height!) */
.back-crest-pin {
  position: absolute;
  top: 46.7%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 146px;
  height: 124px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-aura {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 212, 232, 0.36), transparent 70%);
  filter: blur(14px);
  animation: auraPulse 2.8s ease-in-out infinite;
}

@keyframes auraPulse {
  0%, 100% { opacity: 0.65; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.08); }
}

.back-crest-img {
  position: relative;
  z-index: 2;
  width: 134px;
  height: auto;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.85));
}

.back-player-pin {
  position: absolute;
  top: 66.5%;
  left: 50%;
  transform: translateX(-50%);
  width: 74%;
  text-align: center;
}

.back-player-label {
  font-size: 11.5px;
  color: var(--text-sub);
  letter-spacing: 0.2em;
}

.back-player-name {
  margin-top: 2px;
  font-size: 25px;
  font-weight: 900;
  color: var(--gold-pale);
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Safely above bottom ruby diamond clasp (bottom: 13.8%) */
.back-cta-shell {
  position: absolute;
  bottom: 13.8%;
  left: 50%;
  transform: translateX(-50%);
  padding: 1.5px;
  background: linear-gradient(180deg, #f6d992, #9b7229);
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%);
  white-space: nowrap;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.72));
}

.back-cta-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: linear-gradient(180deg, #13233d, #0a1528);
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 9px 100%, 0 50%);
  color: var(--gold-pale);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold-pale);
  box-shadow: 0 0 0 0 rgba(255, 243, 209, 0.8);
  animation: pulseRing 1.8s infinite;
}

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(255, 243, 209, 0.75); }
  70% { box-shadow: 0 0 0 9px rgba(255, 243, 209, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 243, 209, 0); }
}

/* ---- CARD FRONT (ORNATE BLUE / RED CODEX TAROT FRAMES) ---- */
.card-front {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 13.5% 10.5% 13.5%;
  gap: 6px;
}

.card-front.team-blue {
  background-image: url('/assets/card_front_blue.webp');
}

.card-front.team-red {
  background-image: url('/assets/card_front_red.webp');
}

.card-front.role-undercover {
  box-shadow: 0 0 28px rgba(217, 38, 98, 0.45), 0 22px 48px rgba(0, 0, 0, 0.82);
}

.front-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.front-side-pill {
  padding: 4px 18px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.team-blue .front-side-pill {
  color: #f4f7f2;
  text-shadow: 0 2px 12px rgba(10, 200, 185, 0.65), 0 2px 4px rgba(0, 0, 0, 0.9);
}

.team-red .front-side-pill {
  background: linear-gradient(180deg, rgba(164, 24, 52, 0.72), rgba(86, 12, 28, 0.88));
  border: 1px solid rgba(235, 174, 96, 0.7);
  border-radius: 4px;
  color: #fff2e6;
  text-shadow: 0 2px 10px rgba(226, 56, 84, 0.75);
}

.front-side-subrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 82%;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.team-blue .front-side-subrow { color: #5ce6f2; }
.team-red .front-side-subrow { color: #e8b8c0; }

.sub-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 164, 66, 0.6), transparent);
}

.front-role-hero {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.role-emblem-wrap {
  position: relative;
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.role-emblem-glow {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 212, 232, 0.32), transparent 68%);
  filter: blur(10px);
}

.front-role-hero.is-spy .role-emblem-glow {
  background: radial-gradient(circle, rgba(242, 46, 122, 0.6), rgba(168, 85, 247, 0.3) 52%, transparent 74%);
  animation: auraPulse 2.2s ease-in-out infinite;
}

.role-emblem-img {
  position: relative;
  z-index: 2;
  width: 90px;
  height: 90px;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.88));
}

.role-copy { flex: 1; min-width: 0; }

.role-title {
  font-family: "Songti SC", "STSong", "Noto Serif SC", "PingFang SC", "Microsoft YaHei", serif;
  font-size: 32px;
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #fff7dd 0%, #eac36b 55%, #b8852b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.92));
}

.front-role-hero.is-spy .role-title {
  background: linear-gradient(180deg, #fff0d8 0%, #ff9ec4 48%, #e2386c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(242, 46, 122, 0.55)) drop-shadow(0 3px 6px rgba(0, 0, 0, 0.95));
}

.role-mission {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.42;
  color: #e4dac5;
}

/* Etched Teammates Compartment (Unbroken Subtle Gold Frame) */
.teammates-box {
  padding: 10px 10px 8px;
  background: rgba(5, 11, 21, 0.76);
  border: 1px solid rgba(208, 164, 76, 0.48);
  border-radius: 5px;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.5);
}

.teammates-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tm-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 164, 66, 0.65), transparent);
}

.tm-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--gold-pale);
  letter-spacing: 0.08em;
}

.teammates-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.teammate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 5px 8px;
  background: linear-gradient(180deg, rgba(22, 36, 56, 0.92), rgba(11, 20, 34, 0.95));
  border: 1px solid rgba(164, 178, 202, 0.32);
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-ivory);
}

.teammate-item.is-me {
  background: linear-gradient(180deg, rgba(176, 131, 46, 0.74), rgba(102, 71, 20, 0.88));
  border-color: #f6dc9b;
  color: #fff8e2;
  box-shadow: inset 0 1px 0 rgba(255, 245, 210, 0.45);
}

.team-red .teammate-item.is-me {
  background: linear-gradient(180deg, rgba(168, 28, 56, 0.78), rgba(92, 14, 30, 0.92));
  border-color: #ff94a8;
  color: #fff2e8;
}

.teammate-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teammates-footnote {
  margin-top: 7px;
  text-align: center;
  font-size: 10.5px;
  color: #9ba5b8;
}

/* ==================== REVEAL TRUTH PANEL & MODAL ==================== */
.reveal-header { text-align: center; margin-bottom: 11px; }
.reveal-header h3 { margin: 6px 0 0; font-size: 16px; color: var(--gold-pale); letter-spacing: 0.05em; }

.reveal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reveal-col { padding: 9px 8px; background: rgba(5, 11, 22, 0.82); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 4px; }
.reveal-col.blue { border-color: rgba(10, 200, 185, 0.48); }
.reveal-col.red { border-color: rgba(226, 56, 84, 0.48); }
.reveal-col-head { font-size: 12px; font-weight: 800; margin-bottom: 7px; padding-bottom: 5px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.reveal-col.blue .reveal-col-head { color: var(--blue-bright); }
.reveal-col.red .reveal-col-head { color: var(--red-bright); }
.reveal-member { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 5px 6px; font-size: 12.5px; margin-bottom: 4px; background: rgba(255, 255, 255, 0.03); border-radius: 3px; }
.reveal-member.spy { background: linear-gradient(90deg, rgba(217, 38, 98, 0.36), rgba(124, 58, 237, 0.25)); border: 1px solid rgba(255, 92, 168, 0.72); color: #ffd0e6; font-weight: 800; }
.spy-badge { font-size: 10px; padding: 1px 5px; background: #d92662; color: #fff; border-radius: 2px; flex-shrink: 0; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 6, 14, 0.82);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 14px;
}

.modal-sheet { width: 100%; max-width: 420px; max-height: 78dvh; }
.modal-sheet .hex-frame-inner { max-height: 76dvh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--gold-pale); }
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-empty { text-align: center; padding: 28px 12px; color: var(--text-sub); font-size: 13px; }
.history-item-title { font-size: 13px; font-weight: 800; color: var(--gold-bright); margin-bottom: 6px; }
