:root {
  --bg: #f4f5f7;
  --bg2: #eceef5;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(245, 247, 251, 0.98);
  --border: rgba(99, 102, 241, 0.14);
  --text: #172033;
  --muted: #64748b;
  --gold: #d97706;
  --green: #059669;
  --red: #e11d48;
  --blue: #4f68e8;
  --cyan: #0891b2;
  --violet: #7c3aed;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  --font-head: "Bungee", cursive;
  --font-body: "Be Vietnam Pro", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(91, 141, 238, 0.16), transparent 28%),
    radial-gradient(circle at 84% 10%, rgba(34, 211, 238, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  font-family: var(--font-body);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.025) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: min(1240px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 16px 18px;
  border-radius: 30px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(59, 126, 229, 0.06), transparent 44%),
    rgba(248, 249, 250, 0.96);
  box-shadow: 0 14px 34px rgba(124, 58, 237, 0.08);
  backdrop-filter: blur(12px);
}

.hero-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  font-size: 24px;
  flex-shrink: 0;
}

.hero-left {
  min-width: 0;
  flex: 1;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip-btn,
.primary-btn,
.secondary-btn {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  min-height: 42px;
  padding: 9px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.chip-btn:hover,
.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--blue) 0%, var(--cyan) 100%);
  color: #ffffff;
  border: none;
  font-weight: 700;
}

.secondary-btn {
  background: var(--surface-soft);
}

.profile-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  text-align: left;
}

.profile-chip strong {
  font-size: 13px;
}

.profile-chip span {
  font-size: 12px;
  color: var(--cyan);
  font-family: var(--font-mono);
}

.profile-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 126, 229, 0.28);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.profile-chip:focus-visible {
  outline: 2px solid rgba(59, 126, 229, 0.35);
  outline-offset: 2px;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
}

.hero-status.live .hero-status-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.12);
}

.hero-status-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.hero-status.live .hero-status-label {
  color: var(--green);
}

.hero-card,
.panel,
.list-card {
  border: 1px solid var(--border);
  border-radius: 24px;
    background:
    linear-gradient(180deg, rgba(91, 141, 238, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), transparent),
    var(--surface);
  box-shadow: var(--shadow);
}

.summary {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(91, 141, 238, 0.08), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), transparent),
    var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

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

.summary-mark {
  color: var(--cyan);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sum-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.sum-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-family: var(--font-mono);
}

.sum-val {
  margin-top: 3px;
  font-family: var(--font-head);
  font-size: 18px;
  color: var(--text);
}

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

.toolbar-note {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.toolbar-refresh {
  min-width: 128px;
}

.hero-card {
  max-width: 1240px;
  margin: 0 auto 18px;
  padding: 18px;
}

.eyebrow {
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  margin-bottom: 6px;
}

.title {
  margin: 0;
  font-family: var(--font-head);
  font-size: clamp(22px, 3.6vw, 32px);
  line-height: 1.25;
  letter-spacing: 0.05em;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 760px;
}

.lobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.list-card {
  padding: 16px;
}

.list-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.room-name {
  font-family: var(--font-head);
  font-size: 18px;
  line-height: 1.4;
}

.room-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.badge.waiting {
  background: rgba(52, 211, 153, 0.14);
  color: var(--green);
}

.badge.playing {
  background: rgba(96, 165, 250, 0.14);
  color: var(--blue);
}

.preview-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.preview-row em {
  font-style: normal;
  color: var(--gold);
  font-family: var(--font-mono);
}

.list-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

.empty-box {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.table-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.table-wrap {
  position: relative;
  min-height: 720px;
  border-radius: 28px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at center, rgba(101, 163, 255, 0.2) 0%, rgba(222, 232, 255, 0.65) 52%, rgba(233, 237, 247, 0.96) 100%),
    linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.03), var(--shadow);
}

.table-wrap::before {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  border: 2px solid rgba(91, 141, 238, 0.18);
  pointer-events: none;
}

.table-deck {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 92px;
  height: 128px;
  transform: translate(-50%, -50%);
  border-radius: 16px;
  background: center / cover no-repeat url("/assets/cards/back_light.png");
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.32);
}

.table-deck::before,
.table-deck::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: center / cover no-repeat url("/assets/cards/back_light.png");
  opacity: 0.92;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
  z-index: -1;
}

