:root {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  font-weight: 400;

  color-scheme: light dark;
  color: #333;
  background: #f5f5f5;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  overflow-x: clip;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

#root {
  min-height: 100vh;
  width: 100%;
}

h1, h2, h3, h4 {
  margin-top: 0;
}

button {
  border-radius: 8px;
  border: 2px solid transparent;
  padding: 0.8em 1.5em;
  font-size: 1em;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (prefers-color-scheme: light) {
  :root {
    color: #333;
    background: #f5f5f5;
  }
}
.app {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  background: #667eea;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 100%;
  box-sizing: border-box;
}

.header h1 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  margin: 0;
  color: #ffffff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  margin: 0.5rem 0 0;
  color: rgba(255, 255, 255, 0.9);
}

.main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.game-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.instructions {
  text-align: center;
  margin-bottom: 2rem;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.instructions p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: #333;
  margin: 0.5rem 0;
}

.choice-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-switch {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
}

.btn-switch:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-stay {
  background: #f0f0f0;
  color: #333;
  border: 2px solid #667eea;
}

.btn-stay:hover:not(:disabled) {
  background: #667eea;
  color: white;
}

.btn-reset {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  margin-top: 1rem;
}

.btn-reset:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.result-win {
  color: #22c55e;
  font-size: 1.5rem;
  font-weight: bold;
}

.result-lose {
  color: #ef4444;
  font-size: 1.5rem;
  font-weight: bold;
}

.doors {
  display: flex;
  justify-content: center;
  gap: clamp(0.5rem, 3vw, 2rem);
  padding: 1rem 0;
}

.door-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.door-slot {
  position: relative;
  width: clamp(64px, 22vw, 180px);
  height: clamp(96px, 33vw, 270px);
  perspective: 1200px;
  transition: opacity 0.4s ease, filter 0.4s ease;
}

.door-slot.dimmed {
  opacity: 0.4;
  filter: grayscale(0.6);
}

.door-inside {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, #4a4a4a 0%, #1f1f1f 55%, #050505 100%);
  border-radius: 8px 8px 0 0;
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.95),
    inset 0 12px 24px rgba(0, 0, 0, 0.7),
    inset 0 -8px 18px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.door {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #8B4513 0%, #A0522D 50%, #8B4513 100%);
  border: 4px solid #5D3A1A;
  border-radius: 8px 8px 0 0;
  font-size: clamp(1.5rem, 5vw, 3rem);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.2);
  transform-origin: left center;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  backface-visibility: hidden;
}

