/* RPS Arena Styles */

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

:root {
  --rock-color: #FFA500;
  --paper-color: #1E90FF;
  --scissors-color: #2ECC71;
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --accent: #e94560;
  --success: #2ecc71;
  --warning: #f39c12;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

/* Screens */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

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

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #d63850;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--text-secondary);
}

.btn-link {
  background: none;
  color: var(--text-secondary);
  padding: 4px 8px;
  text-decoration: underline;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

/* Landing Screen */
#landing-screen {
  overflow: hidden;
}

#landing-bg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.landing-content {
  position: relative;
  z-index: 10;
  text-align: center;
}

.logo {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 8px;
  margin-bottom: 16px;
  color: #ffffff;
}

.tagline {
  font-size: 22px;
  color: var(--text-primary);
  margin-bottom: 32px;
  font-weight: 600;
  letter-spacing: 2px;
}

.network-info {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.docs-link {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 24px;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--text-secondary);
  border-radius: 24px;
  transition: all 0.3s ease;
}

.docs-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.1);
}

/* Mobile Block */
.mobile-message {
  text-align: center;
  padding: 40px;
}

.mobile-message h1 {
  font-size: 32px;
  margin-bottom: 24px;
}

.mobile-message p {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Lobby Screen */
#lobby-screen {
  position: relative;
  overflow: hidden;
}

#lobby-bg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.lobby-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(22, 33, 62, 0.95);
  backdrop-filter: blur(10px);
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lobby-header h2 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--rock-color), var(--paper-color), var(--scissors-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 200px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 200px;
  justify-content: flex-end;
}

#user-display {
  color: var(--text-secondary);
  font-family: monospace;
}

.lobby-content {
  position: relative;
  z-index: 10;
  padding: 8px 0 0 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden; /* Prevent content from overflowing */
}

.lobby-content h3 {
  text-align: center;
  margin: 2px 0 6px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.lobby-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0 30px;
  flex: 1 1 0; /* Allow shrinking */
  max-width: 950px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  min-height: 0; /* Critical for flexbox children to shrink */
  overflow: hidden;
}

@media (max-width: 800px) {
  .lobby-list {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 8px;
    padding: 0 16px 16px 16px;
  }
}

.lobby-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 6px 10px;
  background: rgba(22, 33, 62, 0.9);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  text-align: center;
  min-height: 0;
  overflow: hidden;
}

.lobby-item:hover {
  border-color: var(--accent);
  background: rgba(22, 33, 62, 0.95);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(233, 69, 96, 0.2);
}

.lobby-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: 4px;
}

.lobby-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.lobby-status {
  font-size: 12px;
  color: var(--text-secondary);
}

.lobby-status.waiting {
  color: var(--warning);
  font-weight: 500;
}

.lobby-status.in-progress {
  color: var(--success);
  font-weight: 500;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.lobby-actions .btn-primary {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
  width: 100%;
}

.lobby-actions .btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.4);
}

.add-bots-btn {
  padding: 6px 10px;
  font-size: 11px;
  width: 100%;
}

.ping-display {
  position: fixed;
  bottom: 20px;
  right: 24px;
  font-size: 14px;
  color: var(--text-secondary);
  background: rgba(22, 33, 62, 0.9);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 50;
}

/* Waiting Screen */
.waiting-content {
  text-align: center;
  max-width: 400px;
}

.waiting-content h2 {
  font-size: 28px;
  margin-bottom: 32px;
}

.player-slots {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.player-slot {
  padding: 16px;
  background: var(--bg-card);
  border-radius: 8px;
  text-align: left;
}

.player-slot.you {
  border: 2px solid var(--accent);
}

.player-slot.empty {
  color: var(--text-secondary);
  font-style: italic;
}

.lobby-timer {
  margin-bottom: 24px;
  font-size: 18px;
}

.waiting-warning {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 24px;
}

/* Countdown Screen */
#countdown-canvas {
  width: 100%;
  height: 100%;
}

.countdown-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
}

.countdown-number {
  font-size: 120px;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(233, 69, 96, 0.5);
}

/* Role Tutorial */
.role-tutorial {
  display: flex;
  gap: 40px;
  margin-top: 30px;
  justify-content: center;
}

.tutorial-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 30px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
}

