@keyframes castleShake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-8px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(8px);
  }
}

@keyframes wallShake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-8px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(8px);
  }
}

.shake-castle {
  animation: castleShake 0.6s ease-in-out;
}

.shake-wall {
  animation: wallShake 0.6s ease-in-out;
}

@keyframes resourceFlash {
  0% {
    opacity: 1;
    transform: scale(1.3);
    font-weight: bold;
  }
  75% {
    opacity: 1;
    transform: scale(1) translateY(-25px);
    font-weight: bold;
  }
  100% {
    opacity: 0;
    transform: scale(1) translateY(-25px);
  }
}

.resource-diff {
  position: absolute;
  right: -30px;
  top: -5px;
  font-size: 0.85em;
  font-weight: bold;
  animation: resourceFlash 3.5s ease-out forwards;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

a:hover {
  cursor: pointer;
}

.flexcol {
  flex-direction: column;
}

.flexcolrev {
  flex-direction: column-reverse;
}

.flexrow {
  flex-direction: row;
}

.flexrowrev {
  flex-direction: row-reverse;
}

.install-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1d3557;
  color: #f1faee;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition:
    background-color 0.3s,
    transform 0.2s;
}

.install-button .icon {
  margin-right: 8px;
  font-size: 20px;
}

.install-button:hover {
  background-color: #457b9d;
}

.install-button:active {
  transform: scale(0.95);
}

#install-container {
  display: none;
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 1000;
}

.install-dismiss {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #e63946;
  color: white;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
}

.install-dismiss:hover {
  background: #c1121f;
}

/* Hide install prompt when already running as installed PWA */
@media (display-mode: standalone) {
  #install-container {
    display: none !important;
  }
}

.tutorial-button-container {
  display: flex;
  justify-content: space-around;
}

/* Tutorial Styles */
.tutorial-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 900px;
  margin: 20px auto;
  padding: 0 20px;
}

.tutorial-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-info {
  text-align: center;
}

.progress-text {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #a8dadc, #457b9d);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.tutorial-panel {
  padding: 40px 50px;
}

.tutorial-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 30px 0;
  color: var(--text);
  text-align: center;
}

.tutorial-image-container {
  margin: 30px 0;
  text-align: center;
  display: flex;
  justify-content: center;
}

.tutorial-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.tutorial-image:hover {
  transform: scale(1.02);
}

.tutorial-description {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
  margin: 30px 0;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
}

.tutorial-nav {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 30px;
}

.tutorial-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.tutorial-btn {
  padding: 12px 30px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  display: inline-block;
  text-align: center;
}

.tutorial-btn-primary {
  background-color: #457b9d;
  color: white;
  flex: 1;
  min-width: 150px;
}

.tutorial-btn-primary:hover {
  background-color: #2c5073;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tutorial-btn-secondary {
  background-color: rgba(168, 218, 220, 0.3);
  color: var(--text);
  flex: 1;
  min-width: 150px;
  border: 1px solid var(--text);
}

.tutorial-btn-secondary:hover {
  background-color: rgba(168, 218, 220, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tutorial-btn-success {
  background: linear-gradient(135deg, #06a77d, #059a6f);
  color: white;
  width: 100%;
  margin-top: 15px;
  font-size: 1.1rem;
  padding: 14px 30px;
}

.tutorial-btn-success:hover {
  background: linear-gradient(135deg, #059a6f, #047d58);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(6, 168, 125, 0.3);
}

/* ==================== NAVBAR - MODERN REDESIGN ==================== */

.navbar {
  padding: 0;
  overflow: visible;
  background: var(--navbar-bg);
  background-blend-mode: var(--navbar-blend-mode);
  box-shadow:
    inset 0 -3px 6px rgba(0, 0, 0, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.6);
  position: sticky;
  top: 0;
  z-index: 1000;
  font-family: "Cinzel", serif;
}

.navbar-bracket {
  position: absolute;
  top: -5px;
  height: calc(100% + 10px);
  width: auto;
  pointer-events: none;
  z-index: 2;
  filter:
    drop-shadow(1px 0 0 rgba(0, 0, 0, 0.8))
    drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.8))
    drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.navbar-bracket-l {
  left: -8px;
}

.navbar-bracket-r {
  right: -8px;
  transform: scaleX(-1);
}


.navbar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
  z-index: 1;
}

.navbar-inner {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 6px;
  padding: 6px 18px;
  border-radius: 6px;
}

/* ===== Left Section - Branding ===== */
.navbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.navbar-brand:hover {
  transform: scale(1.05);
}

.navbar-logo {
  width: 40px;
  height: 40px;
  filter: brightness(0) invert(1) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
}

.navbar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.game-name {
  color: #e6e0d5;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 2px 2px 0 #1a0a00, 1px 1px 0 #3a1a00;
}

.navbar-version {
  color: rgba(241, 250, 238, 0.75);
  font-size: 0.7rem;
  font-weight: 400;
  font-family: "Inter", sans-serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.navbar-online {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: none;
  border-radius: 0;
  font-size: 0.85rem;
  font-family: "Inter", sans-serif;
}

.navbar-online-dot {
  font-size: 0.5rem;
  color: #39ff6a;
  filter: drop-shadow(0 0 4px #39ff6a);
  animation: pulse 2s infinite;
}

.navbar-online-icon {
  font-size: 0.75rem;
  color: #f5ead8;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.9));
}

.navbar-online-count {
  color: #ffffff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
  font-weight: 600;
}

.navbar-online-trend {
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
  transition: color 0.3s ease;
}

.navbar-online-trend.trend-up   { color: #39ff6a; }
.navbar-online-trend.trend-down { color: #ff4d4d; }

/* ===== Center Section - Main Navigation ===== */
.navbar-center {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
  flex: 1;
  justify-content: center;
  align-items: center;
}

.navbar-center li {
  margin: 0;
  padding: 0;
  position: relative;
  display: flex;
  align-items: center;
}


.navbar-center li.nav-link-secondary {
  display: none;
}

.theme-toggle-wrapper {
  display: flex;
  align-items: center;
  margin-left: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  color: #e6e0d5;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link i {
  font-size: 1rem;
  color: #f5ead8;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9));
}

.nav-link:hover {
  background: rgba(255, 200, 100, 0.1);
  color: #ffcc66;
  text-shadow: 0 0 6px rgba(255, 180, 60, 0.6);
  transform: translateY(-2px);
}

.nav-link-primary {
  background: linear-gradient(135deg, #06a87d 0%, #059a6f 100%);
  color: white !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(6, 168, 125, 0.3);
}

.nav-link-primary:hover {
  background: linear-gradient(135deg, #059a6f 0%, #047d58 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(6, 168, 125, 0.4);
}

/* ===== Right Section - User Actions ===== */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.navbar-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  border-radius: 8px;
  color: #f5ead8;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9));
}

.navbar-icon-btn:hover {
  background: rgba(255, 200, 100, 0.1);
  color: #ffcc66;
  filter: drop-shadow(0 0 4px rgba(255, 180, 60, 0.5));
  transform: translateY(-2px);
}

.navbar-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e63946;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.navbar-badge-muted {
  background: rgba(255, 200, 100, 0.2);
  color: #e0c882;
  box-shadow: none;
}

/* Achievement badge on navbar */
.nav-link-with-badge {
  position: relative;
}

.nav-achievement-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #1d3557;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 8px;
  border: 1.5px solid rgba(29, 53, 87, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  line-height: 1.2;
  pointer-events: none;
}

/* Rank badge on navbar */
.nav-rank-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #457b9d 0%, #a8dadc 100%);
  color: #1d3557;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 8px;
  border: 1.5px solid rgba(29, 53, 87, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  line-height: 1.2;
  pointer-events: none;
}

/* Card count badge on navbar */
.nav-card-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: linear-gradient(135deg, #8b5e2a 0%, #c8a060 100%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 8px;
  border: 1.5px solid rgba(29, 53, 87, 0.3);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  line-height: 1.2;
  pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .nav-achievement-badge {
    top: 4px;
    right: 4px;
    font-size: 0.5rem;
    padding: 1px 3px;
  }

  .nav-rank-badge {
    top: 4px;
    right: 4px;
    font-size: 0.5rem;
    padding: 1px 3px;
  }

  .nav-card-badge {
    top: 4px;
    right: 4px;
    font-size: 0.5rem;
    padding: 1px 3px;
  }
}

/* ===== Compact Stats Component ===== */
.navbar-compact-stats {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  font-family: "Inter", sans-serif;
}

.compact-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(241, 250, 238, 0.85);
  font-size: 0.9rem;
  font-weight: 600;
}

.compact-stat i {
  font-size: 0.95rem;
  opacity: 0.8;
}

.compact-stat-coins i {
  color: #ffd700;
}

.compact-stat-value {
  color: #f1faee;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ===== Burger Menu (Mobile) ===== */
.burger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 4px;
  padding: 8px;
}

.burger span {
  background: #f1faee;
  height: 2px;
  width: 24px;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* ===== Responsive Design ===== */
@media (max-width: 1430px) {
  .navbar {
    gap: 12px;
  }

  .navbar-left {
    gap: 12px;
  }

  .navbar-right {
    gap: 12px;
  }

  .stat-badge {
    padding: 5px 10px;
    font-size: 0.85rem;
    gap: 5px;
  }

  .stat-badge i {
    font-size: 0.9rem;
  }
}

@media (max-width: 1700px) {
  .navbar-center {
    gap: 4px;
  }

  .nav-link {
    padding: 8px 14px;
    font-size: 0.9rem;
  }

  .nav-link span {
    display: none;
  }

  .nav-link i {
    margin: 0;
    font-size: 1.2rem;
  }
}

@media (max-width: 1300px) {
  .navbar-online {
    display: none;
  }
}

@media (max-width: 1200px) {
  .navbar-stats {
    gap: 6px;
  }

  .stat-badge {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
}

@media (max-width: 1024px) {
  .navbar-stats {
    display: none;
  }

  .navbar-compact-stats {
    display: flex;
  }
}

.navbar-home-btn,
.navbar-mobile-show {
  display: none;
}


@media (max-width: 768px) {
  .navbar-home-btn,
  .navbar-mobile-show {
    display: flex;
    order: -1;
  }

  .navbar-mobile-show {
    order: 0;
  }


  /* Mobile navbar button visibility:
     - When bonus is unclaimed (.bonus-unclaimed): show daily bonus, hide cards
     - When bonus is claimed: hide daily bonus, show cards instead
     - Toplist (.navbar-mobile-show) always visible on mobile
     - Always hide inbox, profile, settings on mobile */
  .navbar-mobile-hide {
    display: none !important;
  }

  .bonus-unclaimed .navbar-mobile-alt {
    display: none !important;
  }

  .navbar-actions:not(.bonus-unclaimed) .navbar-mobile-bonus {
    display: none !important;
  }

  .navbar-inner {
    margin: 4px;
    padding: 4px 12px;
    border-radius: 4px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.5);
  }

  .navbar-center {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, #2c3138 0%, #1e2228 100%);
    flex-direction: column;
    padding: 16px;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  }

  .navbar-center > li:not(:last-child)::after {
    display: none;
  }

  .navbar-center.active {
    display: flex;
  }

  .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
  }

  .nav-link span {
    display: inline;
  }

  .navbar-center li.nav-link-secondary {
    display: list-item;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }

  .theme-toggle-wrapper {
    display: flex;
    margin-left: 0;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: center;
    width: 100%;
  }

  .burger {
    display: flex;
  }

  .navbar-stats {
    position: fixed;
    bottom: 20px;
    right: 20px;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
  }

  .coin-badge-inline {
    display: flex !important;
  }

  .navbar-actions {
    gap: 6px;
  }

  .navbar-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .navbar-compact-stats {
    gap: 8px;
    padding: 5px 10px;
  }

  .compact-stat {
    font-size: 0.85rem;
    gap: 5px;
  }

  .compact-stat i {
    font-size: 0.85rem;
  }

  .game-name::before {
    content: attr(data-shorter);
  }
}

@media (max-width: 480px) {
  .navbar-compact-stats {
    gap: 6px;
    padding: 4px 8px;
  }

  .compact-stat {
    font-size: 0.8rem;
    gap: 4px;
  }

  .compact-stat i {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .navbar-logo {
    width: 32px;
    height: 32px;
  }

  .game-name {
    font-size: 1.1rem;
  }

  .navbar-stats {
    bottom: 16px;
    right: 16px;
  }

  .stat-badge {
    padding: 6px 10px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  /* Hide online-players + coins compact widget when navbar is tight */
  .navbar-compact-stats {
    display: none;
  }

  /* Hide inbox on small screens to save space */
  .navbar-icon-btn[title="Inbox"] {
    display: none;
  }

  /* If inbox has an unread-message badge: show inbox, hide daily bonus instead */
  .navbar-actions:has(.navbar-icon-btn[title="Inbox"] .navbar-badge) .navbar-icon-btn[title="Inbox"] {
    display: flex;
  }

  .navbar-actions:has(.navbar-icon-btn[title="Inbox"] .navbar-badge) .daily-bonus-btn {
    display: none;
  }
}

.background {
  position: fixed;
  /* Sticks to the viewport */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  /* Places it behind everything */
  pointer-events: none;
  /* Prevents interference with user interactions */
}

.progress-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom;
  z-index: 2;
  position: relative;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  /* Fully visible initially */
  background: rgba(255, 255, 255, 0.9);
  /* Darkened overlay effect */
  transition: height 0.3s ease;
}

.darkened-background {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom;
  filter: brightness(0.25);
  /* Darken the background */
  z-index: 1;
  position: absolute;
  bottom: 0;
  left: 0;
}

.current-turn {
  display: flex;
  justify-content: center;
  padding: 5px;
  color: var(--text);
}


.turn-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.turn-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 6px;
}

.effect-pill {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: #222;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  text-transform: none;
  white-space: nowrap;
}

.effect-pill-attack {
  border-color: rgba(230, 57, 70, 0.4);
  box-shadow: 0 0 10px rgba(230, 57, 70, 0.25);
}

.effect-pill-build {
  border-color: rgba(188, 108, 37, 0.4);
  box-shadow: 0 0 10px rgba(188, 108, 37, 0.25);
}

.effect-pill-magic {
  border-color: rgba(157, 78, 221, 0.4);
  box-shadow: 0 0 10px rgba(157, 78, 221, 0.25);
}

.effect-pill-all {
  border-color: rgba(247, 127, 0, 0.45);
  box-shadow: 0 0 10px rgba(247, 127, 0, 0.25);
}

.effect-pill-shield {
  border-color: rgba(69, 123, 157, 0.45);
  box-shadow: 0 0 10px rgba(69, 123, 157, 0.25);
}

.effect-pill-warn {
  border-color: rgba(108, 117, 125, 0.5);
  box-shadow: 0 0 10px rgba(108, 117, 125, 0.25);
}

.action-text-discard {
  color: #f77f00;
  text-shadow: 0 0 10px rgba(247, 127, 0, 0.55);
  font-weight: 700;
}

.turn-hint {
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0.85;
}

.reconnect-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.75);
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.reconnect-overlay.hidden {
  display: none;
}

.reconnect-modal {
  background: var(--cloud-bg);
  color: var(--text);
  padding: 20px 24px;
  border-radius: 16px;
  width: min(520px, 90vw);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.reconnect-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.reconnect-text {
  font-size: 0.95rem;
  opacity: 0.9;
  margin-bottom: 14px;
}

.reconnect-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.reconnect-actions.hidden {
  display: none;
}

.reconnect-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.reconnect-btn-primary {
  background: #e63946;
  color: #fff;
}

.reconnect-btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: #333;
}

#game {
  position: relative;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

.room-connecting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 40vh;
  color: var(--text);
  opacity: 0.6;
}

.room-connecting-icon {
  font-size: 2.5rem;
  animation: roomConnectingPulse 1.4s ease-in-out infinite;
}

.room-connecting-text {
  font-family: "Cinzel", serif;
  font-size: 1rem;
  letter-spacing: 1px;
  margin: 0;
}

@keyframes roomConnectingPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.12); }
}


.discard-help {
  margin-top: 2px;
  position: absolute;
  top: 280px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(255, 255, 255, 0.85);
  color: #2a2a2a;
  border-radius: 10px;
  padding: 8px 10px;
  max-width: 420px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

@media (max-width: 1000px) {
  .discard-help {
    position: static;
    transform: none;
    margin-top: 6px;
  }
}

@media (max-height: 650px) {
  .discard-help {
    display: none !important;
  }
}

@media (min-width: 1001px) and (max-height: 820px) {
  .discard-help {
    position: static;
    transform: none;
    left: auto;
    margin-top: 6px;
  }
}

.discard-help.hidden {
  display: none;
}

.discard-help-text {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.discard-help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.discard-help-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.discard-help-primary {
  background: #e63946;
  color: #fff;
}

.discard-help-secondary {
  background: rgba(0, 0, 0, 0.08);
  color: #222;
}

.discard-help-ghost {
  background: transparent;
  color: #444;
  border: 1px dashed rgba(0, 0, 0, 0.2);
}

.score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

/* Banner score display */
.score-banners {
  display: flex;
  gap: 4px;
  align-items: flex-start;
}

.score-banner {
  position: relative;
  display: flex;
  justify-content: center;
}

.score-banner-img {
  width: 32px;
  height: auto;
  display: block;
}

.score-banner-val {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  line-height: 1;
  pointer-events: none;
}

/* Victory screen banners */
.final-score-section {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.final-score-banner .score-banner-img {
  width: 80px;
}

.final-score-banner-val {
  top: 20%;
  font-size: 2rem;
}

.turn-hourglass {
  font-size: 1.4em;
  animation: hourglassFlip 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.turn-hourglass-red  { color: #e03c2d; }
.turn-hourglass-blue { color: #4060e0; }

@keyframes hourglassFlip {
  0%   { transform: rotate(180deg) scale(1.5); opacity: 0; }
  40%  { opacity: 1; }
  100% { transform: rotate(0deg) scale(1); }
}

.discarded-txt {
  color: var(--text);
}

.castle-container {
  position: relative;
}

.last-played-card {
  position: absolute;
  top: 0;
  left: 50%;
  width: 100px;
  height: 200px;
  transform: translateX(-50%);
}

/* Finishing move: dramatic spotlight + slam */
.finishing-move-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 999;
  animation: overlayFadeIn 0.3s ease-out forwards;
  pointer-events: none;
}

.finishing-move-overlay-fade-out {
  animation: overlayFadeOut 0.5s ease-in forwards;
}

.finishing-card-slam {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  width: auto !important;
  z-index: 1000 !important;
  animation: cardSlam 0.6s cubic-bezier(0.22, 0.61, 0.36, 1) forwards !important;
  filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.9)) drop-shadow(0 0 60px rgba(255, 215, 0, 0.4)) !important;
}

.finishing-card-slam .card {
  border-color: gold !important;
}

.finishing-card-settle {
  animation: cardSettle 0.5s ease-in forwards !important;
}

.screen-shake {
  animation: screenShake 0.5s ease-out !important;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes overlayFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes cardSlam {
  0% {
    transform: translate(-50%, -50%) scale(4) rotate(-8deg);
    opacity: 0;
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(2.2) rotate(2deg);
  }
  75% {
    transform: translate(-50%, -50%) scale(2.7) rotate(-1deg);
  }
  100% {
    transform: translate(-50%, -50%) scale(2.5) rotate(0deg);
  }
}

@keyframes cardSettle {
  from {
    transform: translate(-50%, -50%) scale(2.5) rotate(0deg);
    opacity: 1;
  }
  to {
    transform: translate(-50%, -50%) scale(2) rotate(0deg);
    opacity: 0;
  }
}

@keyframes screenShake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-8px, -5px); }
  20% { transform: translate(8px, 5px); }
  30% { transform: translate(-6px, 4px); }
  40% { transform: translate(6px, -4px); }
  50% { transform: translate(-4px, 3px); }
  60% { transform: translate(4px, -2px); }
  70% { transform: translate(-3px, 2px); }
  80% { transform: translate(2px, -1px); }
  90% { transform: translate(-1px, 1px); }
}

.texture {
  width: 100%;
  height: 50%;
  /* Start hidden (no height) */
  background-image: url("/assets/wallc.png");
  /* Replace with your texture image path */
  background-size: auto;
  /* Ensure the texture repeats naturally */
  background-repeat: repeat;
  /* Repeat the texture */
  background-position: top;
  /* Background alignment */
  position: absolute;
  /* Align it within the container */
  bottom: 0;
  /* Ensure growth starts at the bottom */
  transition: height 2s ease;
  /* Smooth growth animation */
}

.cloudy-round-panel {
  color: var(--text);
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  padding: 20px 40px;
  border-radius: 2px;
  border: 1px solid var(--surface-border);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* ---- Papyrus panel treatment ---- */

.color-picker-container,
.pregame-help,
.online-users-panel {
  position: relative;
  isolation: isolate;
  background: var(--papyrus-edge);
  color: var(--papyrus-text);
  border: none;
  border-radius: 0;
  box-shadow: none;
  clip-path: var(--papyrus-shape);
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

.color-picker-container::before,
.pregame-help::before,
.online-users-panel::before {
  content: '';
  position: absolute;
  inset: 16px;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 4px,
      rgba(160, 100, 20, 0.07) 4px,
      rgba(160, 100, 20, 0.07) 5px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 10px,
      rgba(160, 100, 20, 0.04) 10px,
      rgba(160, 100, 20, 0.04) 11px
    ),
    var(--papyrus-fill);
  z-index: -1;
}

/* ---- Per-panel layout ---- */

.color-picker-container {
  text-align: center;
  padding: 28px 44px;
  width: 100%;
}

.color-picker-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 1.2rem;
  font-weight: 600;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
}

.color-picker-status i {
  font-size: 1.3rem;
  color: var(--text);
}

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

.color-picker-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.color-picker-label {
  color: var(--text);
  font-size: 0.9rem;
  opacity: 0.8;
}

.color-picker-taken {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.95rem;
  opacity: 0.85;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--surface-border);
  border-radius: 2px;
}

.color-picker-locked {
  margin-top: 12px;
  font-size: 0.9rem;
  opacity: 0.85;
}

.color-picker-spectate {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--papyrus-text);
  font-size: 1rem;
  font-family: "Cinzel", serif;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--surface-border);
  border-radius: 2px;
}

