/* ========================================
   Wikiゴルフ — Premium UI
   ======================================== */

/* === リセット & ベース === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0c0;
  --text-muted: #5a5a88;
  --accent-cyan: #00e5ff;
  --accent-magenta: #ff3399;
  --accent-gold: #ffcc00;
  --accent-green: #00ff88;
  --accent-purple: #7c3aed;
  --border-color: rgba(255, 255, 255, 0.08);
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.06);
  --font-main: 'Noto Sans JP', 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* === 背景パーティクル === */
.bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-particles::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.06) 0%, transparent 70%);
  top: -200px;
  left: -100px;
  animation: float-slow 20s ease-in-out infinite;
}

.bg-particles::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 51, 153, 0.05) 0%, transparent 70%);
  bottom: -150px;
  right: -100px;
  animation: float-slow 25s ease-in-out infinite reverse;
}

@keyframes float-slow {

  0%,
  100% {
    transform: translate(0, 0);
  }

  33% {
    transform: translate(30px, -40px);
  }

  66% {
    transform: translate(-20px, 20px);
  }
}

/* === ガラスカード === */
.glass-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* === 画面管理 === */
.screen {
  display: none;
  min-height: 100vh;
  padding: 1rem 1rem;
  position: relative;
  z-index: 1;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: screenIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.game-container {
  max-width: 720px;
}

/* ===================================
   ロビー画面
   =================================== */

/* ロゴ */
.logo-section {
  text-align: center;
  margin-bottom: 0.8rem;
}

.logo-title {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  color: var(--text-primary);
}

.logo-accent {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-online {
  color: #FFD700;
  margin-left: 0.1em;
}

.logo-tagline {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 0.3rem;
}

.logo-tagline .highlight {
  color: var(--accent-gold);
  font-style: normal;
  font-weight: 700;
}

/* ルールカード */
.rules-card {
  padding: 0.8rem;
  margin-bottom: 0.8rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.rule-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* CSS Dot Indicators - 全て青に統一 */
.rule-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

.waiting-dot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.waiting-dot::after {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.6);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.3);
    opacity: 0.7;
  }
}

/* ロビーフォーム */
.lobby-form {
  padding: 1.5rem;
}

.input-group {
  margin-bottom: 1.2rem;
}

.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.text-input {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-family: var(--font-main);
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: all 0.25s;
}

.text-input::placeholder {
  color: var(--text-muted);
}

.text-input:focus {
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.04);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.08);
}

.code-input {
  text-align: center;
  font-family: var(--font-main);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.3em;
}

/* モードタブ */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.mode-tab {
  padding: 0.7rem;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-main);
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.mode-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.mode-tab.active {
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
  animation: fadeSlideUp 0.3s ease;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 難易度セレクター */
.difficulty-selector {
  margin-bottom: 1rem;
}

.diff-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.diff-option {
  cursor: pointer;
}

.diff-option input[type="radio"] {
  display: none;
}

.diff-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.7rem 0.3rem;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: all 0.25s;
  gap: 0.2rem;
}

.diff-name {
  font-size: 0.9rem;
  font-weight: 700;
}

.diff-card.mild {
  background: rgba(0, 255, 136, 0.04);
  color: var(--accent-green);
  border-color: rgba(0, 255, 136, 0.12);
}

.diff-card.medium {
  background: rgba(255, 204, 0, 0.04);
  color: var(--accent-gold);
  border-color: rgba(255, 204, 0, 0.12);
}

.diff-card.hot {
  background: rgba(255, 51, 51, 0.04);
  color: #ff5555;
  border-color: rgba(255, 51, 51, 0.12);
}

.diff-card.extreme {
  background: rgba(160, 0, 255, 0.04);
  color: #cc44ff;
  border-color: rgba(160, 0, 255, 0.12);
}

.diff-option input:checked+.diff-card.mild {
  background: rgba(0, 255, 136, 0.12);
  border-color: var(--accent-green);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.15);
}

.diff-option input:checked+.diff-card.medium {
  background: rgba(255, 204, 0, 0.12);
  border-color: var(--accent-gold);
  box-shadow: 0 0 16px rgba(255, 204, 0, 0.15);
}

