@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;
}

/* 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 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(135deg, #1a1d29 0%, #2d3142 100%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 1000;
  font-family: "Cinzel", serif;
  gap: 20px;
}

/* ===== 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: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

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

.game-name {
  color: #f1faee;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.navbar-version {
  color: rgba(241, 250, 238, 0.5);
  font-size: 0.7rem;
  font-weight: 400;
  font-family: "Inter", sans-serif;
}

.navbar-online {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(6, 168, 125, 0.15);
  border-radius: 16px;
  color: #06a87d;
  font-size: 0.85rem;
  font-family: "Inter", sans-serif;
}

.navbar-online i {
  font-size: 0.6rem;
  animation: pulse 2s infinite;
}

/* ===== 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;
}

.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: rgba(241, 250, 238, 0.85);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link i {
  font-size: 1rem;
  opacity: 0.8;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f1faee;
  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: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(241, 250, 238, 0.85);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.navbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f1faee;
  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);
}

/* 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;
}

/* 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;
  }
}

/* ===== 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: 1400px) {
  .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;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 10px 16px;
  }

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

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

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

  .nav-link span {
    display: inline;
  }

  .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;
  }

  .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;
  }
}

.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: cover;
  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: cover;
  filter: brightness(0.25);
  /* Darken the background */
  z-index: 1;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.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;
}

.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;
  justify-content: center;
  color: var(--text);
}

.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: white;
  background: var(--cloud-bg);
  padding: 20px 40px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.color-picker-container {
  color: white;
  text-align: center;
  background: var(--cloud-bg);
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  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;
  color: var(--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(255, 255, 255, 0.08);
  border-radius: 8px;
}

.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(--text);
  font-size: 1rem;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.color-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

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

.red-button {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.red-button:hover {
  box-shadow: 0 6px 16px rgba(231, 76, 60, 0.5);
}

.blue-button {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}

.blue-button:hover {
  box-shadow: 0 6px 16px rgba(52, 152, 219, 0.5);
}

.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;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  background: var(--cloud-bg);
  padding: 12px 20px;
  border-radius: 12px;
  width: 100%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.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;
}

.timer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  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(255, 255, 255, 0.15);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.timer-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}

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

.pregame-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  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, #e63946 0%, #d62828 100%);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

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

.pregame-action-primary.blue-accent {
  background: linear-gradient(135deg, #4a90d9 0%, #2c5aa0 100%);
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
}

.pregame-action-primary.blue-accent:hover {
  box-shadow: 0 6px 16px rgba(74, 144, 217, 0.5);
}

.pregame-action-secondary {
  background: var(--cloud-bg);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pregame-action-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Pregame Help */
.pregame-help {
  background: var(--cloud-bg);
  border-radius: 10px;
  padding: 0;
  width: 100%;
  overflow: hidden;
}

.pregame-help summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text);
  font-weight: 500;
  list-style: none;
}

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

.pregame-help summary i {
  color: var(--text);
}

.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 16px 16px;
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.9;
}

