:root {
  --bg-top: #edf4ff;
  --bg-bottom: #f7f0d8;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --text: #14233d;
  --muted: #58657a;
  --line: #d5dfec;
  --line-strong: #b3c1d4;
  --primary: #0f6674;
  --primary-strong: #0a4952;
  --accent: #d9a528;
  --accent-soft: rgba(217, 165, 40, 0.16);
  --danger: #8e354a;
  --shadow-soft: 0 14px 36px rgba(20, 35, 61, 0.1);
  --shadow-card: 0 16px 28px rgba(20, 35, 61, 0.14);
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(900px 360px at -8% -12%, rgba(48, 107, 187, 0.18) 0%, rgba(48, 107, 187, 0) 72%),
    radial-gradient(800px 340px at 108% 0%, rgba(217, 165, 40, 0.16) 0%, rgba(217, 165, 40, 0) 66%),
    linear-gradient(160deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 16px 44px;
}

.hero,
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(250, 252, 255, 0.98) 100%);
  border: 1px solid rgba(179, 193, 212, 0.72);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.hero {
  padding: 22px 24px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 1.12rem + 1.4vw, 2.3rem);
}

.hero p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.panel {
  margin-top: 16px;
  padding: 20px;
}

.mode-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.92) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.stats-mode-panel {
  margin-top: 14px;
  max-width: none;
}

.mode-panel h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--primary-strong);
  white-space: nowrap;
}

.mode-controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
}

.strategy-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}

.strategy-option input {
  margin: 0;
}

.strategy-option:has(input:disabled) {
  opacity: 0.65;
}

.mode-actions {
  display: flex;
  justify-content: flex-end;
}

.mode-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.status-panel {
  text-align: center;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.phase-label {
  margin: 0;
  color: var(--primary-strong);
  font-weight: 800;
  font-size: 1rem;
  min-height: 1.5em;
}

.message {
  margin: 10px auto 0;
  max-width: 50rem;
  min-height: 3.6em;
  color: var(--muted);
  line-height: 1.7;
}

.door-stage {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.door-card {
  position: relative;
  height: 460px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 246, 252, 0.96) 100%);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.door-card.active {
  border-color: rgba(15, 102, 116, 0.42);
  box-shadow: 0 0 0 3px rgba(15, 102, 116, 0.12), var(--shadow-card);
}

.door-card.opened-by-host {
  background: linear-gradient(180deg, rgba(245, 240, 236, 0.98) 0%, rgba(236, 230, 224, 0.94) 100%);
}

.door-card.final-choice {
  border-color: rgba(217, 165, 40, 0.74);
  box-shadow: 0 0 0 4px rgba(217, 165, 40, 0.18), var(--shadow-card);
}

.door-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--primary-strong);
  font-weight: 800;
}

.door-button {
  position: relative;
  width: 100%;
  height: 320px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.door-button:hover {
  transform: none;
  filter: none;
}

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

.door-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.host-image {
  position: absolute;
  right: -12px;
  bottom: -8px;
  width: 48%;
  max-width: 168px;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(20, 35, 61, 0.22));
}

.door-caption {
  margin: 0;
  height: 3em;
  text-align: center;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 700;
}

.door-card.selected .door-caption,
.door-card.final-choice .door-caption {
  color: var(--primary-strong);
}

.door-card.result-win .door-caption {
  color: #0b6a2b;
}

.door-card.result-lose .door-caption {
  color: var(--danger);
}

.action-row {
  margin-top: 22px;
  display: flex;
  justify-content: center;
}

.stats-panel h2 {
  margin: 0 0 14px;
  font-size: 1.15rem;
  color: var(--primary-strong);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.stats-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 248, 253, 0.96) 100%);
}

.stats-card h3 {
  margin: 0 0 10px;
  color: var(--primary-strong);
  font-size: 1rem;
}

.stats-card p {
  margin: 6px 0;
  color: var(--text);
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(180deg, #edf2f8 0%, #dde7f1 100%);
  color: #183052;
  box-shadow: 0 10px 18px rgba(20, 35, 61, 0.14);
}

#simulate100Button {
  padding: 10px 14px;
  font-size: 0.95rem;
}

button.primary {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
}

.guide-content ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  line-height: 1.7;
}

summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--primary-strong);
}

@media (max-width: 720px) {
  .mode-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .mode-panel h2 {
    white-space: normal;
  }

  .mode-controls {
    flex-wrap: wrap;
  }

  .mode-actions {
    justify-content: stretch;
  }

  .mode-actions button {
    width: 100%;
  }

  .status-panel {
    min-height: 124px;
  }

  .message {
    min-height: 5.2em;
  }

  .door-card {
    height: 360px;
  }

  .door-button {
    height: 230px;
  }

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