:root {
  --bg: #eef3f7;
  --bg-soft: #f8fbfd;
  --panel: #ffffff;
  --panel-soft: #f6f9fb;
  --line: #d6e1e8;
  --line-strong: #b9cbd7;
  --text: #1f2a36;
  --muted: #6d7f8f;
  --accent: #2d7ea3;
  --accent-soft: #eaf4f8;
  --success: #3c8b63;
  --felt: #dfe9de;
  --felt-edge: #c8d9c8;
  --domino: #fffdfa;
  --domino-edge: #d8d3ca;
  --pip: #1f2a36;
  --body-grad-start: #f7fafc;
  --body-grad-mid: #edf3f7;
  --body-grad-end: #e8eef3;
  --shell-glow: rgba(45, 126, 163, 0.08);
  --shadow-rgb: 20, 38, 54;
  --chip-border: #cfe0e8;
  --chip-bg: #eaf4f8;
  --chip-text: #2d7ea3;
  --feature-grad-start: #f7fbfd;
  --feature-grad-end: #edf5f8;
  --feature-border: #d2e1e8;
  --input-bg: #ffffff;
  --input-placeholder: #94a4b1;
  --button-bg: #ffffff;
  --button-border: #c7dbe4;
  --button-hover-border: #b8d7e6;
  --button-hover-bg: #eaf4f8;
  --chat-bubble-bg: #f8fbfd;
  --chat-self-bg: #eaf4f8;
  --table-surface-start: #eef5ee;
  --table-surface-end: #e4eee4;
  --board-stage-start: #d8e7d8;
  --board-stage-end: #cfdfcf;
  --table-pocket-bg: rgba(255, 255, 255, 0.92);
  --table-pocket-shadow: rgba(24, 45, 60, 0.06);
  --xp-rail: #e4ecf1;
  --alert-info-bg: #edf7fb;
  --alert-info-border: #cfe5ef;
  --alert-info-text: #376278;
  --overlay-bg: rgba(18, 30, 22, 0.28);
  --modal-surface: rgba(255, 255, 255, 0.98);
  --modal-surface-border: #d2e1d2;
  --notification-badge-bg: #dc8f32;
  --notification-badge-text: #ffffff;
  --theme-option-bg: #f6f9fb;
  --theme-option-border: #d6e1e8;
  --theme-option-text: #6d7f8f;
  --theme-option-active-bg: #eaf4f8;
  --theme-option-active-border: #b8d7e6;
  --theme-option-active-text: #2d7ea3;
  --status-open-bg: #dff6e9;
  --status-open-border: #c5e7d4;
  --status-open-text: #217c4a;
  --status-progress-bg: #fff3e0;
  --status-progress-border: #f1d9b1;
  --status-progress-text: #b5651d;
  --status-closed-bg: #ffe0e0;
  --status-closed-border: #efb8b8;
  --status-closed-text: #c0392b;
}

html[data-theme="dark"] {
  --bg: #0f1720;
  --bg-soft: #15212c;
  --panel: #182530;
  --panel-soft: #1f2f3b;
  --line: #2a3e4d;
  --line-strong: #395165;
  --text: #ecf5fb;
  --muted: #9fb3c2;
  --accent: #7cc3e0;
  --accent-soft: #1d3845;
  --success: #64c68d;
  --felt: #1e2e2a;
  --felt-edge: #304740;
  --domino: #f2eee7;
  --domino-edge: #b6aea0;
  --pip: #16212c;
  --body-grad-start: #0b1218;
  --body-grad-mid: #101a23;
  --body-grad-end: #15212c;
  --shell-glow: rgba(124, 195, 224, 0.12);
  --shadow-rgb: 4, 10, 15;
  --chip-border: #335061;
  --chip-bg: #1d3845;
  --chip-text: #89d0ea;
  --feature-grad-start: #1a2a35;
  --feature-grad-end: #1c3440;
  --feature-border: #2d4454;
  --input-bg: #0f1a23;
  --input-placeholder: #6f8797;
  --button-bg: #16242e;
  --button-border: #2f4758;
  --button-hover-border: #4d7087;
  --button-hover-bg: #1d3845;
  --chat-bubble-bg: #13202a;
  --chat-self-bg: #1d3845;
  --table-surface-start: #16221d;
  --table-surface-end: #1b2a24;
  --board-stage-start: #21352f;
  --board-stage-end: #182923;
  --table-pocket-bg: rgba(18, 30, 38, 0.94);
  --table-pocket-shadow: rgba(0, 0, 0, 0.35);
  --xp-rail: #22313d;
  --alert-info-bg: #172733;
  --alert-info-border: #2f4758;
  --alert-info-text: #a9d8ea;
  --overlay-bg: rgba(2, 7, 12, 0.62);
  --modal-surface: rgba(22, 36, 46, 0.98);
  --modal-surface-border: #2b4452;
  --notification-badge-bg: #f0a84d;
  --notification-badge-text: #13202a;
  --theme-option-bg: #13202a;
  --theme-option-border: #2a3e4d;
  --theme-option-text: #9fb3c2;
  --theme-option-active-bg: #1d3845;
  --theme-option-active-border: #4d7087;
  --theme-option-active-text: #ecf5fb;
  --status-open-bg: #173126;
  --status-open-border: #27513d;
  --status-open-text: #7fd2a2;
  --status-progress-bg: #3a2a16;
  --status-progress-border: #6a4a1f;
  --status-progress-text: #f2c17d;
  --status-closed-bg: #381d22;
  --status-closed-border: #6a3139;
  --status-closed-text: #f0a3ab;
}

html {
  font-size: 14px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background: linear-gradient(180deg, var(--body-grad-start), var(--body-grad-mid) 55%, var(--body-grad-end));
}

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

.shell-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top right, var(--shell-glow), transparent 20%);
}

.app-header,
.app-main {
  position: relative;
}

.app-header {
  z-index: 40;
}

.app-nav,
.app-main {
  max-width: 1420px;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.9rem 1rem 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 128px;
}

.brand-logo-dark {
  display: none;
}

.brand-copy strong,
.panel-title,
h1 {
  font-family: "Fraunces", serif;
}

.app-main {
  padding: 1rem 1rem 1.5rem;
  z-index: auto;
}

.eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2.8vw, 2.25rem);
}

.panel-card,
.inner-panel,
.clean-card {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(var(--shadow-rgb), 0.16);
}

.panel-card,
.clean-card {
  padding: 1rem;
}

.inner-panel {
  padding: 1rem;
}

.card-surface {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(var(--shadow-rgb), 0.16);
  padding: 1rem;
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.hero-panel > * {
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.05rem;
}

.lobby-prototype {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 290px;
  gap: 1rem;
  align-items: start;
}

.left-column,
.right-column,
.center-column,
.lobby-actions-grid,
.compact-form,
.chat-compose,
.seat-list,
.hand-list,
.teams-list,
.rank-list,
.table-rows,
.forum-stream,
.notice-stack {
  display: grid;
  gap: 0.75rem;
}

.panel-row,
.rank-row,
.table-head,
.table-line,
.team-card,
.seat-head,
.table-topbar,
.board-head,
.pocket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
}

.panel-row + *,
.board-head + *,
.table-topbar + * {
  margin-top: 0.45rem;
}

