:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1f2430;
  --text: #e6e6e6;
  --muted: #a8b0bd;
  --border: #2c3340;
  --green: #23c552;
  --blue: #3b82f6;
  --red: #ef4444;
  --yellow: #f59e0b;
  --gray: #6b7280;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  margin-top: 0;
  margin-bottom: 20px;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

button {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

.cards {
  display: grid;
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

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

.card-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.row {
  margin: 8px 0;
  color: var(--text);
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: bold;
  color: white;
  background: var(--gray);
  text-transform: capitalize;
}

.badge.online { background: var(--green); }
.badge.playing { background: var(--blue); }
.badge.offline { background: var(--red); }
.badge.updating { background: var(--yellow); color: black; }
.badge.unknown { background: var(--gray); }

.error {
  background: #3a1717;
  border: 1px solid #6b2222;
  color: #ffb4b4;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.hidden {
  display: none;
}

#lastFetch {
  color: var(--muted);
  font-size: 0.95rem;
}


.player-list {
  color: var(--muted);
  margin: 6px 0 10px 0;
  line-height: 1.45;
  word-break: break-word;
}


.server-card.tappable {
  cursor: pointer;
}

.mods-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.mods-header {
  margin-bottom: 10px;
  color: var(--text);
}

.mods-list {
  display: grid;
  gap: 10px;
}

.mod-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}

.mod-name {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.mod-meta {
  color: var(--muted);
  font-size: 0.92rem;
}


.copy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.copy-btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


.share-btn {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.share-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.copy-row strong {
  min-width: 110px;
}

#mainJoinCode,
#crossplayJoinCode {
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.copy-btn,
.share-btn {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.9rem;
  min-width: 72px;
}

@media (max-width: 600px) {
  .copy-row {
    align-items: flex-start;
  }

  .copy-row strong {
    width: 100%;
    min-width: 0;
    margin-bottom: 2px;
  }

  #mainJoinCode,
  #crossplayJoinCode {
    flex: 1 1 100%;
  }

  .copy-btn,
  .share-btn {
    flex: 0 0 auto;
  }
}

.join-block {
  margin: 10px 0 6px 0;
}

.join-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.join-actions .copy-btn,
.join-actions .share-btn {
  min-width: 88px;
}

.join-block {
  margin: 10px 0 8px 0;
}

.join-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
  width: 100%;
}

.join-actions-grid .copy-btn,
.join-actions-grid .share-btn {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.95rem;
}

.join-actions-grid .share-btn {
  border: 1px solid rgba(255,255,255,0.25);
}

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

.join-actions-flex .copy-btn {
  min-width: 90px;
}

.stale-warn {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 0.92rem;
  opacity: 0.95;
}

.hidden {
  display: none !important;
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.player-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 0.95rem;
  line-height: 1;
}

.player-empty {
  opacity: 0.72;
}

.recent-players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.recent-player-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055) 0%, rgba(255,255,255,0.02) 18%, rgba(0,0,0,0.06) 100%);
  border: 1px solid rgba(205,212,220,0.14);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.16),
    inset 0 -1px 0 rgba(0,0,0,0.30),
    0 4px 10px rgba(0,0,0,0.16),
    0 0 0 1px rgba(170,176,186,0.08);
}

.recent-player-name {
  font-weight: 500;
}

.recent-player-time {
  opacity: 0.72;
  white-space: nowrap;
}

.pulse-status {
  animation: pulseStatus 1.2s ease;
}

.pulse-join {
  animation: pulseJoin 1.5s ease;
}

.pulse-card {
  animation: pulseCard 1.5s ease;
}

@keyframes pulseStatus {
  0%   { transform: scale(1); box-shadow: 0 0 0 rgba(255,255,255,0); }
  35%  { transform: scale(1.05); box-shadow: 0 0 18px rgba(255,255,255,0.18); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(255,255,255,0); }
}

@keyframes pulseJoin {
  0%   { color: inherit; }
  35%  { color: #7fb3ff; }
  100% { color: inherit; }
}

@keyframes pulseCard {
  0%   { box-shadow: 0 0 0 rgba(127,179,255,0); }
  40%  { box-shadow: 0 0 0 2px rgba(127,179,255,0.22); }
  100% { box-shadow: 0 0 0 rgba(127,179,255,0); }
}

.join-new-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(88, 136, 255, 0.18);
  border: 1px solid rgba(88, 136, 255, 0.35);
  color: #9fc0ff;
  vertical-align: middle;
}

.pulse-status {
  animation: pulseStatus 1.2s ease;
}

.pulse-join {
  animation: pulseJoin 1.5s ease;
}

.pulse-players {
  animation: pulsePlayers 1.2s ease;
}

.pulse-card {
  animation: pulseCard 1.5s ease;
}

.pulse-join-badge {
  animation: pulseJoinBadge 1.2s ease;
}

@keyframes pulseStatus {
  0%   { transform: scale(1); box-shadow: 0 0 0 rgba(255,255,255,0); }
  35%  { transform: scale(1.05); box-shadow: 0 0 18px rgba(255,255,255,0.18); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(255,255,255,0); }
}