.table-deck::before {
  transform: translate(-5px, -4px) rotate(-6deg);
}

.table-deck::after {
  transform: translate(5px, 3px) rotate(5deg);
}

.table-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + 120px));
  text-align: center;
  width: min(80%, 320px);
  pointer-events: none;
}

.table-center strong {
  display: block;
  font-family: var(--font-head);
  font-size: 18px;
  line-height: 1.5;
}

.table-center span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.peek-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 8;
}

.peek-overlay.active {
  pointer-events: auto;
}

.peek-panel {
  width: min(760px, calc(100% - 32px));
  padding: 16px 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(99, 102, 241, 0.22);
  backdrop-filter: blur(8px);
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transition: opacity 180ms ease, transform 220ms ease;
  pointer-events: auto;
}

.peek-overlay.active .peek-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.peek-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.peek-header strong {
  font-size: 16px;
  font-family: var(--font-head);
  line-height: 1.4;
}

.peek-header span {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 13px;
}

.peek-slots {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
}

.peek-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.peek-slot {
  position: relative;
  width: 190px;
}

.peek-slot.dragging {
  z-index: 6;
}

.peek-label,
.peek-summary {
  text-align: center;
  font-size: 13px;
  font-family: var(--font-mono);
}

.peek-label {
  color: var(--text);
  margin-bottom: 8px;
}

.peek-stage {
  position: relative;
  width: 190px;
  height: 270px;
  margin: 0 auto;
  pointer-events: auto;
  touch-action: none;
}

.peek-face,
.peek-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  user-select: none;
  -webkit-user-drag: none;
}

.peek-face {
  z-index: 1;
  box-shadow: 0 18px 26px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  background: #ffffff;
}

.peek-face-image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.peek-face-mask {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 40px;
  height: 90px;
  background: #ffffff;
  border-bottom-right-radius: 18px;
  z-index: 2;
  pointer-events: none;
}

.peek-back {
  z-index: 3;
  cursor: grab;
  transition: transform 90ms linear, opacity 160ms ease;
  object-fit: cover;
  box-shadow: 0 18px 26px rgba(0, 0, 0, 0.3);
}

.peek-slot.peeled .peek-face-mask {
  opacity: 0;
}

.peek-back.peeled {
  cursor: default;
}

.seat {
  position: absolute;
  width: 220px;
  transform: translate(-50%, -50%);
}

.seat-card {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(99, 102, 241, 0.14);
  padding: 12px 10px;
  backdrop-filter: blur(6px);
}

.seat-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}

