/* Root Variables */
:root {
  --felt-green: #0d5c2d;
  --dark-felt: #0a4824;
  --gold: #d4af37;
  --dark-gold: #b8941f;
  --card-red: #dc143c;
  --card-black: #000000;
  --card-bg: #f8f8f8;
  --bg-primary: #1a3a2e;
  --bg-secondary: #16423c;
  --bg-tertiary: #0f2922;
  --bg-card: #2d5a47;
  --bg-darker: #0a1f1a;
  --text-primary: #ffffff;
  --text-secondary: #b0c4b1;
  --text-muted: #7a8c7b;
  --text-gold: var(--gold);
  --text-dark: #1a1a1a;
  --border-primary: #3d6b52;
  --border-secondary: #2d5a47;
  --border-gold: var(--gold);
  --success: #228b22;
  --danger: #dc143c;
  --warning: #ff8c00;
  --info: #4682b4;
  --btn-primary: var(--gold);
  --btn-primary-hover: var(--dark-gold);
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-medium: rgba(0, 0, 0, 0.2);
  --shadow-heavy: rgba(0, 0, 0, 0.4);
  --modal-overlay: rgba(0, 0, 0, 0.75);
}

/* Upside-down heart styling */
.upside-down-heart {
  display: inline-block;
  transform: rotate(180deg);
}

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

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.4;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Georgia', serif;
  font-weight: bold;
  margin-bottom: 0.5em;
}

/* Screen Management */
.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.5s ease-in;
}

.screen.active {
  display: block;
}

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

/* Screen Headers */
.screen-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border-primary);
  z-index: 100;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: flex-start;
}

.main-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-darker);
  border-bottom: 1px solid var(--border-primary);
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
}

.logo-small {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-gold);
}

.logo-icon {
  font-size: 2rem;
}

/* Header Wallet */
.header-wallet {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.wallet-info-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--btn-primary);
  color: var(--text-dark);
  border: 2px solid var(--dark-gold);
}

.btn-primary:hover {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: white;
  border: 2px solid var(--success);
}

.btn-success:hover {
  background: #1e7e1e;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-primary);
}

.btn-outline:hover {
  background: var(--border-primary);
  color: var(--text-primary);
  border-color: var(--border-gold);
}

.btn-wallet {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 2px solid var(--border-primary);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.btn-wallet:hover {
  border-color: var(--border-gold);
  background: var(--bg-secondary);
}

.btn-create {
  background: var(--success);
  color: white;
  border: 2px solid var(--success);
}

.btn-create:hover {
  background: #1e7e1e;
}

.btn-join {
  background: var(--info);
  color: white;
  border: 2px solid var(--info);
}

.btn-join:hover {
  background: #3a6fa5;
}

.btn-action {
  background: var(--warning);
  color: var(--text-dark);
  border: 2px solid var(--warning);
}

.btn-action:hover {
  background: #e6770a;
}

.btn-warning {
  background: var(--warning);
  color: var(--text-dark);
  border: 2px solid var(--warning);
}

.btn-warning:hover {
  background: #e6770a;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  min-width: auto;
}

.btn-full {
  width: 100%;
}

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

.btn-link {
  background: none;
  border: none;
  color: var(--warning);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
}

.btn-link:hover {
  color: var(--gold);
}

.room-code .btn-icon {
  margin-left: 0.5rem;
  padding: 0.25rem;
  font-size: 0.8rem;
  vertical-align: middle;
}

/* Form Elements */
.select-input,
input[type="text"],
input[type="number"],
textarea {
  padding: 0.75rem;
  background: var(--bg-card);
  border: 2px solid var(--border-secondary);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}

.select-input:focus,
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

input[type="text"] {
  text-transform: uppercase;
}

textarea {
  resize: vertical;
  min-height: 100px;
  font-family: monospace;
  font-size: 0.9rem;
}

/* Hero Section */
.hero-section {
  padding-top: 80px;
  padding-bottom: 0.5rem;
  height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: radial-gradient(ellipse at center, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  overflow: hidden;
}

.hero-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  text-align: center;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.hero-logo {
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.game-title {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-gold);
  text-shadow: 2px 2px 4px var(--shadow-heavy);
}

.title-card {
  font-size: 2rem;
  animation: bounce 2s infinite ease-in-out;
}

.title-card:first-child { animation-delay: 0.5s; }
.title-card:last-child { animation-delay: 1s; }

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

.game-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 0;
}

/* Welcome Main Content - Side by Side Layout */
.welcome-main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
}