.diff-option input:checked+.diff-card.hot {
  background: rgba(255, 51, 51, 0.12);
  border-color: #ff5555;
  box-shadow: 0 0 16px rgba(255, 51, 51, 0.15);
}

.diff-option input:checked+.diff-card.extreme {
  background: rgba(160, 0, 255, 0.12);
  border-color: #cc44ff;
  box-shadow: 0 0 16px rgba(160, 0, 255, 0.15);
}

/* お題難易度カード */
.difficulty-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.diff-card.easy {
  background: rgba(0, 255, 136, 0.04);
  color: #00cc88;
  border-color: rgba(0, 255, 136, 0.12);
}

.diff-card.hard-diff {
  background: rgba(255, 160, 0, 0.04);
  color: #ffaa00;
  border-color: rgba(255, 160, 0, 0.12);
}

.diff-card.oni {
  background: rgba(160, 0, 255, 0.04);
  color: #cc44ff;
  border-color: rgba(160, 0, 255, 0.12);
}

.diff-option input:checked+.diff-card.easy {
  background: rgba(0, 255, 136, 0.12);
  border-color: #00cc88;
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.15);
}

.diff-option input:checked+.diff-card.hard-diff {
  background: rgba(255, 160, 0, 0.12);
  border-color: #ffaa00;
  box-shadow: 0 0 16px rgba(255, 160, 0, 0.15);
}

.diff-option input:checked+.diff-card.oni {
  background: rgba(160, 0, 255, 0.12);
  border-color: #cc44ff;
  box-shadow: 0 0 16px rgba(160, 0, 255, 0.15);
}

/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.8rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-main);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.btn:hover::after {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0088cc);
  color: #000;
  box-shadow: 0 4px 20px rgba(0, 229, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 229, 255, 0.35);
}

.btn-cpu {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.2);
}

.btn-cpu:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.35);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--accent-magenta), #cc0066);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 51, 153, 0.2);
  width: auto;
  white-space: nowrap;
  min-width: 80px;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 51, 153, 0.35);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  width: auto;
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

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

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-skip,
.btn-leave {
  flex: 1;
  max-width: 160px;
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
}

.btn-skip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-skip:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hud-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.btn-leave {
  background: rgba(255, 50, 50, 0.06);
  border: 1px solid rgba(255, 50, 50, 0.15);
  color: #ff6666;
}

.btn-leave:hover {
  background: rgba(255, 50, 50, 0.12);
}

/* ロビーその他 */
.divider-text {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0.8rem 0;
  position: relative;
}

.divider-text::before,
.divider-text::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: var(--border-color);
}

.divider-text::before {
  left: 0;
}

.divider-text::after {
  right: 0;
}

.join-group {
  display: flex;
  gap: 0.6rem;
}

.join-group .text-input {
  flex: 1;
}

/* フッターリンク */
.lobby-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.lobby-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s;
}

.lobby-footer a:hover,
.lobby-footer a:active {
  color: var(--accent-cyan);
  text-shadow: 0 0 8px rgba(0, 214, 252, 0.4);
}

.footer-sep {
  margin: 0 0.4rem;
  opacity: 0.3;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.8rem 1.5rem;
  background: rgba(255, 51, 51, 0.9);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 100;
  backdrop-filter: blur(10px);
  animation: toastIn 0.4s ease;
  white-space: nowrap;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.hidden {
  display: none !important;
}

/* ===================================
   待機画面
   =================================== */
.waiting-content {
  text-align: center;
  padding: 3rem 2rem;
}

.room-code-display {
  margin-bottom: 2.5rem;
}

.room-code-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
}

.room-code-value {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--accent-cyan);
  letter-spacing: 0.3em;
  text-shadow: 0 0 40px rgba(0, 229, 255, 0.4);
  margin-bottom: 0.8rem;
}

.waiting-animation {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 2rem;
}

.orbit-ring {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--accent-cyan);
  border-radius: 50%;
  animation: orbit-pulse 2.5s ease-out infinite;
  opacity: 0;
}

