/* ==========================================================================
   CloneGuessr Design System & Styles
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-dark: #0a0e17;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(28, 36, 56, 0.95);
  --bg-glass: rgba(15, 23, 42, 0.72);
  --border-glass: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(56, 189, 248, 0.3);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #06b6d4;
  --accent-sky: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  /* Typography */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows & Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-glass: 0 16px 40px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-glass);
  --shadow-hover: 0 20px 48px -4px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--border-glow);
  --shadow-accent: 0 8px 24px -4px rgba(6, 182, 212, 0.45);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.font-mono {
  font-family: var(--font-mono);
}

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

/* --------------------------------------------------------------------------
   App Layout
   -------------------------------------------------------------------------- */
.app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* 全画面 Street View コンテナ */
.pano-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* NMPZ用物理シールド (Street ViewのWebGLループ暴走を防ぐ物理遮断層) */
.pano-shield {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  background: transparent;
  pointer-events: all;
  cursor: default;
}

/* パノラマ不調時の緊急スキップボタン */
.skip-location-btn {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 25;
  font-size: 12px;
  padding: 8px 16px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.skip-location-btn:hover {
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.4);
}

/* --------------------------------------------------------------------------
   Glass Cards & Panels
   -------------------------------------------------------------------------- */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
  padding: 40px;
  color: var(--text-main);
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass);
}

/* --------------------------------------------------------------------------
   Header Overlay (S2)
   -------------------------------------------------------------------------- */
.game-header {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 28px;
  border-radius: var(--radius-lg);
  pointer-events: auto;
  transition: all 0.3s ease;
}

.header-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--text-dim);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.stat-value.highlight {
  color: var(--accent-emerald);
}

.header-divider {
  width: 1px;
  height: 28px;
  background: var(--border-glass);
}

.header-mode-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-sky);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
}

/* --------------------------------------------------------------------------
   S1: Title Screen
   -------------------------------------------------------------------------- */
.screen-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.screen-view:not(.active) {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.title-card {
  width: 90%;
  max-width: 540px;
  text-align: center;
  animation: fadeInDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.title-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.title-logo {
  font-family: var(--font-heading);
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.title-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.setting-group {
  text-align: left;
  margin-bottom: 20px;
}

.setting-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.select-wrapper {
  position: relative;
}

.custom-select, .custom-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-select:focus, .custom-input:focus {
  border-color: var(--accent-sky);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

/* Segmented Control for Modes */
.segmented-control {
  display: flex;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.segment-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.segment-title {
  font-size: 14px;
  font-weight: 700;
}

.segment-sub {
  font-size: 10px;
  opacity: 0.7;
}

.segment-btn.active {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-sky);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* API Key Section */
.api-key-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-glass);
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.text-link-btn:hover {
  color: var(--text-main);
}

.key-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-rose);
}

.key-status-dot.configured {
  background: var(--accent-emerald);
}

.key-input-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.key-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

.title-actions {
  margin-top: 28px;
}

.title-footer {
  margin-top: 20px;
  color: var(--text-dim);
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-sky), var(--accent-cyan));
  color: #04121e;
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 10px 28px -2px rgba(6, 182, 212, 0.6);
}

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

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.btn-large {
  width: 100%;
  padding: 16px 28px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

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

.btn-icon-only {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   S2 & S3: Guess Map Container (Floating & Expanding)
   -------------------------------------------------------------------------- */
.guess-map-wrapper {
  position: absolute;
  z-index: 10;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* S2: 通常フローティング状態（右下） */
.guess-map-wrapper.floating {
  bottom: 24px;
  right: 24px;
  width: 320px;
  height: 220px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  border: 2px solid var(--border-glass);
  overflow: hidden;
}

/* PC ホバー時またはアクティブ時：自動拡大 */
.guess-map-wrapper.floating:hover,
.guess-map-wrapper.floating.expanded {
  width: 640px;
  height: 440px;
  border-color: var(--border-glow);
  box-shadow: var(--shadow-hover);
}

/* S3: ラウンド結果時（全画面） */
.guess-map-wrapper.fullscreen {
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
  box-shadow: none;
  z-index: 15;
}

.guess-map-viewport {
  width: 100%;
  height: 100%;
}

/* 推測ボタン群 (S2) */
.guess-controls {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 5;
}

.btn-guess {
  flex: 1;
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: none;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-guess:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.btn-guess:disabled {
  background: #334155;
  color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
}

.guess-map-wrapper.fullscreen .guess-controls {
  display: none;
}

/* --------------------------------------------------------------------------
   S3: Round Result Panel
   -------------------------------------------------------------------------- */
.round-result-panel {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 520px;
  padding: 24px;
  border-radius: var(--radius-xl);
  z-index: 25;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--accent-emerald);
}

.result-location-name {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
}

.result-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0;
}

.metric-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: center;
}

.metric-box.highlight {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

.metric-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.metric-box.highlight .metric-value {
  color: var(--accent-emerald);
}

/* --------------------------------------------------------------------------
   S4: Final Result Screen
   -------------------------------------------------------------------------- */
.glass-panel-container {
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.final-card {
  width: 90%;
  max-width: 600px;
  text-align: center;
  animation: fadeInDown 0.5s ease;
}

.final-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--accent-amber);
}

.final-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  margin: 6px 0 16px;
}

