/* Age of Empires I: Definitive Edition Authentic Web Theme (Responsive Desktop + Tablet + Mobile) */

:root {
  --outer-brown: #8f5938;
  --outer-brown-dark: #59371e;
  --parchment-mid: #dfbc89;
  --parchment-edge: #c49260;
  --header-bg: #333a3e;
  --slate-dark: #373f42;
  --slate-light: #4d565a;
  --slate-panel: #464d53;
  --slate-deep: #1b2126;
  --slate-sel: #5b676e;
  --gold-divider: #b89056;
  --gold-border: #a58259;
  --gold-bright: #e0b15c;
  --gold-text: #f1c98a;
  --gold-selected: #feae1a;
  --btn-blue-edge: #29454c;
  --btn-blue-mid: #3b84b1;
  --btn-blue-glow: #58a6d5;
  --input-bg: #f5f3ef;
  --input-fg: #1e2326;
  --fg-white: #f4f6f7;
  --fg-muted: #c5ccd1;
  --green: #4ade80;
  --red: #fb7185;
  --font-ui: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-mono: "Consolas", "Cascadia Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-ui);
  color: var(--fg-white);
  background: radial-gradient(circle at 50% 35%, var(--parchment-mid), var(--parchment-edge) 85%);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

/* Outer Carved Bronze Frame */
.aoe-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  border: 6px solid var(--outer-brown);
  outline: 2px solid var(--outer-brown-dark);
  outline-offset: -8px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 240, 205, 0.25), transparent 70%),
    linear-gradient(180deg, #deb883 0%, #d4a872 100%);
}

/* Top Beveled Title Plaque */
.aoe-banner-wrap {
  display: flex;
  justify-content: center;
  padding: 6px 12px 4px;
  flex-shrink: 0;
}

.aoe-banner {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 6px 34px;
  border-radius: 999px;
  background: linear-gradient(180deg, #36393e 0%, #5c6166 45%, #32383d 100%);
  border: 2px solid #c89e5a;
  box-shadow: 0 3px 10px rgba(35, 20, 8, 0.45), inset 0 1px 0 rgba(255, 232, 180, 0.35);
}

.aoe-banner h1 {
  font-size: clamp(15px, 2.2vw, 22px);
  font-weight: 800;
  color: #ffffff;
  text-shadow: 1px 2px 3px rgba(0, 0, 0, 0.75);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.banner-rivet {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f5d38c, #8c6530);
  border: 1.5px solid #3f2b18;
  flex-shrink: 0;
}

/* Interior Stage */
.aoe-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 14px 8px;
  gap: 7px;
}

/* Metallic Steel-Blue AoE Button */
.aoe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  text-shadow: 1px 1px 2px rgba(10, 20, 25, 0.85);
  background:
    radial-gradient(ellipse at 50% 35%, var(--btn-blue-glow), var(--btn-blue-mid) 55%, var(--btn-blue-edge) 100%);
  border: 2px solid #b89352;
  box-shadow: inset 0 0 0 1px #1f3138, 0 2px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  user-select: none;
  transition: filter 0.12s, transform 0.08s;
  white-space: nowrap;
}

.aoe-btn:hover:not(:disabled) {
  filter: brightness(1.16);
  border-color: #efc778;
}

.aoe-btn:active:not(:disabled) {
  transform: translateY(1px);
  filter: brightness(0.92);
}

.aoe-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.aoe-btn.success-flash {
  background: radial-gradient(ellipse at 50% 35%, #4ecc84, #2a945a 60%, #184e30 100%) !important;
  border-color: #ffe082 !important;
}

.aoe-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.aoe-btn-xs {
  padding: 4px 9px;
  font-size: 11px;
}

/* Row 1: Filter Bar */
.toolbar-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-shrink: 0;
}

.filter-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--header-bg);
  border: 2px solid var(--gold-border);
  box-shadow: inset 0 0 0 1px #202528;
  padding: 4px 10px;
}

.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-text);
}

.filter-search {
  flex: 0 1 210px;
  width: 210px;
  min-width: 140px;
}

.filter-auto {
  gap: 4px;
}

.aoe-spin {
  width: 54px !important;
  text-align: center;
  padding: 3px 4px;
  font-family: var(--font-mono);
}

.sec-unit {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-muted);
}

.filter-lang {
  margin-left: auto;
}

.aoe-input, .aoe-select {
  background: var(--input-bg);
  color: var(--input-fg);
  border: 1.5px solid var(--gold-border);
  padding: 4px 8px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
  border-radius: 2px;
}

