/* Material Design 3 CSS Custom Properties */
:root {
  /* Light Theme Colors */
  --md-sys-color-primary: #6750a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eaddff;
  --md-sys-color-on-primary-container: #21005d;
  
  --md-sys-color-secondary: #625b71;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #e8def8;
  --md-sys-color-on-secondary-container: #1d192b;
  
  --md-sys-color-tertiary: #7d5260;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #ffd8e4;
  --md-sys-color-on-tertiary-container: #31111d;
  
  --md-sys-color-surface: #fffbfe;
  --md-sys-color-on-surface: #1c1b1f;
  --md-sys-color-surface-variant: #e7e0ec;
  --md-sys-color-on-surface-variant: #49454f;
  
  --md-sys-color-background: #fffbfe;
  --md-sys-color-on-background: #1c1b1f;
  
  --md-sys-color-outline: #79747e;
  --md-sys-color-outline-variant: #cac4d0;
  
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-on-error-container: #410002;
  
  /* Shadow */
  --md-sys-elevation-shadow: rgba(0, 0, 0, 0.2);
  
  /* Typography */
  --md-sys-typescale-display-large-font: 'Roboto';
  --md-sys-typescale-display-large-size: 57px;
  --md-sys-typescale-display-large-weight: 400;
  --md-sys-typescale-display-large-line-height: 64px;
  
  --md-sys-typescale-headline-large-font: 'Roboto';
  --md-sys-typescale-headline-large-size: 32px;
  --md-sys-typescale-headline-large-weight: 400;
  --md-sys-typescale-headline-large-line-height: 40px;
  
  --md-sys-typescale-title-large-font: 'Roboto';
  --md-sys-typescale-title-large-size: 22px;
  --md-sys-typescale-title-large-weight: 400;
  --md-sys-typescale-title-large-line-height: 28px;
  
  --md-sys-typescale-body-large-font: 'Roboto';
  --md-sys-typescale-body-large-size: 16px;
  --md-sys-typescale-body-large-weight: 400;
  --md-sys-typescale-body-large-line-height: 24px;
  
  --md-sys-typescale-label-large-font: 'Roboto';
  --md-sys-typescale-label-large-size: 14px;
  --md-sys-typescale-label-large-weight: 500;
  --md-sys-typescale-label-large-line-height: 20px;
}

/* Dark Theme Colors */
[data-theme="dark"] {
  --md-sys-color-primary: #d0bcff;
  --md-sys-color-on-primary: #371e73;
  --md-sys-color-primary-container: #4f378b;
  --md-sys-color-on-primary-container: #eaddff;
  
  --md-sys-color-secondary: #ccc2dc;
  --md-sys-color-on-secondary: #332d41;
  --md-sys-color-secondary-container: #4a4458;
  --md-sys-color-on-secondary-container: #e8def8;
  
  --md-sys-color-tertiary: #efb8c8;
  --md-sys-color-on-tertiary: #492532;
  --md-sys-color-tertiary-container: #633b48;
  --md-sys-color-on-tertiary-container: #ffd8e4;
  
  --md-sys-color-surface: #10090d;
  --md-sys-color-on-surface: #e6e1e5;
  --md-sys-color-surface-variant: #49454f;
  --md-sys-color-on-surface-variant: #cac4d0;
  
  --md-sys-color-background: #10090d;
  --md-sys-color-on-background: #e6e1e5;
  
  --md-sys-color-outline: #938f99;
  --md-sys-color-outline-variant: #49454f;
  
  --md-sys-color-error: #ffb4ab;
  --md-sys-color-on-error: #690005;
  --md-sys-color-error-container: #93000a;
  --md-sys-color-on-error-container: #ffdad6;
}

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

body {
  font-family: var(--md-sys-typescale-body-large-font);
  font-size: var(--md-sys-typescale-body-large-size);
  font-weight: var(--md-sys-typescale-body-large-weight);
  line-height: var(--md-sys-typescale-body-large-line-height);
  color: var(--md-sys-color-on-background);
  background-color: var(--md-sys-color-background);
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
}