.final-score-box {
  margin-bottom: 24px;
}

.final-total-score {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
}

.final-max-score {
  font-size: 18px;
  color: var(--text-dim);
  font-weight: 600;
  margin-left: 6px;
}

.round-breakdown-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
  text-align: left;
}

.breakdown-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.breakdown-table th {
  text-align: left;
  padding: 8px;
  color: var(--text-dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border-glass);
}

.breakdown-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.breakdown-table tr:last-child td {
  border-bottom: none;
}

.final-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Loading Overlay & Alerts
   -------------------------------------------------------------------------- */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 14, 23, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent-sky);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 14px;
  color: var(--text-muted);
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 16px;
  text-align: left;
}

.alert-error {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fca5a5;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

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

/* --------------------------------------------------------------------------
   Phase 2: Timer, Seed & Modal Styles
   -------------------------------------------------------------------------- */
.timer-stat {
  min-width: 68px;
}

.timer-warning {
  color: var(--accent-rose) !important;
  animation: timerPulse 0.8s ease-in-out infinite alternate;
}

@keyframes timerPulse {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(1.08);
    opacity: 0.75;
  }
}

.seed-group {
  margin-bottom: 18px;
}

.seed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.seed-header .setting-label {
  margin-bottom: 0;
}

.text-link-small {
  background: none;
  border: none;
  color: var(--accent-sky);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease;
}

.text-link-small:hover {
  opacity: 0.8;
}

.text-link-muted {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
  display: inline-block;
  margin-bottom: 8px;
}

.text-link-muted:hover {
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.footer-sep {
  color: var(--text-dim);
  font-size: 10px;
}

.final-share-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* 最終結果シード表示 */
.final-seed-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}

.btn-challenge-share {
  background: rgba(56, 189, 248, 0.12) !important;
  border-color: rgba(56, 189, 248, 0.3) !important;
  color: var(--accent-sky) !important;
  padding: 6px 14px !important;
}

.btn-challenge-share:hover {
  background: rgba(56, 189, 248, 0.22) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
}

.seed-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.final-seed {
  color: var(--accent-cyan);
  font-size: 14px;
  letter-spacing: 0.05em;
}

.btn-copy-seed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-seed:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: fadeInDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s ease;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-content {
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.license-item {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-glass);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
}

.license-item h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-sky);
  margin-bottom: 6px;
}