.color-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  border: 4px solid transparent;
  border-radius: 2px;
  padding: 22px 40px;
  min-width: 130px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: "Cinzel", serif;
  color: #e6d9c0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 8px rgba(220, 180, 100, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.color-button i {
  font-size: 1.8rem;
}

.color-button:hover {
  transform: translateY(-3px);
}

.color-button:disabled {
  pointer-events: none;
}

.color-button-loading {
  opacity: 0.5;
  filter: grayscale(0.4);
}

.color-button-selected {
  opacity: 1;
  filter: none;
  animation: color-btn-pulse 0.8s ease-in-out infinite;
}

@keyframes color-btn-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* Iron trim — red button */
.red-button {
  background:
    linear-gradient(to bottom, rgba(181, 34, 34, 0.82) 0%, rgba(139, 26, 26, 0.88) 50%, rgba(90, 8, 8, 0.95) 100%),
    url('/gui/brick_pattern.png');
  background-size: auto, auto;
  border-color: #3a3028;
  box-shadow:
    inset 0 2px 0 rgba(255, 200, 150, 0.18),
    inset 0 -4px 8px rgba(0, 0, 0, 0.65),
    0 0 0 1px #0d0a08,
    0 5px 15px rgba(0, 0, 0, 0.55);
}

.red-button:hover {
  background:
    linear-gradient(to bottom, rgba(197, 40, 40, 0.78) 0%, rgba(155, 28, 28, 0.85) 50%, rgba(104, 10, 10, 0.93) 100%),
    url('/gui/brick_pattern.png');
  background-size: auto, auto;
  box-shadow:
    inset 0 2px 0 rgba(255, 200, 150, 0.28),
    inset 0 -4px 8px rgba(0, 0, 0, 0.55),
    0 0 0 1px #1a0a08,
    0 6px 20px rgba(139, 28, 28, 0.65);
}

/* Steel-silver trim — blue button */
.blue-button {
  background:
    linear-gradient(to bottom, rgba(42, 78, 130, 0.82) 0%, rgba(30, 58, 110, 0.88) 50%, rgba(10, 24, 53, 0.95) 100%),
    url('/gui/brick_pattern.png');
  background-size: auto, auto;
  border-color: #5a7085;
  box-shadow:
    inset 0 2px 0 rgba(180, 210, 255, 0.15),
    inset 0 -4px 8px rgba(0, 0, 0, 0.65),
    0 0 0 1px #08101e,
    0 5px 15px rgba(0, 0, 0, 0.55);
}

.blue-button:hover {
  background:
    linear-gradient(to bottom, rgba(50, 90, 148, 0.78) 0%, rgba(37, 70, 128, 0.85) 50%, rgba(13, 32, 64, 0.93) 100%),
    url('/gui/brick_pattern.png');
  background-size: auto, auto;
  box-shadow:
    inset 0 2px 0 rgba(180, 210, 255, 0.25),
    inset 0 -4px 8px rgba(0, 0, 0, 0.55),
    0 0 0 1px #0a1428,
    0 6px 20px rgba(30, 58, 110, 0.65);
}

.red-button:focus,
.blue-button:focus {
  outline: none;
}

/* Pregame Wrapper */
.pregame-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 15px;
  max-width: 600px;
  margin: 0 auto;
}

/* Timer Panel */
.pregame-timer-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  padding: 16px 20px;
  border-radius: 2px;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.timer-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.timer-info i {
  color: var(--text);
  font-size: 1.1rem;
}

.timer-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.timer-actions .timer-btn {
  flex: 1;
}

.timer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 2px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: "Cinzel", serif;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.timer-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.timer-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

.timer-btn i {
  font-size: 0.9rem;
}

.timer-btn-primary {
  background: linear-gradient(135deg, #e63946 0%, #d62828 100%);
  color: white;
}

.timer-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

.timer-btn-secondary {
  background: rgba(0, 0, 0, 0.2);
  color: var(--papyrus-text);
  border: 1px solid var(--surface-border);
}

.timer-btn-secondary:hover {
  background: rgba(200, 150, 12, 0.12);
  border-color: #c8960c;
}

/* Pregame Actions */
.pregame-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 0 12px;
  box-sizing: border-box;
}

.pregame-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 2px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: "Cinzel", serif;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

.pregame-action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pregame-action-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

.pregame-action-btn i {
  font-size: 1rem;
}

.pregame-action-primary {
  background: linear-gradient(135deg, #e63946 0%, #d62828 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
  flex: 1;
  max-width: 200px;
}

.pregame-action-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(230, 57, 70, 0.5);
}

.pregame-action-primary.red-accent {
  background: linear-gradient(135deg, #9B1C1C 0%, #720D0D 100%);
  box-shadow: 0 4px 12px rgba(139, 28, 28, 0.3);
}

.pregame-action-primary.red-accent:hover {
  box-shadow: 0 6px 16px rgba(139, 28, 28, 0.55);
}

.pregame-action-primary.blue-accent {
  background: linear-gradient(135deg, #2055A0 0%, #143070 100%);
  box-shadow: 0 4px 12px rgba(32, 85, 160, 0.3);
}

.pregame-action-primary.blue-accent:hover {
  box-shadow: 0 6px 16px rgba(32, 85, 160, 0.55);
}

.pregame-action-secondary {
  background: var(--action-secondary-bg);
  border: 2px solid var(--action-secondary-border);
  color: var(--action-secondary-color);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -2px 5px rgba(0, 0, 0, 0.2),
    0 4px 10px rgba(0, 0, 0, 0.2);
}

.pregame-action-secondary:hover {
  background: var(--action-secondary-bg-hover);
  border-color: var(--action-secondary-border-hover);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 5px rgba(0, 0, 0, 0.15),
    0 5px 14px rgba(0, 0, 0, 0.25);
}

/* Invite a Challenger collapsible */
.invite-details {
  width: 100%;
}

.invite-summary {
  list-style: none;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
}

.invite-summary .gui-corner {
  width: 40px;
  height: 40px;
}

.invite-summary::-webkit-details-marker {
  display: none;
}

.invite-details[open] .invite-summary {
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 2px;
  opacity: 0.85;
}

.invite-dropdown {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-top: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Pregame Help */
/* Quick Name Set */
.quick-name-prompt {
  background: var(--cloud-bg);
  border: 1px dashed rgba(100, 120, 200, 0.3);
  border-radius: 10px;
  padding: 12px 16px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-name-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  opacity: 0.8;
}

.quick-name-label i {
  color: #5b9ee9;
  font-size: 12px;
}

.quick-name-form {
  display: flex;
  gap: 6px;
}

.quick-name-input {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid rgba(100, 120, 200, 0.25);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.quick-name-input::placeholder {
  color: var(--text);
  opacity: 0.4;
}

.quick-name-input:focus {
  border-color: rgba(91, 158, 233, 0.5);
}

.quick-name-btn {
  padding: 7px 14px;
  background: rgba(40, 167, 69, 0.15);
  border: 1px solid rgba(40, 167, 69, 0.35);
  border-radius: 6px;
  color: #28a745;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.quick-name-btn:hover {
  background: rgba(40, 167, 69, 0.25);
  border-color: rgba(40, 167, 69, 0.5);
}

.quick-name-result {
  font-size: 12px;
  color: #28a745;
  min-height: 0;
}

.quick-name-result:empty {
  display: none;
}

.pregame-help {
  padding: 0;
  width: 100%;
  overflow: hidden;
}

.pregame-help summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  cursor: pointer;
  color: var(--papyrus-text);
  font-weight: 700;
  font-size: 1.1rem;
  font-family: "Cinzel", serif;
  letter-spacing: 0.5px;
  list-style: none;
}

.pregame-help summary::-webkit-details-marker {
  display: none;
}

.pregame-help summary i {
  color: var(--papyrus-text);
  font-size: 1rem;
}

.pregame-help summary::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: auto;
  transition: transform 0.2s ease;
  font-size: 0.8rem;
}

.pregame-help[open] summary::after {
  transform: rotate(180deg);
}

.pregame-help p {
  padding: 0 26px 24px;
  margin: 0;
  color: var(--papyrus-text);
  font-size: 0.9rem;
  line-height: 1.6;
  opacity: 0.85;
}

/* Larger screens - horizontal layout */
@media (min-width: 768px) {
  .pregame-wrapper {
    max-width: 800px;
    gap: 20px;
    padding: 25px;
  }

  .pregame-timer-panel {
    padding: 16px 24px;
  }

  .timer-info {
    font-size: 1rem;
  }

  .timer-btn {
    padding: 10px 18px;
    font-size: 0.9rem;
  }

  .pregame-action-btn {
    padding: 14px 24px;
    font-size: 1rem;
    min-width: 140px;
  }

  .pregame-action-primary {
    max-width: 220px;
  }

  .pregame-help {
    max-width: 500px;
  }
}

/* Landscape mobile - compact */
@media (max-height: 500px) {
  .pregame-wrapper {
    gap: 10px;
    padding: 10px;
  }

  .color-picker-container {
    padding: 18px 28px;
    margin: 5px;
  }

  .color-picker-h1 {
    font-size: 1.1rem;
    margin-bottom: 10px;
  }

  .color-button {
    padding: 14px 24px;
    font-size: 0.85rem;
  }

  .pregame-timer-panel {
    padding: 10px 15px;
  }

  .timer-info {
    font-size: 0.85rem;
  }

  .timer-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .pregame-actions {
    gap: 8px;
  }

  .pregame-action-btn {
    padding: 10px 16px;
    font-size: 0.85rem;
    min-width: 100px;
  }

  .pregame-help summary {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .pregame-help p {
    font-size: 0.85rem;
    padding: 0 14px 12px;
  }
}

.cta {
  padding: 12px 24px;
  border-radius: 6px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.learn-more {
  background-color: #457b9d;
  color: white;
}

.learn-more:hover {
  background-color: #2c5073;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.learn-more:active {
  transform: translateY(0);
}

/* Game Over / Midgame Styles */
.game-over-container {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 20px;
  overflow-y: auto;
  box-sizing: border-box;
}

.game-over-content {
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border-radius: 2px;
  padding: 50px 40px;
  max-width: 700px;
  width: 100%;
  margin: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--surface-border);
  animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

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

.game-over-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  margin-bottom: clamp(20px, 4vh, 40px);
  flex-shrink: 0;
}

.game-over-header-center {
  text-align: center;
  flex: 1;
  min-width: 0;
}

.game-over-header-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  color: var(--text);
  opacity: 0.7;
  cursor: pointer;
  text-decoration: none;
  padding: 8px clamp(12px, 2vw, 20px);
  transition: color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;
  min-width: clamp(50px, 8vw, 70px);
}

.game-over-header-action i {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  color: #c8960c;
}

.game-over-header-action span {
  font-size: clamp(0.55rem, 1vw, 0.7rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: "Cinzel", serif;
}

.game-over-header-action:hover {
  opacity: 1;
  background: rgba(200, 150, 12, 0.12);
  border-color: #c8960c;
}

#restart-button {
  opacity: 1;
  border-color: #c8960c;
  animation:
    restartGrow 0.5s ease-in-out 1 forwards,
    restartGlow 1.8s ease-in-out 0.5s infinite;
}

@keyframes restartGrow {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes restartGlow {
  0%   { box-shadow: 0 0 0px rgba(200, 150, 12, 0); }
  50%  { box-shadow: 0 0 14px rgba(200, 150, 12, 0.7), 0 0 28px rgba(200, 150, 12, 0.3); }
  100% { box-shadow: 0 0 0px rgba(200, 150, 12, 0); }
}

.winner-badge {
  display: inline-block;
  padding: clamp(6px, 1vh, 10px) clamp(12px, 2vw, 20px);
  border-radius: 2px;
  font-weight: 700;
  font-size: clamp(0.65rem, 1.2vw, 0.85rem);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: "Cinzel", serif;
  margin-bottom: clamp(8px, 2vh, 15px);
  animation: pulse 1.5s ease-in-out infinite;
}

.winner-red {
  background: rgba(220, 53, 69, 0.8);
  color: white;
  border: 2px solid #dc3545;
}

.winner-blue {
  background: rgba(52, 152, 219, 0.8);
  color: white;
  border: 2px solid #3498db;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.game-over-title {
  font-size: clamp(1.5rem, 5vw, 3.5rem);
  font-weight: 800;
  margin: 0;
  color: var(--papyrus-text);
  font-family: "Cinzel", serif;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  letter-spacing: 1px;
}

.final-score-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 3vw, 30px);
  margin: clamp(20px, 5vh, 40px) 0;
  padding: clamp(15px, 4vh, 30px) 0;
  border-top: 1px solid var(--surface-border);
  border-bottom: 1px solid var(--surface-border);
  flex-shrink: 0;
}

.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1.5vh, 12px);
  padding: clamp(10px, 2vh, 20px) clamp(15px, 3vw, 30px);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--surface-border);
  min-width: clamp(60px, 15vw, 120px);
  position: relative;
}

.red-score {
  border-color: rgba(220, 53, 69, 0.4);
  background: rgba(220, 53, 69, 0.08);
}

.blue-score {
  border-color: rgba(52, 100, 180, 0.4);
  background: rgba(52, 100, 180, 0.08);
}

.score-label {
  font-size: clamp(0.7rem, 1.2vw, 0.9rem);
  font-weight: 700;
  color: var(--text);
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: "Cinzel", serif;
}

.score-value {
  font-size: clamp(1.5rem, 4vw, 3.2rem);
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.score-badge {
  position: absolute;
  top: -10px;
  right: 8px;
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  color: #1a0a00;
  padding: clamp(3px, 0.5vh, 4px) clamp(8px, 1.5vw, 12px);
  border-radius: 2px;
  font-size: clamp(0.55rem, 1vw, 0.7rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  font-family: "Cinzel", serif;
}

.deck-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  opacity: 0.5;
  color: var(--text);
}

.deck-label-left {
  right: 100%;
  margin-right: 6px;
}

.deck-label-right {
  left: 100%;
  margin-left: 6px;
}

.score-divider {
  font-size: clamp(1.2rem, 3vw, 2.5rem);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.5);
}

.finishing-card-section {
  text-align: center;
  padding: clamp(12px, 2vh, 20px);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  margin: clamp(15px, 3vh, 25px) 0;
  border-left: 3px solid #c8960c;
  flex-shrink: 0;
}

.finishing-card-label {
  margin: 0;
  font-size: clamp(0.75rem, 1.5vw, 1rem);
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
}

.finishing-card-label strong {
  color: #c8960c;
  font-weight: 700;
  font-size: clamp(0.85rem, 1.7vw, 1.1rem);
}

.elo-section {
  text-align: center;
  padding: clamp(12px, 2vh, 20px);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  margin: clamp(10px, 2vh, 18px) 0;
  border-left: 3px solid #c8960c;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.elo-change {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 700;
}

.elo-positive {
  color: #4caf50;
}

.elo-negative {
  color: #e74c3c;
}

.elo-new-rating {
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  color: rgba(255, 255, 255, 0.85);
}

.elo-rank {
  font-size: clamp(0.75rem, 1.3vw, 0.9rem);
  color: #f0a500;
  font-weight: 500;
}

.campaign-stars-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: clamp(20px, 5vh, 40px) 0;
  padding: clamp(15px, 4vh, 30px) 0;
  border-top: 1px solid var(--surface-border);
  border-bottom: 1px solid var(--surface-border);
}

.campaign-star-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--surface-border);
}

.campaign-star-row.achieved {
  background: rgba(200, 150, 12, 0.1);
  border-color: rgba(200, 150, 12, 0.3);
}

.campaign-star-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.star-achieved {
  color: #f0c040;
}

.star-missed {
  color: rgba(255, 255, 255, 0.2);
}

.campaign-star-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.campaign-star-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.campaign-star-desc {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.game-over-newgame {
  display: flex;
  justify-content: center;
  margin-top: clamp(15px, 3vh, 30px);
  flex-shrink: 0;
}

.game-over-btn {
  padding: clamp(10px, 1.5vh, 14px) clamp(20px, 3vw, 28px);
  border-radius: 2px;
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  font-weight: 700;
  font-family: "Cinzel", serif;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.new-game-btn {
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  border: 1px solid #b7892b;
  color: #1a0a00;
}

.game-over-deck-cta {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.deck-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--surface-border);
  color: var(--text);
  font-size: clamp(0.75rem, 1.2vw, 0.85rem);
  opacity: 0.7;
}

.deck-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
}

.deck-cta-msg {
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.6;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.new-game-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 150, 12, 0.35);
}

.card-top-left {
  display: flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  top: 8px;
  left: 8px;
}

.card-top-right {
  display: flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  top: 8px;
  right: 8px;
}


.card-icon {
  width: 16px;
  height: 16px;
}

.card-costs {
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-cost {
  display: flex;
  flex-direction: row;
  color: white;
}

.cost-icon {
  width: 16px;
  height: 16px;
}

.card-value {
  font-size: 14px;
  font-weight: bold;
  color: white;
}

.card-name {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  /*white-space: nowrap;*/
  max-width: 80px;
  color: white;
}

.blue-hue {
  filter: hue-rotate(200deg);
}

.red-hue {
  filter: hue-rotate(290deg);
}

.efx-indicator {
  height: 50px;
}

:root {
  left: 0;
  --translate-start: -100%;
  /* Default: offscreen left */
  --translate-end: 0;
  /* Default: offscreen right */
}

@keyframes slideInOut {
  0% {
    transform: translateX(var(--translate-start));
    /* Start offscreen to the left */
    opacity: 0;
  }

  25% {
    transform: translateX(var(--translate-end));
    /* Fully visible in the center */
    opacity: 1;
  }

  75% {
    transform: translateX(var(--translate-end));
    /* Stay in place for a moment */
    opacity: 1;
  }

  100% {
    transform: translateX(var(--translate-start));
    /* Move offscreen to the right */
    opacity: 0;
    visibility: hidden;
  }
}

.played-card-anim {
  position: fixed;
  width: 130px;
  animation: slideInOut 2s ease-in-out 1 forwards;
  /*max-width: 60vw; */
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  /* Preserve aspect ratio */
  overflow: hidden;
  top: 0%;
  /*transform: translateY(-50%);*/
  /* Adjust animation duration (3s) as needed */
}

.played-card-anim.red {
  left: 0;
  --translate-start: -100%;
  /* Default: offscreen left */
  --translate-end: 0;
  /* Default: offscreen right */
}

.played-card-anim.blue {
  right: 0;
  --translate-start: 100%;
  /* Default: offscreen left */
  --translate-end: 0;
  /* Default: offscreen right */
}

@keyframes fallToFlat {
  0% {
    transform: translate(-100%, -50%) rotate(-90deg);
    /* Offscreen, vertical position */
    opacity: 0;
    /* Hidden */
  }

  30% {
    transform: translate(0, -50%) rotate(-45deg);
    /* Midway, halfway through the fall */
    opacity: 1;
    /* Visible */
  }

  60% {
    transform: translate(0, -50%) rotate(0deg);
    /* In the center, flat position */
    opacity: 1;
  }

  80% {
    transform: translate(0, -50%) rotate(0deg);
    /* In the center, flat position */
    opacity: 1;
  }

  100% {
    transform: translateX(-100%);
    /* Move offscreen to the right */
    opacity: 0;
    visibility: hidden;
  }
}

.stick {
  position: absolute;
  top: 50%;
  /* Center vertically */
  left: 50%;
  /* Center horizontally */
  transform-origin: center left;
  /* Pivot point for rotation */
  transform: translate(-100%, -50%) rotate(-90deg);
  /* Initial offscreen vertical position */
  animation: fallToFlat 2s ease-out 1 forwards;
  /* Play once */
  max-width: 100vw;
  /* Fit within viewport width */
  max-height: 100vh;
  /* Fit within viewport height */
  object-fit: contain;
  /* Maintain aspect ratio */
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.hidden {
  display: none;
}

.overlay-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  cursor: pointer;
  border: 2px solid white;
}

/***** MODAL DIALOG ****/
#modal {
  /* Underlay covers entire screen. */
  position: fixed;
  top: 0px;
  bottom: 0px;
  left: 0px;
  right: 0px;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;

  /* Flexbox centers the .modal-content vertically and horizontally */
  display: flex;
  flex-direction: column;
  align-items: center;

  /* Animate when opening */
  animation-name: fadeIn;
  animation-duration: 150ms;
  animation-timing-function: ease;
}