/* 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: 12px 20px;
    margin: 5px;
  }

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

  .color-button {
    padding: 10px 20px;
    font-size: 1rem;
  }

  .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: linear-gradient(
    135deg,
    rgba(30, 60, 114, 0.95) 0%,
    rgba(70, 123, 157, 0.95) 100%
  );
  border-radius: 20px;
  padding: 50px 40px;
  max-width: 700px;
  width: 100%;
  margin: auto;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(168, 218, 220, 0.2);
  border: 2px solid rgba(168, 218, 220, 0.3);
  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: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  text-decoration: none;
  padding: 8px clamp(12px, 2vw, 20px);
  border-radius: 10px;
  transition: color 0.2s ease, background 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);
}

.game-over-header-action span {
  font-size: clamp(0.55rem, 1vw, 0.7rem);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.game-over-header-action:hover {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
}

.winner-badge {
  display: inline-block;
  padding: clamp(6px, 1vh, 10px) clamp(12px, 2vw, 20px);
  border-radius: 25px;
  font-weight: 700;
  font-size: clamp(0.65rem, 1.2vw, 0.85rem);
  letter-spacing: 1px;
  text-transform: uppercase;
  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(--text);
  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: 2px solid rgba(168, 218, 220, 0.2);
  border-bottom: 2px solid rgba(168, 218, 220, 0.2);
  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: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  min-width: clamp(60px, 15vw, 120px);
  position: relative;
}

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

.blue-score {
  border-color: rgba(52, 152, 219, 0.3);
  background: rgba(52, 152, 219, 0.08);
}

.score-label {
  font-size: clamp(0.7rem, 1.2vw, 0.9rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.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(135deg, #ffd700, #ffed4e);
  color: #333;
  padding: clamp(3px, 0.5vh, 4px) clamp(8px, 1.5vw, 12px);
  border-radius: 12px;
  font-size: clamp(0.55rem, 1vw, 0.7rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.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(255, 255, 255, 0.05);
  border-radius: 8px;
  margin: clamp(15px, 3vh, 25px) 0;
  border-left: 4px solid #457b9d;
  flex-shrink: 0;
}

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

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

.elo-section {
  text-align: center;
  padding: clamp(12px, 2vh, 20px);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin: clamp(10px, 2vh, 18px) 0;
  border-left: 4px solid #f0a500;
  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;
}

.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: 8px;
  font-size: clamp(0.85rem, 1.5vw, 1rem);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.new-game-btn {
  background: linear-gradient(135deg, #06a77d, #059a6f);
  color: white;
  box-shadow: 0 4px 12px rgba(6, 168, 125, 0.3);
}

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

.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 {
  width: 100%;
  max-width: 90%;
  max-height: 90%;
  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;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.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;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--primary-bg);
}

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

.profile-header h1 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--text);
}

.profile-section {
  margin-bottom: 28px;
  padding: 0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

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

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--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: 6px;
  background: var(--cloud-bg2);
  transition: all 0.2s ease;
}

.checkbox-label:hover {
  background: rgba(69, 123, 157, 0.1);
}

.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;
  background: var(--cloud-bg2);
  border: 1px solid rgba(69, 123, 157, 0.2);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.game-card:hover {
  background: rgba(69, 123, 157, 0.1);
  border-color: var(--primary-bg);
  transform: translateX(2px);
}

.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 rgba(69, 123, 157, 0.1);
}

.form-actions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.profile-btn-save {
  background: linear-gradient(135deg, #06a77d 0%, #059a6f 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(6, 168, 125, 0.2);
}

.profile-btn-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(6, 168, 125, 0.3);
}

.profile-btn-save:active {
  transform: translateY(0);
}

.profile-btn-close {
  background: var(--cloud-bg2);
  color: var(--text);
  border: 1px solid rgba(69, 123, 157, 0.2);
}

.profile-btn-close:hover {
  background: rgba(69, 123, 157, 0.15);
  border-color: var(--primary-bg);
}

.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(230, 57, 70, 0.1);
  color: #e63946;
}

/* 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;
}

.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);
}

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

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

.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);
  border-radius: 25%;
}

.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 {
  filter: blur(10px) brightness(1.5);
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: 5px;
}

.online {
  background-color: green;
}

.offline {
  background-color: red;
}

.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;
  text-align: center;
  background: linear-gradient(135deg, rgba(109, 211, 231, 0.1), rgba(255, 182, 193, 0.1));
  border-radius: 8px;
  animation: fadeInOut 0.4s ease-in-out;
}

.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: bold;
  color: inherit;
}

.fallback-content p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.9;
  line-height: 1.3;
}

.fallback-link {
  margin-top: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.fallback-link:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

@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%;
}

/* Campaign Progress Header */
.campaign-progress-header {
  width: 100%;
  max-width: 900px;
  padding: 20px;
  background: linear-gradient(
    135deg,
    rgba(69, 123, 157, 0.15) 0%,
    rgba(6, 168, 125, 0.1) 100%
  );
  border: 2px solid var(--primary-bg);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.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(--text);
  font-weight: 600;
}

.progress-title i {
  color: var(--text);
  font-size: 1.5rem;
}

.progress-status {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
}

.progress-level {
  font-weight: 700;
  color: var(--primary-bg);
}

.progress-bar-container {
  width: 100%;
  height: 24px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-bg) 0%, #06a77d 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(6, 168, 125, 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%);
  }
}

@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;
  }
}

.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 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);
}