@keyframes pulseJoin {
  0%   { color: inherit; }
  35%  { color: #7fb3ff; }
  100% { color: inherit; }
}

@keyframes pulsePlayers {
  0%   { color: inherit; transform: scale(1); }
  35%  { color: #9fc0ff; transform: scale(1.04); }
  100% { color: inherit; transform: scale(1); }
}

@keyframes pulseCard {
  0%   { box-shadow: 0 0 0 rgba(127,179,255,0); }
  40%  { box-shadow: 0 0 0 2px rgba(127,179,255,0.22); }
  100% { box-shadow: 0 0 0 rgba(127,179,255,0); }
}

@keyframes pulseJoinBadge {
  0%   { transform: scale(0.95); opacity: 0.6; }
  40%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055) 0%, rgba(255,255,255,0.02) 18%, rgba(0,0,0,0.06) 100%);
  border: 1px solid rgba(205,212,220,0.14);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.16),
    inset 0 -1px 0 rgba(0,0,0,0.30),
    0 4px 10px rgba(0,0,0,0.16),
    0 0 0 1px rgba(170,176,186,0.08);
}

.history-text {
  font-weight: 500;
}

.history-time {
  opacity: 0.72;
  white-space: nowrap;
}

.history-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
}

.history-chevron {
  opacity: 0.8;
}

.history-wrap {
  margin-top: 8px;
}

.app-footer {
  margin: 22px 0 10px 0;
  padding: 14px 8px 24px 8px;
  text-align: center;
  opacity: 0.78;
}

.app-footer-line {
  font-size: 0.95rem;
  line-height: 1.5;
}

.app-title-block {
  text-align: center;
  margin: 6px 0 18px 0;
}

.app-title-main {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 6px;
}

.app-title-sub {
  font-size: 1.15rem;
  font-weight: 600;
  opacity: 0.88;
  line-height: 1.2;
}

.app-footer-note {
  margin-top: 6px;
  font-size: 0.82rem;
  line-height: 1.4;
  opacity: 0.62;
}

.actions-no-button {
  justify-content: center;
}

.actions-no-button #lastFetch {
  margin-left: 0;
}

.footer-admin-link {
  color: inherit;
  text-decoration: none;
  opacity: 0.72;
}

.footer-admin-link:hover,
.footer-admin-link:focus {
  text-decoration: underline;
}


.top-view-switch {
  display: flex;
  gap: 10px;
  margin: 18px 0 18px 0;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.top-view-btn,
.activity-server-btn {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 12px 14px;
  background: transparent;
  color: #bfc7d8;
  font: inherit;
  font-weight: 700;
}

.top-view-btn.active,
.activity-server-btn.active {
  background: linear-gradient(180deg, #24344f 0%, #182338 100%);
  color: #eef4ff;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset, 0 8px 24px rgba(0,0,0,0.22);
}

.activity-page.hidden {
  display: none;
}

.activity-page-header {
  margin: 0 0 14px 0;
}

.activity-page-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.activity-page-subtitle {
  margin-top: 6px;
  color: #9ca7bc;
  font-size: 14px;
}

.activity-server-switch {
  display: flex;
  gap: 10px;
  margin: 0 0 16px 0;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.activity-feed-card {
  border-radius: 24px;
  padding: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

.activity-feed-head {
  margin-bottom: 12px;
}

.activity-feed-title {
  font-size: 22px;
  font-weight: 800;
}

.activity-feed-body .history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-feed-empty {
  color: #9ca7bc;
}


.activity-item {
  position: relative;
  overflow: hidden;
}

.activity-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 999px;
  opacity: 0.95;
}

.activity-join {
  background: linear-gradient(180deg, rgba(80,170,110,0.12) 0%, rgba(255,255,255,0.02) 100%);
}
.activity-join::before {
  background: #62d27c;
}

.activity-leave {
  background: linear-gradient(180deg, rgba(140,150,165,0.10) 0%, rgba(255,255,255,0.02) 100%);
}
.activity-leave::before {
  background: #9aa4b6;
}

.activity-kill {
  background: linear-gradient(180deg, rgba(185,75,75,0.13) 0%, rgba(255,255,255,0.02) 100%);
}
.activity-kill::before {
  background: #e06a6a;
}

.activity-hideout {
  background: linear-gradient(180deg, rgba(80,120,210,0.13) 0%, rgba(255,255,255,0.02) 100%);
}
.activity-hideout::before {
  background: #73a0ff;
}

.activity-hq {
  background: linear-gradient(180deg, rgba(200,150,70,0.13) 0%, rgba(255,255,255,0.02) 100%);
}
.activity-hq::before {
  background: #f0b35a;
}

.activity-generic {
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
}
.activity-generic::before {
  background: #6f7b91;
}


.activity-dev-tools {
  margin: 0 0 16px 0;
  border-radius: 20px;
  padding: 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}

.activity-dev-tools-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #dfe7ff;
  margin-bottom: 12px;
}

.activity-dev-tools-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.activity-dev-btn {
  border: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(180deg, #24344f 0%, #182338 100%);
  color: #eef4ff;
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
}

.activity-dev-btn.danger {
  border-color: rgba(224,106,106,0.35);
  background: linear-gradient(180deg, rgba(130,45,45,0.95) 0%, rgba(92,28,28,0.95) 100%);
}

.activity-dev-tools-status {
  margin-top: 10px;
  color: #9ca7bc;
  font-size: 13px;
  min-height: 18px;
}


.activity-dev-tools-status {
  margin-top: 10px;
  color: #9ca7bc;
  font-size: 13px;
  min-height: 18px;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.activity-dev-tools-status.status-working {
  color: #b8c7e6;
}

.activity-dev-tools-status.status-success {
  color: #7ee08f;
}

.activity-dev-tools-status.status-error {
  color: #f08a8a;
}