.panel-title {
  margin: 0;
  font-size: 1.02rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.subtle-chip,
.status-chip,
.clean-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 0.82rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat-box,
.notice-inline,
.team-card,
.rank-row,
.forum-stream-item,
.table-line,
.player-summary-card,
.seat-card,
.chat-bubble,
.history-item {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.stat-box {
  padding: 0.9rem 0.8rem;
  text-align: center;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.35rem;
  aspect-ratio: 1 / 1;
}

.stat-box span,
.forum-stream-item span,
.team-copy small,
.player-summary-card small,
.muted-copy {
  color: var(--muted);
}

.stat-box strong {
  font-size: 1.5rem;
  color: var(--accent);
}

.rank-row,
.team-card,
.table-line,
.player-summary-card,
.seat-card,
.chat-bubble,
.history-item,
.notice-inline,
.forum-stream-item {
  padding: 0.75rem 0.85rem;
}

.rank-number {
  width: 22px;
  color: var(--accent);
  font-weight: 700;
}

.rank-copy {
  flex: 1;
}

.leaderboard-modal-body {
  display: grid;
  gap: 1rem;
}

.leaderboard-tabs {
  display: flex;
  gap: 0.55rem;
  border-bottom: 0;
  margin-top: 0.35rem;
}

.leaderboard-tabs .nav-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 0.4rem 0.8rem;
  font-size: 0.84rem;
}

.leaderboard-tabs .nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #c5dfe9;
}

.leaderboard-tab-content {
  margin-top: 0.75rem;
}

.leaderboard-search-form {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.teams-search-form {
  grid-template-columns: minmax(14ch, 14ch) auto;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.4rem;
}

.team-search-input {
  max-width: 14ch;
}

.leaderboard-paging {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.teams-browser-item {
  grid-template-columns: 52px 1fr auto;
  display: grid;
  gap: 1.15rem;
  align-items: center;
}

.team-browser-copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.teams-browser-actions {
  display: grid;
  justify-items: end;
  align-items: center;
  gap: 0.4rem;
}

.teams-browser-state {
  display: grid;
  justify-items: end;
  gap: 0.35rem;
}

.xp-copy,
.rank-copy strong,
.team-copy strong,
.table-line span:first-child {
  font-weight: 600;
}

.team-copy strong,
.team-copy small {
  display: block;
}

.avatar-sm,
.avatar-lg,
.team-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  border-radius: 999px;
  flex-shrink: 0;
}

.avatar-sm,
.team-icon {
  width: 34px;
  height: 34px;
  font-size: 0.84rem;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.2rem;
}

.feature-banner {
  min-height: 126px;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--feature-border);
  background: linear-gradient(135deg, var(--feature-grad-start), var(--feature-grad-end));
}

.feature-banner strong {
  display: block;
  margin: 0.25rem 0;
  font-size: 1.6rem;
  color: var(--accent);
}

.notice-featured {
  margin-bottom: 0.9rem;
}

.tournament-panel {
  margin-top: 0;
}

.tournament-stack {
  display: grid;
  gap: 0.9rem;
}

.tournament-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 78px;
  padding: 1rem 1.25rem;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: var(--panel-soft);
  color: var(--muted);
  text-align: center;
  font-size: 1rem;
  line-height: 1.45;
}

.tournament-card {
  min-height: 0;
}

.lobby-tournament-card {
  position: relative;
  min-height: 168px;
  padding-top: 1rem;
}

.tournament-carousel .carousel-inner {
  overflow: visible;
}

.tournament-carousel-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.tournament-carousel-btn {
  position: static;
  width: 36px;
  height: 36px;
  border: 1px solid var(--button-border);
  border-radius: 999px;
  background: var(--button-bg);
  color: var(--accent);
  opacity: 1;
}

.tournament-carousel-btn:hover {
  background: var(--button-hover-bg);
  border-color: var(--button-hover-border);
  color: var(--accent);
}

.tournament-carousel-btn span {
  font-size: 1.45rem;
  line-height: 1;
}

.tournament-carousel-indicators {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0;
  flex: 1;
}

.tournament-carousel-indicators button {
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--line-strong);
  opacity: 0.55;
}

.tournament-carousel-indicators button.active {
  background: var(--accent);
  opacity: 1;
}

.tournament-copy {
  display: grid;
  gap: 0.25rem;
}

.tournament-copy span,
.tournament-copy small,
.tournament-copy strong {
  display: block;
}

.notice-media-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  align-items: start;
}

.notice-copy {
  display: grid;
  gap: 0.28rem;
}

.lobby-tournament-countdown {
  top: 0.9rem;
  right: 0.9rem;
}

.lobby-tournament-countdown.is-live {
  background: var(--status-closed-bg);
  color: var(--status-closed-text);
}

.lobby-tournament-copy {
  min-height: 136px;
  padding-right: 7.25rem;
  position: relative;
  padding-bottom: 0.1rem;
}

.lobby-tournament-title {
  margin: 0 0 0.2rem;
  padding-right: 0.5rem;
  font-size: 1.2rem;
  line-height: 1.15;
}

.lobby-tournament-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.lobby-tournament-actions {
  position: absolute;
  bottom: 0.1rem;
  right: 0.5rem;
  display: flex;
  justify-content: flex-end;
}

.notice-copy strong,
.notice-copy span {
  display: block;
}

.notice-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.notice-icon-sm {
  width: 24px;
  height: 24px;
}

.banner-kicker {
  color: var(--text);
  font-size: 0.88rem;
  text-transform: uppercase;
}

.lobby-actions-grid {
  grid-template-columns: 1fr 1.15fr;
}

.compact-form .form-control,
.compact-form .form-select,
.chat-compose .form-control,
textarea.form-control,
.form-control,
.form-select {
  background: var(--input-bg) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  padding: 0.65rem 0.8rem !important;
}

.compact-form .form-control::placeholder,
textarea.form-control::placeholder,
.form-control::placeholder {
  color: var(--input-placeholder) !important;
}

.split-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.toggle-row,
.toggle-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
}

.notice-toggle-form {
  display: inline-flex;
}

.notice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 34px;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--button-border);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  cursor: pointer;
}

.notice-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.notice-toggle-track {
  position: relative;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color 0.16s ease;
}

.notice-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(var(--shadow-rgb), 0.24);
  transition: transform 0.16s ease;
}

.notice-toggle input:checked + .notice-toggle-track {
  background: var(--status-closed-border);
}

.notice-toggle input:checked + .notice-toggle-track::after {
  transform: translateX(16px);
}

.notice-toggle-label {
  font-size: 0.8rem;
  font-weight: 600;
}

.action-btn,
.mini-btn,
.clean-btn,
.clean-action-btn {
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--accent);
  border-radius: 10px;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.action-btn,
.clean-action-btn {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-weight: 600;
}

.action-btn.secondary,
.mini-btn.muted,
.mini-btn,
.clean-btn,
.clean-action-btn.secondary {
  background: var(--panel-soft);
}

.mini-btn,
.clean-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  min-height: 34px;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.icon-search-btn {
  min-width: 38px;
  width: 38px;
  padding: 0.45rem;
}

.search-btn-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.mini-btn:hover,
.clean-btn:hover,
.clean-action-btn:hover,
.nav-user-btn:hover {
  background: var(--button-hover-bg);
  border-color: var(--button-hover-border);
  color: var(--accent);
}

.table-head,
.table-line {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) 0.65fr 0.75fr 0.9fr 0.9fr 56px;
}

.table-head {
  color: var(--muted);
  padding: 0 0.25rem;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.table-head span,
.table-line > span {
  min-width: 0;
}

.table-head span:nth-child(n + 2):not(:last-child),
.table-line > span:nth-child(n + 2):not(:last-child) {
  justify-self: center;
  text-align: center;
}

.table-line > span:first-child,
.table-line > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-line-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}

.table-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.table-access-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 0.34rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.table-access-pill.open {
  background: rgba(32, 163, 105, 0.14);
  border-color: rgba(32, 163, 105, 0.28);
  color: #18754a;
}

.table-access-pill.invite-only {
  background: rgba(72, 110, 152, 0.14);
  border-color: rgba(72, 110, 152, 0.28);
  color: #365b83;
}

.table-status-pill.open {
  background: var(--status-open-bg);
  border-color: var(--status-open-border);
  color: var(--status-open-text);
}