/* 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: linear-gradient(
    135deg,
    rgba(107, 142, 35, 0.15) 0%,
    rgba(173, 216, 230, 0.1) 100%
  );
  border: 2px solid rgba(255, 255, 255, 0.15);
}

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

.map-description-title {
  margin: 0 0 16px 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  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(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  text-decoration: none;
  font-weight: 700;
  border-radius: 8px;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  font-size: 1rem;
}

.play-now-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
  border-color: rgba(255, 255, 255, 0.4);
}

/* 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: linear-gradient(
    135deg,
    rgba(69, 123, 157, 0.1) 0%,
    rgba(6, 168, 125, 0.05) 100%
  );
  border-bottom: 2px solid var(--primary-bg);
}

.campaign-level-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-bg) 0%, #06a77d 100%);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(69, 123, 157, 0.3);
  flex-shrink: 0;
}

.level-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
}

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

.campaign-level-title h3 {
  margin: 0 0 6px 0;
  font-size: 1.4rem;
  color: var(--text);
}

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

.campaign-level-image {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid rgba(69, 123, 157, 0.1);
}

.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: linear-gradient(
    135deg,
    rgba(6, 168, 125, 0.1) 0%,
    rgba(168, 218, 220, 0.05) 100%
  );
  border-left: 4px solid #06a77d;
  border-radius: 6px;
  margin-bottom: 16px;
}

.campaign-learning-box i {
  color: #06a77d;
  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: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.campaign-btn-play {
  background: linear-gradient(135deg, #06a77d 0%, #047d58 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(6, 168, 125, 0.25);
}

.campaign-btn-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(6, 168, 125, 0.35);
}

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

.campaign-btn-locked {
  background: var(--cloud-bg2);
  color: var(--number);
  cursor: not-allowed;
  opacity: 0.6;
}

/* 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.5);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  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(0, 0, 0, 0.7);
  transform: rotate(90deg);
}

.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;
}

/* 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;*/
/*}*/
.speech-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  /* Semi-transparent black */
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 52vh;
  z-index: 10010;
}

p.bubble {
  position: relative;
  max-width: 700px;
  text-align: center;
  line-height: 1.4em;
  margin: 25% 15%;
  background-color: #fff;
  border: 8px solid #333;
  border-radius: 30px;
  font-family: sans-serif;
  padding: 20px;
  font-size: large;
  margin-bottom: 20px;
}

/* Ensure speech bubble is the positioning parent */
p.speech.bubble {
  position: relative !important;
}

.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);
}

.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;
}

p.bubble:before,
p.bubble:after {
  content: " ";
  position: absolute;
  width: 0;
  height: 0;
}

p.speech:before {
  left: 30px;
  bottom: -50px;
  border: 25px solid;
  border-color: #333 transparent transparent #333;
}

p.speech:after {
  left: 38px;
  bottom: -30px;
  border: 15px solid;
  border-color: #fff transparent transparent #fff;
}

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;
}

/* Large screen adjustments - bring bubble closer to character */
@media (min-width: 1200px) {
  .speech-container {
    padding-bottom: 30vh;
  }
}

/* Medium screens */
@media (min-width: 769px) and (max-width: 1199px) {
  .speech-container {
    padding-bottom: 35vh;
  }
}