.aoe-input {
  width: 100%;
}

.aoe-input:focus, .aoe-select:focus {
  border-color: var(--gold-selected);
  box-shadow: 0 0 0 2px rgba(254, 174, 26, 0.25);
}

.aoe-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-text);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.aoe-check input {
  accent-color: var(--gold-selected);
  width: 14px;
  height: 14px;
}

/* Row 2: Tab Bar */
.tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.tabs-left, .tabs-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tab-btn {
  background: var(--header-bg);
  color: var(--fg-muted);
  border: 2px solid var(--gold-border);
  box-shadow: 0 1px 0 var(--outer-brown-dark);
  padding: 5px 14px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.tab-btn:hover {
  color: var(--gold-text);
}

.tab-btn.active {
  background: #493b24;
  color: var(--gold-selected);
  border-color: var(--gold-selected);
}

.tab-btn.live-hot:not(.active) {
  color: #ff8a80;
}

.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--header-bg);
  border: 2px solid var(--gold-border);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #fef08a;
}

.dot-green {
  color: var(--green);
  font-size: 12px;
}

.download-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, #1d643d 0%, #14462a 100%);
  border: 2px solid #4ade80;
  color: #fef08a;
  text-decoration: none;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.12s;
}

.download-pill:hover {
  filter: brightness(1.15);
}

/* Mobile Sub-Tab Switcher (Hidden on Desktop/Tablet >= 768px) */
.mobile-subtabs {
  display: none;
  gap: 6px;
  flex-shrink: 0;
}

.msub-btn {
  flex: 1;
  background: var(--header-bg);
  color: var(--fg-muted);
  border: 2px solid var(--gold-border);
  padding: 7px 6px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.msub-btn.active {
  background: #493b24;
  color: var(--gold-selected);
  border-color: var(--gold-selected);
}

/* Panel Container (Gold Border + Dark Bevel) */
.panel-box {
  background: var(--slate-panel);
  border: 2px solid var(--gold-border);
  outline: 2px solid var(--outer-brown-dark);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.panel-hdr {
  background: var(--header-bg);
  color: var(--fg-white);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 6px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.gold-divider {
  height: 2px;
  background: var(--gold-divider);
  flex-shrink: 0;
}

/* Main Split Layout */
.main-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 0;
}

.left-col {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lobbies-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lobby-panel {
  flex: 13;
  background: var(--slate-dark);
}

.player-panel {
  flex: 9;
  background: var(--slate-panel);
}

.bottom-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex-shrink: 0;
}

/* Drag Resizers */
.h-resizer {
  width: 12px;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.h-resizer::after {
  content: "";
  width: 4px;
  height: 44px;
  border-radius: 3px;
  background: #6b4827;
  border: 1px solid var(--gold-bright);
}

.v-resizer {
  height: 9px;
  cursor: row-resize;
  background: #5b472d;
  border-top: 1px solid var(--gold-border);
  border-bottom: 1px solid #2b2114;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.v-resizer::after {
  content: "";
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: var(--gold-bright);
}

/* Tables */
.table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.aoe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.aoe-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--header-bg);
  color: var(--fg-white);
  font-weight: 700;
  text-align: left;
  padding: 7px 8px;
  border-bottom: 2px solid var(--gold-divider);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.aoe-table thead th:hover {
  color: var(--gold-bright);
}

.aoe-table tbody tr {
  background: var(--slate-dark);
  color: var(--gold-text);
  cursor: pointer;
  transition: background 0.08s;
}

.aoe-table tbody tr:nth-child(odd) {
  background: var(--slate-light);
}

.aoe-table tbody tr:hover {
  background: #556168;
}

.aoe-table tbody tr.selected {
  background: #65522f !important;
  color: #ffffff;
}

.aoe-table tbody tr.full-room {
  color: #cbb590;
}

.aoe-table tbody td {
  padding: 6px 8px;
  white-space: nowrap;
  border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}

.aoe-table td.num, .aoe-table th.num {
  text-align: center;
  font-family: var(--font-mono);
}

.elo-cell {
  color: var(--gold-selected);
  font-family: var(--font-mono);
  font-weight: 700;
  text-align: center;
}

.wr-hi { color: var(--green); font-weight: 700; }
.wr-lo { color: var(--red); font-weight: 700; }

.bind-chk {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.bind-ally { accent-color: #4ade80; }
.bind-enemy { accent-color: #fb7185; }

/* Mobile Room Cards (Hidden on Desktop) */
.mobile-cards {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  gap: 8px;
  flex-direction: column;
}

.room-card {
  background: var(--slate-light);
  border: 1.5px solid var(--gold-border);
  padding: 9px 11px;
  border-radius: 3px;
  cursor: pointer;
}

.room-card.selected {
  background: #5e4b2a;
  border-color: var(--gold-selected);
}

.room-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.room-card-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--gold-selected);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-card-players {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--green);
  flex-shrink: 0;
}

.room-card-meta {
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

/* Right Tool Panel */
.right-panel {
  width: 390px;
  flex-shrink: 0;
}

.right-stack {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.right-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 6px 8px;
  gap: 5px;
  overflow: hidden;
}

.pane-group {
  flex: 0 0 47%;
  min-height: 160px;
}

.pane-pinfo {
  flex: 0 0 15%;
  min-height: 68px;
}

.pane-chat {
  flex: 1 1 38%;
  min-height: 130px;
}

.sec-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
}

.sec-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-text);
}

.sec-fair {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--green);
}