.tutorial-section.you-are {
  border: 3px solid var(--accent);
  background: rgba(233, 69, 96, 0.2);
}

.tutorial-section.attack {
  border: 3px solid var(--success);
}

.tutorial-section.avoid {
  border: 3px solid var(--warning);
}

.tutorial-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.tutorial-section.you-are .tutorial-label {
  color: var(--accent);
}

.tutorial-section.attack .tutorial-label {
  color: var(--success);
}

.tutorial-section.avoid .tutorial-label {
  color: var(--warning);
}

.tutorial-section canvas {
  border-radius: 50%;
  margin-bottom: 10px;
}

.role-name {
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
}

.role-name.rock {
  color: var(--rock-color);
}

.role-name.paper {
  color: var(--paper-color);
}

.role-name.scissors {
  color: var(--scissors-color);
}

/* Game Screen */
#game-canvas {
  width: 100%;
  height: 100%;
  background: #ffffff;
}

.game-ping {
  position: fixed;
  top: 16px;
  right: 16px;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.5);
  background: rgba(255, 255, 255, 0.8);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Get Ready Overlay (3-second preview phase) */
.get-ready-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 20;
  pointer-events: none;
}

.get-ready-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-countdown {
  font-size: 100px;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(233, 69, 96, 0.6), 0 4px 8px rgba(0, 0, 0, 0.3);
  line-height: 1;
}

.get-ready-text {
  font-size: 36px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 4px;
  margin-top: 10px;
}

/* Global Confetti Canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* Result Screen */
.result-content {
  text-align: center;
  background: var(--bg-card);
  padding: 48px;
  border-radius: 16px;
  min-width: 400px;
}

#result-title {
  font-size: 48px;
  margin-bottom: 16px;
}

#result-title.victory {
  color: var(--success);
}

#result-title.defeat {
  color: var(--accent);
}

.payout {
  font-size: 32px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 32px;
}

.payout.none {
  color: var(--text-secondary);
}

.standings {
  margin-bottom: 32px;
}

.standing-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.standing-item:last-child {
  border-bottom: none;
}

.standing-rank {
  font-weight: 700;
  width: 40px;
}

.standing-name {
  flex: 1;
  text-align: left;
}

.standing-role {
  width: 80px;
  text-align: right;
}

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

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--bg-card);
  padding: 32px;
  border-radius: 16px;
  max-width: 450px;
  text-align: center;
}

.modal-content h3 {
  margin-bottom: 16px;
}

.deposit-address {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-dark);
  padding: 12px;
  border-radius: 8px;
  margin: 16px 0;
}

.deposit-address code {
  flex: 1;
  font-size: 12px;
  word-break: break-all;
  text-align: left;
}

.warning {
  font-size: 12px;
  color: var(--warning);
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.payment-status {
  margin-top: 16px;
  color: var(--text-secondary);
}

/* Wallet Selection Modal */
.wallet-modal-content {
  min-width: 320px;
  max-width: 400px;
}

.wallet-modal-subtitle {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 14px;
}

.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  max-height: 300px;
  overflow-y: auto;
}

.wallet-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-dark);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.wallet-option:hover {
  background: rgba(233, 69, 96, 0.1);
  border-color: var(--accent);
}

.wallet-option img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.wallet-option-info {
  flex: 1;
}

.wallet-option-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.wallet-option-detected {
  font-size: 12px;
  color: var(--success);
  margin-top: 2px;
}

.no-wallets-message {
  padding: 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.no-wallets-message a {
  color: var(--accent);
  text-decoration: none;
}

.no-wallets-message a:hover {
  text-decoration: underline;
}

/* Role Colors */
.rock-color { color: var(--rock-color); }
.paper-color { color: var(--paper-color); }
.scissors-color { color: var(--scissors-color); }

/* Animations */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.countdown-number {
  animation: pulse 1s ease-in-out infinite;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-card);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
}

.nav-tab {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--text-secondary);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-tab:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.nav-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* Tab Content */
.tab-content {
  position: relative;
  z-index: 10;
  padding-top: 80px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.tab-content.hidden {
  display: none;
}

#lobbies-tab {
  display: flex;
  justify-content: center;
  align-items: stretch;
  max-width: none;
  height: calc(100vh - 45px); /* Subtract footer height */
  padding-top: 60px; /* Header height */
  box-sizing: border-box;
}

