/* =============================================
   ВРАЩЕНИЕ СУДЬБЫ — ソ連国家ルーレット CSS
   独立デザイン例外ページ（design-policy.md §7）
   glass系トークン不使用
   ============================================= */

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

:root {
  --soviet-red:    #FF5E00; /* Splatoon Orange */
  --soviet-red-dk: #CC4A00;
  --soviet-red-lt: #FF8533;
  --soviet-gold:   #00D0B5; /* Splatoon Teal */
  --soviet-gold-dk:#00A18C;
  --soviet-cream:  #F8F8F8;
  --soviet-bg:     #1A1A24; /* Deep matte background */
  --soviet-bg2:    #242436;
  --ease-spin:     cubic-bezier(0.22, 1, 0.36, 1);
}

html, body {
  height: 100%;
}

body {
  background: var(--soviet-bg);
  color: var(--soviet-cream);
  font-family: 'Zen Kaku Gothic New', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* =============================================
   背景装飾
   ============================================= */
.bg-stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--soviet-bg);
  /* ドットパターンのマットな背景装飾 */
  background-image: radial-gradient(var(--soviet-bg2) 2px, transparent 2px);
  background-size: 24px 24px;
  pointer-events: none;
}

.bg-hammer-sickle {
  position: fixed;
  bottom: -5%;
  right: -3%;
  font-size: clamp(200px, 35vw, 480px);
  opacity: 0.04;
  color: var(--soviet-gold);
  line-height: 1;
  pointer-events: none;
  z-index: 0;
  user-select: none;
  animation: bg-rotate 60s linear infinite;
}

@keyframes bg-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-hammer-sickle { animation: none; }
}

/* =============================================
   メインコンテナ
   ============================================= */
.main-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem 4rem;
  min-height: 100vh;
}

/* =============================================
   ページヘッダー
   ============================================= */
.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
  animation: fade-down 0.7s var(--ease-spin) both;
}

.page-eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: var(--soviet-gold);
  border: 1px solid rgba(255, 215, 0, 0.5);
  padding: 0.3em 1.1em;
  border-radius: 2px;
  margin-bottom: 1.1rem;
  opacity: 0.85;
}

.page-title {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--soviet-gold);
  /* ネオンを消してソリッドなドロップシャドウに */
  text-shadow: 4px 4px 0 var(--soviet-bg2);
  margin-bottom: 1rem;
}

.page-desc {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  color: rgba(245, 240, 232, 0.6);
  letter-spacing: 0.05em;
}

/* =============================================
   ルーレットエリア
   ============================================= */
.roulette-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  animation: fade-up 0.8s var(--ease-spin) 0.15s both;
}

.roulette-wrapper {
  position: relative;
  width: clamp(280px, 80vw, 480px);
  height: clamp(280px, 80vw, 480px);
}

/* 外枠リング */
.roulette-wrapper::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 8px solid var(--soviet-bg2);
  /* 発光を消してマットに */
  box-shadow: none;
  pointer-events: none;
  z-index: 2;
}



/* ポインター（上部固定の三角） */
.roulette-pointer {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.5rem;
  color: var(--soviet-gold);
  z-index: 10;
  text-shadow: none;
  line-height: 1;
  filter: drop-shadow(0 4px 0 var(--soviet-bg2));
}

#roulette-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  cursor: pointer;
}

/* =============================================
   スピンボタン
   ============================================= */
.spin-btn {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 1rem 3rem;
  font-family: 'Bebas Neue', 'Zen Kaku Gothic New', sans-serif;
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--soviet-bg);
  background: var(--soviet-gold);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 0 var(--soviet-gold-dk);
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease,
    background 0.2s ease;
  animation: fade-up 0.9s var(--ease-spin) 0.3s both;
}

.spin-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}

.spin-btn:hover::after {
  transform: translateX(100%);
}

.spin-btn:hover {
  transform: translateY(2px);
  box-shadow: 0 4px 0 var(--soviet-gold-dk);
  background: var(--soviet-red);
  color: #fff;
}

.spin-btn:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--soviet-gold-dk);
}

.spin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.spin-btn-icon {
  font-size: 1.2em;
  display: inline-block;
  animation: btn-rotate 4s linear infinite;
}

@keyframes btn-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spin-btn-icon { animation: none; }
}

/* =============================================
   当選オーバーレイ
   ============================================= */
.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 36, 0.95);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  /* transition なし: flash演出のあと瞬時に出す */
}

.result-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.result-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 3rem 2.5rem;
  background: var(--soviet-bg2);
  border: 4px solid var(--soviet-red);
  border-radius: 12px;
  box-shadow: 12px 12px 0 rgba(0,0,0,0.5);
  max-width: min(600px, 90vw);
  /* パンチのあるスプリング登場 */
  animation: result-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes result-appear {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

.result-star-top,
.result-star-bot {
  font-size: 1.8rem;
  color: var(--soviet-gold);
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
  animation: star-blink 1.2s ease-in-out infinite alternate;
}

@keyframes star-blink {
  from { opacity: 0.6; text-shadow: 0 0 12px rgba(255, 215, 0, 0.5); }
  to   { opacity: 1;   text-shadow: 0 0 25px rgba(255, 215, 0, 1); }
}

.result-label {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  color: rgba(245, 240, 232, 0.7);
  letter-spacing: 0.15em;
  margin: 0.6rem 0 1.2rem;
}

.result-text {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 900;
  line-height: 1.2;
  color: var(--soviet-cream);
  text-shadow: none;
  margin: 1.5rem 0;
  padding: 0 1rem;
}

.result-anthem-label {
  font-size: clamp(0.75rem, 2.2vw, 0.9rem);
  color: rgba(245, 240, 232, 0.5);
  letter-spacing: 0.2em;
  margin-top: 0.4rem;
  animation: anthem-pulse 1s ease-in-out infinite alternate;
}

@keyframes anthem-pulse {
  from { opacity: 0.4; }
  to   { opacity: 0.9; }
}

.confetti-container {
  /* position:fixed + overflow:visible で画面全体に飛び散る */
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 150;
}

/* rAFで transform/opacity を直接書き換えるため
   .confetti-piece に animation は不要 */
.confetti-piece {
  position: absolute;
}

/* =============================================
   フェードアニメーション（汎用）
   ============================================= */
@keyframes fade-down {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* =============================================
   画面フラッシュ（決定瞬間の白フラッシュ）
   ============================================= */
.screen-flash {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}

.screen-flash.go {
  animation: flash-out 0.45s ease-out forwards;
}

@keyframes flash-out {
  0%   { opacity: 0.9; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .screen-flash.go { animation: none; }
  .result-inner    { animation: none; }
}

/* =============================================
   レスポンシブ調整
   ============================================= */
@media (max-width: 480px) {
  .main-container {
    padding: 1.5rem 1rem 3rem;
  }
  .page-header {
    margin-bottom: 1.5rem;
  }
  .roulette-section {
    gap: 1.8rem;
  }
  .spin-btn {
    padding: 0.85rem 2.2rem;
  }
  .result-inner {
    padding: 2rem 1.5rem;
  }
}