#modal > .modal-underlay {
  /* underlay takes up the entire viewport. This is only
	required if you want to click to dismiss the popup */
  position: absolute;
  z-index: -1;
  top: 0px;
  bottom: 0px;
  left: 0px;
  right: 0px;
}

#modal > .modal-content {
  /* Position visible dialog near the top of the window */
  margin-top: 10vh;

  /* Sizing for visible dialog */
  width: 80%;
  max-width: 600px;
  max-height: 80vh;

  /* Display properties for visible dialog*/
  border: solid 1px #999;
  border-radius: 8px;
  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.3);
  background-color: var(--cloud-bg);
  padding: 20px;

  /* Animate when opening */
  animation-name: zoomIn;
  animation-duration: 150ms;
  animation-timing-function: ease;
  overflow: scroll;
}

#modal.closing {
  /* Animate when closing */
  animation-name: fadeOut;
  animation-duration: 150ms;
  animation-timing-function: ease;
}

#modal.closing > .modal-content {
  /* Animate when closing */
  animation-name: zoomOut;
  animation-duration: 150ms;
  animation-timing-function: ease;
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes zoomIn {
  0% {
    transform: scale(0.9);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes zoomOut {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(0.9);
  }
}

/* Form styling */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
}

.form-group input,
.form-group button {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--resource-panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.games-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 200px;
  overflow: scroll;
}

.games-list li {
  display: flex;
  align-items: center;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 8px;
}

.games-list li span {
  flex: 1;
  padding: 0 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.games-list .room-name {
  flex: 2;
  /* Room name gets more space */
}

.games-list .actions {
  flex: 0 0 auto;
  /* Prevent actions from stretching */
  display: flex;
  gap: 5px;
}

.games-list .actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}

.games-list .actions button img {
  width: 16px;
  height: 16px;
}

.games-list .actions button:hover {
  opacity: 0.8;
}

/* Profile Modal Styling */
.profile-modal {
  width: 85%;
  max-width: 700px;
  overflow: clip; /* clip without creating scroll context; corners stay fixed */
  position: relative;
}

/* Override modal-content border/background for the profile modal.
   Higher specificity [1,2,0] needed to beat #modal > .modal-content [1,1,0]. */
#modal > .modal-content.profile-modal {
  border: none;
  padding: 5px; /* exact gap between modal edge and background image */
  background-color: transparent;
  background-image: url('/gui/gui_panel_dark.webp');
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-origin: content-box;
  background-clip: content-box;
}

/* Inner scroll container for profile modal content */
.modal-scroll-body {
  overflow-y: auto;
  max-height: 75vh;
  padding: 15px;
}

.profile-header {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--papyrus-edge);
}

.profile-header i {
  font-size: 1.8rem;
  color: var(--papyrus-text);
}

.profile-header h1 {
  margin: 0;
  font-size: 1.8rem;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
}

.profile-section {
  position: relative;
  isolation: isolate;
  margin-bottom: 28px;
  padding: 0;
}

.profile-section-card {
  position: relative;
  isolation: isolate;
  background: var(--panel-texture-url) center/cover, var(--panel-bg);
  border: 1.5px solid var(--resource-panel-border);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.profile-section-card::before,
.checkbox-label::before,
.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--dirt-texture-url) repeat;
  opacity: var(--dirt-opacity, 0.1);
  pointer-events: none;
  z-index: -1;
}

.profile-section::before,
.profile-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--dirt-texture-url) repeat;
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: "Cinzel", serif;
  letter-spacing: 0.4px;
  color: var(--papyrus-text);
}

.section-title i {
  color: var(--papyrus-text);
  font-size: 1.1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-family: "Cinzel", serif;
  font-size: 0.88rem;
  letter-spacing: 0.3px;
  color: var(--papyrus-text);
}

.form-group input,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--primary-bg);
  border-radius: 6px;
  background: var(--icon-bg);
  color: var(--text);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(69, 123, 157, 0.1);
}

.form-hint {
  margin-top: 5px;
  font-size: 0.85rem;
  color: var(--number);
  font-weight: 400;
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 12px;
  border-radius: 2px;
  position: relative;
  isolation: isolate;
  background: var(--surface-subtle);
  border: 1px solid var(--surface-border);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.checkbox-label:hover {
  background: var(--surface-hover);
  border-color: var(--surface-border-hover);
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--primary-bg);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.checkbox-label > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.checkbox-text {
  font-weight: 600;
  color: var(--text);
}

.checkbox-hint {
  font-size: 0.85rem;
  color: var(--number);
  font-weight: 400;
}

/* Game Cards */
.games-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  position: relative;
  isolation: isolate;
  background: var(--panel-texture-url) center/cover, var(--panel-bg);
  border: 1.5px solid var(--resource-panel-border);
  border-radius: 12px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.game-card:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.game-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.game-info .room-name {
  font-weight: 600;
  color: var(--primary-bg);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.game-info .room-name:hover {
  opacity: 0.8;
}

.game-info .opponent {
  font-size: 0.9rem;
  color: var(--text);
  opacity: 0.8;
}

.game-score {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary-bg);
  min-width: 80px;
  text-align: center;
}

.game-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.game-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text);
}

.game-actions .editGame {
  color: var(--text);
}

.game-actions .editGame:hover {
  background: rgba(69, 123, 157, 0.15);
}

.game-actions .deleteGame {
  color: #e63946;
}

.game-actions .deleteGame:hover {
  background: rgba(230, 57, 70, 0.15);
}

.game-actions button i {
  font-size: 1rem;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--number);
  text-align: center;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.5;
}

.empty-state p {
  margin: 0;
  font-size: 1rem;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--papyrus-edge);
}

.form-actions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 2px;
  font-weight: 700;
  font-family: "Cinzel", serif;
  font-size: 0.88rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

