/* Reset & Basic Setup */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-color: #323437;
  --main-color: #00f5d4; /* Cyberpunk Electric Cyan */
  --accent-color: #ff007f; /* Hot Pink for highlighting vs / streak */
  --sub-color: #646669; /* Grey text for untyped/background */
  --text-color: #ffffff;
  --card-bg: #2c2e31;
  --panel-bg: rgba(44, 46, 49, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --error-color: #f44336;
  --success-color: #00f5d4;
  --font-family: 'Karla', sans-serif;
  --transition-speed: 0.3s;
  
  /* Player Role Colors */
  --color-batsman: #3b82f6; /* Blue */
  --color-bowler: #10b981; /* Green */
  --color-allrounder: #a855f7; /* Purple */
  --color-legend: #f59e0b; /* Gold */
}

body.light-theme {
  --bg-color: #f3f4f6; /* Soft light gray */
  --main-color: #0ea5e9; /* Sky Blue/Teal */
  --accent-color: #db2777; /* Deep Pink */
  --sub-color: #7c8ba1; /* Slate gray */
  --text-color: #1e293b; /* Dark slate */
  --card-bg: #ffffff; /* Premium white */
  --panel-bg: rgba(255, 255, 255, 0.8);
  --border-color: rgba(0, 0, 0, 0.08);
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-weight: 400;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 1050px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem 1rem;
}

/* Header Styling */
header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 1rem;
}

.header-left {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.header-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.nav-logo {
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-color);
  letter-spacing: -0.03em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-logo .logo-accent-blue {
  color: var(--main-color);
}

.nav-logo-icon {
  font-size: 1.0rem;
  color: var(--main-color);
}

.nav-page-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sub-color);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--sub-color);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-speed), background-color var(--transition-speed);
}

.icon-btn:hover {
  color: var(--main-color);
  background-color: rgba(255, 255, 255, 0.05);
}