.table-status-pill.in-progress {
  background: var(--status-progress-bg);
  border-color: var(--status-progress-border);
  color: var(--status-progress-text);
}

.table-status-pill.closed {
  background: var(--status-closed-bg);
  border-color: var(--status-closed-border);
  color: var(--status-closed-text);
}

.table-enter-btn {
  min-width: 40px;
  width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 0.35rem;
  border-radius: 12px;
}

.table-enter-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.forum-stream-item {
  display: grid;
  gap: 0.15rem;
}

.player-summary-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 0.8rem;
  align-items: center;
}

.xp-bar {
  height: 6px;
  margin: 0.45rem 0;
  background: var(--xp-rail);
  border-radius: 999px;
  overflow: hidden;
}

.xp-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--success));
}

.teams-list {
  max-height: 260px;
  overflow: auto;
}

.team-card {
  grid-template-columns: 34px 1fr auto;
  display: grid;
  gap: 0.75rem;
  align-items: center;
}

.team-card-actions {
  display: grid;
  gap: 0.45rem;
  justify-items: end;
}

.team-policy-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0.2rem;
}

.status-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.management-list,
.management-heading {
  display: grid;
  gap: 0.7rem;
}

.management-heading {
  grid-template-columns: 34px 1fr;
  align-items: center;
}

.management-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 0.9rem;
}

.chat-window,
.history-window {
  min-height: 180px;
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 0.65rem;
}

.chat-conversation-thread {
  gap: 0.8rem;
  align-content: start;
}

.chat-message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}

.chat-message.is-self {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.chat-message.is-self .chat-message-avatar {
  order: 2;
}

.chat-message.is-self .chat-message-body {
  order: 1;
  justify-items: end;
}

.chat-message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(20, 38, 54, 0.12);
}

.chat-message-body {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.chat-message-meta {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.chat-message-meta strong {
  color: var(--text);
  font-size: 0.85rem;
}

.chat-message-callout {
  max-width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--chat-bubble-bg);
  color: var(--text);
  line-height: 1.45;
  box-shadow: 0 4px 12px rgba(var(--shadow-rgb), 0.18);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.is-self .chat-message-callout {
  background: var(--chat-self-bg);
  border-color: var(--line-strong);
}

.clean-table-shell {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 300px;
  gap: 1rem;
}

.board-column {
  display: grid;
  gap: 0.85rem;
}

.pill-strip,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.clean-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.clean-board-head .pill-strip {
  flex: 1 1 auto;
}

.table-felt {
  position: relative;
  min-height: 560px;
  border-radius: 22px;
  border: 1px solid var(--felt-edge);
  background: linear-gradient(180deg, var(--table-surface-start), var(--table-surface-end));
  padding: 1.2rem;
}

.table-waiting-overlay {
  position: absolute;
  inset: 10px;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 1rem;
  pointer-events: none;
}

.table-waiting-dialog {
  width: min(360px, 100%);
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  padding: 1.1rem 1.2rem;
  border-radius: 22px;
  border: 1px solid rgba(var(--shadow-rgb), 0.12);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 42px rgba(var(--shadow-rgb), 0.2);
  text-align: center;
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

html[data-theme="dark"] .table-waiting-dialog {
  background: rgba(23, 34, 41, 0.9);
  border-color: rgba(167, 201, 215, 0.14);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.42);
}

.table-waiting-gif {
  width: 76px;
  height: 76px;
  object-fit: contain;
}

.table-waiting-title {
  color: var(--text);
  font-family: "Fraunces", serif;
  font-size: 1.1rem;
  line-height: 1.15;
}

.table-waiting-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.table-waiting-actions {
  margin-top: 0.15rem;
}

.clean-board-stage {
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px solid var(--felt-edge);
  background: linear-gradient(180deg, var(--board-stage-start), var(--board-stage-end));
  padding: 0.5rem;
  overflow: hidden;
}

.seat-position {
  position: absolute;
  z-index: 4;
  display: none;
  pointer-events: auto;
}

.seat-position-north {
  top: -1.35rem;
  left: 50%;
  transform: translateX(-50%);
  justify-content: center;
}

.seat-position-east {
  top: 50%;
  right: -1.4rem;
  transform: translateY(calc(-50% - 68px));
  align-items: center;
}

.seat-position-west {
  top: 50%;
  left: -1.4rem;
  transform: translateY(calc(-50% + 68px));
  align-items: center;
}

.table-pocket {
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--table-pocket-bg);
  box-shadow: 0 6px 14px var(--table-pocket-shadow);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.table-pocket.active {
  border-color: #89b8cc;
  box-shadow: 0 0 0 3px rgba(45, 126, 163, 0.14), 0 8px 18px rgba(45, 126, 163, 0.16);
  animation: pulse-badge 1.8s ease-in-out infinite;
}

.pocket-avatar-ring {
  --turn-progress: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    conic-gradient(#2d7ea3 calc(var(--turn-progress) * 1turn), rgba(45, 126, 163, 0.14) 0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.pocket-avatar-ring.urgent {
  background:
    conic-gradient(#c0392b calc(var(--turn-progress) * 1turn), rgba(192, 57, 43, 0.16) 0);
}

.pocket-avatar {
  flex-shrink: 0;
}

.pocket-meta {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.pocket-meta small {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1;
}

.turn-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.16rem 0.4rem;
  border-radius: 999px;
  background: rgba(45, 126, 163, 0.12);
  color: #1f6c8f;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.seat-pocket-north {
  min-height: 42px;
  max-width: 260px;
}

.seat-pocket-east,
.seat-pocket-west {
  flex-direction: column;
  min-width: 46px;
  padding: 0.35rem 0.25rem;
  gap: 0.3rem;
  text-align: center;
}

.seat-pocket-east .pocket-meta,
.seat-pocket-west .pocket-meta {
  justify-items: center;
}

.hidden-stack {
  display: flex;
  gap: 0.08rem;
  justify-content: center;
}

.hidden-stack.vertical {
  flex-direction: column;
  align-items: center;
}

.stack-vertical {
  flex-direction: column;
}

.domino {
  position: relative;
  display: grid;
  overflow: hidden;
  background: var(--domino);
  border: 1px solid var(--domino-edge);
  box-shadow: 0 4px 10px rgba(35, 47, 56, 0.08);
}

.domino.vertical {
  width: 42px;
  height: 72px;
  grid-template-rows: 1fr 1fr;
}

.domino.horizontal {
  width: 72px;
  height: 42px;
  grid-template-columns: 1fr 1fr;
}

.domino::before {
  content: "";
  position: absolute;
  background: #908b82;
}

.domino.vertical::before {
  left: 5px;
  right: 5px;
  top: calc(50% - 0.5px);
  height: 1px;
}

.domino.horizontal::before {
  top: 5px;
  bottom: 5px;
  left: calc(50% - 0.5px);
  width: 1px;
}

.domino-half {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.pip {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--pip);
}

.top-left { top: 8px; left: 8px; }
.top-center { top: 8px; left: calc(50% - 2.5px); }
.top-right { top: 8px; right: 8px; }
.mid-left { top: calc(50% - 2.5px); left: 8px; }
.mid-right { top: calc(50% - 2.5px); right: 8px; }
.bottom-left { bottom: 8px; left: 8px; }
.bottom-center { bottom: 8px; left: calc(50% - 2.5px); }
.bottom-right { bottom: 8px; right: 8px; }
.center { top: calc(50% - 2.5px); left: calc(50% - 2.5px); }

.domino-back {
  background: linear-gradient(180deg, #edf4f8, #e0ebf1);
  border-color: #c8d8e1;
}

.domino-mark {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid #95afbc;
  background: repeating-linear-gradient(45deg, rgba(45, 126, 163, 0.18), rgba(45, 126, 163, 0.18) 3px, transparent 3px, transparent 6px);
}

.mini-domino.vertical {
  width: 18px;
  height: 30px;
}

.mini-domino.horizontal {
  width: 30px;
  height: 18px;
}

.mini-domino .pip {
  width: 2px;
  height: 2px;
}

.mini-domino .top-left { top: 4px; left: 4px; }
.mini-domino .top-center { top: 4px; left: calc(50% - 1px); }
.mini-domino .top-right { top: 4px; right: 4px; }
.mini-domino .mid-left { top: calc(50% - 1px); left: 4px; }
.mini-domino .mid-right { top: calc(50% - 1px); right: 4px; }
.mini-domino .bottom-left { bottom: 4px; left: 4px; }
.mini-domino .bottom-center { bottom: 4px; left: calc(50% - 1px); }
.mini-domino .bottom-right { bottom: 4px; right: 4px; }
.mini-domino .center { top: calc(50% - 1px); left: calc(50% - 1px); }

.domino-board.vertical {
  width: 34px;
  height: 68px;
}

.domino-board.horizontal {
  width: 68px;
  height: 34px;
}

/* ── Domino surface (absolute positioned tiles) ── */
.domino-surface {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}

.chain-tile {
  position: absolute;
  transition: none;
}

.hand-zone {
  display: grid;
  gap: 0.85rem;
}

.hand-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.hand-flow {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
}

.player-hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-content: center;
  flex: 0 1 auto;
  min-width: 0;
  gap: 0.2rem;
}

.hand-tile {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  display: grid;
  justify-items: center;
  margin: 0;
}

.hand-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.5rem;
  margin-left: auto;
}

.hand-action-btn {
  width: 66px;
  min-width: 66px;
  height: 66px;
  min-height: 66px;
  padding: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.1;
}

.hand-icon-btn {
  padding: 0.25rem;
}

.hand-action-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.table-name-pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  width: 100%;
  margin-bottom: 0.8rem;
}

.table-name-pill-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-name-pill-value {
  color: var(--text);
  font-family: "Fraunces", serif;
  font-size: 1.12rem;
  line-height: 1.1;
}

.hand-domino.vertical {
  width: 38px;
  height: 66px;
}

.hand-tile.selected .hand-domino {
  box-shadow: 0 0 0 2px rgba(45, 126, 163, 0.2);
  transform: translateY(-2px);
}

.seat-card {
  display: grid;
  gap: 0.3rem;
}

.seat-card .seat-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
}

.seat-info {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.seat-info strong {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-invite-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0.2rem;
  border-radius: 10px;
}

.seat-invite-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.table-leave-form {
  display: flex;
  justify-content: center;
}

.table-control-actions {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  justify-content: center;
}

.table-control-btn {
  width: 96px;
  min-width: 96px;
  height: 96px;
  min-height: 96px;
  padding: 0.7rem 0.6rem;
  border-radius: 18px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  text-align: center;
  box-shadow: 0 12px 26px rgba(var(--shadow-rgb), 0.14);
}

.table-control-btn span {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.1;
}

.table-start-btn {
  border-color: rgba(75, 176, 73, 0.32);
  background: linear-gradient(180deg, rgba(225, 249, 220, 0.96), rgba(205, 241, 200, 0.94));
  color: #236f20;
}

.table-start-btn:hover,
.table-start-btn:focus-visible {
  border-color: rgba(75, 176, 73, 0.46);
  background: linear-gradient(180deg, rgba(214, 246, 208, 1), rgba(188, 234, 182, 1));
  color: #1f621c;
}

.table-leave-btn {
  border-color: rgba(190, 110, 83, 0.28);
  background: linear-gradient(180deg, rgba(251, 239, 233, 0.98), rgba(247, 224, 214, 0.96));
  color: #a65436;
}

.table-leave-btn:hover,
.table-leave-btn:focus-visible {
  border-color: rgba(190, 110, 83, 0.38);
  background: linear-gradient(180deg, rgba(250, 229, 221, 1), rgba(244, 212, 199, 1));
  color: #94472d;
}

.table-pause-btn {
  border-color: rgba(216, 145, 43, 0.3);
  background: linear-gradient(180deg, rgba(255, 243, 221, 0.98), rgba(251, 230, 183, 0.96));
  color: #a66112;
}

.table-pause-btn:hover,
.table-pause-btn:focus-visible {
  border-color: rgba(216, 145, 43, 0.42);
  background: linear-gradient(180deg, rgba(255, 237, 205, 1), rgba(248, 220, 162, 1));
  color: #8d520e;
}

.table-control-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}

.table-leave-icon {
  transform: rotate(180deg);
}

.seat-info small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.seat-card.current-turn {
  border-color: #6cb4d2;
  background: linear-gradient(180deg, rgba(224, 245, 253, 0.98), rgba(206, 234, 247, 0.96));
  box-shadow: 0 0 0 2px rgba(45, 126, 163, 0.16), 0 12px 22px rgba(45, 126, 163, 0.12);
}

.seat-card.current-turn .seat-info strong {
  color: #175d7d;
}

.scores-list {
  display: grid;
  gap: 0.4rem;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 0.88rem;
}

.score-row strong {
  color: var(--accent);
  font-family: "Fraunces", serif;
  font-size: 1.1rem;
}

.turn-timer-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 196px;
  margin-left: auto;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(43, 140, 197, 0.26);
  background: linear-gradient(180deg, rgba(224, 247, 255, 0.98), rgba(177, 233, 255, 0.96));
  color: #0b5f8b;
  font-weight: 800;
  font-size: 0.9rem;
  line-height: 1;
  box-shadow: 0 12px 22px rgba(43, 140, 197, 0.16);
  white-space: nowrap;
}