.orbit-ring.delay-1 {
  animation-delay: 0.7s;
}

.orbit-ring.delay-2 {
  animation-delay: 1.4s;
}

@keyframes orbit-pulse {
  0% {
    transform: scale(0.5);
    opacity: 0.7;
  }

  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}



.waiting-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.waiting-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===================================
   ゲーム画面
   =================================== */

#wiki-game-screen {
  display: none;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
  min-height: 0;
  align-items: stretch;
  justify-content: flex-start;
}

#wiki-game-screen.active {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
}

/* 固定ヘッダー */
.game-fixed-header {
  flex-shrink: 0;
  padding: 0.8rem 1rem 0;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* スクロール可能なリンクボディ */
.game-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem 2rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.game-scroll-body::-webkit-scrollbar {
  width: 5px;
}

.game-scroll-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* ヘッダー */
.game-header {
  padding: 1rem 1.2rem;
  position: relative;
  overflow: hidden;
}

.game-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-gold), var(--accent-magenta));
  opacity: 0.5;
}

/* ===== HUD 2行レイアウト ===== */
.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.top-row {
  margin-bottom: 0.5rem;
}

.bottom-row {
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* 現在の記事（左上） */
.hud-current-article {
  flex: 1;
  min-width: 0;
}

.hud-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.1rem;
}

.hud-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* タイマー（右上） */
.hud-timer {
  flex-shrink: 0;
}

.timer-compact {
  position: relative;
  width: 48px;
  height: 48px;
}

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

.timer-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 3;
}

.timer-fill {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 113.1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-fill.danger {
  stroke: #ff4444;
}

.timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--accent-cyan);
}

.timer-text.danger {
  color: #ff4444;
  animation: pulse-text 0.5s ease-in-out infinite;
}

@keyframes pulse-text {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }
}

/* ゴール（左下） */
.hud-goal {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.hud-goal-tag {
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: #1a1a2e;
  background: linear-gradient(135deg, var(--accent-gold), #ffaa00);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.hud-goal-text {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* スコア（右下） */
.hud-score {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.score-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.score-val {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1;
}

.score-unit.me .score-val {
  color: var(--accent-cyan);
}

.score-unit.opp .score-val {
  color: var(--accent-magenta);
}

.score-tag {
  font-size: 0.5rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.score-sep {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0.1rem;
}

/* スコアボード + タイマー */
.game-stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.6rem;
}

.timer-section {
  flex-shrink: 0;
}




.scoreboard {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.score-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
}

.score-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.score-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 900;
}

.score-player.me .score-value {
  color: var(--accent-cyan);
}

.score-player.opponent .score-value {
  color: var(--accent-magenta);
}

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

/* ゴール表示 */
.goal-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.goal-tag {
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: #1a1a2e;
  background: linear-gradient(135deg, var(--accent-gold), #ffaa00);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(255, 204, 0, 0.3);
  flex-shrink: 0;
}

.goal-name {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--accent-gold);
  word-break: break-word;
  text-shadow: 0 0 24px rgba(255, 204, 0, 0.25);
}

/* 相手情報 */
.opponent-current {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

#wiki-opponent-current {
  color: var(--accent-magenta);
}

/* 現在の記事 */
.current-article {
  text-align: center;
  padding: 0.8rem 1rem;
  margin: 0.5rem 0;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(0, 229, 255, 0.12);
  border-radius: var(--radius-sm);
}

.current-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.15rem;
  letter-spacing: 0.1em;
}

.current-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
  word-break: break-word;
}

/* リンク一覧 */
.wiki-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0;
  align-content: flex-start;
}

.wiki-link-btn {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-main);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: var(--accent-cyan);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: linkFadeIn 0.25s ease backwards;
  position: relative;
  overflow: hidden;
}

.wiki-link-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.08), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

@keyframes linkFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wiki-link-btn:hover {
  background: rgba(0, 229, 255, 0.06);
  border-color: rgba(0, 229, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 229, 255, 0.1);
}

.wiki-link-btn:hover::after {
  opacity: 1;
}