/* Amber/gold — confirm action */
.profile-btn-save {
  background: linear-gradient(to bottom, #d4841c 0%, #a85f08 50%, #5a2e00 100%);
  border: 2px solid #2a1a0a;
  color: #fff5d6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 200, 120, 0.22),
    inset 0 -3px 6px rgba(0, 0, 0, 0.5),
    0 0 0 1px #0a0500,
    0 4px 12px rgba(0, 0, 0, 0.4);
}

.profile-btn-save:hover {
  background: linear-gradient(to bottom, #e8941e 0%, #c07010 50%, #6a3500 100%);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 210, 130, 0.3),
    inset 0 -3px 6px rgba(0, 0, 0, 0.4),
    0 0 0 1px #1a0800,
    0 6px 16px rgba(180, 100, 20, 0.5);
}

.profile-btn-save:active {
  transform: translateY(0);
  background: linear-gradient(to bottom, #a86010 0%, #804808 50%, #401800 100%);
}

/* Dark iron — dismiss */
.profile-btn-close {
  background: linear-gradient(to bottom, #3a3028 0%, #2a2018 50%, #1a1008 100%);
  border: 2px solid #504838;
  color: #c8b898;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -2px 5px rgba(0, 0, 0, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.4);
}

.profile-btn-close:hover {
  background: linear-gradient(to bottom, #4a4038 0%, #3a3028 50%, #2a2010 100%);
  border-color: #706850;
  transform: translateY(-2px);
}

/* Logout / secondary action */
.profile-btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 10px 16px;
  background: linear-gradient(to bottom, #2a2018 0%, #1a1008 100%);
  border: 1px solid #4a4030;
  border-radius: 2px;
  color: #c8b898;
  font-family: "Cinzel", serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.profile-btn-logout:hover {
  background: linear-gradient(to bottom, #3a3028 0%, #2a2018 100%);
  border-color: #6a6050;
}

.form-result {
  margin-top: 15px;
  padding: 12px;
  border-radius: 6px;
  text-align: center;
  font-weight: 500;
}

.form-result.success {
  background: rgba(6, 168, 125, 0.1);
  color: #06a77d;
}

.form-result.error {
  background: rgba(139, 28, 28, 0.12);
  color: #c03030;
}

/* Profile Modal Responsive */
@media (max-width: 768px) {
  .profile-modal {
    width: 95%;
    max-width: 100%;
  }

  .profile-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
  }

  .profile-header h1 {
    font-size: 1.4rem;
  }

  .form-actions {
    flex-direction: column;
    gap: 8px;
  }

  .form-actions button {
    width: 100%;
  }

  .game-card {
    flex-wrap: wrap;
    gap: 8px;
  }

  .game-info {
    flex-basis: 100%;
  }

  .game-score {
    flex: 1;
    min-width: 60px;
  }

  .game-actions {
    flex-basis: 100%;
    justify-content: flex-end;
  }
}

.red {
  color: red;
}

.cloudbg2 {
  background-color: var(--cloud-bg2);
}

.info-bar-above-game {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---- Retro fighter HP bars ---- */

.player-hpbar-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 120px;
  max-width: 220px;
}

.player-hpbar-name {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: "Cinzel", serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-hpbar-bars {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.player-hpbar-track {
  position: relative;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 1px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}

.player-hpbar-castle-track {
  height: 14px;
}

.player-hpbar-wall-track {
  height: 7px;
}

.player-hpbar-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 1px;
}

.player-hpbar-castle-fill.hp-high {
  background: linear-gradient(to bottom, #5fdb6a 0%, #2ecc71 50%, #27ae60 100%);
  box-shadow: 0 0 4px rgba(46, 204, 113, 0.5);
}

.player-hpbar-castle-fill.hp-mid {
  background: linear-gradient(to bottom, #f0d060 0%, #e0a020 50%, #c88010 100%);
  box-shadow: 0 0 4px rgba(224, 160, 32, 0.5);
}

.player-hpbar-castle-fill.hp-low {
  background: linear-gradient(to bottom, #f06060 0%, #e03030 50%, #b02020 100%);
  box-shadow: 0 0 4px rgba(224, 48, 48, 0.5);
  animation: hpLowPulse 0.9s ease-in-out infinite;
}

@keyframes hpLowPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.player-hpbar-wall-fill {
  background: linear-gradient(to bottom, #a0b4c8 0%, #7090a8 50%, #507090 100%);
}

.player-hpbar-fill.hp-overflow {
  animation: hpOverflowGlow 1.1s ease-in-out infinite;
}

@keyframes hpOverflowGlow {
  0%, 100% { box-shadow: 0 0 4px 1px rgba(255, 215, 0, 0.5), inset 0 0 6px rgba(255, 215, 0, 0.2); filter: brightness(1.05); }
  50% { box-shadow: 0 0 12px 3px rgba(255, 215, 0, 0.9), inset 0 0 10px rgba(255, 215, 0, 0.35); filter: brightness(1.25); }
}

.player-hpbar-val {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  font-size: 0.6rem;
  font-weight: 700;
  font-family: "Cinzel", serif;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.player-hpbar-wall-val {
  font-size: 0.55rem;
}

/* Blue player: name right-aligned, bars fill right-to-left (P2 fighter style) */
.player-hpbar-blue .player-hpbar-name {
  justify-content: flex-end;
}

.player-hpbar-blue .player-hpbar-track {
  display: flex;
  justify-content: flex-end;
}

.skip-tutorial-btn {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.skip-tutorial-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}

.skip-tutorial-btn:active {
  transform: scale(0.98);
}

/* Unified resource panel — one cohesive container instead of 6 individual pills */
.main-resources-group {
  display: flex;
  flex-direction: column;
  background: var(--panel-texture-url) center/cover, var(--panel-bg);
  border: 1.5px solid var(--resource-panel-border);
  border-radius: 12px;
  padding: 4px 6px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.main-resources-group .icon-number {
  background-color: transparent;
  border-radius: 0;
  gap: 4px;
}

/* Fixed two-column grid: left group always left half, right group always right half.
   This prevents layout jiggle when numbers change from 1 to 2 digits. */
.main-resources-group .resource-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

/* Right group: push content to the right edge of its column */
.main-resources-group .resource-stats .icon-number:last-child {
  justify-content: flex-end;
}

/* Secondary (income) icon — smaller than the primary */
.main-resources-group .resource-stats .icon-number:last-child .icon-img {
  width: 16px;
}

/* Remove horizontal padding from numbers — the pill bg is gone, padding just adds dead space */
.main-resources-group .number {
  padding-left: 0;
  padding-right: 0;
}

.main-resources-group .resource-stats + .resource-stats {
  border-top: 1px solid rgba(128, 128, 128, 0.2);
}

.resource-stats {
  display: flex;
  padding: 5px 0;
  position: relative;
}

.resource-protected {
  border-radius: 10px;
}

/* Primary resource count — larger and heavier, the main read */
.resource-value {
  font-size: 1.35em;
  font-weight: 800;
}

/* Income value — secondary read, smaller and dimmed */
.resource-inc-value {
  font-size: 1.2em;
  opacity: 0.6;
}

/* Outline on resource numbers — theme-aware via CSS variables */
.number span {
  -webkit-text-stroke: var(--stat-stroke);
  paint-order: stroke fill;
}

.number span.stat-pos {
  color: var(--stat-color-pos);
  -webkit-text-stroke: var(--stat-stroke-pos);
}

.number span.stat-neg {
  color: var(--stat-color-neg);
  -webkit-text-stroke: var(--stat-stroke-neg);
}

.resource-protected-shield {
  position: absolute;
  top: -6px;
  left: -10px;
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 0 8px rgba(69, 123, 157, 0.6));
  opacity: 0.95;
  pointer-events: none;
}

.resource-buffed .icon {
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.resource-buffed-build .icon {
  box-shadow:
    0 0 10px rgba(188, 108, 37, 0.6),
    0 0 18px rgba(188, 108, 37, 0.45);
}

.resource-buffed-attack .icon {
  box-shadow:
    0 0 10px rgba(230, 57, 70, 0.7),
    0 0 18px rgba(230, 57, 70, 0.5);
}

.resource-buffed-magic .icon {
  box-shadow:
    0 0 10px rgba(157, 78, 221, 0.7),
    0 0 18px rgba(157, 78, 221, 0.5);
}

.resource-buff-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #ffd54f;
  color: #4a3400;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.resource-blocked-badge {
  position: absolute;
  top: -8px;
  left: -10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(60, 60, 60, 0.9);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.shield-magic-defense {
  position: absolute;
  top: 50%;
  /* Center vertically */
  left: 50%;
  /* Center horizontally */
  transform: translate(-50%, -50%);
  /* Adjust position to center the image fully */
  width: 40%;
  /* Adjust size as needed */
  height: auto;
  z-index: 10;
  /* Ensure it appears on top of other content */
}

.shield-magic-defense-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40%;
  height: auto;
  z-index: 9;
  filter: blur(10px) brightness(1.5);
}

.image-container,
.castle-visual-group,
.castle-and-wall {
  overflow: visible !important;
}

.castle-decoration {
  position: absolute;
  pointer-events: none;
  z-index: 3;
  max-width: 40%;
  max-height: 40%;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  background: none;
  border-radius: 0;
}

.status-dot::before {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 11px;
  content: "\f06d"; /* fire */
}

.status-dot.online::before {
  color: #e8902a;
  filter: drop-shadow(0 0 3px rgba(232, 144, 42, 0.65));
}

.status-dot.offline::before {
  color: rgba(120, 90, 60, 0.35);
  filter: none;
}

.status-dot.away::before {
  color: #d4a817;
  filter: drop-shadow(0 0 3px rgba(212, 168, 23, 0.5));
}

.banner-on-home {
  width: 300px;
  height: 250px;
  margin-right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  z-index: 3;
}

.banner-on-home.hidden {
  display: none;
}

.banner-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  padding-top: 36px;
  text-align: center;
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  position: relative;
  animation: fadeInOut 0.4s ease-in-out;
}

/* Category label tab */
.banner-category-label {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 4px 10px;
  font-family: "Cinzel", serif;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 5px;
  border-bottom: 1px solid var(--surface-border);
}

/* Game news — amber/gold */
.banner-cat-game .banner-category-label {
  background: linear-gradient(to right, #7a4a00, #5a3000);
  color: #f5d080;
  border-bottom-color: #a06010;
}

/* Indie spotlight / cross-promo — deep teal */
.banner-cat-promo .banner-category-label {
  background: linear-gradient(to right, #0d3d3a, #082828);
  color: #7ee8e0;
  border-bottom-color: #1a6060;
}

/* Community — deep purple */
.banner-cat-community .banner-category-label {
  background: linear-gradient(to right, #2e1a4a, #1a0a30);
  color: #c4a0f0;
  border-bottom-color: #5a3090;
}

/* Image-type banner: full clickable image with optional CTA overlay */
.banner-fallback-image {
  padding: 0;
  gap: 0;
  background: none;
  text-decoration: none;
  color: inherit;
  position: relative;
  cursor: pointer;
}

.fallback-image-full {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.fallback-image-cta {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  font-family: "Comfortaa", sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.2s;
}

.banner-fallback-image:hover .fallback-image-cta {
  background: #fff;
}

.fallback-image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.fallback-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fallback-content h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
}

.fallback-content p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--text);
}

.fallback-link {
  margin-top: 8px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(to bottom, #d4841c 0%, #a85f08 50%, #5a2e00 100%);
  border: 2px solid #2a1a0a;
  border-radius: 2px;
  color: #fff5d6;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.fallback-link:hover {
  background: linear-gradient(to bottom, #e4942c 0%, #b86f18 50%, #6a3e10 100%);
  border-color: #3a2a1a;
}

@keyframes fadeInOut {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.fallback-mobile-download {
  background-image: url(/screenshots/cwGameplayOnPhonesScewedTiny.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.fallback-mobile-download .fallback-image {
  display: none;
}

.fallback-mobile-download .fallback-content {
  background: transparent;
  padding: 0;
  border-radius: 0;
  gap: 0;
  backdrop-filter: none;
}

.fallback-mobile-download .fallback-content h3,
.fallback-mobile-download .fallback-content p {
  display: none;
}

.fallback-mobile-download .fallback-link {
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  font-weight: bold;
  border-color: white;
  padding: 12px 32px;
  font-size: 1rem;
  border-radius: 6px;
}

.fallback-mobile-download .fallback-link:hover {
  background: white;
}

.small-text-pane {
  width: 400px;
  margin-left: 10px;
}

.eventlog {
  display: flex;
  flex-direction: column;
  align-items: first baseline;
  align-self: baseline;
  height: 80px;
  width: 100%;
  overflow: scroll;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */

  ::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari */
  }
}

/* HEX MAP */
/* Map Container */
.map-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
  width: 100%;
}

/* Unified Campaign Dashboard Panel */
.campaign-dashboard {
  width: 100%;
  max-width: 900px;
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  overflow: hidden;
}

/* Campaign Progress Header — inside dashboard, no own background */
.campaign-progress-header {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Campaign CTA — inside dashboard, separated by top border */
.campaign-dashboard .campaign-cta {
  background: rgba(0, 0, 0, 0.1);
  border: none;
  border-top: 1px solid var(--surface-border);
  border-radius: 0;
  max-width: 100%;
}

.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  color: var(--papyrus-text);
  font-family: "Cinzel", serif;
  font-weight: 700;
}

.progress-title i {
  color: #c8960c;
  font-size: 1.5rem;
}

.progress-stats {
  display: flex;
  gap: 16px;
}

.progress-status {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.progress-level {
  font-weight: 700;
  color: #c8960c;
}

.progress-bar-container {
  width: 100%;
  height: 24px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
  position: relative;
}

.progress-bar-label {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 700;
  color: #1a0a00;
  text-shadow: none;
  z-index: 1;
  font-family: "Cinzel", serif;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #b7892b 0%, #c8960c 50%, #e6ce6a 100%);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  position: relative;
  box-shadow: 0 0 8px rgba(200, 150, 12, 0.3) inset;
}

.progress-bar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Campaign Stars Toplist */
.campaign-stars-toplist {
  width: 90%;
  max-width: 500px;
  margin: 24px auto 0;
}

.campaign-stars-toplist-title {
  text-align: center;
  color: var(--papyrus-text);
  font-size: 1.15rem;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Cinzel", serif;
}

.campaign-stars-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  overflow: hidden;
}

.campaign-stars-table thead {
  background: rgba(0, 0, 0, 0.2);
}

.campaign-stars-table th {
  color: var(--papyrus-text);
  font-weight: bold;
  padding: 10px 12px;
  text-align: left;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: "Cinzel", serif;
}

.campaign-stars-table td {
  color: var(--text);
  padding: 10px 12px;
  border-bottom: 1px solid var(--surface-border);
}

.campaign-stars-table tbody tr:last-child td {
  border-bottom: none;
}

.campaign-stars-table tbody tr:hover {
  background: rgba(200, 150, 12, 0.06);
}

.cst-rank {
  width: 40px;
  text-align: center !important;
  font-weight: bold;
}

.cst-player {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cst-stars {
  width: 90px;
  text-align: right !important;
  white-space: nowrap;
}

.cst-star-icon {
  color: #ffd700;
  font-size: 0.75em;
}

.cst-star-count {
  font-weight: bold;
  color: #ffd700;
  margin-left: 4px;
  font-size: 0.9em;
}

.cst-player-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}

.cst-player-link:hover {
  color: #c8960c;
  text-decoration: underline;
}

.cst-is-player {
  background: linear-gradient(90deg, rgba(240, 192, 64, 0.12) 0%, transparent 80%);
  box-shadow: inset 3px 0 0 #f0c040;
}

.cst-is-player:hover {
  background: linear-gradient(90deg, rgba(240, 192, 64, 0.2) 0%, rgba(255, 255, 255, 0.04) 80%) !important;
}

.cst-you-badge {
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  color: #1a0a00;
  font-size: 0.62em;
  padding: 1px 5px;
  border-radius: 2px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .campaign-stars-toplist {
    width: 95%;
  }

  .campaign-stars-table th,
  .campaign-stars-table td {
    padding: 8px 10px;
    font-size: 0.85em;
  }
}

@media (max-width: 768px) {
  .campaign-progress-header {
    padding: 16px;
  }

  .progress-info {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .progress-title {
    font-size: 1.1rem;
  }
}

.campaign-cta {
  width: 100%;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-sizing: border-box;
}

.campaign-cta-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
}

.campaign-cta-stars {
  margin-left: 8px;
  color: #f0c040;
  font-size: 0.8rem;
}

.campaign-cta-stars i {
  margin-right: 2px;
}

.campaign-cta-btn {
  padding: 10px 24px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: "Cinzel", serif;
  gap: 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.campaign-cta-complete .campaign-cta-subtitle {
  width: 100%;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
}

.campaign-cta-complete .campaign-cta-subtitle i {
  color: #f0c040;
  margin-right: 8px;
}

@media (max-width: 768px) {
  .campaign-cta {
    flex-direction: column;
    text-align: center;
    padding: 14px 16px;
  }
}

.map-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  padding: 20px 0;
}

.hex-map {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.hex-map-row {
  display: flex;
  justify-content: center;
}

/* Hexagon Styling */
.hex {
  width: 50px;
  height: 57px;
  background-color: #6b8e23;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 12px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.15);
  margin-right: 1px;
}

.hex-img {
  background-size: cover;
  background-position: center;
}

.hex:hover {
  transform: scale(1.08) translateZ(0);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.4);
}

.hex:active {
  transform: scale(0.98);
}

.hex-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(0, 0, 0, 0.1) 100%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.hex:hover .hex-overlay {
  opacity: 1;
}

.hex-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.hex-value-txt {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 16px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.hex:hover .hex-value-txt {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

.hex-locked {
  opacity: 0.6;
  filter: grayscale(1) brightness(0.85);
}

.hex-locked:hover {
  opacity: 0.75;
  filter: grayscale(0.8) brightness(0.95);
}

.hex-unlocked {
  filter: brightness(1) saturate(1.1);
}

.hex-glow-gold {
  filter: brightness(1.1) saturate(1.2) drop-shadow(0 0 8px rgba(255, 215, 0, 0.7));
}

.hex-glow-silver {
  filter: brightness(1.1) saturate(1.1) drop-shadow(0 0 8px rgba(192, 192, 192, 0.6));
}

.hex-glow-bronze {
  filter: brightness(1.05) saturate(1.05) drop-shadow(0 0 6px rgba(205, 127, 50, 0.5));
}

.hex-reward-badge {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  color: #ffd700;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid #ffd700;
  animation: rewardBadgePulse 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes rewardBadgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Hex glow effect for highlighting next level */
.hex-glow {
  animation: hexGlowPulse 1.5s ease-in-out 3;
  z-index: 10;
  position: relative;
}

@keyframes hexGlowPulse {
  0%, 100% {
    filter: brightness(1) saturate(1.1) drop-shadow(0 0 0px rgba(255, 215, 0, 0));
    transform: scale(1);
  }
  50% {
    filter: brightness(1.4) saturate(1.5) drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
    transform: scale(1.15);
  }
}

.hex-map-offset {
  margin-left: 51px;
  height: 31px;
  transform: translate(0, -13px);
}

/* Campaign map: scale hexes up 1.8x for better readability */
.campaign-map-wrapper .hex {
  width: 90px;
  height: 103px;
  margin-right: 2px;
}

.campaign-map-wrapper .hex-map-offset {
  margin-left: 92px;
  height: 56px;
  transform: translate(0, -23px);
}

@media (max-width: 480px) {
  .campaign-map-wrapper .hex {
    width: 50px;
    height: 57px;
    margin-right: 1px;
  }

  .campaign-map-wrapper .hex-map-offset {
    margin-left: 51px;
    height: 31px;
    transform: translate(0, -13px);
  }

  .campaign-map-wrapper .hex-next-wrapper {
    margin-right: 1px;
  }

  .hex-next-arrow {
    font-size: 1.2rem;
    top: -28px;
  }
}

/* Wrapper for next-level hex — allows the arrow to float above */
.hex-next-wrapper {
  position: relative;
  overflow: visible;
  margin-right: 1px;
}

.hex-next-wrapper .hex {
  margin-right: 0;
}

.campaign-map-wrapper .hex-next-wrapper {
  margin-right: 2px;
}

/* Bouncing amber arrow above the next-level hex */
.hex-next-arrow {
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  color: #e6ce6a;
  font-size: 1.8rem;
  z-index: 20;
  pointer-events: none;
  text-shadow:
    0 0 6px rgba(200, 150, 12, 1),
    0 0 16px rgba(200, 150, 12, 0.8),
    0 0 30px rgba(200, 150, 12, 0.5);
  animation: hexArrowBounce 0.85s ease-in-out infinite;
}

@keyframes hexArrowBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
  50% { transform: translateX(-50%) translateY(-8px); opacity: 0.75; }
}

/* Next level to play: permanent amber pulsing glow */
.hex-next-level {
  animation: hexNextLevelGlow 2s ease-in-out infinite;
  z-index: 5;
  position: relative;
}

@keyframes hexNextLevelGlow {
  0%, 100% {
    filter: brightness(1.1) saturate(1.3) drop-shadow(0 0 6px rgba(200, 150, 12, 0.7));
    transform: scale(1);
  }
  50% {
    filter: brightness(1.25) saturate(1.5) drop-shadow(0 0 18px rgba(200, 150, 12, 1));
    transform: scale(1.05);
  }
}

/* Empty campaign hex: radial depth + crosshatch texture */
.hex-campaign.hex-empty {
  background-image:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.22) 100%),
    repeating-linear-gradient(
      60deg,
      rgba(0, 0, 0, 0.06) 0px,
      rgba(0, 0, 0, 0.06) 1px,
      transparent 1px,
      transparent 9px
    ),
    repeating-linear-gradient(
      120deg,
      rgba(0, 0, 0, 0.06) 0px,
      rgba(0, 0, 0, 0.06) 1px,
      transparent 1px,
      transparent 9px
    ) !important;
}

/* Map Info Section */
.map-info-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 900px;
}

.map-info-panel {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-info-placeholder {
  text-align: center;
  opacity: 0.8;
}

.map-info-placeholder i {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.6;
}

.map-info-placeholder p {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.map-description-panel {
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
}

.map-description-content {
  padding: 20px 0;
}

.map-description-title {
  margin: 0 0 16px 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--papyrus-text);
  font-family: "Cinzel", serif;
  letter-spacing: 1px;
}

.map-description-text {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
}

.map-description-text:last-of-type {
  margin-bottom: 16px;
}

.play-now-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  color: #1a0a00;
  text-decoration: none;
  font-weight: 700;
  font-family: "Cinzel", serif;
  border-radius: 2px;
  transition: all 0.2s ease;
  border: 1px solid #b7892b;
  cursor: pointer;
  font-size: 1rem;
}

.play-now-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 150, 12, 0.35);
}

/* Campaign Info Panel Styling */
.campaign-info-panel {
  min-height: unset;
  padding: 0;
}

.campaign-level-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--surface-border);
}

.campaign-level-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  border: 1px solid #b7892b;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.level-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: #1a0a00;
  font-family: "Cinzel", serif;
}

.campaign-level-title {
  flex: 1;
}

.campaign-level-title h3 {
  margin: 0 0 6px 0;
  font-size: 1.4rem;
  color: var(--papyrus-text);
  font-family: "Cinzel", serif;
}

.campaign-difficulty {
  display: flex;
  gap: 4px;
  font-size: 1rem;
}

.campaign-level-image {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--surface-border);
}

.campaign-content {
  padding: 20px;
}

.campaign-description {
  margin: 0 0 16px 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
}

.campaign-learning-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(200, 150, 12, 0.08);
  border-left: 3px solid #c8960c;
  border-radius: 2px;
  margin-bottom: 16px;
}

.campaign-learning-box i {
  color: #c8960c;
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.campaign-learning-box span {
  font-size: 0.9rem;
  color: var(--text);
}

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

.campaign-btn-play,
.campaign-btn-locked {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 2px;
  font-weight: 700;
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.campaign-btn-play {
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  border: 1px solid #b7892b;
  color: #1a0a00;
}

.campaign-btn-play:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 150, 12, 0.35);
}

.campaign-btn-play:active {
  transform: translateY(0);
}

.campaign-btn-locked {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  color: var(--text);
  cursor: not-allowed;
  opacity: 0.5;
}

.campaign-star-hints {
  margin-top: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  border: 1px solid var(--surface-border);
}

.campaign-star-hints-title {
  font-family: "Cinzel", serif;
  font-size: 13px;
  margin: 0 0 8px 0;
  color: #c8960c;
}

.campaign-star-hints-title i {
  color: #c8960c;
}

.campaign-star-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.campaign-star-hint:last-child {
  border-bottom: none;
}

.campaign-star-hint.achieved {
  opacity: 0.6;
}

.campaign-star-hint > i {
  flex-shrink: 0;
  font-size: 14px;
}

.campaign-star-hint-label {
  font-weight: 700;
  font-size: 12px;
  display: block;
  color: var(--papyrus-text);
}

.campaign-star-hint-desc {
  font-size: 11px;
  opacity: 0.7;
  display: block;
}

.campaign-star-hint-info {
  flex: 1;
}

.campaign-star-hint-reward {
  flex-shrink: 0;
  margin-left: auto;
}

.campaign-star-claim-btn {
  padding: 3px 10px;
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  border: 1px solid #b7892b;
  border-radius: 2px;
  color: #1a0a00;
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 11px;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.campaign-star-claim-btn:hover {
  opacity: 0.85;
}

.campaign-star-claimed {
  color: #28a745;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.campaign-star-reward-locked {
  color: #c8960c;
  font-size: 11px;
  opacity: 0.4;
  white-space: nowrap;
}

/* Campaign Chat */
.campaign-chat-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--surface-border);
}

.campaign-chat-title {
  font-size: 0.85rem;
  margin: 0 0 8px;
  color: var(--papyrus-text);
  font-family: "Cinzel", serif;
}

.campaign-chat-title i {
  margin-right: 4px;
}

.campaign-chat {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  padding: 8px;
}

.campaign-chat-messages {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.campaign-chat-msg {
  font-size: 0.8rem;
  line-height: 1.3;
  padding: 5px 8px;
  border-left: 2px solid #c8960c;
  border-radius: 0 2px 2px 0;
  background: rgba(0, 0, 0, 0.15);
}

.campaign-chat-admin {
  border-left-color: #e0c882;
}

.campaign-chat-name {
  font-weight: 700;
  margin-right: 4px;
  color: #c8960c;
  font-size: 0.8rem;
}

.campaign-chat-admin-icon {
  color: #e0c882;
  font-size: 0.7rem;
  margin-right: 4px;
}

.campaign-chat-text {
  color: var(--text);
  word-break: break-word;
}

.campaign-chat-empty {
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0.45;
  text-align: center;
  margin: 8px 0;
  font-style: italic;
}

.campaign-chat-form {
  display: flex;
  gap: 6px;
}

.campaign-chat-form input {
  flex: 1;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  padding: 6px 10px;
  font-size: 0.8rem;
  outline: none;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  transition: border-color 0.2s ease;
}

.campaign-chat-form input:focus {
  border-color: #c8960c;
}

.campaign-chat-form button {
  border: 1px solid #b7892b;
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  color: #1a0a00;
  border-radius: 2px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: opacity 0.2s ease;
}

.campaign-chat-form button:hover {
  opacity: 0.85;
}

.campaign-chat-login-hint {
  font-size: 0.75rem;
  color: var(--text);
  opacity: 0.45;
  text-align: center;
  margin: 4px 0 0;
}

/* Responsive Campaign Panel */
@media (max-width: 768px) {
  .campaign-level-header {
    padding: 16px;
    flex-direction: column;
    text-align: center;
  }

  .campaign-level-title h3 {
    font-size: 1.2rem;
  }

  .campaign-level-badge {
    width: 50px;
    height: 50px;
  }

  .level-number {
    font-size: 1.4rem;
  }

  .campaign-actions {
    flex-direction: column;
  }
}

/* ==================== MAP INFO MODAL ==================== */

.map-info-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  animation: fadeIn 0.2s ease;
}

.map-info-modal.hidden {
  display: none;
}

.map-info-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.map-info-modal-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
  animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.map-info-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--surface-border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.map-info-modal-close:hover {
  background: rgba(200, 150, 12, 0.15);
  border-color: #c8960c;
  color: #c8960c;
}

.map-info-modal-content {
  position: relative;
}

.map-info-modal-content .map-info-content {
  margin: 0;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Ensure campaign level image is responsive in modal */
.map-info-modal-content .campaign-level-image {
  max-height: 250px;
  object-fit: cover;
}

/* Make sure buttons fit well in modal */
.map-info-modal-content .campaign-actions {
  display: flex;
  gap: 10px;
}

.map-info-modal-content .campaign-btn-play,
.map-info-modal-content .campaign-btn-locked {
  min-width: 0;
  flex: 1;
}

/* ==================== TOURNAMENT SYSTEM ==================== */

.hex-tournament-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
}

.hex-arena-name {
  font-size: 0.6em;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  color: #fff;
  text-align: center;
  line-height: 1.1;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hex-tournament-time {
  font-size: 0.55em;
  color: #f1c40f;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.hex-player-count {
  font-size: 0.55em;
  color: #ddd;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.hex-player-count i {
  font-size: 0.8em;
  margin-right: 2px;
}

.hex-status-badge {
  font-size: 0.5em;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hex-status-active {
  background: #e74c3c;
  color: #fff;
  animation: pulse-badge 1.5s infinite;
}

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

.hex-tournament-active {
  box-shadow: 0 0 15px 3px rgba(231, 76, 60, 0.6);
  animation: tournament-glow 2s ease-in-out infinite;
}

@keyframes tournament-glow {
  0%, 100% { box-shadow: 0 0 15px 3px rgba(231, 76, 60, 0.6); }
  50% { box-shadow: 0 0 25px 6px rgba(231, 76, 60, 0.9); }
}

.hex-tournament-upcoming {
  box-shadow: 0 0 10px 2px rgba(241, 196, 15, 0.4);
}

.hex-tournament-closed {
  filter: grayscale(70%) brightness(50%);
  opacity: 0.6;
}

.hex-tournament-closed-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hex-status-closed {
  background: rgba(100, 100, 100, 0.8);
  color: #aaa;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}

.tournament-info-closed {
  text-align: center;
}

.tournament-closed-notice {
  margin-top: 12px;
  padding: 12px;
  background: rgba(100, 100, 100, 0.15);
  border-radius: 8px;
  color: #aaa;
  font-size: 0.9em;
}

.tournament-closed-notice p {
  margin: 4px 0;
}

.tournament-this-arena {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 0.9em;
}

.tournament-this-time {
  color: #f1c40f;
  font-weight: bold;
}

.tournament-this-players {
  color: var(--text);
  opacity: 0.8;
}

.tournament-this-players i {
  color: #DAA520;
  margin-right: 4px;
}

/* Tournament info modal */
.tournament-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tournament-header {
  text-align: center;
}

.tournament-arena-name {
  margin: 0 0 4px 0;
  font-size: 1.3em;
  color: var(--text);
}

.tournament-arena-name i {
  margin-right: 6px;
  color: #DAA520;
}

.tournament-arena-desc {
  margin: 0;
  font-size: 0.85em;
  color: var(--text);
  opacity: 0.6;
  font-style: italic;
}

.tournament-recent {
  margin: 10px 0 12px 0;
  padding: 8px 10px;
  background: rgba(128, 128, 128, 0.07);
  border-radius: 6px;
  border: 1px solid rgba(128, 128, 128, 0.12);
}

.tournament-recent-title {
  margin: 0 0 7px 0;
  font-size: 0.8em;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tournament-recent-title i {
  margin-right: 5px;
}

.tournament-recent-entry {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

.tournament-recent-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.tournament-recent-date {
  font-size: 0.7em;
  opacity: 0.45;
}

.tournament-recent-podium {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.podium-entry {
  font-size: 0.82em;
  display: flex;
  align-items: center;
  gap: 5px;
}

.podium-1st i { color: #ffd700; }
.podium-2nd i { color: #b0b0b0; }
.podium-3rd i { color: #cd7f32; }

.tournament-schedule-title {
  margin: 0 0 8px 0;
  font-size: 1em;
  color: var(--text);
}

.tournament-schedule-title i {
  margin-right: 6px;
  color: #DAA520;
}

.tournament-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tournament-schedule-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(128, 128, 128, 0.08);
  border: 1px solid rgba(128, 128, 128, 0.2);
}

.tournament-schedule-item.tournament-active {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.4);
}

.tournament-schedule-item.tournament-upcoming {
  background: rgba(241, 196, 15, 0.08);
  border-color: rgba(241, 196, 15, 0.2);
}

.tournament-schedule-item.tournament-current {
  border-color: #DAA520;
  border-width: 2px;
}

.tournament-schedule-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tournament-schedule-status {
  font-size: 0.75em;
  font-weight: bold;
  text-transform: uppercase;
  min-width: 80px;
}

.tournament-schedule-status i {
  margin-right: 4px;
}

.tournament-active .tournament-schedule-status {
  color: #e74c3c;
}

.tournament-upcoming .tournament-schedule-status {
  color: #f1c40f;
}

.tournament-completed .tournament-schedule-status {
  color: #7f8c8d;
}

.tournament-schedule-arena {
  font-size: 0.85em;
  color: var(--text);
}

.tournament-schedule-time {
  font-size: 0.8em;
  color: var(--text);
  opacity: 0.6;
}

.tournament-schedule-players {
  font-size: 0.8em;
  color: var(--text);
  opacity: 0.8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tournament-schedule-players i {
  color: #DAA520;
}

.tournament-actions {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.tournament-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  font-size: 0.95em;
  transition: all 0.2s;
}

.tournament-btn-register {
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  border: 1px solid #a07820;
  color: #1a0a00;
  font-family: "Cinzel", serif;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.tournament-btn-register:hover {
  background: linear-gradient(to bottom, #f0da80 0%, #d4a20e 50%, #c8960c 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.tournament-btn-unregister {
  background: transparent;
  border: 1px solid rgba(180, 140, 80, 0.45);
  color: var(--text);
  opacity: 0.75;
}

.tournament-btn-unregister:hover {
  opacity: 1;
  border-color: rgba(180, 140, 80, 0.75);
  transform: translateY(-1px);
}

/* Tournament banner above the map */
.tournament-banner {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 12px;
}

.tournament-banner-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--cloud-bg);
  border: 1px solid rgba(128, 128, 128, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.tournament-banner-card-upcoming {
  border-color: rgba(241, 196, 15, 0.35);
}

.tournament-banner-status {
  font-size: 0.7em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
  display: inline-block;
  width: fit-content;
}

.tournament-banner-live {
  background: rgba(231, 76, 60, 0.25);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.4);
  animation: pulse-badge 1.5s infinite;
}

.tournament-banner-completed {
  background: rgba(127, 140, 141, 0.2);
  color: #95a5a6;
  border: 1px solid rgba(127, 140, 141, 0.3);
}

.tournament-banner-upcoming {
  background: rgba(241, 196, 15, 0.15);
  color: #f1c40f;
  border: 1px solid rgba(241, 196, 15, 0.3);
}

.tournament-banner-details {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tournament-banner-arena {
  font-weight: bold;
  color: var(--text);
  font-size: 0.95em;
}

.tournament-banner-time {
  color: #f1c40f;
  font-size: 0.85em;
  font-weight: bold;
}

.tournament-banner-players {
  color: var(--text);
  opacity: 0.65;
  font-size: 0.8em;
}

.tournament-banner-players i {
  color: #DAA520;
  margin-right: 3px;
}

.tournament-banner-action {
  margin-top: 4px;
}

.tournament-banner-action .tournament-btn {
  width: 100%;
  justify-content: center;
  padding: 8px 16px;
  font-size: 0.85em;
}

.tournament-banner-prize {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--cloud-bg);
  border: 1px solid rgba(218, 165, 32, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  min-width: 100px;
}

.tournament-banner-prize-label {
  font-size: 0.7em;
  color: var(--text);
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tournament-banner-prize-label i {
  margin-right: 3px;
  color: #DAA520;
}

.tournament-banner-prize-total {
  font-size: 1.4em;
  font-weight: bold;
  color: #f1c40f;
}

.tournament-banner-prize-split {
  display: flex;
  gap: 8px;
  font-size: 0.7em;
}

.prize-1st {
  color: #ffd700;
}

.prize-2nd {
  color: #c0c0c0;
}

.prize-3rd {
  color: #cd7f32;
}

.tournament-banner-prize-split i {
  margin-right: 2px;
}

@media (max-width: 768px) {
  .tournament-banner {
    flex-direction: column;
    gap: 8px;
  }

  .tournament-banner-details {
    justify-content: center;
  }

  .tournament-banner-card {
    align-items: center;
    text-align: center;
  }

  .tournament-banner-prize-split {
    justify-content: center;
  }
}

/* Responsive modal adjustments */
@media (max-width: 768px) {
  .map-info-modal {
    padding: 15px;
  }

  .map-info-modal-container {
    max-width: 100%;
    max-height: 95vh;
  }

  .map-info-modal-close {
    width: 32px;
    height: 32px;
    font-size: 1rem;
    top: 8px;
    right: 8px;
  }
}

@media (max-width: 480px) {
  .map-info-modal {
    padding: 10px;
  }

  .map-info-modal-container {
    max-height: 98vh;
  }

  .map-info-modal-close {
    width: 30px;
    height: 30px;
    top: 6px;
    right: 6px;
  }
}

@media (max-height: 600px) {
  .map-info-modal {
    padding: 10px;
    align-items: flex-start;
  }

  .map-info-modal-container {
    max-height: 98vh;
    margin-top: 10px;
  }

  .map-info-modal-content .campaign-level-image {
    max-height: 150px;
  }
}

@media (max-height: 450px) {
  .map-info-modal-container {
    max-height: 95vh;
  }

  .map-info-modal-content .campaign-level-header {
    padding: 12px;
  }

  .map-info-modal-content .campaign-level-image {
    max-height: 120px;
  }

  .map-info-modal-content .campaign-content {
    padding: 15px;
  }

  .map-info-modal-content .campaign-description {
    font-size: 0.9rem;
  }
}

/* ==================== MODERN PROGRESS BAR ==================== */

.progbar-modern {
  background: var(--cloud-bg2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--text);
}

.progbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.progbar-header:hover {
  background: rgba(0, 0, 0, 0.05);
}

.progbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}

.progbar-title i {
  color: #ffa726;
  font-size: 16px;
}

.progbar-toggle {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.3s ease;
}

.progbar-content.collapsed {
  max-height: 0;
  overflow: hidden;
}

.progbar-content.collapsed + .progbar-header .progbar-toggle i {
  transform: rotate(-90deg);
}

.progbar-content {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 20px;
}

.progbar-goal {
  padding: 15px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.progbar-goal:last-of-type {
  border-bottom: none;
}

.progbar-goal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}

.progbar-goal-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
}

.progbar-goal-icon {
  font-size: 20px;
  color: #ffa726;
  flex-shrink: 0;
  margin-top: 2px;
}

.progbar-goal-text {
  flex: 1;
  min-width: 0;
}

.progbar-goal-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.progbar-goal-rarity {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progbar-goal-desc {
  font-size: 12px;
  opacity: 0.7;
  line-height: 1.4;
}

.progbar-goal-points {
  font-weight: 700;
  font-size: 13px;
  color: #06a77d;
  flex-shrink: 0;
}

.progbar-goal-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progbar-progress-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progbar-progress-fill {
  height: 100%;
  background: #4fc3f7;
  border-radius: 10px;
  transition: width 0.5s ease, background-color 0.3s ease;
  position: relative;
}

.progbar-progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.progbar-progress-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.progbar-progress-stat {
  opacity: 0.7;
  font-weight: 500;
}

.progbar-progress-percent {
  font-weight: 700;
  color: var(--text);
}

.progbar-footer {
  padding: 15px 0;
  text-align: center;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  margin-top: 10px;
}

.progbar-view-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--primary-bg);
  color: var(--text-on-dark);
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.progbar-view-all:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.progbar-view-all i {
  font-size: 10px;
}

.progbar-empty {
  padding: 20px;
}

.progbar-empty-message {
  text-align: center;
  opacity: 0.6;
}

.progbar-empty-message i {
  font-size: 32px;
  color: #ffa726;
  margin-bottom: 10px;
}

.progbar-empty-message p {
  font-size: 14px;
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .progbar-header {
    padding: 10px 15px;
  }

  .progbar-content {
    padding: 0 15px;
  }

  .progbar-goal {
    padding: 12px 0;
  }

  .progbar-goal-header {
    flex-direction: column;
    gap: 8px;
  }

  .progbar-goal-points {
    align-self: flex-start;
  }

  .progbar-goal-icon {
    font-size: 18px;
  }

  .progbar-title {
    font-size: 13px;
  }
}

/* Toast Container */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

/* Toast Notification */
.toast {
  background-color: #333;
  color: #fff;
  padding: 12px 20px;
  border-radius: 5px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  animation:
    toastFadeIn 0.3s ease,
    toastFadeOut 0.5s ease 3s forwards;
}

/* Fade Animations */
@keyframes toastFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastFadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.fill-button {
  position: relative;
  height: 45px;
  width: 150px;
  margin: 10px 7px;
  padding: 5px 5px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 2px;
  color: gray;
  border: 2px #383736 solid;
  border-radius: 4px;
  text-transform: uppercase;
  outline: 0;
  overflow: hidden;
  background: none;
  z-index: 1;
  cursor: pointer;
  transition: 0.08s ease-in;
  -o-transition: 0.08s ease-in;
  -ms-transition: 0.08s ease-in;
  -moz-transition: 0.08s ease-in;
  -webkit-transition: 0.08s ease-in;
}

.fill-button:hover {
  color: whitesmoke;
}

.fill-button:before {
  content: "";
  position: absolute;
  background: #383736;
  bottom: 0;
  left: 0;
  right: 0;
  top: var(--fill-height, 20%);
  /*top: 100%;*/
  z-index: -1;
  -webkit-transition: top 0.09s ease-in;
}

/*.fill-button:hover:before {*/
/*  top: 0;*/
/*}*/
.advisor-wrapper {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10010;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.advisor-icon-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #2b2b2b;
  border: 3px solid #f5c518;
  cursor: pointer;
  position: relative;
  overflow: visible;
  pointer-events: all;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.advisor-icon-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.advisor-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
  display: block;
}

.advisor-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  background: #e63946;
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: bold;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: advisorBadgePop 0.3s ease;
  pointer-events: none;
}

@keyframes advisorBadgePop {
  0% { transform: scale(0); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.advisor-wrapper.advisor-unread .advisor-badge {
  display: flex;
}

.advisor-bubble {
  max-width: min(420px, calc(100vw - 110px));
  pointer-events: all;
}

.advisor-wrapper.advisor-minimized .advisor-bubble {
  display: none;
}

.bubble {
  position: relative;
  max-width: 700px;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  line-height: 1.4em;
  margin: 0;
  background-color: #fff;
  border: 8px solid #333;
  border-radius: 30px;
  font-family: sans-serif;
  padding: 20px;
  font-size: large;
  /* Never taller than the space above the character */
  max-height: calc(48vh - clamp(10px, 3vh, 40px));
  overflow-y: auto;
}

/* Ensure speech bubble is the positioning parent */
.speech.bubble {
  position: relative !important;
}

.speech-close-btn {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #999;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.15s ease;
}

.speech-close-btn:hover {
  color: #333;
  background: rgba(0, 0, 0, 0.08);
}

.speech-text {
  display: block;
}

.speech-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 8px 0 4px;
}

.speech-action-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.speech-action-primary {
  background: #e63946;
  color: #fff;
  box-shadow: 0 4px 10px rgba(230, 57, 70, 0.35);
}

.speech-action-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(230, 57, 70, 0.45);
}

.speech-action-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.speech-action-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.tutorial-skip-btn {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.speech-color-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.speech-color-buttons .color-button {
  flex-direction: row;
  font-size: 0.85rem;
  padding: 8px 18px;
  min-width: unset;
  letter-spacing: 0.5px;
}

.speech-cards-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
}

.speech-card-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.speech-card-thumb img {
  width: 60px;
  border-radius: 6px;
  border: 2px solid #333;
}

.speech-card-thumb > span {
  font-size: 0.75rem;
  color: #666;
  font-weight: 600;
}

.speech-card-effect {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 700;
}

.speech-card-effect img {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 0;
}

.speech-effect-from {
  color: #888;
}

.speech-effect-to,
.speech-effect-positive {
  color: #28a745;
}

.speech-effect-negative {
  color: #e63946;
}

.speech-card-effect i {
  font-size: 0.7rem;
  color: #888;
}

.speech-tutorial-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.proceed-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
  border: 2px solid #28a745;
  border-radius: 20px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.proceed-btn:hover {
  background: rgba(40, 167, 69, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(40, 167, 69, 0.25);
}

.proceed-btn:active {
  transform: translateY(0);
}

.proceed-btn i {
  font-size: 1rem;
}

.skip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(230, 57, 70, 0.1);
  color: #e63946;
  border: 2px solid #e63946;
  border-radius: 20px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.skip-btn:hover {
  background: rgba(230, 57, 70, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(230, 57, 70, 0.25);
}

.skip-btn:active {
  transform: translateY(0);
}

.skip-btn i {
  font-size: 1rem;
}

p.thought {
  width: 300px;
  border-radius: 200px;
  padding: 30px;
}

.bubble:before,
.bubble:after {
  content: none;
}

.advisor-bubble {
  position: relative;
}

.advisor-bubble:before,
.advisor-bubble:after {
  content: " ";
  position: absolute;
  width: 0;
  height: 0;
}

.advisor-bubble:before {
  right: 30px;
  left: auto;
  bottom: -48px;
  border: 24px solid;
  border-color: #333 transparent transparent transparent;
}

.advisor-bubble:after {
  right: 35px;
  left: auto;
  bottom: -31px;
  border: 19px solid;
  border-color: #fff transparent transparent transparent;
}

p.thought:before,
p.thought:after {
  left: 10px;
  bottom: -30px;
  width: 40px;
  height: 40px;
  background-color: #fff;
  border: 8px solid #333;
  -webkit-border-radius: 28px;
  -moz-border-radius: 28px;
  border-radius: 28px;
}

p.thought:after {
  width: 20px;
  height: 20px;
  left: 5px;
  bottom: -40px;
  -webkit-border-radius: 18px;
  -moz-border-radius: 18px;
  border-radius: 18px;
}

.speech-image {
  position: absolute;
  bottom: 0;
  left: 0;
  /*width: 50vw; /* Half of the screen width */
  height: 50vh; /* Half of the screen height */
  object-fit: cover;
}

/* Tutorial builder pop animation */
@keyframes tutorialBuilderPop {
  0%   { transform: scale(1);    filter: none; }
  25%  { transform: scale(1.7);  filter: drop-shadow(0 0 8px rgba(255, 200, 50, 0.95)); }
  55%  { transform: scale(1.45); filter: drop-shadow(0 0 5px rgba(255, 200, 50, 0.7)); }
  80%  { transform: scale(1.15); filter: none; }
  100% { transform: scale(1);    filter: none; }
}

.tutorial-builder-pop {
  animation: tutorialBuilderPop 1.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  z-index: 5;
}

/* Tutorial cursor / finger animation */
.tutorial-cursor {
  position: fixed;
  font-size: 52px;
  z-index: 10020;
  pointer-events: none;
  color: #fff;
  filter: drop-shadow(2px 3px 6px rgba(0, 0, 0, 0.85));
  transition: left 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              top 0.85s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.35s ease;
  transform-origin: top left;
  opacity: 0;
}

.tutorial-cursor.tutorial-cursor-visible {
  opacity: 1;
}

@keyframes tutorialClick {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.72); }
  70%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.tutorial-cursor.tutorial-cursor-click {
  animation: tutorialClick 0.35s ease forwards;
}

/* Ripple that appears at click point */
.tutorial-click-ripple {
  position: fixed;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  pointer-events: none;
  z-index: 10019;
  transform: translate(-50%, -50%) scale(0);
  animation: tutorialRipple 0.5s ease-out forwards;
}

@keyframes tutorialRipple {
  0%   { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}

/* Responsive adjustments for speech bubble on mobile */
@media (max-width: 768px) {
  .bubble {
    padding: 15px;
    font-size: medium;
  }
}

/* Cards Overview Grid */
.cards-overview-header {
  text-align: center;
  margin-bottom: 30px;
}

.cards-overview-header h3 {
  margin: 0 0 10px 0;
  font-size: 1.8rem;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
}

.cards-overview-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
  opacity: 0.8;
  letter-spacing: 0.5px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.card-grid-item {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: 2px;
  overflow: hidden;
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  transition: all 0.3s ease;
  cursor: pointer;
  height: 100%;
}

.card-grid-item:hover {
  transform: translateY(-8px);
  border-color: #c8960c;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.card-grid-image {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
}

.card-grid-overlay {
  position: absolute;
  inset: 0;
}

.deck-count-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  display: inline-flex;
  align-items: center;
  cursor: default;
}

.card-grid-overlay .card-type-badge {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.deck-count-number {
  background: rgba(15, 15, 25, 0.75);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  letter-spacing: 0.3px;
}

.deck-count-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  transform: none;
  background: rgba(15, 15, 25, 0.92);
  color: #fff;
  font-size: 0.78rem;
  font-family: "Comfortaa", sans-serif;
  padding: 5px 10px;
  border-radius: 6px;
  width: max-content;
  max-width: 160px;
  white-space: normal;
  line-height: 1.35;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  z-index: 10;
  pointer-events: none;
}

.deck-count-badge:hover .deck-count-tooltip {
  display: block;
}

.card-type-badge {
  padding: 6px 12px;
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-type-offense {
  background: rgba(205, 92, 92, 0.7);
}

.card-type-magic {
  background: rgba(173, 216, 230, 0.7);
  color: #333;
}

.card-type-defense {
  background: rgba(139, 69, 19, 0.7);
}

.card-type-special {
  background: rgba(128, 128, 128, 0.7);
}

.card-type-resource {
  background: rgba(255, 228, 181, 0.7);
  color: #333;
}

.card-grid-info {
  padding: 12px 12px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-grid-title {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
  line-height: 1.3;
  word-break: break-word;
  text-transform: capitalize;
}

.card-grid-costs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cost-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 2px;
  font-size: 0.8rem;
  color: white;
  font-weight: 500;
}

.tutorial-nav-link {
  transition: all 0.2s ease;
  border-radius: 6px;
  padding: 8px 16px;
  display: inline-block;
  border: 1px solid transparent;
}

.tutorial-nav-link:hover {
  background: rgba(200, 150, 12, 0.12);
  border-color: #c8960c;
}

/* Card Details View */
.card-details-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  padding: 28px 32px;
}

.card-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--surface-border);
}

.card-back-link {
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 2px;
  border: 1px solid var(--surface-border);
  background: rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.card-back-link:hover {
  background: rgba(200, 150, 12, 0.15);
  border-color: #c8960c;
}

.card-navigation-counter {
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 6px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.15);
}

.card-details-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.card-details-image-section {
  display: flex;
  justify-content: center;
}

.card-image-wrapper {
  position: relative;
  width: 100%;
  max-width: 400px;
  border-radius: 2px;
  overflow: hidden;
  border: 3px solid var(--surface-border);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 12px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.card-details-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.card-details-image:hover {
  transform: scale(1.02);
}

.card-type-badge-large {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  border-radius: 0;
  color: white;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.card-details-info-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-details-title-section {
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 16px;
}

.card-details-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
  text-transform: capitalize;
  line-height: 1.2;
}

.card-details-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px 0;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: "Cinzel", serif;
  color: #c8960c;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.card-details-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--surface-border);
}

.card-version-history {
  margin-top: 4px;
}

.card-version-gallery {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.card-version-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.card-version-thumb {
  width: 80px;
  height: 112px;
  object-fit: cover;
  border-radius: 2px;
  border: 2px solid var(--surface-border);
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.card-version-thumb:hover {
  opacity: 1;
  border-color: #c8960c;
}

.card-version-label {
  font-family: "Cinzel", serif;
  font-size: 0.65rem;
  color: var(--papyrus-text);
  opacity: 0.6;
  letter-spacing: 0.5px;
}

.card-details-description-section {
  padding: 0;
}

.card-details-description {
  margin: 0;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text);
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.18);
  border-left: 3px solid #c8960c;
  border-radius: 0 2px 2px 0;
  font-style: italic;
}

.card-details-stats {
  margin-top: 4px;
}

.card-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.card-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  background: var(--panel-texture-url) center/cover, var(--panel-bg);
  border: 1.5px solid var(--resource-panel-border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.card-stat-value {
  font-family: 'Oswald', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #c89a4a;
  line-height: 1;
  margin-bottom: 4px;
}

.card-stat-label {
  font-size: 0.7rem;
  color: var(--text);
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-navigation-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-border);
}

.card-nav-button {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.card-nav-button:hover {
  background: rgba(200, 150, 12, 0.12);
  border-color: #c8960c;
}

.card-nav-prev:hover {
  /* no transform — medieval doors don't slide */
}

.card-nav-button span {
  flex: 1;
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  color: var(--papyrus-text);
  text-transform: capitalize;
}

.card-nav-button i {
  font-size: 1rem;
  color: #c8960c;
}

/* Player List Styles */
.players-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
}

.players-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.players-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.8rem;
  font-family: "Cinzel", serif;
  color: var(--text);
  margin: 0;
  flex: 1;
}

.players-title i {
  color: var(--text);
}

.players-count {
  background: var(--cloud-bg);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--cloud-bg);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.back-link:hover {
  transform: translateX(-3px);
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--cloud-bg);
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.player-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.player-rank {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.6;
  min-width: 40px;
}

.player-info {
  flex: 1;
  min-width: 0;
}

.player-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.player-name i {
  color: var(--text);
  opacity: 0.7;
}

.player-stats {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.player-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0.8;
}

.player-stat i {
  font-size: 0.8rem;
}

.player-stat-date {
  display: none;
}

@media (min-width: 600px) {
  .player-stat-date {
    display: flex;
  }
}

.player-actions {
  display: flex;
  gap: 8px;
}

.player-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #457b9d 0%, #1d3557 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.player-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(69, 123, 157, 0.4);
}

.player-action-btn i {
  font-size: 0.9rem;
}

.player-action-btn span {
  display: none;
}

@media (min-width: 500px) {
  .player-action-btn span {
    display: inline;
  }
}

.player-action-disabled {
  background: rgba(128, 128, 128, 0.3);
  cursor: not-allowed;
}

.player-action-disabled:hover {
  transform: none;
  box-shadow: none;
}

.player-you-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
  border-radius: 8px;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
}

.players-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: var(--cloud-bg);
  border-radius: 12px;
  text-align: center;
}

.players-empty i {
  font-size: 3rem;
  color: var(--text);
  opacity: 0.4;
  margin-bottom: 16px;
}

.players-empty p {
  color: var(--text);
  font-size: 1.1rem;
  margin: 0;
}

.players-empty-hint {
  font-size: 0.9rem !important;
  opacity: 0.7;
  margin-top: 8px !important;
}

/* Profile Color Picker */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-input {
  width: 50px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
}

.color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input::-webkit-color-swatch {
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
}

.color-input::-moz-color-swatch {
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
}

.color-preview {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-value {
  font-family: monospace;
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Game Tooltip (follows cursor, respects Card Help setting) */
.game-tooltip {
  position: fixed;
  z-index: 100000;
  pointer-events: none;
  background: rgba(15, 15, 25, 0.92);
  color: #fff;
  font-size: 0.78rem;
  font-family: "Comfortaa", sans-serif;
  padding: 5px 10px;
  border-radius: 6px;
  max-width: 220px;
  white-space: normal;
  line-height: 1.35;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.1s ease;
}

.game-tooltip.game-tooltip-visible {
  opacity: 1;
}

/* In-Game Card Help Panel */
.card-help-container {
  width: 100%;
  max-width: 500px;
  margin: 8px auto 0;
  padding: 0 8px;
  box-sizing: border-box;
}

.card-help-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--help-panel-bg);
  border: 2px solid var(--help-panel-border);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  min-height: 40px;
  transition: all 0.2s ease;
}

.card-help-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--help-panel-icon);
  font-size: 14px;
}

.card-help-text {
  flex: 1;
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--help-panel-text);
  font-weight: 400;
}

/* Resource icon badges inside card help text */
.help-res-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  display: inline-block;
  margin-bottom: 1px;
}

.help-res-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 5px;
  margin: 0 1px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.8em;
  font-weight: 700;
  vertical-align: middle;
  white-space: nowrap;
}

.help-res-badge.help-res-cost span { color: #ff7575; }
.help-res-badge.help-res-gain span { color: #75ffb3; }
.help-res-badge.help-res-dmg span  { color: #ffaa75; }

/* Mobile responsive */
@media (max-width: 768px) {
  .card-help-container {
    margin: 6px auto 0;
    padding: 0 6px;
  }

  .card-help-panel {
    padding: 6px 10px;
    gap: 6px;
    min-height: 36px;
  }

  .card-help-icon {
    width: 18px;
    height: 18px;
    font-size: 12px;
  }

  .card-help-text {
    font-size: 11px;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .card-help-panel {
    padding: 5px 8px;
    gap: 6px;
    min-height: 32px;
    border-radius: 6px;
  }

  .card-help-icon {
    width: 16px;
    height: 16px;
    font-size: 11px;
  }

  .card-help-text {
    font-size: 10px;
    line-height: 1.3;
  }
}

/* Online Users Compact List */
.online-users-panel {
  padding: 20px 26px;
  margin-top: 12px;
  width: 100%;
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.online-users-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  opacity: 0.8;
}

.online-users-header i {
  color: #5b9ee9;
  font-size: 14px;
}

.online-users-self-wrap {
  margin-bottom: 8px;
}

.online-users-self {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(91, 158, 233, 0.08);
  border: 1px solid rgba(91, 158, 233, 0.2);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
}

.self-name {
  font-weight: 600;
}

.self-you-tag {
  font-size: 9px;
  background: #b8780a;
  color: #fff5d6;
  padding: 2px 14px 2px 7px;
  border-radius: 0;
  clip-path: polygon(0% 0%, calc(100% - 8px) 0%, 100% 50%, calc(100% - 8px) 100%, 0% 100%);
  text-transform: uppercase;
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.rename-btn {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--papyrus-text);
  opacity: 0.55;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 13px;
  transition: opacity 0.15s ease;
}

.rename-btn:hover {
  opacity: 1;
}

.rename-popover {
  margin-top: 6px;
  padding: 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--surface-border);
  border-radius: 2px;
}

.rename-popover.hidden {
  display: none;
}

.rename-form {
  display: flex;
  gap: 6px;
}

.rename-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid rgba(100, 120, 200, 0.25);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.15);
  color: var(--text);
  font-size: 13px;
  outline: none;
  min-width: 0;
  transition: border-color 0.2s ease;
}

.rename-input::placeholder {
  color: var(--text);
  opacity: 0.4;
}

.rename-input:focus {
  border-color: rgba(91, 158, 233, 0.5);
}

.rename-submit {
  padding: 6px 12px;
  background: rgba(40, 167, 69, 0.15);
  border: 1px solid rgba(40, 167, 69, 0.35);
  border-radius: 5px;
  color: #28a745;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.rename-submit:hover {
  background: rgba(40, 167, 69, 0.25);
  border-color: rgba(40, 167, 69, 0.5);
}

.rename-result {
  font-size: 11px;
  color: #28a745;
  margin-top: 4px;
}

.rename-result:empty {
  display: none;
}

.online-users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.online-users-section {
  display: flex;
  flex-direction: column;
}

.online-section-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(100, 120, 200, 0.1);
  margin-bottom: 2px;
}

.section-icon-free {
  font-size: 11px;
  color: #e8902a;
  filter: drop-shadow(0 0 3px rgba(232, 144, 42, 0.7));
  flex-shrink: 0;
}

.section-icon-busy {
  font-size: 11px;
  color: var(--papyrus-text);
  opacity: 0.7;
  flex-shrink: 0;
}

.section-icon-recent {
  font-size: 11px;
  color: rgba(120, 90, 60, 0.5);
  flex-shrink: 0;
}

.online-user-row.recently-online {
  opacity: 0.45;
}

.user-color-dot-offline {
  background-color: rgba(120, 90, 60, 0.35) !important;
  border-color: rgba(120, 90, 60, 0.2);
}

.recently-online-ago {
  font-size: 10px;
  color: var(--text);
  opacity: 0.5;
  white-space: nowrap;
}

.invite-push-btn {
  background: rgba(212, 168, 23, 0.12);
  color: #d4a817;
  border-color: rgba(212, 168, 23, 0.3);
}

.invite-push-btn:hover {
  background: rgba(212, 168, 23, 0.2);
}

/* Push Invite Modal */
.push-invite-modal-box {
  max-width: 400px;
  text-align: center;
}

.push-invite-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text);
  opacity: 0.5;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: opacity 0.15s;
}

.push-invite-close:hover {
  opacity: 1;
}

.push-invite-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.push-invite-header h3 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: 1.1rem;
  color: var(--papyrus-text);
}

.push-invite-icon {
  color: #d4a817;
  font-size: 1.2rem;
}

.push-invite-desc {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
  margin: 0 0 14px;
}

.push-invite-cost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: rgba(212, 168, 23, 0.1);
  border: 1px solid rgba(212, 168, 23, 0.3);
  border-radius: 6px;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #d4a817;
  margin-bottom: 16px;
}