.turn-timer-pill.is-urgent {
  border-color: rgba(214, 86, 63, 0.3);
  background: linear-gradient(180deg, rgba(255, 231, 224, 0.98), rgba(255, 194, 180, 0.96));
  color: #aa2d1d;
  animation: pulse-badge 0.9s infinite;
}

.table-result-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--overlay-bg);
}

.table-result-dialog {
  width: min(460px, 100%);
  border-radius: 20px;
  border: 1px solid var(--modal-surface-border);
  background: var(--modal-surface);
  box-shadow: 0 20px 48px rgba(var(--shadow-rgb), 0.45);
  padding: 1.15rem 1.15rem 1rem;
  display: grid;
  gap: 0.85rem;
}

.table-result-header,
.table-result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-result-body {
  display: grid;
  gap: 0.5rem;
  text-align: center;
}

#table-result-summary {
  margin: 0;
  white-space: pre-line;
  line-height: 1.55;
}

.table-result-celebration {
  display: grid;
  justify-items: center;
  gap: 0.55rem;
  margin-bottom: 0.15rem;
}

.table-result-confetti {
  width: min(180px, 42vw);
  height: auto;
  pointer-events: none;
}

.table-result-congrats {
  color: var(--accent-strong);
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
  line-height: 1.2;
}

.table-result-body p {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.45;
}

.table-result-actions[hidden] {
  display: none;
}

.table-pocket.disconnected {
  opacity: 0.5;
}

.clean-topbar .mini-btn,
.clean-btn,
.clean-action-btn {
  color: var(--accent);
}

.alert-info {
  background: var(--alert-info-bg);
  border: 1px solid var(--alert-info-border);
  color: var(--alert-info-text);
  border-radius: 12px;
}

