/* ===== リセット・基本設定 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* カラーパレット */
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-glass: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.12);

  --text-primary: #f0f0ff;
  --text-secondary: #a0a0cc;
  --text-muted: #606088;

  --accent-purple: #7c3aed;
  --accent-purple-light: #a78bfa;
  --accent-blue: #3b82f6;
  --accent-cyan: #22d3ee;
  --accent-pink: #ec4899;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
  --accent-orange: #f97316;

  --gradient-primary: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  --gradient-win: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
  --gradient-lose: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
  --gradient-draw: linear-gradient(135deg, var(--accent-yellow), var(--accent-orange));

  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.3);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  --font-main: 'M PLUS Rounded 1c', sans-serif;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== 広告枠 ===== */
.ad-container {
  width: 100%;
  flex-shrink: 0;
  z-index: 10;
}

.ad-top {
  height: 60px;
}

.ad-bottom {
  height: 60px;
}

.ad-placeholder {
  width: 100%;
  height: 100%;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-label {
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ===== メインコンテナ ===== */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
}

/* 背景装飾 */
.game-container::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* ===== 画面切り替え ===== */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
  max-width: 400px;
  animation: fadeIn 0.4s ease-out;
}

.screen.active {
  display: flex;
}

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

/* ===== ボタン共通 ===== */
.btn {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 1.1rem;
  border: none;
  cursor: pointer;
  padding: 16px 40px;
  border-radius: var(--radius-full);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  box-shadow: 0 0 50px rgba(124, 58, 237, 0.5);
  transform: translateY(-2px);
}

.btn-glow {
  position: relative;
  overflow: hidden;
}

.btn-glow::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.15) 50%, transparent 70%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.btn-share {
  background: #000;
  color: #fff;
  border: 1px solid #333;
  font-size: 1rem;
  padding: 12px 28px;
}

.btn-share:hover {
  background: #1a1a1a;
}

.share-icon {
  font-weight: 900;
  font-size: 1.1rem;
}

.btn-icon {
  font-size: 1.3rem;
}

/* ===== ホーム画面 ===== */
.logo-area {
  text-align: center;
  margin-bottom: 8px;
}

.logo-text {
  font-size: 3rem;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.app-title {
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1.4;
  margin-top: 8px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-accent {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.streak-display {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.streak-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.streak-value {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== 待機画面 ===== */
.waiting-animation {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--accent-purple-light);
  opacity: 0;
  animation: pulse 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.pulse-ring.delay-1 {
  animation-delay: 0.5s;
}

.pulse-ring.delay-2 {
  animation-delay: 1s;
}

@keyframes pulse {
  0% { transform: scale(0.5); opacity: 0.8; }
  100% { transform: scale(1.5); opacity: 0; }
}

.waiting-icon {
  font-size: 3rem;
  animation: rotate 3s linear infinite;
}

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

.waiting-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== 対戦画面（手の選択） ===== */
.timer-container {
  margin-bottom: 8px;
}

.timer-ring {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-ring svg {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: var(--bg-glass);
  stroke-width: 6;
}

.timer-progress {
  fill: none;
  stroke: url(#timerGrad);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.timer-text {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--text-primary);
  z-index: 1;
}

.timer-text.warning {
  color: var(--accent-red);
  animation: pulse-warning 0.5s ease-in-out infinite alternate;
}

@keyframes pulse-warning {
  from { transform: scale(1); }
  to { transform: scale(1.15); }
}

.select-prompt {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.hand-buttons {
  display: flex;
  gap: 16px;
  width: 100%;
  justify-content: center;
}

.hand-btn {
  flex: 1;
  max-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-main);
  -webkit-tap-highlight-color: transparent;
}

.hand-btn:hover {
  border-color: var(--accent-purple-light);
  background: rgba(124, 58, 237, 0.15);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.2);
}

.hand-btn:active {
  transform: scale(0.95) translateY(0);
}

.hand-btn.selected {
  border-color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.25);
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.3);
  transform: translateY(-4px) scale(1.05);
}

.hand-emoji {
  font-size: 2.5rem;
}

.hand-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ===== ロック画面 ===== */
.locked-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.my-move-display {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.my-move-emoji {
  font-size: 2.5rem;
}

.locked-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-purple-light);
  animation: dotBounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ===== 結果画面 ===== */
.result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.result-banner {
  padding: 16px 48px;
  border-radius: var(--radius-xl);
  animation: resultPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes resultPop {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.result-banner.win {
  background: var(--gradient-win);
  box-shadow: 0 0 40px rgba(16, 185, 129, 0.4);
}

.result-banner.lose {
  background: var(--gradient-lose);
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.4);
}

.result-banner.draw {
  background: var(--gradient-draw);
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.4);
}

.result-text {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.result-hands {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 8px 0;
}

.result-hand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.result-hand-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.result-hand-emoji {
  font-size: 3rem;
  animation: handReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes handReveal {
  0% { transform: scale(0) rotate(-180deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.vs-text {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-muted);
}

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

.result-streak {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}

.result-actions .btn {
  width: 100%;
}

/* ===== レスポンシブ ===== */
@media (max-width: 380px) {
  .hand-buttons {
    gap: 10px;
  }

  .hand-btn {
    padding: 16px 8px;
  }

  .hand-emoji {
    font-size: 2rem;
  }

  .app-title {
    font-size: 1.5rem;
  }

  .title-accent {
    font-size: 1.8rem;
  }
}

@media (min-width: 768px) {
  .ad-top, .ad-bottom {
    height: 90px;
  }

  .game-container {
    padding: 40px 24px;
  }

  .hand-btn {
    max-width: 130px;
    padding: 24px 16px;
  }

  .hand-emoji {
    font-size: 3rem;
  }
}

/* ===== ユーティリティ ===== */
.hidden {
  display: none !important;
}