.push-invite-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.push-invite-send-btn {
  padding: 9px 20px;
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  border: 1px solid #b7892b;
  border-radius: 2px;
  color: #1a0a00;
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
}

.push-invite-send-btn:hover {
  opacity: 0.85;
}

.push-invite-cancel-btn {
  padding: 9px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  color: var(--text);
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-weight: 600;
  font-size: 0.82rem;
  transition: opacity 0.2s;
}

.push-invite-cancel-btn:hover {
  opacity: 0.7;
}

.push-invite-result {
  margin-top: 10px;
  font-size: 0.85rem;
  min-height: 20px;
}

.push-invite-success {
  color: #28a745;
}

.push-invite-error {
  color: #dc3545;
}

.online-users-table {
  display: flex;
  flex-direction: column;
}

.online-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid rgba(100, 120, 200, 0.07);
  transition: background 0.15s ease;
}

.online-user-row:last-child {
  border-bottom: none;
}

.online-user-row:hover {
  background: rgba(100, 120, 200, 0.08);
}

.online-user-row.in-game {
  opacity: 0.5;
}

.user-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.user-profile-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
}

.user-profile-link:hover {
  color: #06a77d;
  text-decoration: underline;
}

.user-rank-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.6;
  flex-shrink: 0;
  line-height: 1;
}