@media (max-width: 1180px) {
  .lobby-prototype,
  .clean-table-shell,
  .lobby-actions-grid,
  .forum-index-grid,
  .profile-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .lobby-clean-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: auto;
  }

  .admin-sidebar {
    position: static;
  }

  .lobby-tabs-shell {
    position: static;
    width: 100%;
    min-height: auto;
  }

  .lobby-clean-grid > .center-column {
    order: 1;
    width: 100%;
  }

  .lobby-clean-grid > .lobby-tabs-shell {
    order: 2;
    width: 100%;
  }

  .table-control-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .admin-tournament-head,
  .admin-tournament-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .admin-user-head,
  .admin-user-table-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .admin-tournament-head,
  .admin-user-head {
    display: none;
  }

  .table-head,
  .table-line {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .table-head {
    display: none;
  }

  .table-line-actions {
    justify-content: flex-start;
  }

  .lobby-icon-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .table-felt {
    min-height: 780px;
  }

  .clean-board-stage {
    inset: 10px;
  }
}

.app-nav-clean {
  grid-template-columns: auto 1fr auto;
}

.logo-only {
  gap: 0;
}

.logo-only .brand-logo {
  width: 150px;
}

.signed-in-dropdown {
  min-width: 240px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  z-index: 1300;
}

.signed-in-summary {
  display: grid;
  margin-bottom: 0.75rem;
}

.theme-picker {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.theme-picker-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.theme-picker-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.sound-picker {
  margin-top: -0.1rem;
}

.sound-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.sound-choice-btn {
  min-width: 92px;
}

.sound-choice-btn.is-muted {
  background: transparent;
  border-color: var(--theme-option-border);
  color: var(--theme-option-text);
}

.sound-volume-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sound-volume-slider {
  width: 100%;
  accent-color: var(--accent);
}

.sound-volume-value {
  min-width: 52px;
  text-align: right;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.theme-choice-btn {
  border: 1px solid var(--theme-option-border);
  background: var(--theme-option-bg);
  color: var(--theme-option-text);
  border-radius: 10px;
  padding: 0.48rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.theme-choice-btn:hover {
  border-color: var(--theme-option-active-border);
  color: var(--text);
}

.theme-choice-btn.is-active {
  background: var(--theme-option-active-bg);
  border-color: var(--theme-option-active-border);
  color: var(--theme-option-active-text);
}

.nav-user-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 0.72rem 0.95rem;
}

.signed-in-menu {
  position: relative;
  z-index: 1300;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.notification-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--accent);
  padding: 0.2rem;
}

.notification-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.notification-btn.has-active-notifications .notification-icon {
  filter: none;
  opacity: 1;
}

.notification-btn.is-muted .notification-icon {
  filter: grayscale(1) saturate(0.15);
  opacity: 0.45;
}

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--notification-badge-bg);
  color: var(--notification-badge-text);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notifications-dropdown {
  min-width: 320px;
}

.notifications-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.notification-item {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  color: inherit;
  text-decoration: none;
}

.notification-item.is-unread {
  border-color: #c7dbe4;
  background: #eef7fb;
}

.notification-link-btn {
  width: 100%;
  padding: 0.75rem 0.8rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  display: grid;
  gap: 0.2rem;
}

.notification-link-btn strong {
  color: var(--text);
}

.notification-link-btn span,
.notification-link-btn small {
  color: var(--muted);
}

.lobby-clean-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: stretch;
  min-height: calc(100vh - 11.5rem);
}

.lobby-tabs-shell {
  display: grid;
  gap: 0.9rem;
  position: sticky;
  top: 1rem;
  align-self: stretch;
  min-height: 100%;
  grid-template-rows: auto 1fr;
}

.lobby-icon-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  border-bottom: 0;
}

.lobby-icon-tabs .nav-item {
  min-width: 0;
}

.lobby-icon-tabs .nav-link {
  width: 100%;
  min-height: 78px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 0.7rem 0.45rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
}

.lobby-icon-tabs .nav-link.active {
  border-color: var(--button-hover-border);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 10px 22px rgba(var(--shadow-rgb), 0.14);
}

.lobby-tab-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.lobby-tab-content {
  display: grid;
  min-width: 0;
  min-height: 0;
}

.lobby-tab-content > .tab-pane {
  display: none;
}

.lobby-tab-content > .active {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  min-height: 100%;
}

#lobby-chat-pane {
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
}

#lobby-chat-pane .chat-window {
  min-height: 0;
  max-height: none;
  height: 100%;
}

.lobby-teams-list,
.lobby-tab-content .rank-list,
.lobby-tab-content .forum-stream {
  max-height: 520px;
  overflow: auto;
  padding-right: 0.1rem;
}

.panel-actions,
.icon-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.panel-search-dropdown .dropdown-toggle::after {
  margin-left: 0.45rem;
}

.center-column {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.tables-panel .panel-actions {
  align-items: stretch;
}

.tables-panel-actions {
  justify-content: flex-start;
  margin-top: 0.45rem;
  margin-bottom: 0.45rem;
}

.tables-panel {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  align-content: start;
  flex: 1;
  min-height: 0;
}

.tables-panel .panel-row {
  margin-top: 0;
  align-items: flex-start;
}

.tables-panel .table-rows {
  align-content: start;
}

.lobby-action-icon-btn {
  min-width: 96px;
  min-height: 78px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.7rem;
  text-align: center;
  white-space: normal;
  line-height: 1.15;
  border-radius: 14px;
}

.lobby-action-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.lobby-action-icon-btn span {
  font-size: 0.82rem;
  font-weight: 700;
}

.lobby-search-trigger.dropdown-toggle::after {
  display: none;
}

.icon-search-btn.dropdown-toggle::after {
  display: none;
}

.panel-search-menu {
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 14px 28px rgba(20, 38, 54, 0.12);
}

.header-search-form {
  display: grid;
  gap: 0.65rem;
}

.profile-link-btn {
  padding: 0;
  border: 0;
  background: transparent;
}

.friend-picker {
  max-height: 180px;
  overflow: auto;
  display: grid;
  gap: 0.45rem;
}

.friend-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.friend-modal-summary,
.forum-modal-posts {
  display: grid;
  gap: 0.65rem;
}

.forum-modal-post {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 0.75rem 0.8rem;
}

.profile-shell,
.forum-index-grid {
  display: grid;
  gap: 1rem;
}

.profile-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.profile-summary-card {
  background: transparent;
  border: 0;
  padding: 0;
}

.profile-side-by-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.profile-request-actions {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: flex-end;
}

.profile-request-btn {
  min-width: 82px;
}

.profile-request-btn.accept {
  border-color: rgba(70, 153, 108, 0.3);
  background: linear-gradient(180deg, rgba(229, 247, 235, 0.98), rgba(211, 239, 220, 0.96));
  color: #2b7650;
}

.profile-request-btn.accept:hover,
.profile-request-btn.accept:focus-visible {
  border-color: rgba(70, 153, 108, 0.42);
  background: linear-gradient(180deg, rgba(218, 242, 226, 1), rgba(197, 233, 209, 1));
  color: #246543;
}

.profile-request-btn.reject {
  border-color: rgba(190, 110, 83, 0.28);
  background: linear-gradient(180deg, rgba(251, 239, 233, 0.98), rgba(247, 224, 214, 0.96));
  color: #a65436;
}

.profile-request-btn.reject:hover,
.profile-request-btn.reject:focus-visible {
  border-color: rgba(190, 110, 83, 0.38);
  background: linear-gradient(180deg, rgba(250, 229, 221, 1), rgba(244, 212, 199, 1));
  color: #94472d;
}

.profile-contact-form {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  gap: 0.9rem 1rem;
  align-items: end;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.profile-contact-field {
  display: grid;
  gap: 0.35rem;
}

.profile-contact-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.profile-email-toggle {
  margin: 0;
  min-height: 42px;
}

.profile-privacy-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.profile-stats-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.profile-pie-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.profile-pie-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 0.95rem;
  display: grid;
  gap: 0.75rem;
}

.profile-pie-wrap {
  display: flex;
  justify-content: center;
}

.profile-pie-chart {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}

.profile-pie-chart::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.profile-pie-chart span {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
}

.profile-chart-stack {
  display: grid;
  gap: 0.9rem;
}

.profile-chart-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
  padding: 0.95rem;
  display: grid;
  gap: 0.7rem;
}