.game-setup-section {
  display: flex;
  justify-content: center;
}

.game-rules-section {
  display: flex;
  justify-content: center;
}

/* Play Options */
.play-options {
  max-width: 500px;
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--border-primary);
  border-radius: 12px;
  padding: 1.5rem;
  height: fit-content;
}

.options-grid {
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: center;
  height: 100%;
}

.option-section {
  text-align: center;
}

.option-section h4 {
  color: var(--text-gold);
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.create-options,
.join-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: bold;
  position: relative;
  width: 100%;
}

.option-divider::before,
.option-divider::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 1px;
  background: var(--border-secondary);
}

.option-divider::before { top: -10px; }
.option-divider::after { bottom: -10px; }

/* Game Rules */
.game-rules {
  max-width: 500px;
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--border-secondary);
  border-radius: 12px;
  padding: 1.5rem;
  height: fit-content;
}

.rules-header {
  margin-bottom: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-secondary);
  padding-bottom: 0.5rem;
}

.rules-header h3 {
  color: var(--text-gold);
  font-size: 1.1rem;
  margin: 0;
}

.rules-content {
  display: block;
}

.rules-grid {
  display: grid;
  gap: 0.75rem;
}

.rule-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  text-align: left;
}

.rule-number {
  background: var(--gold);
  color: var(--text-dark);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.rule-text p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0;
  line-height: 1.3;
  text-align: left;
}

/* Lobby Screen */
.lobby-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  padding-top: 120px;
}

.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-primary);
}

.lobby-header h2 {
  color: var(--text-gold);
  font-size: 2rem;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.room-code {
  font-family: monospace;
  font-size: 1.25rem;
  color: var(--text-primary);
  background: var(--bg-card);
  padding: 0.5rem 1rem;
  border: 2px solid var(--border-gold);
  border-radius: 6px;
}

.lobby-content {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  align-items: start;
}

.lobby-sidebar {
  background: var(--bg-card);
  border: 2px solid var(--border-secondary);
  border-radius: 12px;
  padding: 1.5rem;
}

.players-section h3 {
  color: var(--text-gold);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-secondary);
  padding-bottom: 0.5rem;
}

.players-list {
  list-style: none;
  margin-bottom: 1rem;
}