.wiki-link-btn:focus {
  outline: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.wiki-link-btn:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.05s;
}

.wiki-link-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.wiki-goal-link {
  background: linear-gradient(135deg, rgba(255, 204, 0, 0.12), rgba(255, 204, 0, 0.04)) !important;
  border-color: rgba(255, 204, 0, 0.35) !important;
  color: var(--accent-gold) !important;
  animation: goal-glow 2s ease-in-out infinite;
  font-weight: 800;
}

@keyframes goal-glow {

  0%,
  100% {
    box-shadow: 0 0 6px rgba(255, 204, 0, 0.15), inset 0 0 8px rgba(255, 204, 0, 0.05);
  }

  50% {
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.25), inset 0 0 12px rgba(255, 204, 0, 0.08);
  }
}

.wiki-link-blocked {
  opacity: 0.12 !important;
  text-decoration: line-through !important;
  color: var(--text-muted) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* 通知 */
.wiki-opponent-notice {
  text-align: center;
  padding: 0.7rem 1rem;
  margin: 0.5rem 0;
  background: rgba(255, 204, 0, 0.08);
  border: 1px solid rgba(255, 204, 0, 0.2);
  border-radius: var(--radius-sm);
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 0.9rem;
  animation: screenIn 0.4s ease;
}

.rematch-notice {
  text-align: center;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 0.9rem;
  animation: screenIn 0.4s ease;
}

.wiki-waiting-msg {
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-green);
  animation: bounce-slow 2s ease-in-out infinite;
}

.wiki-waiting-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
  gap: 0.8rem;
  margin: 0 auto;
}


.wiki-waiting-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: #fff;
}

.wiki-waiting-sub {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.dot-animation {
  display: inline-block;
  animation: dot-blink 1.4s infinite;
}

@keyframes dot-blink {

  0%,
  20% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }

  80%,
  100% {
    opacity: 1;
  }
}

/* ===================================
   結果画面
   =================================== */
.result-hero {
  text-align: center;
  padding: 1.5rem 0 1rem;
  position: relative;
}

.trophy-icon {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--accent-gold);
  text-transform: uppercase;
  animation: trophy-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin-bottom: 0.5rem;
}

.trophy-text {
  font-family: var(--font-mono);
  text-shadow: 0 0 20px rgba(255, 204, 0, 0.4);
}

@keyframes trophy-bounce {
  0% {
    transform: scale(0) rotate(-20deg);
    opacity: 0;
  }

  60% {
    transform: scale(1.2) rotate(5deg);
    opacity: 1;
  }

  100% {
    transform: scale(1) rotate(0);
  }
}

.winner-name {
  font-size: 2.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-gold), #ff8800, var(--accent-gold));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gold-shimmer 3s ease infinite;
}

@keyframes gold-shimmer {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

.winner-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* 結果ルート */
.result-route {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.result-badge {
  font-weight: 800;
  font-size: 1rem;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
}

.result-badge.start {
  background: rgba(0, 255, 136, 0.08);
  color: var(--accent-green);
}

.result-badge.goal {
  background: rgba(255, 204, 0, 0.08);
  color: var(--accent-gold);
}

.result-arrow {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
}

/* 結果統計 */
.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.stat-card {
  text-align: center;
  padding: 0.8rem 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent-cyan);
  line-height: 1;
  margin-bottom: 0.2rem;
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* 結果比較 */
.result-comparison {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-player {
  flex: 1;
  text-align: center;
  padding: 1.2rem;
  max-width: 250px;
  transition: all 0.3s;
}

.result-player.winner-highlight {
  border-color: rgba(255, 204, 0, 0.3);
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.1);
}

.result-vs {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--text-muted);
}

.rp-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
}

.rp-clicks {
  font-size: 3rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.rp-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.rp-history {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.wiki-history-item {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-muted);
}

.wiki-history-start {
  color: var(--accent-green);
  border-color: rgba(0, 255, 136, 0.2);
}

.wiki-history-goal {
  color: var(--accent-gold);
  border-color: rgba(255, 204, 0, 0.2);
}

.wiki-history-arrow {
  font-size: 0.55rem;
  color: var(--text-muted);
}

/* Confetti */
.confetti-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  top: -10px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(400px) rotate(720deg);
    opacity: 0;
  }
}