.header-controls {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 12px;
  align-items: center;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 24px;
  background-color: var(--md-sys-color-surface-variant);
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 24px;
}

.icon-button:hover {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  transform: scale(1.05);
}

.install-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: 20px;
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-family: var(--md-sys-typescale-label-large-font);
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: var(--md-sys-typescale-label-large-weight);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px var(--md-sys-elevation-shadow);
}

.install-button:hover {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--md-sys-elevation-shadow);
}

header h1 {
  font-family: var(--md-sys-typescale-headline-large-font);
  font-size: var(--md-sys-typescale-headline-large-size);
  font-weight: var(--md-sys-typescale-headline-large-weight);
  line-height: var(--md-sys-typescale-headline-large-line-height);
  color: var(--md-sys-color-primary);
  margin: 24px 0 8px 0;
}

header p {
  font-size: var(--md-sys-typescale-title-large-size);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 24px;
}

.mode-toggle {
  display: flex;
  gap: 8px;
  justify-content: center;
  background-color: var(--md-sys-color-surface-variant);
  border-radius: 28px;
  padding: 4px;
  margin: 0 auto;
  width: fit-content;
}

.mode-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 24px;
  background-color: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--md-sys-typescale-label-large-font);
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: var(--md-sys-typescale-label-large-weight);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-button.active {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: 0 1px 3px var(--md-sys-elevation-shadow);
}

.mode-button:hover:not(.active) {
  background-color: var(--md-sys-color-outline-variant);
}

/* Game Area */
.game-area {
  background-color: var(--md-sys-color-surface);
  border-radius: 28px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px var(--md-sys-elevation-shadow);
  border: 1px solid var(--md-sys-color-outline-variant);
  transition: all 0.3s ease;
}

.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* Situation Display */
.situation-display {
  margin-bottom: 32px;
}

.situation-display h2 {
  font-family: var(--md-sys-typescale-title-large-font);
  font-size: var(--md-sys-typescale-title-large-size);
  font-weight: var(--md-sys-typescale-title-large-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 16px;
}

.board-state {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  justify-content: center;
}

.stage, .pot-size, .bet-size {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 500;
  font-size: 14px;
  border: none;
}

.stage {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

/* Cards Display */
.cards-display {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-cards h3, .community-cards h3 {
  font-family: var(--md-sys-typescale-title-large-font);
  font-size: 18px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 12px;
  text-align: center;
}

.cards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.card {
  background-color: var(--md-sys-color-surface);
  border: 2px solid var(--md-sys-color-outline);
  border-radius: 12px;
  padding: 16px 12px;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  min-width: 64px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px var(--md-sys-elevation-shadow);
  transition: all 0.2s ease;
  color: var(--md-sys-color-on-surface);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--md-sys-elevation-shadow);
}

.card.hidden {
  background-color: var(--md-sys-color-outline);
  color: var(--md-sys-color-surface);
  border-color: var(--md-sys-color-outline);
}

/* Input Section */
.input-section h2 {
  font-family: var(--md-sys-typescale-title-large-font);
  font-size: var(--md-sys-typescale-title-large-size);
  font-weight: var(--md-sys-typescale-title-large-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 20px;
}

.slider-group {
  margin-bottom: 20px;
  padding: 16px;
  background-color: var(--md-sys-color-surface-variant);
  border-radius: 16px;
  transition: all 0.2s ease;
}

.slider-group:hover {
  background-color: var(--md-sys-color-secondary-container);
}

.slider-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-label-large-size);
}

.slider-group input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--md-sys-color-outline-variant);
  outline: none;
  -webkit-appearance: none;
  margin: 8px 0;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  cursor: pointer;
  border: 2px solid var(--md-sys-color-surface);
  box-shadow: 0 2px 4px var(--md-sys-elevation-shadow);
}

.slider-group input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  cursor: pointer;
  border: 2px solid var(--md-sys-color-surface);
  box-shadow: 0 2px 4px var(--md-sys-elevation-shadow);
}

.value {
  float: right;
  font-weight: 600;
  color: var(--md-sys-color-primary);
  font-size: 16px;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.primary-button, .secondary-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border: none;
  border-radius: 20px;
  font-family: var(--md-sys-typescale-label-large-font);
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: var(--md-sys-typescale-label-large-weight);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
  justify-content: center;
}