.user-rank-badge.top-1 {
  color: #ffd700;
  opacity: 1;
}

.user-rank-badge.top-2 {
  color: #c0c0c0;
  opacity: 1;
}

.user-rank-badge.top-3 {
  color: #cd7f32;
  opacity: 1;
}

.user-rank-badge i {
  font-size: 0.75rem;
}

.user-row-actions {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-activity-badge {
  font-size: 11px;
  background: rgba(220, 53, 69, 0.12);
  color: #dc3545;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.user-activity-badge.available-badge {
  background: rgba(100, 120, 200, 0.1);
  color: var(--text);
  opacity: 0.5;
}

.user-activity-badge.away-badge {
  background: rgba(212, 168, 23, 0.15);
  color: #d4a817;
}

.user-color-dot-away {
  background-color: #d4a817 !important;
  box-shadow: 0 0 4px rgba(212, 168, 23, 0.5);
  border-color: rgba(212, 168, 23, 0.4);
}

.online-user-row.user-away {
  opacity: 0.6;
}

.online-users-empty {
  text-align: center;
  font-size: 13px;
  color: var(--text);
  opacity: 0.6;
  padding: 12px 0;
}

.online-users-more {
  font-size: 10px;
  color: var(--text);
  opacity: 0.6;
  padding: 4px 8px;
  font-style: italic;
  text-align: center;
}

.invite-btn,
.join-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 5px;
  transition: all 0.15s ease;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.invite-btn {
  background: rgba(40, 167, 69, 0.12);
  border: 1px solid rgba(40, 167, 69, 0.3);
  color: #28a745;
}

.invite-btn:hover {
  background: rgba(40, 167, 69, 0.22);
  border-color: rgba(40, 167, 69, 0.5);
  color: #218838;
}

.invite-btn-sent,
.invite-btn-sent:hover {
  background: rgba(200, 160, 0, 0.15);
  border-color: rgba(200, 160, 0, 0.5);
  color: #c8a000;
  cursor: default;
}

.join-btn {
  background: rgba(91, 158, 233, 0.12);
  border: 1px solid rgba(91, 158, 233, 0.3);
  color: #5b9ee9;
}

.join-btn:hover {
  background: rgba(91, 158, 233, 0.25);
  border-color: rgba(91, 158, 233, 0.5);
  color: #4a90d9;
}

.you-badge {
  font-size: 8px;
  background: rgba(74, 144, 226, 0.2);
  color: #5b9ee9;
  padding: 1px 4px;
  border-radius: 4px;
  margin-left: auto;
  text-transform: uppercase;
  font-weight: 600;
}

/* Toast Container - Fixed Position */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

#toast-container > * {
  pointer-events: auto;
}

/* Invite Toast */
.invite-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #4a90e2, #5b9ee9);
  color: white;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(74, 144, 226, 0.4);
  animation: slideInRight 0.3s ease;
  max-width: 350px;
}

.invite-toast .toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 13px;
}

.invite-toast .toast-content i {
  font-size: 18px;
}

.invite-toast .toast-action {
  background: white;
  color: #4a90e2;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.invite-toast .toast-action:hover {
  background: #f0f7ff;
  transform: scale(1.05);
}

.invite-toast .toast-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.invite-toast .toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  transition: color 0.2s ease;
}

.invite-toast .toast-close:hover {
  color: white;
}

.invite-toast .toast-mute {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.invite-toast .toast-mute:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

/* Error Toast */
.error-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
  animation: slideInRight 0.3s ease-out;
  margin-bottom: 10px;
}

.error-toast .toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 14px;
}

.error-toast .toast-content i {
  font-size: 18px;
}

.error-toast .toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  transition: color 0.2s ease;
}

.error-toast .toast-close:hover {
  color: white;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Notification Prompt Toast */
.notif-prompt-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #05926e 0%, #06a77d 100%);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(6, 167, 125, 0.4);
  animation: slideInRight 0.3s ease-out;
  margin-bottom: 10px;
}

.notif-prompt-toast .toast-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-size: 14px;
}

.notif-prompt-toast .toast-content i {
  font-size: 18px;
  flex-shrink: 0;
}

.notif-prompt-toast .toast-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.notif-prompt-toast .toast-action {
  background: white;
  color: #06a77d;
  border: none;
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.notif-prompt-toast .toast-action:hover {
  background: #e8fdf6;
}

.notif-prompt-toast .toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s;
}

.notif-prompt-toast .toast-close:hover {
  color: white;
}

@media (max-width: 600px) {
  .notif-prompt-toast {
    gap: 8px;
  }

  .notif-prompt-toast .toast-content {
    font-size: 12px;
  }

  .notif-prompt-toast .toast-content i {
    font-size: 14px;
  }

  .notif-prompt-toast .toast-action {
    padding: 5px 10px;
    font-size: 11px;
  }
}

/* Mobile responsive - Online Users */
@media (max-width: 768px) {
  .online-users-panel {
    max-width: 100%;
    padding: 16px 18px;
    margin-top: 10px;
  }

  .online-users-header {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .online-user-row {
    font-size: 13px;
    padding: 6px 6px;
    gap: 7px;
  }

  .action-label {
    display: none;
  }

  .invite-btn,
  .join-btn {
    font-size: 12px;
    padding: 4px 10px;
  }

  .user-activity-badge {
    font-size: 10px;
    padding: 2px 7px;
  }

  .you-badge {
    font-size: 7px;
    padding: 1px 3px;
  }

  .invite-toast {
    max-width: 300px;
    padding: 10px 12px;
    gap: 8px;
  }

  .invite-toast .toast-content {
    font-size: 12px;
  }

  .invite-toast .toast-action {
    padding: 5px 10px;
    font-size: 11px;
  }

  .error-toast {
    max-width: 300px;
    padding: 10px 12px;
    gap: 8px;
  }

  .error-toast .toast-content {
    font-size: 12px;
  }

  #toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
}

@media (max-width: 480px) {
  .online-users-panel {
    padding: 6px 8px;
    margin-top: 8px;
  }

  .online-user-row {
    font-size: 12px;
    padding: 5px 5px;
    gap: 6px;
  }

  .invite-btn,
  .join-btn {
    font-size: 11px;
    padding: 3px 8px;
  }

  .user-activity-badge {
    font-size: 9px;
    padding: 2px 6px;
  }

  .invite-toast {
    max-width: 280px;
    padding: 8px 10px;
    gap: 6px;
    font-size: 11px;
  }

  .invite-toast .toast-content i {
    font-size: 14px;
  }

  .error-toast {
    max-width: 280px;
    padding: 8px 10px;
    gap: 6px;
    font-size: 11px;
  }

  .error-toast .toast-content i {
    font-size: 14px;
  }
}

/* Inbox Page Styles */
.inbox-container {
  max-width: 900px;
  margin: 40px auto;
  padding: 24px 28px;
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.inbox-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--surface-border);
}

.inbox-header h1 {
  font-size: 2rem;
  margin-bottom: 10px;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
}

.inbox-header i {
  margin-right: 10px;
  color: #c8960c;
}

.inbox-subtitle {
  font-size: 0.9rem;
  opacity: 0.7;
  color: var(--text);
}

.inbox-error {
  text-align: center;
  padding: 40px 20px;
}

.inbox-error i {
  font-size: 64px;
  color: #dc3545;
  margin-bottom: 20px;
  display: block;
}

