:root {
  --gold: #FFD700;
  --gold-dark: #B8860B;
  --dark-bg: #1a1a2e;
  --darker-bg: #0f0f1a;
  --card-bg: #252542;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --accent-red: #ff4757;
  --accent-green: #2ed573;
  --accent-blue: #3742fa;
}

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

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  background: linear-gradient(135deg, var(--darker-bg) 0%, var(--dark-bg) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
}

/* 背景画像オーバーレイ */
.background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('garo_bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 1; /* 透過なし */
  z-index: -1;
  pointer-events: none;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
  position: relative;
  z-index: 1;
}

header {
  text-align: center;
  padding: 24px 0;
  border-bottom: 2px solid var(--gold);
  margin-bottom: 24px;
}

header h1 {
  font-size: 1.5rem;
  background: linear-gradient(90deg, var(--gold), #fff, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
  margin-bottom: 8px;
}

header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.card {
  background: rgba(37, 37, 66, 0.75); /* 透過度調整: 0.75 (0=完全透明, 1=不透明) */
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 215, 0, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.card-title {
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  background: var(--darker-bg);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--gold);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: var(--darker-bg);
  font-size: 1.2rem;
  padding: 18px;
  text-shadow: none;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

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

.btn-secondary {
  background: transparent;
  border: 1px solid var(--text-secondary);
  color: var(--text-secondary);
  margin-top: 12px;
}

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

.progress-container {
  display: none;
  margin: 20px 0;
}

.progress-bar {
  height: 8px;
  background: var(--darker-bg);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
  width: 0%;
  transition: width 0.1s;
}

.progress-text {
  text-align: center;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

#results {
  display: none;
}

.result-main {
  text-align: center;
  padding: 30px 20px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
  border: 2px solid var(--gold);
  border-radius: 16px;
  margin-bottom: 20px;
}

.result-label {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.result-period {
  font-size: 0.9rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.result-value {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 8px;
}

.result-value.positive {
  color: var(--accent-green);
}

.result-value.negative {
  color: var(--accent-red);
}

.result-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.result-sub span {
  color: var(--gold);
}

.result-sub-row {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 8px;
}

.result-sub-row .highlight {
  color: var(--gold);
  font-weight: bold;
}

.game-over-badge {
  display: inline-block;
  background: var(--accent-red);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.875rem;
  margin-top: 12px;
}

.sim-summary {
  margin-top: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.sim-summary-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 4px;
}

.sim-summary-row:last-child {
  margin-bottom: 0;
}

.sim-summary .count {
  color: var(--gold);
  font-weight: bold;
}

.sim-summary .game-over-count {
  color: var(--accent-red);
  font-weight: bold;
}

/* 分布リスト */
.distribution-list {
  margin-top: 16px;
}

.distribution-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  font-size: 0.9rem;
}

.distribution-item:last-child {
  margin-bottom: 0;
}

.distribution-label {
  flex: 1;
  color: var(--text-primary);
}

.distribution-item.game-over .distribution-label {
  color: var(--accent-red);
}

.distribution-count {
  color: var(--gold);
  font-weight: bold;
  min-width: 50px;
  text-align: right;
}

.distribution-percent {
  color: var(--text-secondary);
  min-width: 60px;
  text-align: right;
  margin-left: 8px;
}

.distribution-bar-container {
  flex: 1;
  max-width: 120px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  margin-left: 12px;
  overflow: hidden;
}

.distribution-bar {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.3s;
}

.distribution-item.game-over .distribution-bar {
  background: var(--accent-red);
}

.distribution-item.positive .distribution-bar {
  background: var(--accent-green);
}

.distribution-item.negative .distribution-bar {
  background: var(--accent-red);
}

.chart-container {
  position: relative;
  height: 300px;
  margin: 20px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 12px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

th {
  color: var(--gold);
  font-weight: normal;
  background: rgba(255, 215, 0, 0.05);
}

th:first-child, td:first-child {
  text-align: left;
}

tr:hover td {
  background: rgba(255, 215, 0, 0.05);
}

.positive-cell {
  color: var(--accent-green);
}

.negative-cell {
  color: var(--accent-red);
}

.game-over-row {
  background: rgba(255, 71, 87, 0.1);
}

.info-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

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

.stat-item {
  background: rgba(255, 215, 0, 0.05);
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--gold);
}

footer {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  border-top: 1px solid rgba(255, 215, 0, 0.1);
  margin-top: 24px;
}