.profile-stacked-bar,
.profile-progress-rail {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eef3;
  display: flex;
}

.profile-stacked-bar span,
.profile-progress-rail span {
  display: block;
  height: 100%;
}

.profile-stacked-bar-win {
  background: linear-gradient(90deg, #3c8b63, #5aa879);
}

.profile-stacked-bar-loss {
  background: linear-gradient(90deg, #d9a05d, #e4b980);
}

.profile-stacked-bar-xp {
  background: linear-gradient(90deg, var(--accent), #63a9c6);
}

.profile-stacked-bar-alert {
  background: linear-gradient(90deg, #d16f55, #e38f7a);
}

.profile-stacked-bar-muted {
  background: linear-gradient(90deg, #dfe9ef, #edf3f7);
}

.profile-progress-rail span {
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #63a9c6);
}

.profile-progress-rail.activity span {
  background: linear-gradient(90deg, #dc8f32, #f3aa52);
}

.profile-chart-legend {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  color: var(--muted);
}

.profile-chart-legend.compact {
  font-size: 0.8rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 0.35rem;
}

.legend-dot.win {
  background: #3c8b63;
}

.legend-dot.loss {
  background: #d9a05d;
}

.legend-dot.xp {
  background: var(--accent);
}

.legend-dot.alert {
  background: #d16f55;
}

.legend-dot.muted {
  background: #c7d5de;
}

.profile-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.profile-chart-grid div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.7rem 0.75rem;
  display: grid;
  gap: 0.2rem;
}

.profile-chart-grid strong {
  font-size: 1.15rem;
}

.profile-team-card {
  align-items: start;
}

.profile-modal-color {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
}

.management-member-card {
  align-items: start;
}

.profile-team-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.forum-index-grid {
  grid-template-columns: 1.35fr 0.85fr;
}

.forum-admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: center;
}

.modal-content {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.teams-modal-dialog {
  max-width: 720px;
}

.leaderboard-modal-dialog {
  max-width: 720px;
}

.leaderboard-results-list {
  margin-top: 0.9rem;
}

.modal {
  z-index: 2000;
}

.modal-backdrop {
  z-index: 1990;
}

.modal-header {
  border-bottom-color: var(--line);
}

.modal-header-split {
  align-items: flex-start;
}

.modal-footer {
  border-top-color: var(--line);
}

.quick-join-body {
  display: grid;
  gap: 0.85rem;
  justify-items: center;
  text-align: center;
}

.quick-join-toggle {
  justify-content: flex-start;
  width: 100%;
  text-align: left;
}

.quick-join-bot-form {
  margin-right: auto;
}

.quick-join-bot-btn {
  min-width: 9.5rem;
}

.teams-results-list {
  margin-top: 0.9rem;
}

.teams-results-paging {
  margin-top: 1rem;
}

.create-team-trigger-btn,
.create-team-submit-btn {
  background: linear-gradient(180deg, #f3aa52, #dc8f32);
  border-color: #d28a34;
  color: #fff;
}

.create-team-trigger-btn:hover,
.create-team-submit-btn:hover {
  background: linear-gradient(180deg, #f6b568, #e49b42);
  border-color: #d99647;
  color: #fff;
}

@media (max-width: 900px) {
  .profile-contact-form,
  .profile-pie-grid,
  .profile-side-by-side {
    grid-template-columns: 1fr;
  }

  .profile-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

button[disabled],
.btn[disabled],
.mini-btn.disabled,
.clean-btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Tournament cards ───────────────────────────── */

.tournament-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.1rem;
  align-items: stretch;
}

.tournament-hero {
  align-items: stretch;
}

.tournament-hero-copy {
  display: grid;
  gap: 0.45rem;
  max-width: 62ch;
}

.tournament-hero-text {
  margin: 0;
  font-size: 0.95rem;
}

.tournament-hero-aside {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.75rem;
  width: auto;
}

.tournament-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.tournament-summary-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2rem;
}

.tournament-digital-countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 7.4rem;
  padding: 0.28rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(var(--shadow-rgb), 0.04);
  color: var(--text);
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  align-self: center;
  margin: 0;
}

.tournament-match-center {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.tournament-empty-state,
.tournament-registration-panel {
  display: grid;
  gap: 0.3rem;
}

.tournament-registration-panel {
  margin-bottom: 1rem;
  padding: 0.95rem 1rem;
}

.tournament-team-register-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.tournament-team-register-form .form-select {
  min-width: 220px;
  flex: 1 1 220px;
}

.tournament-match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem;
}

.tournament-match-card {
  display: grid;
  gap: 0.7rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 0.9rem;
}

.tournament-match-meta {
  display: grid;
  gap: 0.18rem;
  min-height: 3rem;
}

.tournament-match-meta span {
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 600;
}

.tournament-match-meta small,
.tournament-countdown-inline {
  color: var(--muted);
}

.tournament-match-slot {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.tournament-match-slot small {
  color: var(--muted);
}

.tournament-match-slot-winner {
  border-color: #8fc8a5;
  background: linear-gradient(180deg, #effaf3, #e4f5ea);
  box-shadow: inset 0 0 0 1px rgba(47, 128, 78, 0.08);
}

.tournament-match-slot-winner strong {
  color: #1f7c45;
}

.tournament-summary-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  box-shadow: 0 10px 24px rgba(var(--shadow-rgb), 0.12);
  padding: 0.9rem 1rem;
  display: grid;
  gap: 0.18rem;
  align-content: start;
}

.tournament-summary-card span,
.tournament-summary-card small {
  color: var(--muted);
}

.tournament-summary-card strong {
  color: var(--text);
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
}

.tournament-filter-bar {
  margin-bottom: 1rem;
}

.tournament-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tournament-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.tournament-filter-btn:hover {
  background: var(--button-hover-bg);
  border-color: var(--button-hover-border);
  color: var(--accent);
}

.tournament-filter-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--button-hover-border);
  color: var(--accent);
}

.tournament-lobby-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.tournament-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent) 0%, #1a5c78 100%);
}

.tournament-countdown-badge {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  z-index: 1;
  display: inline-grid;
  gap: 0.12rem;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  background: rgba(10, 18, 24, 0.74);
  color: #fff;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
  text-align: right;
}

.tournament-countdown-label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.tournament-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tournament-banner-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tournament-banner-text {
  font-family: "Fraunces", serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  padding: 1rem;
  text-align: center;
}

.tournament-card-body {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.tournament-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.tournament-card-title {
  font-family: "Fraunces", serif;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.tournament-card-desc {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

.tournament-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.tournament-card-meta span {
  padding: 0.15rem 0.5rem;
  background: var(--panel-soft);
  border-radius: 4px;
}

.tournament-card-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.45rem 0.8rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.countdown-value {
  font-weight: 600;
  font-family: "Manrope", monospace;
  color: inherit;
  font-size: 0.88rem;
}

.tournament-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: auto;
  padding-top: 0.4rem;
}

.text-accent { color: var(--accent); }

.tournament-empty-state {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}

.tournament-empty-state p,
.tournament-empty-state small {
  margin: 0;
}

.tournament-empty-state small {
  color: var(--muted);
}

/* ── Badges ─────────────────────────────────────── */

.badge-open {
  background: #dff6e9;
  color: #217c4a;
}

.badge-full {
  background: #fff3e0;
  color: #b5651d;
}

.badge-live {
  background: #ffe0e0;
  color: #c0392b;
  animation: pulse-badge 2s infinite;
}

.badge-ended {
  background: var(--panel-soft);
  color: var(--muted);
}

.badge-default {
  background: var(--panel-soft);
  color: var(--text);
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── Bracket display ────────────────────────────── */

.bracket-container {
  display: flex;
  gap: 2rem;
  overflow-x: auto;
  padding: 1rem 0;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 220px;
}

.bracket-round h4 {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.bracket-match {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.bracket-match-live {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.bracket-match-completed {
  opacity: 0.85;
}

.bracket-player {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.bracket-player:last-child {
  border-bottom: none;
}

.bracket-winner {
  font-weight: 600;
  background: linear-gradient(180deg, #effaf3, #e3f5ea);
  color: #1f7c45;
  box-shadow: inset 0 0 0 1px rgba(47, 128, 78, 0.12);
}

.bracket-score {
  font-weight: 600;
  color: var(--accent);
}

.bracket-section {
  display: block;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.2rem;
  background: var(--panel-soft);
}

/* ── Admin area ─────────────────────────────────── */

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

.admin-sidebar {
  position: sticky;
  top: 1rem;
}

.admin-center {
  display: grid;
  gap: 0;
}

.admin-tournament-head,
.admin-tournament-row {
  grid-template-columns: 1.8fr 0.9fr 0.9fr 0.7fr 1.1fr;
}

.admin-user-head,
.admin-user-table-row {
  grid-template-columns: 1.6fr 0.7fr 0.7fr 1.2fr;
}

.admin-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}

.admin-audit-stream {
  display: grid;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.admin-audit-item {
  display: grid;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 0.84rem;
}

.admin-audit-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.admin-audit-meta small {
  color: var(--muted);
  font-size: 0.76rem;
}

.tournament-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  font-size: 0.88rem;
}

.tournament-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.95fr);
  gap: 1rem;
}

.tournament-detail-main,
.tournament-detail-sidebar,
.tournament-detail-full {
  min-width: 0;
}

.tournament-detail-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tournament-detail-full {
  grid-column: 1 / -1;
}

.tournament-status-card {
  display: grid;
  justify-items: start;
  gap: 0.45rem;
  width: auto;
  min-width: 220px;
}

.tournament-champion-card {
  display: grid;
  justify-items: start;
  gap: 0.45rem;
  width: auto;
  min-width: 280px;
  border-color: rgba(214, 154, 46, 0.42);
  background:
    radial-gradient(circle at top right, rgba(255, 221, 137, 0.34), transparent 42%),
    linear-gradient(180deg, #fff8e8, #fff0cf);
  box-shadow: 0 14px 30px rgba(166, 116, 18, 0.14);
}

.tournament-champion-badge {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.5rem 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(191, 132, 28, 0.28);
  background: rgba(255, 255, 255, 0.72);
  color: #8a5a05;
  font-family: "Fraunces", serif;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.05;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 231, 0.75);
}

.tournament-status-card .badge {
  font-family: "Fraunces", serif;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--text);
}

.tournament-status-card .badge.badge-live {
  color: var(--status-live-text);
}

.tournament-status-card .badge.badge-open {
  color: var(--status-open-text);
}

.tournament-status-card .badge.badge-ended {
  color: var(--status-ended-text);
}

.tournament-status-card .badge.badge-default {
  color: var(--text);
}

.tournament-hero-aside {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: stretch;
  justify-content: flex-end;
}

.tournament-hero-aside > * {
  flex: 0 1 auto;
}

.tournament-hero-aside .card-surface {
  height: 100%;
}

.tournament-registration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.tournament-detail-layout .btn,
.tournament-detail-layout .mini-btn {
  box-shadow: 0 12px 24px rgba(var(--shadow-rgb), 0.16);
}

.tournament-detail-layout .btn:hover,
.tournament-detail-layout .mini-btn:hover {
  box-shadow: 0 14px 28px rgba(var(--shadow-rgb), 0.2);
}

.tournament-register-btn {
  min-width: 140px;
  justify-content: center;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(var(--shadow-rgb), 0.18);
}

.tournament-participants-list {
  gap: 0.65rem;
  max-height: 26rem;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.tournament-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.4rem;
}

.tournament-detail-item {
  display: grid;
  gap: 0.2rem;
  align-content: start;
}

.tournament-detail-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tournament-detail-value {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

/* ── Tournament filters ─────────────────────────── */

.tournament-filters .btn-group .btn {
  font-size: 0.82rem;
}

/* ── Header nav ─────────────────────────────────── */

.header-nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.nav-link-clean {
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0.75;
  transition: opacity 0.15s;
}

.nav-link-clean:hover {
  opacity: 1;
  color: var(--accent);
}

html[data-theme="dark"] .search-btn-icon,
html[data-theme="dark"] .status-icon,
html[data-theme="dark"] .notice-icon,
html[data-theme="dark"] .notification-icon,
html[data-theme="dark"] .lobby-tab-icon,
html[data-theme="dark"] .lobby-action-icon,
html[data-theme="dark"] .seat-invite-icon,
html[data-theme="dark"] .table-enter-icon,
html[data-theme="dark"] .table-leave-icon,
html[data-theme="dark"] .hand-action-icon {
  filter: brightness(1.04) contrast(1.08);
}

html[data-theme="dark"] .profile-link-btn,
html[data-theme="dark"] .forum-preview-trigger,
html[data-theme="dark"] .notification-link-btn,
html[data-theme="dark"] .theme-choice-btn {
  color: var(--text);
}

html[data-theme="dark"] .table-start-btn {
  border-color: rgba(114, 206, 106, 0.3);
  background: linear-gradient(180deg, rgba(21, 61, 27, 0.96), rgba(29, 86, 34, 0.94));
  color: #a8f0a4;
}

html[data-theme="dark"] .table-start-btn:hover,
html[data-theme="dark"] .table-start-btn:focus-visible {
  border-color: rgba(132, 224, 124, 0.38);
  background: linear-gradient(180deg, rgba(24, 73, 31, 0.98), rgba(35, 101, 41, 0.96));
  color: #bcf6b7;
}

html[data-theme="dark"] .table-leave-btn {
  border-color: rgba(211, 126, 100, 0.28);
  background: linear-gradient(180deg, rgba(65, 32, 24, 0.94), rgba(87, 40, 29, 0.92));
  color: #f1b39f;
}

html[data-theme="dark"] .table-leave-btn:hover,
html[data-theme="dark"] .table-leave-btn:focus-visible {
  border-color: rgba(226, 143, 117, 0.34);
  background: linear-gradient(180deg, rgba(76, 36, 27, 0.96), rgba(98, 47, 35, 0.94));
  color: #f6c2b2;
}

html[data-theme="dark"] .table-pause-btn {
  border-color: rgba(233, 171, 69, 0.28);
  background: linear-gradient(180deg, rgba(74, 48, 13, 0.94), rgba(98, 62, 16, 0.92));
  color: #f5ca85;
}

html[data-theme="dark"] .table-pause-btn:hover,
html[data-theme="dark"] .table-pause-btn:focus-visible {
  border-color: rgba(241, 185, 91, 0.36);
  background: linear-gradient(180deg, rgba(85, 55, 15, 0.96), rgba(111, 71, 19, 0.94));
  color: #f8d79f;
}

html[data-theme="dark"] .brand-logo-light {
  display: block;
  filter: brightness(0) invert(1);
}

html[data-theme="dark"] .brand-logo-dark {
  display: none;
}

html[data-theme="dark"] .nav-user-btn,
html[data-theme="dark"] .notification-btn,
html[data-theme="dark"] .panel-search-menu,
html[data-theme="dark"] .signed-in-dropdown,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .profile-chart-grid div,
html[data-theme="dark"] .bracket-match,
html[data-theme="dark"] .score-row,
html[data-theme="dark"] .friend-check,
html[data-theme="dark"] .forum-modal-post {
  box-shadow: 0 10px 24px rgba(var(--shadow-rgb), 0.32);
}

html[data-theme="dark"] .notification-item.is-unread,
html[data-theme="dark"] .team-policy-indicator,
html[data-theme="dark"] .xp-bar,
html[data-theme="dark"] .profile-stacked-bar,
html[data-theme="dark"] .profile-progress-rail,
html[data-theme="dark"] .profile-chart-grid div,
html[data-theme="dark"] .forum-modal-post,
html[data-theme="dark"] .friend-check,
html[data-theme="dark"] .notification-btn,
html[data-theme="dark"] .nav-user-btn {
  border-color: var(--line-strong);
}

html[data-theme="dark"] .notification-item.is-unread {
  background: #132733;
}

html[data-theme="dark"] .notifications-dropdown {
  background: var(--panel);
  border-color: var(--line-strong);
}

html[data-theme="dark"] .notification-item {
  background: #1c2a35;
  border-color: var(--line);
}

html[data-theme="dark"] .notification-link-btn strong {
  color: var(--text);
}

html[data-theme="dark"] .notification-link-btn span {
  color: #c5d8e4;
}

html[data-theme="dark"] .notification-link-btn small {
  color: var(--muted);
}

html[data-theme="dark"] .notifications-dropdown .notice-inline strong {
  color: var(--text);
}

html[data-theme="dark"] .notifications-dropdown .notice-inline span,
html[data-theme="dark"] .notifications-dropdown .notice-inline small {
  color: var(--muted);
}

html[data-theme="dark"] .notice-inline,
html[data-theme="dark"] .team-card,
html[data-theme="dark"] .rank-row,
html[data-theme="dark"] .forum-stream-item,
html[data-theme="dark"] .table-line,
html[data-theme="dark"] .player-summary-card,
html[data-theme="dark"] .seat-card,
html[data-theme="dark"] .chat-bubble,
html[data-theme="dark"] .history-item,
html[data-theme="dark"] .management-card,
html[data-theme="dark"] .admin-audit-item,
html[data-theme="dark"] .score-row {
  background: var(--panel-soft);
}

html[data-theme="dark"] .profile-stacked-bar,
html[data-theme="dark"] .profile-progress-rail,
html[data-theme="dark"] .xp-bar {
  background: var(--xp-rail);
}

html[data-theme="dark"] .table-access-pill.open {
  background: rgba(72, 189, 127, 0.18);
  border-color: rgba(72, 189, 127, 0.3);
  color: #95e4b5;
}

html[data-theme="dark"] .table-access-pill.invite-only {
  background: rgba(122, 166, 227, 0.18);
  border-color: rgba(122, 166, 227, 0.28);
  color: #b3d2ff;
}

html[data-theme="dark"] .profile-chart-grid div,
html[data-theme="dark"] .notification-btn,
html[data-theme="dark"] .nav-user-btn,
html[data-theme="dark"] .panel-search-menu,
html[data-theme="dark"] .signed-in-dropdown,
html[data-theme="dark"] .modal-content {
  background: var(--panel);
}

html[data-theme="dark"] .domino-back {
  background: linear-gradient(180deg, #223645, #1a2c37);
  border-color: #4b6778;
}

html[data-theme="dark"] .domino-mark {
  border-color: #83b7ce;
  background: repeating-linear-gradient(45deg, rgba(124, 195, 224, 0.25), rgba(124, 195, 224, 0.25) 3px, transparent 3px, transparent 6px);
}

html[data-theme="dark"] .table-pocket.active,
html[data-theme="dark"] .seat-card.current-turn,
html[data-theme="dark"] .hand-tile.selected .hand-domino,
html[data-theme="dark"] .bracket-match-live {
  box-shadow: 0 0 0 2px rgba(124, 195, 224, 0.22);
}

html[data-theme="dark"] .seat-card.current-turn {
  border-color: #5a9bb7;
  background: linear-gradient(180deg, rgba(23, 56, 70, 0.96), rgba(28, 69, 87, 0.94));
}

html[data-theme="dark"] .seat-card.current-turn .seat-info strong {
  color: #b5e6fb;
}

html[data-theme="dark"] .table-pocket.active {
  border-color: #5b8ba5;
}

html[data-theme="dark"] .create-team-trigger-btn,
html[data-theme="dark"] .create-team-submit-btn {
  color: #13202a;
}

html[data-theme="dark"] .badge-open {
  background: var(--status-open-bg);
  color: var(--status-open-text);
}

html[data-theme="dark"] .badge-full {
  background: var(--status-progress-bg);
  color: var(--status-progress-text);
}

html[data-theme="dark"] .badge-live {
  background: var(--status-closed-bg);
  color: var(--status-closed-text);
}

html[data-theme="dark"] .turn-timer-pill {
  border-color: rgba(76, 181, 234, 0.28);
  background: linear-gradient(180deg, rgba(18, 58, 77, 0.96), rgba(24, 78, 104, 0.94));
  color: #9de2ff;
  box-shadow: 0 12px 22px rgba(7, 23, 30, 0.28);
}

html[data-theme="dark"] .turn-timer-pill.is-urgent {
  border-color: rgba(234, 122, 101, 0.34);
  background: linear-gradient(180deg, rgba(79, 30, 24, 0.96), rgba(104, 38, 30, 0.94));
  color: #ffb8ab;
}

html[data-theme="dark"] .badge-ended,
html[data-theme="dark"] .badge-default,
html[data-theme="dark"] .bracket-section,
html[data-theme="dark"] .subtle-chip {
  background: var(--chip-bg);
  color: var(--chip-text);
}

html[data-theme="dark"] .bracket-winner {
  background: linear-gradient(180deg, #173126, #1d3b2d);
  color: #8fe0ad;
}

html[data-theme="dark"] .tournament-match-slot-winner {
  border-color: #356b4a;
  background: linear-gradient(180deg, #173126, #1d3b2d);
  box-shadow: inset 0 0 0 1px rgba(143, 224, 173, 0.08);
}

html[data-theme="dark"] .tournament-match-slot-winner strong {
  color: #8fe0ad;
}

html[data-theme="dark"] .tournament-champion-card {
  border-color: rgba(212, 171, 77, 0.38);
  background:
    radial-gradient(circle at top right, rgba(187, 138, 33, 0.2), transparent 42%),
    linear-gradient(180deg, rgba(66, 49, 17, 0.94), rgba(41, 31, 12, 0.98));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .tournament-champion-badge {
  border-color: rgba(214, 176, 86, 0.28);
  background: rgba(255, 243, 212, 0.08);
  color: #f2cf83;
  box-shadow: inset 0 0 0 1px rgba(255, 237, 198, 0.06);
}

html[data-theme="dark"] .tournament-countdown-badge {
  background: rgba(6, 11, 16, 0.82);
  border: 1px solid rgba(124, 195, 224, 0.18);
}

@media (max-width: 700px) {
  .hero-panel,
  .tournament-detail-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .tournament-hero-aside,
  .tournament-status-card {
    width: 100%;
  }

  .tournament-hero-aside {
    justify-items: stretch;
  }

  .tournament-card-grid {
    grid-template-columns: 1fr;
  }
  .bracket-container {
    flex-direction: column;
  }
  .header-nav {
    display: none;
  }

  .lobby-icon-tabs {
    gap: 0.45rem;
  }

  .lobby-icon-tabs .nav-link {
    min-height: 72px;
    padding: 0.6rem 0.35rem;
    font-size: 0.72rem;
  }

  .lobby-tab-icon {
    width: 24px;
    height: 24px;
  }

  .lobby-action-icon-btn {
    min-width: 88px;
    min-height: 72px;
  }
}

@media (max-width: 1280px) {
  .tournament-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .tournament-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .lobby-clean-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: auto;
  }

  .lobby-clean-grid > .center-column {
    order: 1;
    width: 100%;
  }

  .lobby-clean-grid > .lobby-tabs-shell {
    order: 2;
    width: 100%;
    position: static;
    min-height: auto;
  }
}