body.light-theme .icon-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* View Container Common */
.view-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 1. Home / Menu View */
.hero-section {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-card-decorator {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.glow-card {
  width: 60px;
  height: 85px;
  background: var(--card-bg);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  border: 2px solid;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  transform: rotate(-10deg);
  transition: transform var(--transition-speed);
}
.glow-card.gold {
  border-color: var(--color-legend);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}
.glow-card.purple {
  border-color: var(--color-allrounder);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
  transform: rotate(15deg) translate(-10px, -5px);
}

.hero-section h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
  text-transform: capitalize;
}

.subtitle {
  color: var(--sub-color);
  font-size: 1.05rem;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.5;
}

.menu-options {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.menu-btn {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 1.2rem;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  text-align: left;
  transition: transform 0.2s, border-color var(--transition-speed), box-shadow var(--transition-speed);
  width: 100%;
  outline: none;
}

.menu-btn:hover {
  transform: translateY(-2px);
  border-color: var(--main-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.menu-btn-icon {
  font-size: 1.8rem;
  color: var(--main-color);
  background: rgba(0, 245, 212, 0.06);
  padding: 0.75rem;
  border-radius: 10px;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.menu-btn.secondary .menu-btn-icon {
  color: var(--accent-color);
  background: rgba(255, 0, 127, 0.06);
}

.menu-btn.secondary:hover {
  border-color: var(--accent-color);
}

.menu-btn-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.btn-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
}

.btn-desc {
  font-size: 0.85rem;
  color: var(--sub-color);
}

/* Multiplayer Lobby Selector Card */
.multiplayer-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: 16px;
  margin-top: 0.5rem;
}

.multiplayer-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.multiplayer-header i {
  color: var(--main-color);
}

.multiplayer-card p {
  font-size: 0.85rem;
  color: var(--sub-color);
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

.multiplayer-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.glow-button {
  box-shadow: 0 0 15px rgba(0, 245, 212, 0.2);
}

.action-btn-main {
  background-color: var(--main-color);
  color: #1e1e1e;
  border: none;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.1s, filter 0.2s;
  width: 100%;
}

.action-btn-main:hover {
  filter: brightness(1.1);
}

.action-btn-main:active {
  transform: scale(0.98);
}

.join-input-group {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.join-input-group input {
  flex-grow: 1;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: var(--text-color);
  font-family: var(--font-family);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  outline: none;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}

.join-input-group input:focus {
  border-color: var(--main-color);
}

.action-btn-sub {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 0.65rem 1.25rem;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.action-btn-sub:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--text-color);
}

body.light-theme .action-btn-sub:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* 2. Lobby Waiting View */
.lobby-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.lobby-card h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.lobby-desc {
  font-size: 0.9rem;
  color: var(--sub-color);
  margin-bottom: 1.5rem;
  line-height: 1.45;
}

.code-display-box {
  display: flex;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
}

.room-code {
  font-family: monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--main-color);
  letter-spacing: 2px;
}

.copy-btn {
  background: rgba(0, 245, 212, 0.1);
  color: var(--main-color);
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background var(--transition-speed);
}

.copy-btn:hover {
  background: rgba(0, 245, 212, 0.2);
}

.lobby-players {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.player-slot {
  display: flex;
  align-items: center;
  background-color: var(--bg-color);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  gap: 0.75rem;
  border: 1px solid transparent;
}

.player-slot.active {
  border-color: rgba(0, 245, 212, 0.3);
}

.player-slot i {
  font-size: 1.2rem;
  color: var(--sub-color);
}

.player-slot.active i {
  color: var(--main-color);
}

.player-slot-name {
  flex-grow: 1;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 500;
}

.status-indicator {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-indicator.ready {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.status-indicator.waiting {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  animation: pulse-op 1.5s infinite;
}

.player-slot-divider {
  color: var(--sub-color);
  font-size: 0.9rem;
}

.cancel-btn {
  background: transparent;
  color: var(--sub-color);
  border: 1px solid var(--border-color);
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.2s, border-color 0.2s;
}

.cancel-btn:hover {
  color: var(--text-color);
  border-color: var(--text-color);
}

/* 3. Gameplay View */
.game-status-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: var(--panel-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  z-index: 10;
}

.player-deck-stat {
  display: flex;
  flex-direction: column;
  width: 32%;
}

.user-deck-stat {
  align-items: flex-start;
}

.opponent-deck-stat {
  align-items: flex-end;
}

.player-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sub-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deck-count-container {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-top: 0.15rem;
}

.deck-badge {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-color);
}

.deck-label {
  font-size: 0.75rem;
  color: var(--sub-color);
}

.mini-deck-visual {
  display: flex;
  gap: 2px;
  margin-top: 0.25rem;
  height: 6px;
  width: 60px;
}

.mini-card-dot {
  flex-grow: 1;
  height: 100%;
  background: var(--main-color);
  border-radius: 1px;
  opacity: 0.7;
}

.opponent-deck-stat .mini-card-dot {
  background: var(--accent-color);
}

.mini-card-dot.spent {
  opacity: 0.15;
}

.game-round-info {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.round-number {
  font-size: 0.85rem;
  color: var(--sub-color);
  font-weight: 500;
}

.turn-bubble {
  background: var(--main-color);
  color: #1e1e1e;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  box-shadow: 0 0 10px rgba(0, 245, 212, 0.2);
}

.turn-bubble.opp-turn {
  background: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.2);
}

/* Arena Playground */
.arena {
  flex-grow: 1;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  perspective: 1000px; /* 3D Card flips */
  margin-bottom: 1.5rem;
}

.card-space {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  position: relative;
  min-height: 530px;
}

.card-deck-stack-underlay {
  position: absolute;
  width: 320px;
  height: 510px;
  border-radius: 16px;
  border: 1px dashed var(--border-color);
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
}

/* VS Section */
.vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  width: 60px;
  position: relative;
}

.vs-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--sub-color);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: all 0.3s;
}

.vs-circle.highlight-user {
  border-color: var(--main-color);
  color: var(--main-color);
  box-shadow: 0 0 15px rgba(0, 245, 212, 0.4);
}

.vs-circle.highlight-opp {
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
}

.comparison-result-popup {
  position: absolute;
  bottom: -90px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 150px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  animation: bounceIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#round-result-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-color);
}

.sub-result-text {
  font-size: 0.75rem;
  color: var(--main-color);
  margin-top: 0.15rem;
}

.continue-round-btn {
  margin-top: 0.5rem;
  background-color: var(--main-color);
  color: #1e1e1e;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: transform 0.1s, filter 0.2s;
  width: 100%;
  justify-content: center;
  box-shadow: 0 0 10px rgba(0, 245, 212, 0.2);
}

.continue-round-btn:hover {
  filter: brightness(1.1);
}

.continue-round-btn:active {
  transform: scale(0.95);
}

/* Card Container / Wrapper for flipping */
.card-wrapper {
  width: 320px;
  height: 510px;
  position: relative;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
}

.card-wrapper.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  border: 2px solid var(--border-color);
  background-color: var(--card-bg);
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Card Front */
.card-face-front {
  /* Dynamic role gradient will apply here */
  padding: 0.75rem;
  visibility: visible;
  transition: visibility 0s 0s;
}

.card-wrapper.flipped .card-face-front {
  visibility: hidden;
  transition: visibility 0s 0.3s;
}

/* Card Back (Flipped face) */
.card-face-back {
  transform: rotateY(180deg);
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #2c2e31 40%, #1e1f21 100%);
  border-color: var(--sub-color);
  visibility: hidden;
  transition: visibility 0s 0.3s;
}

.card-wrapper.flipped .card-face-back {
  visibility: visible;
  transition: visibility 0s 0s;
}

.card-back-pattern {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  opacity: 0.7;
}

.card-back-pattern i {
  font-size: 3rem;
  color: var(--sub-color);
  animation: logo-float 4s infinite ease-in-out;
}

.card-back-pattern span {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--sub-color);
}

/* Inside Player Card (Front) */
.card-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.card-role-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: #1e1e1e;
}