/* ===================================
   レスポンシブ
   =================================== */
@media (max-width: 600px) {
  .logo-title {
    font-size: 1.6rem;
  }

  .logo-tagline {
    font-size: 0.78rem;
  }

  .room-code-value {
    font-size: 2.8rem;
  }

  .rules-card {
    padding: 0.6rem;
    margin-bottom: 0.6rem;
  }

  .rules-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
  }

  .rule-item {
    font-size: 0.7rem;
    gap: 0.3rem;
  }

  .difficulty-selector {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.3rem;
  }

  .diff-card {
    padding: 0.5rem 0.2rem;
  }

  .diff-name {
    font-size: 0.7rem;
  }

  .wiki-link-btn {
    padding: 0.7rem 0.8rem;
    font-size: 1rem;
    min-height: 44px;
  }

  .result-comparison {
    flex-direction: column;
    align-items: center;
  }

  .result-player {
    max-width: 100%;
    width: 100%;
  }

  .result-stats {
    gap: 0.5rem;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .route-step {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }

  .result-vs {
    display: none;
  }

  .route-point {
    font-size: 0.75rem;
  }

  .score-value {
    font-size: 1.5rem;
  }
}

/* ========== 遊び方ボタン ========== */
.btn-how-to-play {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  background: transparent;
  border: 1px dashed rgba(0, 229, 255, 0.3);
  color: var(--accent-cyan);
  font-family: var(--font-main);
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-how-to-play:hover {
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--accent-cyan);
}

/* ========== チュートリアルモーダル ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  position: relative;
  max-width: 500px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px 28px;
  border-radius: var(--radius);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: #ff4444;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  color: #ff6666;
  background: rgba(255, 68, 68, 0.15);
}

.legal-modal {
  max-height: 80vh;
  overflow-y: auto;
}

.legal-body h3 {
  font-size: 0.95rem;
  color: var(--accent-cyan);
  margin-top: 1.2rem;
  margin-bottom: 0.3rem;
}

.legal-body p,
.legal-body li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.legal-body ul {
  padding-left: 1.2rem;
  margin-bottom: 0.5rem;
}

.legal-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.tutorial-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-body h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.step-body p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tutorial-tips {
  background: rgba(255, 204, 0, 0.05);
  border: 1px solid rgba(255, 204, 0, 0.15);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}

.tutorial-tips h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--accent-gold);
}

.tutorial-tips ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tutorial-tips li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
}

.tutorial-tips li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent-gold);
}

/* ========== ジャンル選択グリッド ========== */
.genre-candidates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

/* ========== ゴール選択画面 ========== */
.goal-select-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 16px;
  text-align: center;
}

.goal-select-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: #FFD600;
  transition: all 0.5s ease;
}

.goal-select-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.goal-timer-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.goal-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta));
  border-radius: 2px;
  transition: width 1s linear;
}

.goal-timer-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.goal-candidates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.goal-candidate-card {
  padding: 20px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.goal-candidate-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
}

.goal-candidate-card.goal-voted {
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
}

.goal-candidate-card.opponent-voted {
  border-color: #e040a0;
  background: rgba(224, 64, 160, 0.12);
  box-shadow: 0 0 20px rgba(224, 64, 160, 0.15);
}

.goal-candidate-card.goal-selected {
  border-color: var(--accent-green);
  background: rgba(0, 255, 136, 0.15);
  box-shadow: 0 0 24px rgba(0, 255, 136, 0.2);
  transform: scale(1.05);
  animation: goalPulse 0.5s ease;
}

.goal-candidate-card.goal-not-selected {
  opacity: 0.3;
  transform: scale(0.95);
  pointer-events: none;
}

@keyframes goalPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1.05);
  }
}

.goal-select-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

/* ========== 30クリック到達 ========== */
.wiki-waiting-msg {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .goal-candidates-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .goal-candidate-card {
    padding: 14px 10px;
    font-size: 0.85rem;
  }
}