/* Option Selector Pills */
.opt-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  flex-shrink: 0;
}

.opt-pill {
  background: var(--header-bg);
  color: var(--fg-muted);
  border: 1.5px solid var(--gold-border);
  padding: 3px 6px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.opt-pill.active {
  background: #493b24;
  color: var(--gold-selected);
  border-color: var(--gold-selected);
}

.opt-pill:disabled {
  opacity: 0.4;
  cursor: default;
}

.fairness-track {
  height: 6px;
  background: var(--slate-deep);
  border: 1px solid var(--gold-border);
  overflow: hidden;
  flex-shrink: 0;
}

.fairness-fill {
  height: 100%;
  background: #22c55e;
  transition: width 0.2s;
}

/* High-Visibility Colorful Team Split Output */
.group-output {
  flex: 1;
  min-height: 44px;
  overflow: auto;
  background: var(--slate-deep);
  border: 1.5px solid var(--gold-border);
  padding: 7px 9px;
  line-height: 1.55;
}

.go-code-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 3px;
}

.go-pat {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  color: #ffd166;
}

.go-sep {
  color: #64748b;
  font-weight: 700;
}

.go-vs-code {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  color: #38bdf8;
}

.go-carry-badge {
  background: #4a1d36;
  color: #f9a8d4;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 3px;
}

.go-totals {
  font-size: 13.5px;
  font-weight: 800;
  margin-bottom: 4px;
}