.card-country-flag {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--sub-color);
  font-weight: 600;
}

.card-jersey-number {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sub-color);
}

/* Cricketer Illustration Visual */
.card-player-portrait {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-radius: 10px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.03);
}

.player-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top; /* Align images to the top to avoid cutting player heads */
  border-radius: 8px;
  z-index: 2;
  transition: transform var(--transition-speed);
}

.portrait-glow-svg {
  width: 100px;
  height: 100px;
  z-index: 2;
  filter: drop-shadow(0 0 8px currentColor);
}

.portrait-glow-svg path {
  fill: currentColor;
}

.portrait-shadow-initials {
  position: absolute;
  bottom: 0.25rem;
  right: 0.5rem;
  font-size: 2.25rem;
  font-weight: 900;
  opacity: 0.05;
  color: var(--text-color);
  user-select: none;
}

.card-player-details {
  text-align: center;
  margin-bottom: 0.75rem;
}

.card-player-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.2px;
}

.card-player-team {
  font-size: 0.75rem;
  color: var(--sub-color);
  margin-top: 0.1rem;
}

/* Card Stats Grid */
.card-stats-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.5rem;
  margin-top: auto;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255,255,255,0.02);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

/* User Card interactive styles */
#player-card-space .stat-item:hover {
  background: rgba(0, 245, 212, 0.08);
  border-color: rgba(0, 245, 212, 0.2);
}

#player-card-space .stat-item.selected {
  background: rgba(0, 245, 212, 0.15) !important;
  border-color: var(--main-color) !important;
  box-shadow: 0 0 10px rgba(0, 245, 212, 0.15);
}