.inbox-error p {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.message-item {
  background: var(--cloud-bg2);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}

.message-item.unread {
  border-left-color: #4a90e2;
  background: rgba(74, 144, 226, 0.05);
}

.message-item.read {
  opacity: 0.8;
}

.message-item:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.message-sender {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.message-sender i {
  color: #c8960c;
}

.message-sender strong {
  font-size: 1.1rem;
}

.unread-dot {
  width: 10px;
  height: 10px;
  background: #c8960c;
  border-radius: 2px;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.message-time {
  font-size: 0.85rem;
  opacity: 0.6;
  color: var(--text);
}

.message-body {
  margin-bottom: 12px;
  line-height: 1.6;
  padding: 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  color: var(--text);
  word-wrap: break-word;
}

.message-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-message-action {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--surface-border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-message-action:hover {
  background: rgba(200, 150, 12, 0.15);
  border-color: #c8960c;
}

.btn-message-action i {
  margin-right: 4px;
}

.btn-message-reply {
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  border: 1px solid #b7892b;
  color: #1a0a00;
  font-family: "Cinzel", serif;
  font-weight: 700;
}

.btn-message-reply:hover {
  opacity: 0.88;
}

.btn-message-delete {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.btn-message-delete:hover {
  background: #c82333;
}

.inbox-empty {
  text-align: center;
  padding: 60px 20px;
}

.inbox-empty i {
  font-size: 64px;
  color: var(--text);
  opacity: 0.3;
  margin-bottom: 20px;
  display: block;
}

.inbox-empty p {
  font-size: 1.2rem;
  color: var(--text);
  opacity: 0.6;
  margin-bottom: 8px;
}

.inbox-empty-hint {
  font-size: 0.9rem;
  opacity: 0.5;
}

/* Unread Badge in Navbar */
.unread-badge {
  background: #dc3545;
  color: white;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: bold;
  animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* Mobile Responsive - Inbox */
@media (max-width: 768px) {
  .inbox-container {
    margin: 20px 10px;
    padding: 15px;
  }

  .inbox-header h1 {
    font-size: 1.5rem;
  }

  .message-item {
    padding: 12px;
  }

  .message-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .message-sender strong {
    font-size: 1rem;
  }

  .message-actions {
    width: 100%;
  }

  .btn-message-action {
    flex: 1;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .inbox-container {
    margin: 10px 5px;
    padding: 10px;
  }

  .inbox-header h1 {
    font-size: 1.3rem;
  }

  .message-body {
    font-size: 0.9rem;
  }

  .btn-message-action {
    font-size: 0.8rem;
    padding: 5px 8px;
  }
}

/* Conversations List Styles */
.conversations-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid var(--surface-border);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}

.conversation-item:first-child {
  border-top-left-radius: 2px;
  border-top-right-radius: 2px;
}

.conversation-item:last-child {
  border-bottom-left-radius: 2px;
  border-bottom-right-radius: 2px;
  border-bottom: none;
}

.conversation-item:hover {
  background: rgba(200, 150, 12, 0.1);
  border-left: 3px solid #c8960c;
}

.conversation-item.unread {
  background: rgba(200, 150, 12, 0.06);
  border-left: 3px solid #c8960c;
}

.conversation-avatar {
  width: 50px;
  height: 50px;
  border-radius: 2px;
  background: linear-gradient(to bottom, #3a2a00, #1a0a00);
  border: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c8960c;
  font-size: 24px;
  flex-shrink: 0;
}

.conversation-content {
  flex: 1;
  min-width: 0;
}

.conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.conversation-name {
  font-size: 1rem;
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
}

.conversation-time {
  font-size: 0.8rem;
  opacity: 0.6;
  color: var(--text);
}

.conversation-preview {
  margin-bottom: 6px;
  font-size: 0.9rem;
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.conversation-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.message-count {
  font-size: 0.85rem;
  opacity: 0.6;
  color: var(--text);
}

.message-count i {
  margin-right: 4px;
}

.unread-count {
  background: rgba(200, 150, 12, 0.25);
  border: 1px solid #c8960c;
  color: #c8960c;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 2px;
  font-weight: bold;
}

/* Conversation Thread Styles */
.conversation-container {
  max-width: 900px;
  margin: 20px auto;
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  max-height: 700px;
}

.conversation-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--surface-border);
  background: rgba(0, 0, 0, 0.2);
  border-top-left-radius: 2px;
  border-top-right-radius: 2px;
}

.back-button {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--surface-border);
  color: var(--papyrus-text);
  padding: 7px 14px;
  border-radius: 2px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.back-button:hover {
  background: rgba(200, 150, 12, 0.15);
  border-color: #c8960c;
}

.back-button i {
  margin-right: 6px;
}

.conversation-partner-info {
  flex: 1;
  text-align: center;
  font-size: 1.2rem;
  color: var(--text);
}

.conversation-partner-info i {
  margin-right: 8px;
  color: #c8960c;
}

.messages-thread {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 2px;
  word-wrap: break-word;
}

.message-bubble.sent {
  align-self: flex-end;
  background: linear-gradient(to bottom, #3a2800, #1a1200);
  border: 1px solid #c8960c;
  color: #e6ce6a;
  border-bottom-right-radius: 0;
}

.message-bubble.received {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  border-bottom-left-radius: 0;
  border: 1px solid var(--surface-border);
  border-left: 2px solid #c8960c;
}

.message-bubble-content {
  margin-bottom: 4px;
  line-height: 1.5;
}

.message-bubble.sent .message-bubble-content {
  color: #e6ce6a;
}

.message-bubble.received .message-bubble-content {
  color: var(--text);
}

.message-bubble-time {
  font-size: 0.75rem;
  opacity: 0.7;
}

.message-bubble.sent .message-bubble-time {
  color: rgba(200, 150, 12, 0.7);
  text-align: right;
}

.message-bubble.received .message-bubble-time {
  color: var(--text);
}

.conversation-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text);
}

.conversation-empty i {
  font-size: 64px;
  opacity: 0.3;
  margin-bottom: 20px;
  display: block;
}

.conversation-empty p {
  font-size: 1.2rem;
  opacity: 0.6;
}

/* Mobile Responsive - Conversations */
@media (max-width: 768px) {
  .conversation-item {
    padding: 12px;
    gap: 12px;
  }

  .conversation-avatar {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .conversation-name {
    font-size: 1rem;
  }

  .conversation-preview {
    font-size: 0.85rem;
  }

  .conversation-container {
    margin: 10px;
    height: calc(100vh - 120px);
  }

  .conversation-header-bar {
    padding: 12px 15px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .conversation-partner-info {
    font-size: 1rem;
    order: -1;
    width: 100%;
    text-align: center;
  }

  .message-bubble {
    max-width: 85%;
  }

  .messages-thread {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .conversation-item {
    padding: 10px;
    gap: 10px;
  }

  .conversation-avatar {
    width: 35px;
    height: 35px;
    font-size: 18px;
  }

  .conversation-name {
    font-size: 0.95rem;
  }

  .conversation-preview {
    font-size: 0.8rem;
  }

  .back-button {
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  .btn-message-reply {
    padding: 6px 10px;
    font-size: 0.85rem;
  }

  .message-bubble {
    max-width: 90%;
    padding: 10px 12px;
  }
}

/* Navbar Stats Display */
.stats-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 !important;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: default;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.coin-badge {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #1a1a1a;
  cursor: pointer;
}

.coin-badge i {
  color: #b8860b;
  font-size: 1rem;
}

.coin-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 10px rgba(255, 215, 0, 0.4);
}

.compact-stat-coins {
  cursor: pointer;
  transition: all 0.2s ease;
}

.compact-stat-coins:hover {
  transform: scale(1.05);
}

.progress-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.progress-badge i {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
}

.progress-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.stat-badge span {
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Mobile stats display */
.mobile-stats {
  display: none;
  align-items: center;
  gap: 8px;
  margin-right: 15px;
}

/* Hide old coins-on-narrow-view */
.coins-on-narrow-view {
  display: none;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .stats-display {
    display: none;
  }

  .mobile-stats {
    display: flex;
  }
}

@media (max-width: 768px) {
  .stat-badge {
    padding: 5px 10px;
    font-size: 0.85rem;
    gap: 5px;
  }

  .stat-badge i {
    font-size: 0.9rem;
  }

  .mobile-stats {
    margin-right: 10px;
  }
}

@media (max-width: 480px) {
  .stat-badge {
    padding: 4px 8px;
    font-size: 0.8rem;
    gap: 4px;
  }

  .stat-badge i {
    font-size: 0.85rem;
  }

  .mobile-stats {
    gap: 6px;
  }
}

/* Info Modal Styles */
.info-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.info-modal.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.info-modal-content {
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  max-width: 500px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: slideUp 0.3s ease;
}

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

.info-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: var(--papyrus-text);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.info-modal-close:hover {
  background: rgba(200, 150, 12, 0.15);
  transform: rotate(90deg);
}

.info-modal-header {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 30px 30px 20px;
  border-bottom: 1px solid var(--surface-border);
}

.info-modal-header h2 {
  font-family: "Cinzel", serif;
  color: var(--papyrus-text);
  font-size: 1.5rem;
  margin: 0;
  font-weight: 700;
}

.info-modal-body {
  padding: 25px 30px 30px;
  color: var(--text);
  line-height: 1.6;
}

.coin-balance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 18px;
  background: var(--surface-subtle);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
}

.coin-balance-label {
  font-size: 0.95rem;
  opacity: 0.8;
}

.coin-balance-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #c8960c;
}

.coin-earn-btn {
  margin-left: auto;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 100%);
  color: #1a0a00;
  border: 1px solid #b7892b;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.coin-earn-btn:hover {
  background: linear-gradient(to bottom, #f0da80 0%, #d4a010 100%);
}

.coin-buy-btn {
  margin-left: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.coin-buy-btn-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
}

.coin-buy-btn-disabled:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1d23;
  color: #e0c882;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
  border: 1px solid rgba(255, 200, 100, 0.2);
  pointer-events: none;
  z-index: 10;
}

.info-modal-body p {
  margin: 0 0 15px 0;
  font-size: 1rem;
}

.info-list {
  list-style: none;
  padding: 0;
  margin: 15px 0;
}

.info-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  border-left: 3px solid #c8960c;
}

.info-list li i {
  color: #c8960c;
  font-size: 1.2rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.info-list li strong {
  color: var(--text);
}

.info-modal-footer {
  margin-top: 20px;
  padding: 15px;
  background: rgba(200, 150, 12, 0.08);
  border-radius: 2px;
  border: 1px solid var(--surface-border);
}

.info-modal-footer p {
  margin: 0;
  font-size: 0.95rem;
}

.info-modal-footer i {
  color: #c8960c;
  margin-right: 8px;
}

.discord-link {
  color: #5865f2;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.discord-link:hover {
  border-bottom-color: #5865f2;
}

@media (max-width: 600px) {
  .info-modal-content {
    max-width: 95%;
  }

  .info-modal-header {
    padding: 25px 20px 15px;
  }

  .info-modal-header h2 {
    font-size: 1.3rem;
  }

  .info-modal-body {
    padding: 20px;
  }

  .info-list li {
    flex-direction: column;
    gap: 8px;
  }
}

/* Achievement Celebration Overlay */
.achievement-celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  animation: fadeIn 0.3s ease;
}

.achievement-celebration-overlay.hidden {
  display: none;
}

#achievement-confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.achievement-celebration-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px;
}

#achievement-display-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  z-index: 10;
}

.achievement-celebration-item {
  position: absolute;
  animation: achievementEnter 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes achievementEnter {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  60% {
    transform: scale(3) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(3) rotate(0deg);
    opacity: 1;
  }
}

.achievement-celebration-item.shrinking {
  animation: achievementShrink 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes achievementShrink {
  0% {
    transform: scale(3);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0.8;
  }
}

.achievement-collected-container {
  display: flex;
  flex-wrap: wrap;
  row-gap: 30px;
  column-gap: 80px;
  justify-content: center;
  align-content: center;
  max-width: 900px;
  padding: 20px 40px;
  flex: 1;
  overflow-y: auto;
  z-index: 5;
}

.achievement-collected-item {
  transform: scale(0.8);
  opacity: 0.8;
  transition: all 0.3s ease;
}

.achievement-collected-item:hover {
  transform: scale(0.9);
  opacity: 1;
}

.achievement-celebration-button {
  padding: 15px 40px;
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  color: #1a0a00;
  border: 1px solid #b7892b;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(200, 150, 12, 0.4);
  transition: all 0.3s ease;
  font-family: "Cinzel", serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.achievement-celebration-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(200, 150, 12, 0.6);
  background: linear-gradient(to bottom, #f0da80 0%, #d4a010 50%, #c8960c 100%);
}

.achievement-celebration-button.hidden {
  display: none;
}

@media (max-width: 768px) {
  .achievement-celebration-item {
    animation: achievementEnterMobile 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  }

  @keyframes achievementEnterMobile {
    0% {
      transform: scale(0) rotate(-180deg);
      opacity: 0;
    }
    60% {
      transform: scale(2) rotate(0deg);
      opacity: 1;
    }
    100% {
      transform: scale(2) rotate(0deg);
      opacity: 1;
    }
  }

  .achievement-celebration-item.shrinking {
    animation: achievementShrinkMobile 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  @keyframes achievementShrinkMobile {
    0% {
      transform: scale(2);
      opacity: 1;
    }
    100% {
      transform: scale(0.7);
      opacity: 0.8;
    }
  }

  .achievement-collected-container {
    row-gap: 20px;
    column-gap: 50px;
    padding: 15px;
  }

  .achievement-collected-item {
    transform: scale(0.7);
  }

  .achievement-celebration-button {
    padding: 12px 30px;
    font-size: 1rem;
  }
}

/* Magic Bricks Particle Effect */
@keyframes brickParticleFloat {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-120px) scale(0.5);
    opacity: 0;
  }
}

.magic-bricks-active {
  position: relative;
  overflow: visible;
}

.magic-bricks-active::before,

/* Magic Bricks Particle Effect */
@keyframes brickParticleFloat {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-120px) scale(0.5);
    opacity: 0;
  }
}

.magic-bricks-active {
  position: relative;
  overflow: visible;
}

/* Tutorial Color Picker Pulsate Animation */
@keyframes tutorialPulsate {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.3);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.5), 0 0 60px rgba(255, 215, 0, 0.3);
    filter: brightness(1.3);
  }
}

.tutorial-pulsate {
  animation: tutorialPulsate 2s ease-in-out infinite;
}

.tutorial-pulsate-offset {
  animation-delay: 1s;
}

.red-button.tutorial-pulsate {
  box-shadow: 0 0 10px rgba(155, 28, 28, 0.6), 0 0 20px rgba(155, 28, 28, 0.35) !important;
}

.red-button.tutorial-pulsate:nth-of-type(1) {
  animation: tutorialPulsateRed 2s ease-in-out infinite;
}

.blue-button.tutorial-pulsate {
  box-shadow: 0 0 10px rgba(40, 85, 160, 0.6), 0 0 20px rgba(40, 85, 160, 0.35) !important;
}

.blue-button.tutorial-pulsate-offset {
  animation: tutorialPulsateBlue 2s ease-in-out infinite 1s;
}

@keyframes tutorialPulsateRed {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(155, 28, 28, 0.6), 0 0 20px rgba(155, 28, 28, 0.35);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(155, 28, 28, 0.9), 0 0 40px rgba(155, 28, 28, 0.6), 0 0 60px rgba(155, 28, 28, 0.35);
    filter: brightness(1.3);
  }
}

@keyframes tutorialPulsateBlue {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(40, 85, 160, 0.6), 0 0 20px rgba(40, 85, 160, 0.35);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(40, 85, 160, 0.9), 0 0 40px rgba(40, 85, 160, 0.6), 0 0 60px rgba(40, 85, 160, 0.35);
    filter: brightness(1.3);
  }
}

/* --- In-game trophy for top 3 players --- */
.custom-deck-icon {
  margin-left: 4px;
  font-size: 0.7em;
  opacity: 0.7;
  vertical-align: middle;
  color: var(--text);
}

.trophy-icon {
  margin-left: 5px;
  vertical-align: middle;
}

/* Size by period: daily smallest → alltime largest */
.trophy-daily {
  font-size: 0.7em;
}

.trophy-weekly {
  font-size: 0.85em;
}

.trophy-monthly {
  font-size: 1em;
}

.trophy-alltime {
  font-size: 1.2em;
}

/* Glow by rank position */
@keyframes trophyGlow1 {
  0%, 100% {
    filter: drop-shadow(0 0 4px #ffd700) drop-shadow(0 0 8px #ffd700);
  }
  50% {
    filter: drop-shadow(0 0 8px #ffd700) drop-shadow(0 0 16px #ffaa00) drop-shadow(0 0 24px #ffd700);
  }
}

@keyframes trophyGlow2 {
  0%, 100% {
    filter: drop-shadow(0 0 3px #c0c0c0) drop-shadow(0 0 6px #c0c0c0);
  }
  50% {
    filter: drop-shadow(0 0 6px #c0c0c0) drop-shadow(0 0 12px #a0a0a0);
  }
}

@keyframes trophyGlow3 {
  0%, 100% {
    filter: drop-shadow(0 0 2px #cd7f32);
  }
  50% {
    filter: drop-shadow(0 0 4px #cd7f32) drop-shadow(0 0 8px #b5651d);
  }
}

.trophy-rank-1 {
  color: #ffd700;
  animation: trophyGlow1 2s ease-in-out infinite;
}

.trophy-rank-2 {
  color: #c0c0c0;
  animation: trophyGlow2 2.5s ease-in-out infinite;
}

.trophy-rank-3 {
  color: #cd7f32;
  animation: trophyGlow3 3s ease-in-out infinite;
}

/* ============ Admin Dashboard ============ */

.admin-dashboard {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px;
  font-family: "Comfortaa", sans-serif;
  color: var(--text);
}

.admin-dash-header {
  margin-bottom: 28px;
}

.admin-dash-header h1 {
  margin: 0 0 6px 0;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-dash-header > p {
  margin: 0;
  opacity: 0.65;
  font-size: 0.95rem;
}

.admin-dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.admin-dash-card {
  background: var(--cloud-bg2);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-dash-card-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.admin-dash-card-body {
  flex: 1;
}

.admin-dash-card-body h2 {
  margin: 0 0 4px 0;
  font-size: 1rem;
  font-weight: 700;
}

.admin-dash-card-body > p {
  margin: 0 0 12px 0;
  font-size: 0.82rem;
  opacity: 0.6;
}

.admin-dash-stats {
  display: flex;
  gap: 20px;
}

.admin-dash-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-dash-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.admin-dash-stat-sm {
  font-size: 0.95rem;
}

.admin-dash-stat-unit {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-left: 2px;
}

.admin-dash-stat-label {
  font-size: 0.72rem;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-dash-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.15s ease;
  align-self: flex-start;
}

.admin-dash-card-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ============ Admin Engagement Metrics ============ */

.admin-metrics-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  font-family: "Comfortaa", sans-serif;
  color: var(--text);
}

.admin-metrics-section-title {
  font-size: 1rem;
  font-weight: 700;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px 0;
}

.admin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.admin-metrics-card {
  background: var(--cloud-bg2);
  border-radius: 12px;
  padding: 18px 20px;
}

.admin-metrics-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-metrics-funnel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-metrics-funnel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.admin-metrics-funnel-rate {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 8px;
  margin-top: 2px;
  font-weight: 700;
}

.admin-metrics-funnel-label {
  opacity: 0.75;
}

.admin-metrics-funnel-value {
  font-weight: 700;
  font-size: 1rem;
}

.admin-metrics-dropoffs {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.admin-metrics-dropoffs-title {
  font-size: 0.75rem;
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.admin-metrics-dropoff-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 3px 0;
}

.admin-metrics-dropoff-label {
  opacity: 0.8;
}

.admin-metrics-dropoff-count {
  font-weight: 700;
  color: #e74c3c;
}

.admin-metrics-bucket-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 2px 0;
}

.admin-metrics-bucket-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}

.admin-metrics-bucket-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.admin-metrics-bucket-count {
  font-weight: 700;
  min-width: 28px;
  text-align: right;
}

.admin-metrics-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  background: var(--cloud-bg2);
}

.admin-metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-metrics-table th,
.admin-metrics-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.admin-metrics-table th {
  opacity: 0.55;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-metrics-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-metrics-table tbody tr:hover {
  background: rgba(255,255,255,0.04);
}

/* ============ Game Chat ============ */

.chat-bubble-area {
  position: absolute;
  top: 205px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 50;
  pointer-events: none;
  max-width: 300px;
}

.chat-bubble {
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  color: #fff;
  animation: chatBubbleIn 0.25s ease;
  pointer-events: none;
  text-align: center;
  max-width: 100%;
  word-break: break-word;
}

.chat-bubble-red {
  background: rgba(180, 50, 50, 0.85);
}

.chat-bubble-blue {
  background: rgba(50, 80, 180, 0.85);
}

.chat-bubble-name {
  font-weight: 700;
  margin-right: 4px;
}

.chat-bubble-admin {
  color: #e0c882;
  font-size: 0.72rem;
  margin-left: 3px;
}

.chat-bubble-admin-msg {
  border: 1px solid rgba(224, 200, 130, 0.4);
}

.chat-bubble-fade {
  opacity: 0;
  transition: opacity 0.5s ease;
}

@keyframes chatBubbleIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-toggle-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--resource-panel-border);
  background: var(--panel-bg);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  transition: background 0.15s;
}

.chat-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.chat-toggle-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e74c3c;
}

.game-chat-panel {
  position: fixed;
  bottom: 70px;
  right: 16px;
  width: 280px;
  background: var(--panel-texture-url) center/cover, var(--panel-bg);
  border: 1.5px solid var(--resource-panel-border);
  border-radius: 12px;
  padding: 12px;
  z-index: 60;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  animation: chatPanelIn 0.2s ease;
}

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

.game-chat-emotes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.game-chat-emote-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--resource-panel-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.game-chat-emote-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.game-chat-input-row {
  display: flex;
  gap: 6px;
}

.game-chat-input {
  flex: 1;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--resource-panel-border);
  background: var(--panel-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  box-sizing: border-box;
  min-width: 0;
}

.game-chat-input::placeholder {
  opacity: 0.4;
}

.game-chat-send-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--resource-panel-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.game-chat-send-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Mobile: hide the floating chat button, tap castle instead */
@media (max-width: 700px) {
  .chat-toggle-btn {
    display: none;
  }

  .game-chat-panel {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
  }

  .image-container {
    cursor: pointer;
  }
}

/* ============ Captain's Log ============ */

.captains-log {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px;
}

.captains-log-header {
  text-align: center;
  margin-bottom: 8px;
}

.captains-log-header h1 {
  color: var(--text);
  font-size: 1.4rem;
  margin: 0 0 4px;
}

.captains-log-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
}

.captains-log-nav-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--resource-panel-border);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.captains-log-nav-btn:hover:not(.captains-log-nav-disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.captains-log-nav-disabled {
  opacity: 0.3;
  cursor: default;
}

.captains-log-date {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.captains-log-today-badge {
  font-size: 0.7rem;
  background: rgba(6, 167, 125, 0.2);
  color: #06a77d;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.captains-log-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.captains-log-card {
  background: var(--panel-texture-url) center/cover, var(--panel-bg);
  border: 1.5px solid var(--resource-panel-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.captains-log-card-wide {
  grid-column: 1 / -1;
}

.captains-log-card-title {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.captains-log-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.captains-log-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 55px;
}

.captains-log-stat-value {
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

.captains-log-stat-label {
  color: var(--text);
  font-size: 0.7rem;
  opacity: 0.5;
  margin-top: 4px;
}

.captains-log-details {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}

.captains-log-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  color: var(--text);
  font-size: 0.82rem;
}

.captains-log-detail-row span:first-child {
  opacity: 0.7;
}

.captains-log-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.captains-log-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.captains-log-bar-label {
  color: var(--text);
  font-size: 0.8rem;
  min-width: 65px;
  opacity: 0.7;
}

.captains-log-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}

.captains-log-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.captains-log-bar-count {
  color: var(--text);
  font-size: 0.8rem;
  min-width: 70px;
  text-align: right;
}

@media (max-width: 700px) {
  .captains-log-grid {
    grid-template-columns: 1fr;
  }
  .captains-log-card-wide {
    grid-column: auto;
  }
}

/* ============ FAQ Page ============ */

.faq-wrapper {
  width: 100%;
  max-width: 780px;
  padding: 0 0 40px;
  font-family: "Comfortaa", sans-serif;
  color: var(--text);
}

.faq-header {
  padding: 28px 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 28px;
}

.faq-header h1 {
  margin: 0 0 8px;
  font-size: 1.7rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.faq-header > p {
  margin: 0;
  opacity: 0.65;
  font-size: 0.95rem;
}

.faq-section {
  margin-bottom: 28px;
}

.faq-category {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.5;
  margin: 0 0 10px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.faq-item {
  background: var(--cloud-bg2);
  border-radius: 10px;
  overflow: hidden;
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  list-style: none;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question:hover {
  background: rgba(255,255,255,0.05);
}

.faq-chevron {
  flex-shrink: 0;
  font-size: 0.75rem;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  margin: 0;
  padding: 0 18px 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  opacity: 0.82;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 12px;
}

.faq-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.88rem;
  opacity: 0.7;
  text-align: center;
}

.faq-link {
  color: var(--text);
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.faq-link:hover {
  opacity: 0.8;
}

/* ============ Admin Banner Management ============ */

.admin-banners-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  font-family: "Comfortaa", sans-serif;
  color: var(--text);
}

.admin-banners-wrapper h1 {
  margin-bottom: 5px;
}

.admin-banners-wrapper > p {
  margin-bottom: 20px;
  opacity: 0.7;
}

.admin-banner-form {
  background: var(--cloud-bg2);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
}

.admin-banner-form h2 {
  margin-top: 0;
  margin-bottom: 15px;
}

.form-row {
  margin-bottom: 12px;
}

.form-row label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-weight: 700;
}

.form-row input[type="text"],
.form-row input[type="number"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-family: "Comfortaa", sans-serif;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.form-row-checkboxes label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: 400;
}

.admin-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-family: "Comfortaa", sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.2s;
}

.admin-btn:hover {
  filter: brightness(1.2);
}

.admin-btn-primary {
  background: #4a90d9;
  color: #fff;
}

.admin-btn-success {
  background: #27ae60;
  color: #fff;
}

.admin-btn-warning {
  background: #e67e22;
  color: #fff;
}

.admin-btn-danger {
  background: #c0392b;
  color: #fff;
}

.admin-btn-edit {
  background: #8e44ad;
  color: #fff;
}

.admin-banner-card {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--cloud-bg2);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 12px;
  transition: opacity 0.2s;
}

.admin-banner-disabled {
  opacity: 0.5;
}

.admin-banner-preview {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-banner-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.admin-banner-info {
  flex: 1;
  min-width: 0;
}

.admin-banner-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.admin-banner-info p {
  margin: 2px 0;
  font-size: 0.85rem;
  opacity: 0.8;
}

.admin-banner-link a {
  color: #4a90d9;
  text-decoration: none;
  word-break: break-all;
}

.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
}

.admin-badge-enabled {
  background: rgba(39, 174, 96, 0.3);
  color: #27ae60;
}

.admin-badge-disabled {
  background: rgba(192, 57, 43, 0.3);
  color: #e74c3c;
}

.admin-badge-order {
  background: rgba(74, 144, 217, 0.2);
  color: #4a90d9;
}

.admin-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.admin-banner-actions-row {
  flex-direction: row;
  justify-content: flex-end;
}

.admin-banner-editing {
  opacity: 1 !important;
  border: 1px solid rgba(142, 68, 173, 0.4);
}

.admin-banner-edit-form {
  width: 100%;
}

.admin-banner-edit-form .edit-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-banner-edit-form .form-row {
  margin-bottom: 0;
}

.admin-banner-edit-form select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-family: "Comfortaa", sans-serif;
  font-size: 0.9rem;
}

.admin-banner-edit-form select option {
  background: #2a2d3a;
  color: var(--text);
}

.admin-banner-edit-form .field-label-image {
  display: none;
}

.admin-banner-edit-form.form-type-image .field-label-standard {
  display: none;
}

.admin-banner-edit-form.form-type-image .field-label-image {
  display: block;
}

.admin-banner-edit-form.form-type-image [data-field="title"],
.admin-banner-edit-form.form-type-image [data-field="text"] {
  display: none;
}

.admin-badge-type {
  background: rgba(155, 89, 182, 0.2);
  color: #9b59b6;
}

.admin-banner-form select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-family: "Comfortaa", sans-serif;
  font-size: 0.9rem;
}

.admin-banner-form select option {
  background: #2a2d3a;
  color: var(--text);
}

.admin-banner-form .field-label-image {
  display: none;
}

.admin-banner-form.form-type-image .field-label-standard {
  display: none;
}

.admin-banner-form.form-type-image .field-label-image {
  display: block;
}

.admin-banner-form.form-type-image [data-field="title"],
.admin-banner-form.form-type-image [data-field="text"] {
  display: none;
}

.admin-banner-stats {
  display: flex;
  gap: 15px;
  margin-top: 6px;
  font-size: 0.8rem;
  opacity: 0.7;
}

.admin-stat i {
  margin-right: 3px;
}

.admin-empty {
  text-align: center;
  opacity: 0.5;
  padding: 30px;
}

/* ============ Admin Notification Management ============ */

.admin-notif-overview {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.admin-notif-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 28px;
  background: var(--cloud-bg2);
  border-radius: 10px;
  border: 1px solid rgba(128, 128, 128, 0.2);
}

.admin-notif-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #4a90d9;
}