/* Profile Styles */
.profile-content {
  padding: 0 24px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--bg-card);
  border-radius: 16px;
}

.profile-photo-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.profile-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-dark);
  border: 3px solid var(--accent);
}

.profile-info {
  flex: 1;
}

.username-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.profile-username {
  font-size: 28px;
  font-weight: 700;
}

.profile-wallet {
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 14px;
}

.profile-notice {
  padding: 16px;
  background: var(--warning);
  color: var(--bg-dark);
  border-radius: 8px;
  text-align: center;
  margin-bottom: 24px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: var(--bg-card);
  border-radius: 12px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-top: 4px;
}

/* Match History */
.match-history h4 {
  margin-bottom: 16px;
  font-size: 18px;
}

.match-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.match-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: 8px;
  border-left: 4px solid var(--text-secondary);
}

.match-item.win {
  border-left-color: var(--success);
}

.match-item.loss {
  border-left-color: var(--accent);
}

.match-item.void {
  border-left-color: var(--warning);
}

.match-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.match-result {
  font-weight: 600;
  text-transform: uppercase;
}

.match-item.win .match-result {
  color: var(--success);
}

.match-item.loss .match-result {
  color: var(--accent);
}

.match-opponents {
  font-size: 12px;
  color: var(--text-secondary);
}

.match-meta {
  text-align: right;
}

.match-payout {
  font-weight: 600;
  color: var(--success);
}