.go-t1 { color: #60a5fa; }
.go-t2 { color: #fb7185; }
.go-diff-good { color: #4ade80; }
.go-diff-mid { color: #facc15; }
.go-diff-hi { color: #fb923c; }

.go-pair-line {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  margin-bottom: 2px;
}

.tier-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 0 5px;
  border-radius: 3px;
  margin-right: 5px;
}

.tier-1 { background: #3a2d12; color: #fbbf24; }
.tier-2 { background: #133142; color: #38bdf8; }
.tier-3 { background: #11352a; color: #34d399; }
.tier-4 { background: #2d1c42; color: #c084fc; }
.tier-c1 { background: #123045; color: #7dd3fc; }
.tier-c2 { background: #451926; color: #fda4af; }

.go-p1 { color: #bae6fd; }
.go-p2 { color: #fecdd3; }
.go-elo { color: #fde047; font-family: var(--font-mono); }
.go-vs-kw { color: #f59e0b; font-size: 12px; margin: 0 4px; }
.go-op { color: #94a3b8; margin: 0 3px; }
.go-hint { color: var(--fg-muted); font-size: 12.5px; white-space: pre-line; }

.group-actions {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 6px;
  flex-shrink: 0;
}

.bind-hint {
  font-size: 11px;
  color: var(--gold-text);
  flex-shrink: 0;
}

.f2-callout {
  background: #332614;
  border: 1px solid var(--gold-selected);
  color: #ffd166;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 3px 6px;
  flex-shrink: 0;
}

/* Player Info Pane */
.pinfo-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pinfo-input {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  font-size: 12px;
}

.pinfo-output {
  flex: 1;
  min-height: 30px;
  overflow: auto;
  background: var(--slate-deep);
  border: 1px solid var(--gold-border);
  color: var(--fg-white);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.4;
  padding: 5px 7px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Shared Twitch-Style Community Chat */
.chat-status {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold-text);
}

.chat-status.online {
  color: var(--green);
}

.chat-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.chat-color-dot {
  background: var(--slate-deep);
  border: 1px solid var(--gold-border);
  font-size: 15px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}

.chat-name-lbl {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--fg-muted);
  white-space: nowrap;
}

.chat-name-inp {
  flex: 1;
  min-width: 0;
  padding: 3px 7px;
  font-size: 12px;
}

.chat-feed {
  flex: 1;
  min-height: 44px;
  overflow-y: auto;
  background: #181c20;
  border: 1px solid var(--gold-border);
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.chat-line {
  margin-bottom: 3px;
}

.chat-ts {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #8b949e;
  margin-right: 5px;
}

.chat-user {
  font-weight: 800;
}

.chat-text {
  color: #efeff1;
}

.chat-sys {
  color: #fbbf24;
  font-size: 12px;
  font-style: italic;
  margin-bottom: 4px;
}

.chat-msg-row {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.chat-msg-inp {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  font-size: 13px;
}

/* Leaderboard View */
.lb-view {
  flex: 1;
  background: var(--slate-dark);
}

.lb-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--header-bg);
  padding: 7px 10px;
}

.lb-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fg-white);
}

.lb-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lb-search {
  width: 180px;
}

.lb-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  border-top: 1px solid var(--gold-divider);
  padding: 6px 10px;
}

.lb-page-info {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-text);
}

.lb-top3 {
  background: #4d4430 !important;
  color: var(--gold-selected) !important;
}

/* Live Twitch View */
.live-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
}

.live-player-col {
  flex: 1;
  background: var(--slate-deep);
}

.live-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--header-bg);
  padding: 6px 10px;
}

.live-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-selected);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-hdr-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.twitch-player-wrap {
  flex: 1;
  min-height: 220px;
  background: #0e1013;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.twitch-player-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.twitch-placeholder {
  text-align: center;
  padding: 20px;
}

.tw-ph-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold-selected);
  margin-bottom: 6px;
}

.tw-ph-sub {
  font-size: 13px;
  color: var(--fg-muted);
}

.live-foot {
  background: var(--header-bg);
  border-top: 1px solid var(--gold-divider);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--gold-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-list-col {
  width: 360px;
  flex-shrink: 0;
}

.live-search-row {
  display: flex;
  gap: 6px;
  padding: 8px;
  flex-shrink: 0;
}

.twitch-channel-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tw-card {
  background: var(--slate-dark);
  border: 1.5px solid var(--gold-border);
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.12s;
}

.tw-card:hover {
  background: var(--slate-light);
}

.tw-card.active {
  background: #4e3f24;
  border-color: var(--gold-selected);
}

.tw-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.tw-name {
  font-weight: 800;
  font-size: 13px;
  color: var(--fg-white);
}

.tw-viewers {
  font-size: 11.5px;
  font-weight: 700;
  color: #ff8a80;
  white-space: nowrap;
}

.tw-desc {
  font-size: 12px;
  color: var(--fg-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.live-list-foot {
  padding: 8px;
  text-align: center;
  border-top: 1px solid var(--gold-divider);
  flex-shrink: 0;
}

/* Status Footer */
.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--outer-brown-dark);
  color: var(--gold-text);
  font-size: 11.5px;
  padding: 4px 14px;
  flex-shrink: 0;
}

.status-mid {
  color: var(--fg-white);
  font-weight: 700;
}

.status-right strong {
  color: var(--gold-selected);
}

/* Team Detail Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(12, 10, 8, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-box {
  width: min(820px, 100%);
  max-height: 90dvh;
  background: var(--slate-panel);
  border: 2px solid var(--gold-selected);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  padding: 10px 14px;
  font-weight: 800;
  font-size: 14px;
  color: var(--gold-selected);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--fg-white);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
}

.modal-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-codes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.detail-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.detail-code-pill {
  background: var(--slate-deep);
  border: 1.5px solid var(--gold-border);
  color: var(--gold-selected);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  padding: 5px 14px;
}

.detail-opts {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-fair-card {
  background: var(--slate-dark);
  border: 1.5px solid var(--gold-border);
  padding: 10px 14px;
}

.detail-fair-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.detail-carry-line {
  margin-top: 6px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-selected);
}

.detail-teams-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
}

.detail-team-card {
  background: var(--slate-dark);
  border: 1.5px solid var(--gold-border);
  padding: 12px;
}

.detail-team-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.detail-team-title {
  font-size: 15px;
  font-weight: 800;
}

.detail-weaker {
  background: #3a3324;
  border: 1px solid var(--gold-border);
  color: var(--gold-text);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
}

.detail-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--slate-deep);
  border: 1px solid var(--gold-border);
  padding: 7px 9px;
  margin-top: 6px;
}

.detail-vs-badge {
  align-self: center;
  background: var(--header-bg);
  border: 2px solid var(--gold-selected);
  color: var(--gold-selected);
  font-weight: 800;
  padding: 6px 10px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 38px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #14462a;
  color: #fef08a;
  border: 2px solid #4ade80;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

/* Custom Dark Gold Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #23282c;
}

::-webkit-scrollbar-thumb {
  background: var(--gold-border);
  border-radius: 3px;
}

/* ==================== TABLET RESPONSIVE (768px - 1024px) ==================== */
@media (max-width: 1024px) {
  html, body {
    overflow: auto;
    height: auto;
    min-height: 100dvh;
  }

  .aoe-shell {
    height: auto;
    min-height: 100dvh;
    border-width: 4px;
  }

  .h-resizer, .v-resizer {
    display: none;
  }

  .main-body {
    flex-direction: column;
    gap: 10px;
  }

  .lobby-panel {
    min-height: 290px;
    max-height: 44dvh;
  }

  .player-panel {
    min-height: 220px;
    max-height: 38dvh;
  }

  .right-panel {
    width: 100% !important;
  }

  .right-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px;
  }

  .pane-group {
    grid-column: 1 / -1;
    flex: none !important;
  }

  .pane-pinfo, .pane-chat {
    flex: none !important;
    min-height: 220px;
    max-height: 300px;
  }

  .live-body {
    flex-direction: column;
  }

  .twitch-player-wrap {
    aspect-ratio: 16 / 9;
    min-height: 260px;
  }

  .live-list-col {
    width: 100%;
    max-height: 380px;
  }
}

/* ==================== MOBILE RESPONSIVE (< 768px) ==================== */
@media (max-width: 767px) {
  .aoe-shell {
    border-width: 3px;
    outline: none;
  }

  .aoe-banner {
    padding: 5px 18px;
    gap: 8px;
  }

  .aoe-stage {
    padding: 4px 8px 8px;
    gap: 6px;
  }

  .toolbar-row {
    flex-direction: column;
    gap: 6px;
  }

  .hide-xs {
    display: none !important;
  }

  .filter-bar {
    padding: 6px;
    gap: 6px;
  }

  .filter-search {
    flex: 1 1 100%;
    width: 100%;
  }

  .filter-lang {
    margin-left: 0;
  }

  .tab-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .tabs-left {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }

  .tab-btn {
    padding: 7px 4px;
    font-size: 11.5px;
    text-align: center;
  }

  .tabs-right {
    justify-content: space-between;
  }

  .online-pill, .download-pill {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
    font-size: 11.5px;
  }

  /* Show clean 3-tab mobile switcher for Lobbies / Team / Chat */
  .mobile-subtabs {
    display: flex;
  }

  /* Switch Lobby table to crisp mobile cards */
  #lobbyTable {
    display: none;
  }

  #lobbyCards {
    display: flex;
  }

  .lobby-panel {
    min-height: 240px;
    max-height: 46dvh;
  }

  .player-panel {
    min-height: 200px;
    max-height: 40dvh;
  }

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

  .bottom-actions #btnClearBinds {
    grid-column: 1 / -1;
  }

  /* Mobile panel visibility controlled by body[data-msub] */
  body[data-msub="rooms"] .right-panel {
    display: none;
  }

  body[data-msub="team"] #leftCol,
  body[data-msub="chat"] #leftCol {
    display: none;
  }

  body[data-msub="team"] .right-stack,
  body[data-msub="chat"] .right-stack {
    display: flex;
    flex-direction: column;
  }

  body[data-msub="team"] #paneChat {
    display: none;
  }

  body[data-msub="chat"] #paneGroup,
  body[data-msub="chat"] #panePinfo {
    display: none;
  }

  body[data-msub="chat"] #paneChat {
    min-height: 58dvh;
    max-height: 70dvh;
  }

  .detail-teams-grid {
    grid-template-columns: 1fr;
  }

  .detail-vs-badge {
    justify-self: center;
  }

  .status-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-size: 11px;
  }
}