.admin-notif-stat-label {
  font-size: 0.8rem;
  opacity: 0.65;
  margin-top: 2px;
}

.admin-notif-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-notif-table thead th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid rgba(128, 128, 128, 0.25);
  opacity: 0.65;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.admin-notif-table tbody tr {
  border-bottom: 1px solid rgba(128, 128, 128, 0.12);
}

.admin-notif-table tbody tr:hover {
  background: rgba(128, 128, 128, 0.06);
}

.admin-notif-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.admin-notif-date {
  white-space: nowrap;
  opacity: 0.65;
  font-size: 0.8rem;
}

.admin-notif-title {
  font-weight: 600;
}

.admin-notif-body {
  opacity: 0.75;
  max-width: 280px;
}

.admin-notif-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.admin-notif-rate {
  text-align: center;
  font-weight: 600;
  opacity: 0.45;
}

.admin-notif-rate-hit {
  color: #28a745;
  opacity: 1;
}

.admin-btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* Broadcast detail panel */
.admin-notif-detail {
  margin-top: 16px;
  border-radius: 8px;
  background: var(--cloud-bg2);
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.admin-notif-detail-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.admin-notif-detail-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 1rem;
}

.admin-notif-detail-date {
  opacity: 0.55;
  font-size: 0.8rem;
}

.admin-notif-detail-body {
  opacity: 0.7;
  font-size: 0.9rem;
}

.admin-notif-detail-gift {
  font-size: 0.9rem;
  margin: 4px 0;
  color: var(--text);
}

.admin-notif-detail-stats {
  display: flex;
  gap: 18px;
  font-size: 0.85rem;
  opacity: 0.8;
}

.admin-notif-detail-rate {
  opacity: 0.45;
}

/* Player chips */
.admin-notif-player-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-notif-player {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 16px;
  background: rgba(128, 128, 128, 0.12);
  font-size: 0.82rem;
}

.admin-notif-player-returned {
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid rgba(40, 167, 69, 0.25);
}

.admin-notif-player-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.admin-notif-player-name {
  color: var(--text);
}

.admin-notif-player-badge {
  font-size: 0.7rem;
  color: #28a745;
  font-weight: 600;
}

@media (max-width: 600px) {
  .admin-banner-card {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-banner-preview {
    width: 100%;
    height: 80px;
  }

  .admin-banner-actions {
    flex-direction: row;
    justify-content: flex-end;
  }

  .admin-banner-edit-form .edit-form-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ REPLAY SHARING ============ */

.tournament-victory-status {
  text-align: center;
  margin: 18px 0;
}

.tournament-victory-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1rem;
  color: #c8960c;
  padding: 12px 20px;
  border-radius: 2px;
  background: rgba(200, 150, 12, 0.1);
  border: 1px solid rgba(200, 150, 12, 0.3);
}

/* Share button on game-over modal */
.share-replay-section {
  text-align: center;
  margin: 12px 0;
}

.share-btn {
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  border: 1px solid var(--surface-border);
  padding: 8px 20px;
  border-radius: 2px;
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, border-color 0.2s;
}

.share-btn:hover {
  background: rgba(200, 150, 12, 0.12);
  border-color: #c8960c;
}

.share-result {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.share-url-input {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--surface-border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 2px;
  font-family: inherit;
  font-size: 0.85rem;
  width: 260px;
  max-width: 60vw;
  outline: none;
}

.share-url-input:focus {
  border-color: #c8960c;
}

.share-copy-btn {
  background: linear-gradient(to bottom, #e6ce6a 0%, #c8960c 50%, #b7892b 100%);
  border: 1px solid #b7892b;
  color: #1a0a00;
  padding: 6px 14px;
  border-radius: 2px;
  cursor: pointer;
  font-family: "Cinzel", serif;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.2s;
}

.share-copy-btn:hover {
  opacity: 0.85;
}

/* Activity stats — bar chart hover labels */
.bar-col:hover .bar-label-hover {
  opacity: 0.8 !important;
}
.bar-col:hover .bar-label-peak {
  opacity: 0;
}

/* Replay page — iframe renders game at mobile viewport */
.replay-outer-body {
  margin: 0;
  background: var(--primary-bg, #0b0013);
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.replay-phone-frame {
  width: 390px;
  max-width: 100vw;
  height: 100vh;
}

.replay-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.replay-loading {
  text-align: center;
  opacity: 0.5;
  padding: 40px;
  color: var(--text, white);
}

.replay-overlay {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 100;
  pointer-events: none;
}

.replay-overlay-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  pointer-events: auto;
  font-size: 0.8rem;
  color: white;
  gap: 8px;
}

.replay-overlay-bottom {
  position: fixed;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: auto;
}

.replay-home-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: white;
  text-decoration: none;
  opacity: 0.9;
}

.replay-home-link:hover {
  opacity: 1;
}

.replay-overlay-info {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.9;
}

.replay-winner-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.replay-winner-red {
  background: rgba(255, 107, 107, 0.3);
  color: #ff6b6b;
}

.replay-winner-blue {
  background: rgba(107, 163, 255, 0.3);
  color: #6ba3ff;
}

.replay-control-btn {
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
  text-decoration: none;
  transition: background 0.2s;
}

.replay-control-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.replay-play-btn {
  background: rgba(231, 76, 60, 0.8);
}

.replay-play-btn:hover {
  background: rgba(192, 57, 43, 0.9);
}

.replay-finisher-badge {
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: #ffd700;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 8px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.15), transparent);
  animation: replay-finisher-pulse 1.5s ease-in-out infinite;
}

@keyframes replay-finisher-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
}

@media (max-width: 500px) {
  .share-url-input {
    width: 180px;
  }
}

/* ===== Tournament Bracket ===== */

.bracket-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  color: var(--text);
}

.bracket-header {
  text-align: center;
  margin-bottom: 30px;
}

.bracket-title {
  font-size: 1.6rem;
  margin: 0 0 10px;
}

.bracket-title i {
  margin-right: 8px;
  color: var(--accent-color, #daa520);
}

.bracket-meta {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
  font-size: 0.95rem;
  opacity: 0.85;
}

.bracket-countdown {
  font-size: 1.15rem;
  font-weight: bold;
  color: var(--accent-color, #daa520);
  margin-bottom: 12px;
}

.bracket-countdown i {
  margin-right: 6px;
}

.bracket-countdown-timer {
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.bracket-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  padding: 6px 14px;
  cursor: pointer;
}

/* Empty / Postponed state */
.bracket-empty {
  text-align: center;
  padding: 60px 20px;
  opacity: 0.8;
}

.bracket-empty-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  color: var(--accent-color, #daa520);
}

.bracket-empty h3 {
  margin: 0 0 10px;
  font-size: 1.3rem;
}

.bracket-empty p {
  margin: 0;
  font-size: 1rem;
  opacity: 0.7;
}

/* Banner postponed message */
.tournament-banner-postponed-msg {
  font-size: 0.8rem;
  opacity: 0.7;
  font-style: italic;
  color: var(--text);
}

.tournament-banner-postponed-msg i {
  margin-right: 4px;
}

/* Spectate button */
.tournament-btn-spectate {
  background: linear-gradient(135deg, #2980b9, #3498db);
  font-size: 0.8rem;
  padding: 5px 12px;
}

.tournament-btn-spectate:hover {
  background: linear-gradient(135deg, #3498db, #5dade2);
}

/* Bracket grid */
.bracket {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 0 20px;
  align-items: stretch;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  min-width: 160px;
  flex-shrink: 0;
}

.bracket-round-label {
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  opacity: 0.7;
}

.bracket-matches {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex: 1;
  gap: 8px;
}

.bracket-match {
  background: rgba(128, 128, 128, 0.1);
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 8px;
  padding: 6px 10px;
  position: relative;
}

.bracket-slot {
  padding: 5px 8px;
  font-size: 0.85rem;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bracket-slot-vs {
  text-align: center;
  font-size: 0.7rem;
  opacity: 0.4;
  text-transform: uppercase;
  padding: 1px 0;
}

.bracket-slot-bye {
  opacity: 0.35;
  font-style: italic;
}

.bracket-slot-winner {
  background: rgba(46, 204, 113, 0.15);
  font-weight: 700;
}

/* Champion column */
.bracket-round-winner .bracket-round-label {
  color: #ffd700;
  opacity: 1;
}

.bracket-match-champion {
  background: linear-gradient(135deg, rgba(218, 165, 32, 0.15), rgba(255, 215, 0, 0.1));
  border-color: rgba(218, 165, 32, 0.35);
}

.bracket-slot-champion {
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 8px;
  color: #ffd700;
}

.bracket-slot-champion i {
  margin-right: 6px;
}

/* Connector lines between rounds */
.bracket-match::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -10px;
  width: 10px;
  height: 1px;
  background: rgba(128, 128, 128, 0.25);
}

.bracket-round:last-child .bracket-match::after {
  display: none;
}

/* Live tournament match */
.bracket-match-live {
  cursor: pointer;
  position: relative;
  animation: bracketLiveGlow 2s ease-in-out infinite;
  border: 1px solid rgba(255, 60, 60, 0.6);
  border-radius: 6px;
}

@keyframes bracketLiveGlow {
  0%, 100% { box-shadow: 0 0 4px rgba(255, 60, 60, 0.3); }
  50% { box-shadow: 0 0 12px rgba(255, 60, 60, 0.6); }
}

.bracket-match-live:hover {
  border-color: rgba(255, 60, 60, 0.9);
}

/* Live score floating tooltip */
.bracket-live-tooltip {
  display: none;
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--cloud-bg);
  color: var(--text);
  border: 1px solid rgba(255, 60, 60, 0.5);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 160px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.bracket-live-tooltip.visible {
  display: block;
}

.live-tooltip-header {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.5;
  text-align: center;
  margin-bottom: 8px;
}

.live-tooltip-grid {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.live-tooltip-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-tooltip-col-red {
  align-items: flex-end;
}

.live-tooltip-col-blue {
  align-items: flex-start;
}

.live-tooltip-divider {
  width: 1px;
  background: rgba(128, 128, 128, 0.2);
  align-self: stretch;
}

.live-tooltip-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
}

.live-tooltip-col-red .live-tooltip-stat {
  flex-direction: row-reverse;
}

.live-tooltip-col-red .live-tooltip-stat i {
  color: rgba(231, 76, 60, 0.85);
  font-size: 0.7rem;
}

.live-tooltip-col-blue .live-tooltip-stat i {
  color: rgba(52, 152, 219, 0.85);
  font-size: 0.7rem;
}

.live-tooltip-stat span {
  font-weight: 600;
  min-width: 22px;
  text-align: center;
}

.bracket-match-live-badge {
  position: absolute;
  top: -8px;
  right: -4px;
  background: #e63946;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  z-index: 1;
}

.bracket-match-method {
  position: absolute;
  top: -8px;
  right: -4px;
  background: rgba(128, 128, 128, 0.45);
  color: var(--text);
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  z-index: 1;
}

.bracket-match-done {
  opacity: 0.7;
}

.bracket-match-eliminated {
  opacity: 0.4;
}

.bracket-auto-join {
  text-align: center;
  padding: 12px;
  color: #4ecdc4;
  font-weight: 600;
  animation: fadeIn 0.3s ease;
}

@media (max-width: 600px) {
  .bracket {
    gap: 6px;
  }
  .bracket-round {
    min-width: 130px;
  }
  .bracket-slot {
    font-size: 0.75rem;
    padding: 4px 6px;
  }
}

/* Tournament Lobby */
.tournament-lobby {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.tournament-lobby-bracket {
  flex: 2;
  min-width: 0;
  overflow-x: auto;
}

.tournament-chat {
  flex: 1;
  min-width: 260px;
  max-width: 360px;
  background-color: var(--cloud-bg);
  background-image: var(--dirt-texture-url);
  background-repeat: repeat;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  max-height: 500px;
}

.tournament-chat-title {
  padding: 10px 12px;
  margin: 0;
  font-size: 0.85rem;
  font-family: "Cinzel", serif;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--surface-border);
  color: var(--papyrus-text);
}

.tournament-chat-title i {
  margin-right: 6px;
  color: #c8960c;
}

.tournament-chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 200px;
  max-height: 380px;
}

.tournament-chat-msg {
  font-size: 0.82rem;
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: break-word;
  min-width: 0;
  max-width: 100%;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.12);
  border-left: 2px solid #c8960c;
  border-radius: 0 2px 2px 0;
}

.tournament-chat-user {
  font-weight: 700;
  color: #c8960c;
  margin-right: 5px;
}

.tournament-chat-user::after {
  content: ":";
}

.tournament-chat-text {
  color: var(--text);
}

.tournament-chat-empty {
  color: var(--text);
  opacity: 0.45;
  font-size: 0.82rem;
  text-align: center;
  padding: 20px 8px;
  font-style: italic;
}

.tournament-chat-form {
  display: flex;
  border-top: 1px solid var(--surface-border);
  padding: 8px;
  gap: 6px;
}

.tournament-chat-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  color: var(--text);
  padding: 6px 10px;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.tournament-chat-input:focus {
  border-color: #c8960c;
}

.tournament-chat-send {
  background: rgba(200, 150, 12, 0.18);
  border: 1px solid rgba(200, 150, 12, 0.45);
  border-radius: 2px;
  color: #c8960c;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.2s ease;
}

.tournament-chat-send:hover {
  background: rgba(200, 150, 12, 0.32);
}

@media (max-width: 768px) {
  .tournament-lobby {
    flex-direction: column;
  }
  .tournament-chat {
    max-width: none;
    max-height: 350px;
  }
}

/* ============ My Deck / Deck Toggle ============ */

.deck-toggle {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.deck-toggle-btn {
  padding: 6px 16px;
  border: 1px solid var(--surface-border);
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
  box-sizing: border-box;
}

.deck-toggle-btn:hover:not(:disabled) {
  background: rgba(200, 150, 12, 0.12);
  border-color: #c8960c;
}

.deck-toggle-btn.active {
  background: rgba(200, 150, 12, 0.2);
  border-color: #c8960c;
  font-weight: 600;
}

.deck-toggle-btn--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.deck-toggle-btn-locked {
  opacity: 0.55;
  cursor: default;
  font-size: 0.8rem;
}

.deck-toggle-btn-wrap {
  position: relative;
  display: inline-block;
}

.deck-toggle-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(20, 20, 30, 0.92);
  color: #fff;
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  pointer-events: none;
  z-index: 10;
}

.deck-toggle-btn-wrap:hover .deck-toggle-tooltip {
  display: block;
}

.card-unowned .card-grid-image {
  filter: grayscale(0.6) brightness(0.55);
}

.card-owned-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #ffd700;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  pointer-events: none;
}

.my-cards-card-item {
  cursor: default;
}

.my-cards-card-item .card-grid-image {
  position: relative;
}

.buy-card-btn {
  width: 100%;
  margin-top: 4px;
  padding: 4px 8px;
  font-size: 0.75rem;
  border: 1px solid rgba(200, 150, 12, 0.5);
  border-radius: 2px;
  background: rgba(200, 150, 12, 0.12);
  color: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.buy-card-btn:hover:not(:disabled) {
  background: rgba(200, 150, 12, 0.28);
}

.buy-card-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