.seat-avatar {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.seat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.seat-name {
  font-weight: 700;
  font-size: 13px;
}

.seat-points {
  font-size: 12px;
  color: var(--cyan);
  font-family: var(--font-mono);
}

.seat-status {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.seat-owner {
  color: var(--gold);
  font-size: 16px;
}

.hand {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: 104px;
}

.mini-card,
.empty-card,
.deal-card {
  width: 56px;
  height: 82px;
  border-radius: 5px;
}

.mini-card {
  position: relative;
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.mini-card img,
.deal-card img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.mini-card.peekable {
  cursor: pointer;
}

.empty-card {
  border: 1px dashed rgba(99, 102, 241, 0.18);
  background: rgba(79, 104, 232, 0.04);
}

.seat-delta {
  margin-top: 8px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
}

.seat-delta.pos {
  color: var(--green);
}

.seat-delta.neg {
  color: var(--red);
}

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

.bacay-chat-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  min-height: 220px;
  overflow: auto;
  align-items: stretch;
}

.bacay-chat-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 18px 12px;
  font-family: var(--font-mono);
}

.bacay-chat-item {
  border-radius: 14px;
  padding: 10px;
  background: rgba(79, 104, 232, 0.05);
  border: 1px solid var(--border);
  flex: 0 0 auto;
  width: 100%;
  min-height: 0;
}

.bacay-chat-item.me {
  background: rgba(8, 145, 178, 0.08);
}

.bacay-chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.bacay-chat-author {
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

.bacay-chat-elo {
  margin-left: 6px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 11px;
}

.bacay-chat-time {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.bacay-chat-msg {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.bacay-chat-compose {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.bacay-chat-input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(79, 104, 232, 0.04);
  color: var(--text);
  padding: 0 12px;
}

.bacay-chat-input:focus {
  outline: none;
  border-color: rgba(79, 104, 232, 0.45);
  box-shadow: 0 0 0 3px rgba(79, 104, 232, 0.08);
}

.bacay-chat-send {
  min-width: 88px;
}

.mobile-controls {
  display: none;
}

.mobile-controls-top {
  display: flex;
  align-items: center;
  gap: 8px;
  position: absolute;
  inset: 8px 8px auto 8px;
  z-index: 6;
}

.mobile-top-timer {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  min-width: 88px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  font-family: var(--font-head);
  font-size: 18px;
  color: var(--cyan);
}

.mobile-mini-btn {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 11px;
}

#fullscreenBtnMobile {
  font-size: 16px;
  line-height: 1;
}

.mobile-profile {
  margin-left: auto;
  min-height: 36px;
  padding: 6px 10px;
}

.mobile-room-card {
  position: fixed;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  backdrop-filter: blur(8px);
  width: min(30vw, 280px);
  max-width: 30vw;
  max-height: 50vh;
  overflow: auto;
}

.mobile-room-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mobile-room-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
}

.mobile-room-stats div {
  display: grid;
  gap: 2px;
}

.mobile-room-stats span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
}

.mobile-room-stats strong {
  color: var(--text);
  font-family: var(--font-mono);
}

.mobile-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.panel {
  padding: 16px;
}

.panel-title {
  font-family: var(--font-head);
  font-size: 16px;
  line-height: 1.5;
}

.panel-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.room-stats {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.room-stats div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.room-stats strong {
  font-family: var(--font-mono);
  color: var(--cyan);
}

.action-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.log-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  margin-top: 14px;
}

.log-item {
  border-radius: 14px;
  padding: 10px;
  background: rgba(79, 104, 232, 0.05);
  font-size: 13px;
  color: var(--muted);
}

.log-item strong {
  color: var(--text);
}

.log-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.log-item-subtle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
}

.log-item-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tiny-btn {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(79, 104, 232, 0.08);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tiny-btn.primary {
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border: none;
  color: #fff;
}

.timer {
  font-family: var(--font-head);
  font-size: 28px;
  color: var(--cyan);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.58);
  z-index: 20;
}

.modal-overlay.show {
  display: flex;
}

.modal-card {
  width: min(100%, 460px);
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(91, 141, 238, 0.1), transparent 44%),
    #ffffff;
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-head);
  font-size: 18px;
}

.modal-card p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.modal-grid {
  display: grid;
  gap: 12px;
}