.primary-button {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: 0 2px 4px var(--md-sys-elevation-shadow);
}

.primary-button:hover {
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--md-sys-elevation-shadow);
}

.secondary-button {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border: 1px solid var(--md-sys-color-outline);
}

.secondary-button:hover {
  background-color: var(--md-sys-color-secondary);
  color: var(--md-sys-color-on-secondary);
  transform: translateY(-1px);
}

/* Calculator Section */
.calculator-input h2 {
  font-family: var(--md-sys-typescale-title-large-font);
  font-size: var(--md-sys-typescale-title-large-size);
  font-weight: var(--md-sys-typescale-title-large-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

.subtitle {
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 24px;
  font-size: var(--md-sys-typescale-body-large-size);
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.input-group label {
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  font-size: var(--md-sys-typescale-label-large-size);
}

.input-group select,
.input-group input[type="number"] {
  padding: 12px 16px;
  border: 2px solid var(--md-sys-color-outline);
  border-radius: 12px;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-size: 16px;
  transition: all 0.2s ease;
}

.input-group select:focus,
.input-group input[type="number"]:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-primary-container);
}

.card-input {
  margin-bottom: 24px;
  padding: 16px;
  background-color: var(--md-sys-color-surface-variant);
  border-radius: 16px;
}

.card-input h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 12px;
}

.card-selector, .board-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.board-card {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.board-card select {
  width: 60px;
  padding: 8px 4px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 8px;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-size: 14px;
}

.turn-river {
  display: none;
}

.calculator-results {
  margin-top: 24px;
  padding: 16px;
  background-color: var(--md-sys-color-primary-container);
  border-radius: 16px;
}

.calculator-results h3 {
  color: var(--md-sys-color-on-primary-container);
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 500;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background-color: var(--md-sys-color-surface);
  border-radius: 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
}

.result-label {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 14px;
  font-weight: 500;
}

.result-value {
  color: var(--md-sys-color-primary);
  font-size: 16px;
  font-weight: 600;
}

/* Results Section */
.results-section {
  background-color: var(--md-sys-color-surface);
  border-radius: 28px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px var(--md-sys-elevation-shadow);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.results-section h2 {
  font-family: var(--md-sys-typescale-title-large-font);
  font-size: var(--md-sys-typescale-title-large-size);
  font-weight: var(--md-sys-typescale-title-large-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 16px;
}

/* Stats Section */
.stats-section {
  background-color: var(--md-sys-color-surface);
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 1px 3px var(--md-sys-elevation-shadow);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.stats-section h2 {
  font-family: var(--md-sys-typescale-title-large-font);
  font-size: var(--md-sys-typescale-title-large-size);
  font-weight: var(--md-sys-typescale-title-large-weight);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 20px;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-item {
  background-color: var(--md-sys-color-secondary-container);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--md-sys-elevation-shadow);
}

.stat-label {
  display: block;
  color: var(--md-sys-color-on-secondary-container);
  font-size: var(--md-sys-typescale-label-large-size);
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-value {
  display: block;
  color: var(--md-sys-color-on-secondary-container);
  font-size: 24px;
  font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }
  
  .header-controls {
    position: static;
    justify-content: center;
    margin-bottom: 16px;
  }
  
  .mode-toggle {
    flex-direction: column;
    width: 100%;
  }
  
  .button-group {
    flex-direction: column;
    align-items: stretch;
  }
  
  .primary-button, .secondary-button {
    width: 100%;
  }
  
  header h1 {
    font-size: 28px;
  }
  
  .cards {
    justify-content: center;
  }
  
  .card {
    min-width: 56px;
    min-height: 72px;
    font-size: 18px;
    padding: 12px 8px;
  }
  
  .input-grid {
    grid-template-columns: 1fr;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .board-state {
    flex-direction: column;
    align-items: center;
  }
  
  .card-selector, .board-selector {
    justify-content: center;
  }
}

/* Loading and Transition States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

.slide-up {
  animation: slideUp 0.3s ease;
}

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