.players-list li {
  padding: 0.75rem;
  background: var(--bg-secondary);
  margin-bottom: 0.5rem;
  border-radius: 6px;
  border-left: 3px solid var(--gold);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-ready {
  color: var(--success);
  font-size: 0.8rem;
  font-weight: bold;
}

.waiting-message {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  margin-bottom: 1.5rem;
}

.game-settings {
  border-top: 1px solid var(--border-secondary);
  padding-top: 1rem;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.setting-label {
  color: var(--text-secondary);
}

.setting-value {
  color: var(--text-gold);
  font-weight: bold;
}

.lobby-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.entry-fee-status {
  background: var(--bg-card);
  border: 2px solid var(--border-secondary);
  border-radius: 12px;
  padding: 2rem;
}

.fee-card {
  text-align: center;
}

.fee-card h4 {
  color: var(--text-gold);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.fee-amount {
  font-size: 2rem;
  color: var(--text-primary);
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.payment-status {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.payment-info {
  margin-bottom: 1.5rem;
}

.wallet-balance-info {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.insufficient-funds {
  color: var(--danger);
  font-size: 0.9rem;
  background: rgba(220, 20, 60, 0.1);
  border: 1px solid var(--danger);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 0.5rem;
}

.insufficient-text {
  margin-bottom: 1rem;
  font-weight: 600;
}

.deposit-address-section {
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 0.75rem;
  border: 1px solid var(--border-secondary);
}

.deposit-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.address-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.deposit-address {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-primary);
  background: var(--bg-card);
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-secondary);
  flex: 1;
  word-break: break-all;
  line-height: 1.2;
}

.lobby-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Game Over Screen */
.gameover-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  padding-top: 120px;
}

.gameover-content {
  background: var(--bg-card);
  border: 3px solid var(--border-gold);
  border-radius: 16px;
  padding: 3rem;
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.gameover-title {
  color: var(--text-gold);
  font-size: 3rem;
  margin-bottom: 2rem;
  text-shadow: 2px 2px 4px var(--shadow-heavy);
}

.results-section {
  margin-bottom: 2rem;
}

.final-rankings h2 {
  color: var(--text-gold);
  margin-bottom: 1rem;
}

.final-list {
  list-style: none;
  text-align: left;
  max-width: 400px;
  margin: 0 auto 2rem;
}

.final-list li {
  padding: 0.75rem;
  background: var(--bg-secondary);
  margin-bottom: 0.5rem;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.final-list li:first-child {
  border-left: 4px solid var(--gold);
  background: rgba(212, 175, 55, 0.1);
}

.rank-prize {
  color: var(--success);
  font-weight: bold;
}

.ass-reveal {
  margin: 2rem 0;
}

.ass-card {
  background: var(--bg-darker);
  border: 3px solid var(--danger);
  border-radius: 12px;
  padding: 2rem;
  animation: shake 0.5s infinite;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.ass-title {
  color: var(--danger);
  font-size: 2rem;
  margin-bottom: 1rem;
}

.ass-player {
  color: var(--text-primary);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.ass-penalty {
  color: var(--danger);
  font-weight: bold;
}

.prize-section h3 {
  color: var(--text-gold);
  margin-bottom: 1rem;
}

.prize-list {
  list-style: none;
  text-align: left;
  max-width: 300px;
  margin: 0 auto 2rem;
}

.prize-list li {
  padding: 0.5rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-secondary);
}

.gameover-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Utility Classes */
.hidden { 
  display: none !important; 
}

/* Responsive Design */
@media (max-width: 1024px) {
  .welcome-main-content {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .game-setup-section {
    order: 1;
  }
  
  .game-rules-section {
    order: 2;
  }
  
  .hero-section {
    padding-top: 50px;
  }
  
  .game-title {
    font-size: 2rem;
  }
  
  .title-card {
    font-size: 1.5rem;
  }
  
  .header-content {
    padding: 0.4rem 1.5rem;
  }
}

@media (max-width: 968px) {
  .options-grid {
    grid-template-rows: 1fr auto 1fr;
    gap: 1rem;
  }
  
  .option-divider { 
    display: flex; 
  }
  
  .lobby-content {
    grid-template-columns: 1fr;
  }
  
  .lobby-sidebar { 
    order: 2; 
  }
}

@media (max-width: 768px) {
  .header-content {
    padding: 0.4rem 1rem;
  }
  
  .screen-header {
    padding: 0.4rem 1rem;
  }
  
  .game-title {
    font-size: 1.8rem;
    flex-direction: row;
    gap: 0.3rem;
  }
  
  .title-card {
    font-size: 1.3rem;
  }
  
  .hero-content {
    padding: 0.5rem;
  }
  
  .hero-section {
    padding-top: 45px;
  }
  
  .hero-logo {
    margin-bottom: 1rem;
  }
  
  .welcome-main-content {
    gap: 0.75rem;
  }
  
  .play-options,
  .game-rules {
    padding: 1rem;
  }
  
  .rules-grid {
    gap: 0.5rem;
  }
  
  .rule-item {
    gap: 0.5rem;
  }
  
  .rule-number {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.7rem;
  }
  
  .rule-text p {
    font-size: 0.9rem;
  }
  
  .gameover-content {
    padding: 2rem 1rem;
  }
  
  .gameover-title {
    font-size: 2rem;
  }
  
  .gameover-actions {
    flex-direction: column;
  }
}