.modal-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.modal-grid input,
.modal-grid select {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 12px;
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.player-profile-card {
  width: min(100%, 360px);
}

.player-profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-close-mini {
  min-height: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 12px;
}

.player-profile-body {
  margin-top: 14px;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.player-profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(79, 104, 232, 0.08);
}

.player-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-profile-name {
  font-family: var(--font-head);
  font-size: 18px;
}

.player-profile-points {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 16px;
}

.player-profile-location {
  font-size: 13px;
  color: var(--muted);
}

.player-profile-status {
  font-size: 13px;
  color: var(--green);
  font-weight: 700;
}

.toast-stack {
  position: fixed;
  left: 16px;
  right: auto;
  bottom: 16px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(320px, calc(100vw - 32px));
}

.toast {
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.success {
  border-color: rgba(52, 211, 153, 0.36);
}

.toast.error {
  border-color: rgba(251, 113, 133, 0.4);
}

.deal-card {
  position: fixed;
  z-index: 25;
  transition: transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 360ms ease;
  box-shadow: 0 16px 26px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.orientation-lock {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(244, 245, 247, 0.96);
  backdrop-filter: blur(10px);
}

.orientation-lock.show {
  display: flex;
}

body.orientation-locked {
  overflow: hidden;
}

body.mobile-fullscreen {
  overflow: hidden;
}

.orientation-lock-card {
  width: min(360px, 100%);
  border-radius: 24px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
}

.orientation-lock-icon {
  font-size: 32px;
  line-height: 1;
}

.orientation-lock-title {
  margin-top: 12px;
  font-family: var(--font-head);
  font-size: 18px;
}

.orientation-lock-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .table-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: -1;
  }

  .table-wrap {
    min-height: 640px;
  }
}

@media (min-width: 981px) {
  html,
  body {
    height: 100%;
  }

  body:has(.table-layout) {
    overflow: hidden;
  }

  .page-shell:has(.table-layout) {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .page-shell:has(.table-layout) .table-layout {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    align-items: stretch;
  }

  .page-shell:has(.table-layout) .table-wrap {
    min-height: 0;
    height: 100%;
  }

  .page-shell:has(.table-layout) .sidebar {
    min-height: 0;
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .page-shell:has(.table-layout) .sidebar .panel:last-child {
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .page-shell:has(.table-layout) .bacay-chat-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 12px;
    width: min(100vw, calc(100vw - 8px));
  }

  .hero {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 16px 18px;
  }

  .hero-left {
    order: 2;
    flex-basis: 100%;
  }

  .hero-actions {
    margin-left: auto;
  }

  .hero-home {
    width: 48px;
    height: 48px;
    font-size: 21px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-refresh {
    width: 100%;
  }

  .seat {
    width: 160px;
  }

  .seat-avatar {
    width: 42px;
    height: 42px;
  }

  .mini-card,
  .empty-card,
  .deal-card {
    width: 44px;
    height: 66px;
  }

  .hand {
    min-height: 84px;
    gap: 5px;
  }

  .table-wrap {
    min-height: 560px;
  }

  .peek-stage {
    width: 132px;
    height: 188px;
  }

  .peek-slots {
    gap: 10px;
  }

  .peek-slot {
    width: 132px;
  }
}

@media (orientation: landscape) and (max-width: 932px) and (pointer: coarse) {
  .page-shell {
    width: 100vw;
    margin: 0;
    padding: 0;
  }

  .hero,
  .sidebar {
    display: none;
  }

  .table-layout {
    display: block;
  }

  .table-wrap {
    min-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .table-wrap::before {
    inset: 12px;
  }

  .mobile-controls {
    display: block;
  }

  .mobile-controls-top {
    position: absolute;
    inset: 8px 8px auto 8px;
    z-index: 6;
  }

  .table-center {
    transform: translate(-50%, calc(-50% + 104px));
    width: min(70%, 280px);
  }

  .seat {
    width: 160px;
  }

  .seat-avatar {
    width: 40px;
    height: 40px;
  }

  .hand {
    min-height: 72px;
    gap: 5px;
  }

  .mini-card,
  .empty-card,
  .deal-card {
    width: 42px;
    height: 62px;
  }

  .seat-card {
    padding: 9px 8px;
  }

  .seat-name {
    font-size: 12px;
  }

  .seat-points,
  .seat-status,
  .seat-delta {
    font-size: 10px;
  }

  .peek-panel {
    width: min(720px, calc(100% - 16px));
    padding: 10px 12px 12px;
  }

  .peek-slot,
  .peek-stage {
    width: 124px;
    height: 176px;
  }

  .peek-slots {
    gap: 12px;
  }

  .mobile-room-card {
    width: min(30vw, 260px);
    max-width: 30vw;
    max-height: 50vh;
  }

  #roomSubMobile,
  .mobile-room-code {
    display: none;
  }

  .mobile-room-head {
    align-items: center;
  }

  .mobile-actions {
    justify-content: stretch;
  }

  .mobile-actions .primary-btn,
  .mobile-actions .secondary-btn {
    flex: 1 1 0;
    min-width: 0;
  }

}

body.phone-device .bacay-chat-list,
body.phone-device .bacay-chat-compose,
body.phone-device .sidebar .panel:last-child {
  display: none !important;
}

/* Rules Modal Styles */
.rules-modal-card {
  width: min(100%, 640px);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 18px;
  flex: 1;
}

.rules-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  margin-bottom: 14px;
}

.rules-content::-webkit-scrollbar {
  width: 6px;
}

.rules-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
}

.rules-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

.rules-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

.rules-section {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(79, 104, 232, 0.04);
}

.rules-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.rules-section ul {
  margin: 0;
  padding-left: 20px;
  list-style: disc;
}

.rules-section li {
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.rules-section li strong {
  color: var(--blue);
  font-weight: 600;
}

.rules-section p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