/* Locked selection state when it's not active player's choice */
#player-card-space .stat-item.locked {
  cursor: not-allowed !important;
}
#player-card-space .stat-item.locked:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.02);
}

/* Opponent selected stat highlight during compare */
#opponent-card-space .stat-item.compared-stat {
  background: rgba(255, 0, 127, 0.12) !important;
  border-color: rgba(255, 0, 127, 0.4) !important;
}

/* Winner vs Loser highlight */
.card-face.winner-glow {
  border-color: var(--success-color) !important;
  box-shadow: 0 0 25px rgba(0, 245, 212, 0.4) !important;
}

.card-face.loser-glow {
  border-color: var(--error-color) !important;
  box-shadow: 0 0 25px rgba(244, 67, 54, 0.4) !important;
}

.stat-name-label {
  font-size: 0.8rem;
  color: var(--sub-color);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stat-value-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-color);
}

/* Helper text */
.turn-helper-hint {
  text-align: center;
  font-size: 0.9rem;
  color: var(--sub-color);
  height: 1.5rem;
  font-weight: 500;
}

/* Multiplayer Emotes Bar */
.emotes-panel {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--panel-bg);
  backdrop-filter: blur(8px);
  padding: 0.5rem;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  max-width: 320px;
  margin: 0 auto;
}

.emote-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  transition: background 0.15s, transform 0.1s;
}

.emote-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: scale(1.15);
}

.emote-btn:active {
  transform: scale(0.95);
}

/* Float Emotes Bubble */
.emote-bubble {
  position: fixed;
  z-index: 100;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  box-shadow: 0 5px 15px rgba(0,0,0,0.25);
  animation: floatEmote 2.2s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.user-emote {
  bottom: 100px;
  left: 20%;
}

.opp-emote {
  bottom: 100px;
  right: 20%;
}

/* Blocker Overlay for Screen */
.turn-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(1px);
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  pointer-events: all;
}

.blocker-message {
  background: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  animation: pulse-op 1.5s infinite;
}

/* 4. Game Over View */
.gameover-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.trophy-glow {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: inline-block;
  animation: trophy-bounce 2s infinite ease-in-out;
}

.gameover-card h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.gameover-desc {
  font-size: 0.95rem;
  color: var(--sub-color);
  margin-bottom: 2rem;
  line-height: 1.45;
}

.gameover-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.gameover-stat-card {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--sub-color);
  font-weight: 600;
}

.stat-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--main-color);
}

/* Global Floating Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1e1f21;
  color: #ffffff;
  padding: 0.65rem 1.5rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  animation: toastIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

/* Footer styling */
footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: var(--sub-color);
  font-size: 0.75rem;
  margin-top: 1.5rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 1rem;
}

.footer-middle {
  display: flex;
  justify-content: center;
}

.footer-middle a:hover {
  text-decoration: underline !important;
}

.footer-right {
  display: flex;
  justify-content: flex-end;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#connection-status i {
  color: #10b981;
}

/* Card Role Styling Gradients & Premium Neon Rarity Glows */
.role-legend {
  border-color: var(--color-legend) !important;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, rgba(44, 46, 49, 0.95) 50%, #1e1f21 100%) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 20px rgba(245, 158, 11, 0.25), inset 0 0 15px rgba(245, 158, 11, 0.15) !important;
}
.role-legend .card-role-badge {
  background-color: var(--color-legend);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}
.role-legend .card-player-portrait {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}
.role-legend .card-player-name {
  color: #f59e0b;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.role-batsman {
  border-color: var(--color-batsman) !important;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.06) 0%, rgba(44, 46, 49, 0.95) 50%, #1e1f21 100%) !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3), 0 0 15px rgba(59, 130, 246, 0.15), inset 0 0 10px rgba(59, 130, 246, 0.08) !important;
}
.role-batsman .card-role-badge {
  background-color: var(--color-batsman);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}