.license-item p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Responsive (Mobile: < 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .game-header {
    top: 12px;
    padding: 8px 16px;
    gap: 16px;
  }
  .stat-value {
    font-size: 16px;
  }

  .title-card {
    padding: 24px;
  }
  .title-logo {
    font-size: 32px;
  }

  .guess-map-wrapper.floating {
    bottom: 16px;
    right: 16px;
    width: 200px;
    height: 150px;
  }

  .guess-map-wrapper.floating:hover,
  .guess-map-wrapper.floating.expanded {
    width: calc(100vw - 32px);
    height: 380px;
  }

  .round-result-panel {
    bottom: 20px;
    padding: 18px;
  }

  .deduction-panel {
    top: 65px;
    left: 16px;
    width: calc(100vw - 32px);
    max-height: 50vh;
  }
}

/* --------------------------------------------------------------------------
   Phase 5: Deduction Mode Styles
   -------------------------------------------------------------------------- */
.deduction-panel {
  position: absolute;
  top: 75px;
  left: 24px;
  width: 340px;
  max-height: calc(100vh - 100px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.deduction-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-glass);
  background: rgba(15, 23, 42, 0.7);
}

.deduction-title-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-sky);
}

.deduction-title-badge #deduction-q-count {
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
}

.deduction-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.deduction-toggle-btn:hover {
  color: var(--text-main);
  transform: scale(1.1);
}

.deduction-panel-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.deduction-panel.collapsed .deduction-panel-body {
  display: none;
}

.deduction-question-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deduction-question-text {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-main);
}

.deduction-hint-toggle {
  background: none;
  border: none;
  color: var(--accent-sky);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.2s ease;
}

.deduction-hint-toggle:hover {
  opacity: 0.8;
}

.deduction-hint-text {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.6);
  border-left: 2px solid var(--accent-sky);
  padding: 6px 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.deduction-illust-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

.deduction-illust-img {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  background: rgba(15, 23, 42, 0.6);
}

.deduction-options-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-deduction-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-deduction-opt:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(2px);
}

.btn-deduction-opt-thumb {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
}

.btn-opt-unknown {
  background: rgba(255, 255, 255, 0.02) !important;
  color: var(--text-dim) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  justify-content: center;
  font-size: 11px;
}

.btn-opt-unknown:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-muted) !important;
}

/* 候補カード */
.deduction-candidates-card {
  border-top: 1px solid var(--border-glass);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidates-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.candidates-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.candidates-sub {
  font-size: 10px;
  color: var(--text-dim);
}

.deduction-candidates-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.candidate-row {
  display: grid;
  grid-template-columns: 20px 65px 1fr 40px;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.cand-rank {
  color: var(--text-dim);
  font-weight: 700;
  text-align: center;
}

.cand-name {
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cand-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.cand-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.candidate-row:first-child .cand-bar-fill {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.cand-pct {
  text-align: right;
  color: var(--text-muted);
  font-size: 10px;
}

.btn-finish-deduction {
  margin-top: 6px;
  background: none;
  border: 1px dashed var(--border-glass);
  color: var(--text-dim);
  font-size: 11px;
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-finish-deduction:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.2);
}

/* 振り返りセクション */
.deduction-review-section {
  border-top: 1px solid var(--border-glass);
  padding-top: 14px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.review-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-sky);
  margin: 0;
}

.review-match-summary {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.review-table-wrapper {
  overflow-x: auto;
}

.review-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.review-table th,
.review-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.review-table th {
  color: var(--text-dim);
  font-weight: 600;
  text-align: left;
}

.badge-decisive {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.review-missed-box {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Phase 5: Review Mode (答え合わせモード) Styles
   -------------------------------------------------------------------------- */
.review-mode-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-glass);
  text-align: left;
}

.review-mode-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.review-instruction {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.review-checklist-container {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.review-check-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.review-check-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.review-options-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.review-option-pill {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.review-option-pill:hover {
  background: rgba(56, 189, 248, 0.1);
  color: var(--text-main);
}

.review-option-pill.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-sky);
  color: var(--text-main);
  font-weight: 600;
}

.review-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.review-saved-msg {
  color: var(--accent-emerald);
  font-weight: 700;
  font-size: 12px;
  animation: fadeInDown 0.2s ease;
}


