:root {
  --color-gold: #FFD700;
  --color-pink: #FF69B4;
  --color-lightblue: #87CEEB;
  --color-lightgreen: #90EE90;
  --color-gray: #9E9E9E;
  --bg-gradient-start: #667eea;
  --bg-gradient-end: #764ba2;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
  text-align: center;
}

/* 画面表示制御 */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* タイトル */
.title {
  color: #fff;
  font-size: 2rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  margin-bottom: 10px;
}

.description {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  margin-bottom: 30px;
}

/* ルーレットコンテナ */
.roulette-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
}

/* 矢印 */
.arrow {
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 30px solid var(--color-gold);
  position: relative;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  margin-bottom: -5px;
}

/* ルーレットラッパー */
.roulette-wrapper {
  position: relative;
  width: 280px;
  height: 280px;
}

/* ルーレット本体 */
.roulette {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  position: relative;
  border: 6px solid #333;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: transform 5s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.roulette.spinning {
  transition: transform 5s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

/* ルーレット背景 - conic-gradientで8分割 */
.roulette-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(
    from -22.5deg,
    var(--color-gold) 0deg 45deg,
    var(--color-pink) 45deg 90deg,
    var(--color-pink) 90deg 135deg,
    var(--color-lightblue) 135deg 180deg,
    var(--color-lightblue) 180deg 225deg,
    var(--color-lightblue) 225deg 270deg,
    var(--color-gray) 270deg 315deg,
    var(--color-gray) 315deg 360deg
  );
}

/* セクションテキスト - 中心から配置 */
.section-text {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60px;
  margin-left: -30px;
  margin-top: -8px;
  text-align: center;
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  transform-origin: center center;
  pointer-events: none;
  line-height: 1;
}

/* 各セクションのテキスト位置
   conic-gradient from -22.5deg なので:
   - セクション0: -22.5deg〜22.5deg → 中央 0deg
   - セクション1: 22.5deg〜67.5deg → 中央 45deg
   - ...
   中心から65%の位置（91px = 140px * 0.65）に配置 */

/* セクション0: 中央 0deg（上） */
.section-text[data-index="0"] {
  transform: translateY(-91px);
}

/* セクション1: 中央 45deg */
.section-text[data-index="1"] {
  transform: rotate(45deg) translateY(-91px) rotate(-45deg);
}

/* セクション2: 中央 90deg */
.section-text[data-index="2"] {
  transform: rotate(90deg) translateY(-91px) rotate(-90deg);
}

/* セクション3: 中央 135deg */
.section-text[data-index="3"] {
  transform: rotate(135deg) translateY(-91px) rotate(-135deg);
}

/* セクション4: 中央 180deg */
.section-text[data-index="4"] {
  transform: rotate(180deg) translateY(-91px) rotate(-180deg);
}

/* セクション5: 中央 225deg */
.section-text[data-index="5"] {
  transform: rotate(225deg) translateY(-91px) rotate(-225deg);
}

/* セクション6: 中央 270deg */
.section-text[data-index="6"] {
  transform: rotate(270deg) translateY(-91px) rotate(-270deg);
}

/* セクション7: 中央 315deg */
.section-text[data-index="7"] {
  transform: rotate(315deg) translateY(-91px) rotate(-315deg);
}

/* 中央の円 */
.center-circle {
  position: absolute;
  width: 50px;
  height: 50px;
  background: #fff;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 5;
  border: 3px solid #333;
}

/* 回すボタン */
.spin-button {
  background: linear-gradient(145deg, #ff6b6b, #ee5a24);
  color: #fff;
  border: none;
  padding: 18px 60px;
  font-size: 1.4rem;
  font-weight: bold;
  border-radius: 50px;
  cursor: pointer;
  box-shadow:
    0 6px 20px rgba(238, 90, 36, 0.4),
    0 3px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.spin-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 8px 25px rgba(238, 90, 36, 0.5),
    0 5px 15px rgba(0, 0, 0, 0.3);
}

.spin-button:active:not(:disabled) {
  transform: translateY(0);
}

.spin-button:disabled {
  background: linear-gradient(145deg, #999, #777);
  cursor: not-allowed;
  box-shadow: none;
}

/* プライバシーポリシーリンク */
.privacy-link {
  display: block;
  margin-top: 25px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  text-decoration: underline;
}

/* デモ表示 */
.demo-notice {
  display: block;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.7rem;
}

/* 結果画面 */
.result-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

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

.result-title.jackpot {
  color: #FFD700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.result-title.win {
  color: #FF69B4;
}

.result-title.small {
  color: #5dade2;
}

.result-title.lose {
  color: #9E9E9E;
}

.result-note {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 25px;
}

.close-button {
  background: linear-gradient(145deg, #00b900, #009900);
  color: #fff;
  border: none;
  padding: 15px 50px;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 185, 0, 0.4);
  transition: all 0.3s ease;
}

.close-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 185, 0, 0.5);
}

/* プレイ済み画面 */
.played-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.played-emoji {
  font-size: 4rem;
  margin-bottom: 15px;
}

.played-title {
  color: #333;
  font-size: 1.4rem;
  margin-bottom: 15px;
}

.played-message {
  color: #666;
  font-size: 1rem;
  margin-bottom: 30px;
}

/* ローディング画面 */
.loading-content {
  color: #fff;
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* モーダル */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #fff;
  border-radius: 15px;
  padding: 25px;
  max-width: 350px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content h2 {
  color: #333;
  font-size: 1.2rem;
  margin-bottom: 20px;
  text-align: center;
}

.modal-body {
  text-align: left;
  color: #555;
  font-size: 0.9rem;
  line-height: 1.6;
}

.modal-body h3 {
  font-size: 1rem;
  color: #333;
  margin: 15px 0 10px;
}

.modal-body ul {
  margin-left: 20px;
  margin-bottom: 10px;
}

.modal-body li {
  margin-bottom: 5px;
}

.modal-close-button {
  background: #667eea;
  color: #fff;
  border: none;
  padding: 12px 40px;
  font-size: 1rem;
  border-radius: 25px;
  cursor: pointer;
  margin-top: 20px;
  width: 100%;
  transition: background 0.3s ease;
}

.modal-close-button:hover {
  background: #5a6fd6;
}