.match-date {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Leaderboard Styles */
.leaderboard-content {
  padding: 0 24px;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.leaderboard-header h3 {
  margin: 0;
}

.leaderboard-filters {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 50px 1fr 80px 80px 100px;
  align-items: center;
  padding: 16px;
  background: var(--bg-card);
  border-radius: 8px;
  gap: 16px;
}

.leaderboard-item.header {
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  padding: 8px 16px;
}

.leaderboard-rank {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
  color: #ffd700;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
  color: #c0c0c0;
}

.leaderboard-item:nth-child(4) .leaderboard-rank {
  color: #cd7f32;
}

.leaderboard-player {
  display: flex;
  flex-direction: column;
}

.leaderboard-username {
  font-weight: 600;
}

.leaderboard-wallet {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: monospace;
}

.leaderboard-wins,
.leaderboard-winrate,
.leaderboard-earnings {
  text-align: center;
}

.leaderboard-earnings {
  color: var(--success);
  font-weight: 600;
}

/* Text Input */
.text-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  background: var(--bg-dark);
  border: 1px solid var(--text-secondary);
  border-radius: 8px;
  color: var(--text-primary);
  margin: 16px 0;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.error-text {
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 16px;
}

.error-text.hidden {
  display: none;
}

/* ==================== */
/* How to Play Styles   */
/* ==================== */

#how-to-play-tab {
  height: 100vh;
  overflow-y: auto;
  padding-bottom: 40px;
}

.how-to-play-content {
  padding: 0 24px 40px;
  max-width: 900px;
  margin: 0 auto;
}

.how-to-play-content h3 {
  text-align: center;
  font-size: 28px;
  margin-bottom: 32px;
  background: linear-gradient(135deg, var(--rock-color), var(--paper-color), var(--scissors-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.guide-section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}

.guide-section h4 {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-intro {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

.guide-list {
  list-style: none;
  padding: 0;
  margin-top: 16px;
}

.guide-list li {
  padding: 8px 0 8px 24px;
  position: relative;
  color: var(--text-secondary);
}

.guide-list li::before {
  content: "•";
  position: absolute;
  left: 8px;
  color: var(--accent);
}

/* Quick Start Steps */
.quick-start-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-step {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-dark);
  border-radius: 12px;
  border-left: 4px solid var(--accent);
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.step-text {
  color: var(--text-primary);
  font-size: 15px;
}

/* Controls Grid */
.controls-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  padding: 20px 0;
}

.control-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

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

.key-row {
  display: flex;
  gap: 4px;
}

.key {
  width: 44px;
  height: 44px;
  background: linear-gradient(180deg, #3a3a4a 0%, #2a2a3a 100%);
  border: 1px solid #4a4a5a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  box-shadow: 0 4px 0 #1a1a2a, 0 6px 10px rgba(0, 0, 0, 0.3);
}

.key.arrow-key {
  font-size: 20px;
}

.control-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.control-divider {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* RPS Rules */
.rps-rules {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.rps-rule {
  padding: 12px 16px;
  background: var(--bg-dark);
  border-radius: 10px;
}

.rps-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.role-badge {
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
}

.role-badge.rock {
  background: rgba(255, 165, 0, 0.2);
  color: var(--rock-color);
  border: 2px solid var(--rock-color);
}

.role-badge.paper {
  background: rgba(30, 144, 255, 0.2);
  color: var(--paper-color);
  border: 2px solid var(--paper-color);
}

.role-badge.scissors {
  background: rgba(46, 204, 113, 0.2);
  color: var(--scissors-color);
  border: 2px solid var(--scissors-color);
}

.beats-arrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}

/* Combat Tips */
.combat-tips {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-dark);
  border-radius: 8px;
}

.tip-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.tip-icon.attack {
  background: rgba(46, 204, 113, 0.2);
}

.tip-icon.avoid {
  background: rgba(243, 156, 18, 0.2);
}

.tip-icon.neutral {
  background: rgba(160, 160, 160, 0.2);
}

.tip span {
  color: var(--text-secondary);
  font-size: 14px;
}

.tip strong {
  color: var(--text-primary);
}

/* Showdown Section */
.showdown-section {
  border: 2px solid var(--accent);
  background: linear-gradient(135deg, rgba(233, 69, 96, 0.1) 0%, var(--bg-card) 100%);
  text-align: center;
}

.showdown-section h4 {
  justify-content: center;
}

.showdown-section .guide-intro {
  text-align: center;
}


.showdown-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.showdown-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 20px 0;
}

.showdown-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-dark);
  border-radius: 12px;
}

.showdown-icon {
  width: 48px;
  height: 48px;
  background: rgba(233, 69, 96, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.showdown-step div strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.showdown-step div p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

.showdown-note {
  padding: 12px 16px;
  background: rgba(243, 156, 18, 0.15);
  border: 1px solid var(--warning);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.showdown-note strong {
  color: var(--warning);
}

/* Win Conditions */
.win-conditions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.win-condition {
  padding: 20px;
  background: var(--bg-dark);
  border-radius: 12px;
  text-align: center;
}

.win-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.win-icon {
  font-size: 24px;
}

.win-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

.win-condition p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

/* Match Flow */
.match-flow {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
}

.flow-step {
  flex: 1;
  min-width: 140px;
  text-align: center;
}

.flow-number {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin: 0 auto 12px;
}

.flow-content strong {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 4px;
}

.flow-content p {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 0;
  line-height: 1.4;
}

.flow-arrow {
  color: var(--text-secondary);
  font-size: 20px;
  padding-top: 6px;
  flex-shrink: 0;
}

/* Economy Table */
.economy-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.economy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-dark);
  border-radius: 8px;
}

.economy-row.highlight {
  border: 2px solid var(--success);
  background: rgba(46, 204, 113, 0.1);
}

.economy-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.economy-value {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

.economy-value.success {
  color: var(--success);
}

.economy-note {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}

/* Tips Grid */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.strategy-tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg-dark);
  border-radius: 12px;
}

.strategy-icon {
  width: 40px;
  height: 40px;
  background: rgba(233, 69, 96, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.strategy-tip div strong {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 4px;
}

.strategy-tip div p {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0;
  line-height: 1.4;
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  padding: 16px;
  background: var(--bg-dark);
  border-radius: 12px;
}

.faq-question {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 15px;
}

.faq-answer {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

/* Responsive adjustments for How to Play */
@media (max-width: 768px) {
  .how-to-play-content {
    padding: 0 16px 40px;
  }

  .controls-grid {
    gap: 24px;
  }

  .key {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .win-conditions {
    grid-template-columns: 1fr;
  }

  .tips-grid {
    grid-template-columns: 1fr;
  }

  .match-flow {
    flex-direction: column;
    align-items: stretch;
  }

  .flow-arrow {
    transform: rotate(90deg);
    text-align: center;
    padding: 4px 0;
  }

  .flow-step {
    min-width: auto;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
  }

  .flow-number {
    margin: 0;
    flex-shrink: 0;
  }
}

/* ============================== */
/* How to Play Modal & Button     */
/* ============================== */

.how-to-play-landing-btn {
  margin-top: 12px;
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}

.how-to-play-landing-btn:hover:not(:disabled) {
  background: var(--accent);
  color: white;
}

.how-to-play-modal-content {
  position: relative;
  max-width: 900px;
  max-height: 90vh;
  width: 90%;
  padding: 0;
  overflow: hidden;
}

.how-to-play-modal-content h3 {
  text-align: center;
  font-size: 28px;
  padding: 24px 24px 0;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--rock-color), var(--paper-color), var(--scissors-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.how-to-play-modal-scroll {
  max-height: calc(90vh - 60px);
  overflow-y: auto;
  padding: 0 24px 24px;
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.modal-close-btn:hover {
  background: var(--accent);
  color: white;
}

/* Adjust guide sections in modal */
.how-to-play-modal-content .guide-section {
  margin-bottom: 16px;
}

.how-to-play-modal-content .guide-section:last-child {
  margin-bottom: 0;
}

/* Site Footer */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  z-index: 100;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-copyright {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: #fff;
}

/* ============================================
   Tutorial Styles
   ============================================ */

/* Tutorial Banner in Lobby */
.tutorial-banner {
  background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 10px;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.2);
  flex-shrink: 0;
}

.tutorial-banner-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.tutorial-banner-text {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tutorial-banner-icon {
  font-size: 28px;
}

.tutorial-banner-text div {
  text-align: left;
}

.tutorial-banner-text strong {
  font-size: 1rem;
  color: var(--text-primary);
  display: block;
  margin-bottom: 2px;
}

.tutorial-banner-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.tutorial-btn {
  white-space: nowrap;
  padding: 10px 20px;
  font-size: 14px;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.6);
  }
}

/* Tutorial Screen */
#tutorial-screen {
  background: var(--bg-dark);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#tutorial-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Tutorial Instruction Overlay */
.tutorial-instruction-overlay {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none;
}

.tutorial-instruction-box {
  background: rgba(0, 0, 0, 0.85);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 20px 30px;
  text-align: center;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}

.tutorial-instruction-box h3 {
  color: var(--accent);
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.tutorial-instruction-box p {
  color: var(--text-primary);
  font-size: 1.1rem;
  margin-bottom: 8px;
  line-height: 1.4;
}

.tutorial-subtext {
  color: var(--text-secondary) !important;
  font-size: 0.95rem !important;
  font-style: italic;
}

/* Tutorial Exit Button */
.tutorial-exit-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 20;
}

/* Tutorial Complete Overlay */
.tutorial-complete-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.tutorial-complete-box {
  background: var(--bg-card);
  border: 3px solid var(--success);
  border-radius: 16px;
  padding: 40px 50px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(46, 204, 113, 0.3);
  animation: scale-in 0.3s ease-out;
}

@keyframes scale-in {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.tutorial-complete-box h2 {
  color: var(--success);
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.tutorial-complete-box p {
  color: var(--text-primary);
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.tutorial-complete-subtext {
  color: var(--text-secondary) !important;
  font-size: 1rem !important;
  margin-bottom: 24px !important;
}

.tutorial-complete-box .btn {
  padding: 14px 32px;
  font-size: 1.1rem;
}

/* Tutorial Promo Box in How to Play Tab */
.tutorial-promo-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(233, 69, 96, 0.15) 0%, rgba(22, 33, 62, 0.9) 100%);
  border: 2px solid var(--accent);
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.2);
}

.tutorial-promo-content {
  flex: 1;
}

.tutorial-promo-content strong {
  font-size: 1.1rem;
  color: var(--accent);
  display: block;
  margin-bottom: 6px;
}

.tutorial-promo-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.4;
}

.tutorial-promo-box .btn {
  white-space: nowrap;
  padding: 12px 24px;
  animation: pulse-glow 2s infinite;
}

@media (max-width: 600px) {
  .tutorial-promo-box {
    flex-direction: column;
    text-align: center;
  }

  .tutorial-promo-box .btn {
    width: 100%;
  }
}