.role-batsman .card-player-portrait {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}
.role-batsman .card-player-name {
  text-shadow: 0 0 8px rgba(59, 130, 246, 0.15);
}

.role-bowler {
  border-color: var(--color-bowler) !important;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.06) 0%, rgba(44, 46, 49, 0.95) 50%, #1e1f21 100%) !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3), 0 0 15px rgba(16, 185, 129, 0.15), inset 0 0 10px rgba(16, 185, 129, 0.08) !important;
}
.role-bowler .card-role-badge {
  background-color: var(--color-bowler);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}
.role-bowler .card-player-portrait {
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}
.role-bowler .card-player-name {
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}

.role-allrounder {
  border-color: var(--color-allrounder) !important;
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.06) 0%, rgba(44, 46, 49, 0.95) 50%, #1e1f21 100%) !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3), 0 0 15px rgba(168, 85, 247, 0.15), inset 0 0 10px rgba(168, 85, 247, 0.08) !important;
}
.role-allrounder .card-role-badge {
  background-color: var(--color-allrounder);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}
.role-allrounder .card-player-portrait {
  border-color: rgba(168, 85, 247, 0.3);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}
.role-allrounder .card-player-name {
  text-shadow: 0 0 8px rgba(168, 85, 247, 0.15);
}

/* Interactive Card Animations during plays */
.card-won-animation-user {
  animation: cardWonUser 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) forwards;
}

.card-won-animation-opp {
  animation: cardWonOpp 0.8s cubic-bezier(0.175, 0.885, 0.32, 1) forwards;
}

.card-shake {
  animation: shake 0.5s ease-in-out;
}

/* Helper hidden class */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes logo-float-horizontal {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-3px, -4px); }
}

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

@keyframes floatEmote {
  0% { transform: translateY(20px) scale(0.5); opacity: 0; }
  15% { transform: translateY(-20px) scale(1.1); opacity: 1; }
  75% { transform: translateY(-80px) scale(1); opacity: 1; }
  100% { transform: translateY(-110px) scale(0.8); opacity: 0; }
}