/* Responsive adjustments for speech bubble on mobile */
@media (max-width: 768px) {
  .speech-container {
    padding-bottom: 45vh;
  }

  p.bubble {
    max-width: 90%;
    margin: 20px;
    margin-bottom: 10px;
    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;
  color: var(--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: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  height: 100%;
}

.card-grid-item:hover {
  transform: translateY(-8px);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.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 {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.card-type-badge {
  padding: 6px 12px;
  border-radius: 20px;
  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;
  color: var(--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.3);
  border-radius: 6px;
  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(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Card Details View */
.card-details-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 10px 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.card-back-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.card-back-link:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-4px);
}

.card-navigation-counter {
  color: var(--text);
  opacity: 0.7;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.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: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.card-details-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

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

.card-type-badge-large {
  position: absolute;
  bottom: 12px;
  right: 12px;
  padding: 10px 16px;
  border-radius: 24px;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-details-info-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card-details-title-section {
  border-bottom: 3px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 16px;
}

.card-details-title {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.card-details-section-label {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-details-description-section {
  padding: 0;
}

.card-details-description {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

.card-navigation-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.card-nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.card-nav-button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateX(8px);
}

.card-nav-prev:hover {
  transform: translateX(-8px);
}

.card-nav-button span {
  flex: 1;
}

.card-nav-button i {
  font-size: 1.2rem;
}

/* 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;
}

/* 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(--cloud-bg);
  border: 1px solid rgba(100, 120, 200, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  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: #5b9ee9;
  font-size: 14px;
}

.card-help-text {
  flex: 1;
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
  font-weight: 400;
  opacity: 0.9;
}

/* 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 {
  background: var(--cloud-bg);
  border: 1px solid rgba(100, 120, 200, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  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-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-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.section-dot.free {
  background: #28a745;
  box-shadow: 0 0 4px rgba(40, 167, 69, 0.5);
}

.section-dot.busy {
  background: #dc3545;
  box-shadow: 0 0 4px rgba(220, 53, 69, 0.5);
}

.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-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;
}

.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;
}

.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;
  }
}

/* Mobile responsive - Online Users */
@media (max-width: 768px) {
  .online-users-panel {
    max-width: 100%;
    border-radius: 6px;
    padding: 8px 10px;
    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: 20px;
  background: var(--cloud-bg);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.inbox-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.inbox-header h1 {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--text);
}

.inbox-header i {
  margin-right: 10px;
}

.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: #4a90e2;
}

.message-sender strong {
  font-size: 1.1rem;
}

.unread-dot {
  width: 10px;
  height: 10px;
  background: #4a90e2;
  border-radius: 50%;
  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: var(--cloud-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-message-action:hover {
  background: rgba(74, 144, 226, 0.2);
  border-color: #4a90e2;
  transform: translateY(-2px);
}

.btn-message-action i {
  margin-right: 4px;
}

.btn-message-reply {
  background: #4a90e2;
  color: white;
  border-color: #4a90e2;
}

.btn-message-reply:hover {
  background: #357abd;
}

.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: var(--cloud-bg2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}

.conversation-item:first-child {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.conversation-item:last-child {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  border-bottom: none;
}

.conversation-item:hover {
  background: rgba(74, 144, 226, 0.1);
  transform: translateX(4px);
}

.conversation-item.unread {
  background: rgba(74, 144, 226, 0.05);
  border-left: 4px solid #4a90e2;
}

.conversation-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  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: 1.1rem;
  color: var(--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: #dc3545;
  color: white;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: bold;
}

/* Conversation Thread Styles */
.conversation-container {
  max-width: 900px;
  margin: 20px auto;
  background: var(--cloud-bg);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  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: 16px 20px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  background: var(--cloud-bg2);
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.back-button {
  background: rgba(74, 144, 226, 0.1);
  border: 1px solid rgba(74, 144, 226, 0.3);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.back-button:hover {
  background: rgba(74, 144, 226, 0.2);
}

.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: #4a90e2;
}

.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: 16px;
  word-wrap: break-word;
}

.message-bubble.sent {
  align-self: flex-end;
  background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-bubble.received {
  align-self: flex-start;
  background: var(--cloud-bg2);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-bubble-content {
  margin-bottom: 4px;
  line-height: 1.5;
}

.message-bubble.sent .message-bubble-content {
  color: white;
}

.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(255, 255, 255, 0.8);
  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: var(--icon-bg);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  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(--text);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.info-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

.info-modal-header {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 30px 30px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.info-modal-header h2 {
  color: var(--text);
  font-size: 1.5rem;
  margin: 0;
  font-weight: 700;
}

.info-modal-body {
  padding: 25px 30px 30px;
  color: var(--text);
  line-height: 1.6;
}

.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(255, 255, 255, 0.05);
  border-radius: 8px;
  border-left: 3px solid #ffd700;
}

.info-list li i {
  color: #ffd700;
  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(255, 215, 0, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(255, 215, 0, 0.2);
}

.info-modal-footer p {
  margin: 0;
  font-size: 0.95rem;
}

.info-modal-footer i {
  color: #ffd700;
  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: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
}

.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;
  gap: 15px;
  justify-content: center;
  align-items: flex-start;
  max-width: 800px;
  min-height: 120px;
  padding: 20px;
  margin-bottom: 20px;
}

.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(135deg, #06a77d 0%, #04d9a1 100%);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(6, 167, 125, 0.4);
  transition: all 0.3s ease;
  font-family: "Comfortaa", sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.achievement-celebration-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 167, 125, 0.6);
  background: linear-gradient(135deg, #04d9a1 0%, #06a77d 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 {
    gap: 10px;
    padding: 15px;
    min-height: 100px;
  }

  .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(220, 20, 60, 0.5), 0 0 20px rgba(220, 20, 60, 0.3) !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(30, 144, 255, 0.5), 0 0 20px rgba(30, 144, 255, 0.3) !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(220, 20, 60, 0.5), 0 0 20px rgba(220, 20, 60, 0.3);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(220, 20, 60, 0.8), 0 0 40px rgba(220, 20, 60, 0.5), 0 0 60px rgba(220, 20, 60, 0.3);
    filter: brightness(1.3);
  }
}

@keyframes tutorialPulsateBlue {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(30, 144, 255, 0.5), 0 0 20px rgba(30, 144, 255, 0.3);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(30, 144, 255, 0.8), 0 0 40px rgba(30, 144, 255, 0.5), 0 0 60px rgba(30, 144, 255, 0.3);
    filter: brightness(1.3);
  }
}

/* --- In-game trophy for top 3 players --- */
.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;
}