/* Door panels for a more realistic look */
.door::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 10%;
  right: 10%;
  height: 35%;
  border: 3px solid #5D3A1A;
  border-radius: 4px;
  background: linear-gradient(180deg, #9A6B3A 0%, #8B4513 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.door::after {
  content: '';
  position: absolute;
  top: 55%;
  left: 10%;
  right: 10%;
  height: 35%;
  border: 3px solid #5D3A1A;
  border-radius: 4px;
  background: linear-gradient(180deg, #9A6B3A 0%, #8B4513 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.door:not(:disabled):hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.2);
  background: linear-gradient(180deg, #A0522D 0%, #B8733D 50%, #A0522D 100%);
}

.door:disabled {
  opacity: 1;
  cursor: default;
}

.door-star {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(3rem, 9vw, 5.5rem);
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.reset-row {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.door-star-below {
  font-size: clamp(3rem, 9vw, 5.5rem);
  margin-top: 0.75rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.door.final {
  border-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.3), 0 8px 16px rgba(0, 0, 0, 0.3);
}

.door-slot.open .door {
  transform: rotateY(-78deg);
  box-shadow: 12px 10px 24px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.9s cubic-bezier(0.55, 0.05, 0.25, 1), box-shadow 0.9s ease;
}

.door-slot.open .door:not(:disabled):hover {
  transform: rotateY(-78deg);
}

.door-number {
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.door-content {
  font-size: clamp(3rem, 8vw, 5rem);
  animation: reveal 0.6s ease-out 0.3s both;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

@keyframes reveal {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.info-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.explanation,
.stats {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  color: #333;
}

.explanation h2,
.stats h2 {
  color: #667eea;
  margin-top: 0;
}

.explanation h3 {
  color: #764ba2;
  margin-top: 1.5rem;
}

.explanation ol {
  padding-left: 1.5rem;
}

.explanation li {
  margin: 0.5rem 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.stat-item {
  text-align: center;
  padding: 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  color: white;
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

.stats-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.stat-detail {
  padding: 1rem;
  background: #f3f4f6;
  border-radius: 12px;
  text-align: center;
}

.stat-detail h4 {
  margin: 0 0 0.5rem 0;
  color: #667eea;
}

.stat-percentage {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
  margin: 0;
}

.footer {
  background: #667eea;
  text-align: center;
  padding: 1.5rem;
  color: rgba(255, 255, 255, 0.9);
  margin-top: auto;
  width: 100%;
  box-sizing: border-box;
}

.footer p {
  margin: 0;
  font-size: 0.9rem;
}

/* Responsive design */
@media (min-width: 768px) {
  .info-section {
    grid-template-columns: 1fr 1fr;
  }
  
  .stats {
    grid-column: span 1;
  }
  
  .explanation {
    grid-column: span 1;
  }
}

@media (min-width: 1024px) {
  .info-section {
    grid-template-columns: 2fr 1fr;
  }
}

@media (max-width: 767px) {
  .game-section {
    padding: 1.5rem 1rem;
  }
  
  .doors {
    gap: 0.5rem;
  }
  
  .choice-buttons {
    flex-direction: column;
    width: 100%;
  }
  
  .choice-buttons .btn {
    width: 100%;
  }
  
  .stats-comparison {
    grid-template-columns: 1fr;
  }
}
.simulation-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 2rem;
  margin-top: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  color: #333;
}

.simulation-section h2 {
  color: #667eea;
  margin-top: 0;
  text-align: center;
}

.simulation-intro {
  text-align: center;
  color: #666;
  margin-bottom: 1.5rem;
}

.simulation-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-simulate {
  font-size: 1.1rem;
  padding: 1rem 2rem;
}

.btn-switch-sim {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
}

.btn-switch-sim:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-stay-sim {
  background: #f0f0f0;
  color: #333;
  border: 2px solid #667eea;
}

.btn-stay-sim:hover {
  background: #667eea;
  color: white;
}

.simulation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.simulation-header h3 {
  margin: 0;
  color: #667eea;
}

.btn-stop {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
}

.btn-stop:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Mini doors visualization — reuses .door-slot / .door / .door-inside / .door-star
   from App.css, scaled down via .door-container-mini. */
.mini-doors {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(1rem, 3vw, 1.75rem);
  margin-bottom: 1.5rem;
  min-height: clamp(100px, 23vw, 140px);
}

.door-container-mini .door-slot {
  width: clamp(40px, 11vw, 64px);
  height: clamp(78px, 22vw, 122px);
  perspective: 700px;
}

.door-container-mini .door {
  border-width: 2px;
  padding: 0;
  font-size: 1rem;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.25);
}

.door-container-mini .door,
.door-container-mini .door-slot.open .door {
  transition: transform 0.25s cubic-bezier(0.55, 0.05, 0.25, 1), box-shadow 0.25s ease;
}

.door-container-mini .door-slot.open .door {
  box-shadow: 3px 2px 6px rgba(0, 0, 0, 0.4), inset 0 0 6px rgba(0, 0, 0, 0.2);
}

.mini-doors.instant .door,
.mini-doors.instant .door-slot.open .door {
  transition: none;
}

.mini-doors.instant .door-content {
  animation: none;
}

.door-container-mini .door-content {
  font-size: clamp(1.25rem, 4.5vw, 2.25rem);
  animation-duration: 0.25s;
  animation-delay: 0.08s;
}

.door-container-mini .door-star {
  font-size: clamp(1.25rem, 4.5vw, 2.25rem);
}

.door-container-mini .door-star-below {
  font-size: clamp(1.25rem, 4.5vw, 2.25rem);
  margin-top: 0.4rem;
}

/* Progress bar */
.simulation-progress {
  margin-bottom: 1rem;
}

.progress-bar {
  width: 100%;
  height: 20px;
  background: #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.1s ease;
}

.progress-text {
  display: block;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
}

/* Results list */
.results-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 100px;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  align-content: flex-start;
}

.result-emoji {
  font-size: 1.5rem;
  animation: popIn 0.2s ease-out;
}

@keyframes popIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Summary */
.simulation-summary {
  background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
  border-radius: 16px;
  padding: 1.5rem;
  animation: slideUp 0.5s ease-out;
}

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

.simulation-summary h3 {
  margin: 0 0 1rem 0;
  color: #667eea;
  text-align: center;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border-radius: 12px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.summary-stat.win {
  border-left: 4px solid #22c55e;
}

.summary-stat.lose {
  border-left: 4px solid #ef4444;
}

.summary-stat.percentage {
  border-left: 4px solid #667eea;
}

.summary-value {
  font-size: 2rem;
  font-weight: bold;
  color: #333;
}

.summary-label {
  font-size: 0.9rem;
  color: #666;
}

/* Expected comparison */
.expected-comparison {
  margin-top: 1rem;
}

.expected-comparison h4 {
  margin: 0 0 1rem 0;
  color: #764ba2;
  text-align: center;
}

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

.expected-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border-radius: 12px;
  background: white;
  border: 2px solid #e5e7eb;
  transition: all 0.3s ease;
}

.expected-stat.active {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.expected-strategy {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.expected-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
}

.comparison-note {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  margin: 0;
  padding: 1rem;
  background: white;
  border-radius: 8px;
}

/* Responsive */
@media (max-width: 600px) {
  .simulation-buttons {
    flex-direction: column;
  }
  
  .btn-simulate {
    width: 100%;
  }
  
  .summary-stats {
    grid-template-columns: 1fr;
  }

  .expected-stats {
    grid-template-columns: 1fr;
  }
}