@keyframes bounceIn {
  from { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); opacity: 0.8; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes toastIn {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes trophy-bounce {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  50% { transform: translateY(-8px) scale(1.08) rotate(5deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

@keyframes cardWonUser {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  30% { transform: translate(30px, -20px) scale(1.02); opacity: 0.9; }
  100% { transform: translate(-350px, -300px) scale(0.1); opacity: 0; }
}

@keyframes cardWonOpp {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  30% { transform: translate(-30px, -20px) scale(1.02); opacity: 0.9; }
  100% { transform: translate(350px, -300px) scale(0.1); opacity: 0; }
}

/* Mobile Media Queries (Extreme Premium Responsive adjustments) */
@media (max-width: 768px) {
  .app-container {
    padding: 1rem 0.5rem;
  }
  
  header {
    margin-bottom: 1rem;
    padding: 0 0.5rem;
  }
  
  .hero-section h1 {
    font-size: 1.8rem;
  }
  
  .subtitle {
    font-size: 0.95rem;
  }

  .game-status-bar {
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    margin-bottom: 1rem;
  }

  .deck-badge {
    font-size: 1.15rem;
  }
  
  .mini-deck-visual {
    width: 45px;
    height: 4px;
  }

  .arena {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    justify-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .card-space {
    min-height: auto;
    height: 440px;
    width: 100%;
  }

  .card-deck-stack-underlay {
    width: 250px;
    height: 420px;
  }

  .card-wrapper {
    width: 250px;
    height: 420px;
  }
  
  /* Redefine card contents for smaller screens */
  .card-player-portrait {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: none;
    min-height: auto;
    margin-bottom: 0.35rem;
  }
  
  .portrait-glow-svg {
    width: 80px;
    height: 80px;
  }
  
  .portrait-shadow-initials {
    font-size: 2rem;
  }

  .card-player-name {
    font-size: 1rem;
  }

  .card-player-team {
    font-size: 0.72rem;
  }
  
  .card-stats-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 0.4rem;
  }

  .stat-item {
    padding: 0.3rem 0.5rem;
  }
  
  .stat-name-label {
    font-size: 0.72rem;
  }

  .stat-value-label {
    font-size: 0.8rem;
  }
  
  .card-role-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.35rem;
  }
  
  .card-country-flag {
    font-size: 1rem;
  }
  
  /* VS Area inside Mobile */
  .vs-divider {
    grid-row: 2;
    flex-direction: row;
    width: 100%;
    height: 40px;
    justify-content: center;
    gap: 1rem;
  }

  .vs-circle {
    width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  .comparison-result-popup {
    bottom: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    min-width: 160px;
    z-index: 100;
  }

  /* Emote placements in mobile */
  .user-emote {
    bottom: 80px;
    left: 10%;
  }

  .opp-emote {
    bottom: 80px;
    right: 10%;
  }
  
  .gameover-card, .lobby-card {
    padding: 1.5rem;
  }

  footer {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    justify-items: center;
    text-align: center;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
  }
  
  .footer-right {
    justify-content: center;
  }
}

/* 13. Added custom player inputs and red loser popups */
.name-input-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 1.25rem;
  gap: 0.4rem;
}

.name-input-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--main-color);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  text-transform: uppercase;
}

.name-input-group input {
  width: 100%;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: var(--text-color);
  font-family: var(--font-family);
  font-weight: 600;
  outline: none;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.name-input-group input:focus {
  border-color: var(--main-color);
  box-shadow: 0 0 8px rgba(0, 245, 212, 0.25);
}

.comparison-result-popup.loser-round-bg {
  background: rgba(255, 0, 95, 0.95);
  border-color: #ff005f;
  box-shadow: 0 0 15px rgba(255, 0, 95, 0.6);
}

.comparison-result-popup.loser-round-bg #round-result-text,
.comparison-result-popup.loser-round-bg .sub-result-text {
  color: #ffffff;
}

.comparison-result-popup.loser-round-bg .sub-result-text {
  opacity: 0.9;
}

.comparison-result-popup.loser-round-bg .continue-round-btn {
  background-color: #ffffff;
  color: #ff005f;
}

/* 14. Reveal buttons and revealed role badge styles */
.reveal-btn {
  background-color: transparent;
  color: var(--main-color);
  border: 1px solid rgba(0, 245, 212, 0.3);
  padding: 0.35rem 0.65rem;
  font-family: var(--font-family);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.4rem;
  transition: all 0.2s;
  box-shadow: 0 0 10px rgba(0, 245, 212, 0.05);
}

.reveal-btn:hover:not(:disabled) {
  background-color: rgba(0, 245, 212, 0.08);
  border-color: var(--main-color);
  box-shadow: 0 0 10px rgba(0, 245, 212, 0.15);
}

.reveal-btn:disabled {
  color: var(--sub-color);
  border-color: var(--border-color);
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.opponent-deck-stat .reveal-btn {
  color: var(--accent-color);
  border-color: rgba(255, 0, 127, 0.3);
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.05);
}

.opponent-deck-stat .reveal-btn:hover:not(:disabled) {
  background-color: rgba(255, 0, 127, 0.08);
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.15);
}

.revealed-role-badge {
  margin-top: 1rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  animation: popBadge 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  z-index: 10;
  box-shadow: 0 0 15px currentColor;
}

.revealed-role-badge.role-legend {
  background-color: var(--color-legend);
  color: #1e1e1e;
}

.revealed-role-badge.role-batsman {
  background-color: var(--color-batsman);
  color: #ffffff;
}

.revealed-role-badge.role-bowler {
  background-color: var(--color-bowler);
  color: #ffffff;
}

.revealed-role-badge.role-allrounder {
  background-color: var(--color-allrounder);
  color: #ffffff;
}

@keyframes popBadge {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
