/* Draw a Perfect Circle – Minimalist Obsidian Theme */
:root {
  --bg-obsidian: #101010;
  --bg-canvas: #141416;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-green: #2ecc71;
  --accent-amber: #f39c12;
  --accent-red: #e74c3c;
  --accent-gold: #f1c40f;
  --border-color: rgba(255, 255, 255, 0.1);
  --card-bg: rgba(26, 26, 32, 0.95);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Outfit", "Segoe UI", sans-serif;
  background-color: var(--bg-obsidian);
  color: var(--text-main);
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* Top Navigation Bar */
.top-nav {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  z-index: 50;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 50px;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.nav-center-score {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* Stage & Canvas Area */
.stage-container {
  width: 95%;
  max-width: 620px;
  height: 520px;
  background: radial-gradient(circle at center, #18181c 0%, #0d0d0f 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 20px 0;
}

#circle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Golden Pinwheel Glow Effect for Legendary Scores (>98%) */
.legendary-pinwheel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 600px;
  transform: translate(-50%, -50%);
  background: conic-gradient(from 0deg, rgba(241, 196, 15, 0.15), transparent 45deg, rgba(241, 196, 15, 0.15) 90deg, transparent 135deg, rgba(241, 196, 15, 0.15) 180deg, transparent 225deg, rgba(241, 196, 15, 0.15) 270deg, transparent 315deg, rgba(241, 196, 15, 0.15) 360deg);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  animation: spinPinwheel 12s linear infinite;
  transition: opacity 0.5s ease;
}

.legendary-pinwheel.active {
  opacity: 1;
}

@keyframes spinPinwheel {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Center Origin Dot & Go Button */
.center-origin-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.8);
  pointer-events: none;
  z-index: 10;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-go-trigger {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  background: #ffffff;
  color: #101010;
  border-radius: 50%;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.4);
  z-index: 20;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
}

.btn-go-trigger:hover {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 32px rgba(255, 255, 255, 0.7);
}

.btn-go-trigger.hidden {
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0;
  pointer-events: none;
}

/* Live & Final Score Display Overlay */
.score-hud-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 15;
  text-align: center;
}

.score-hud-number {
  font-family: "Space Mono", monospace;
  font-size: 3.6rem;
  font-weight: 900;
  color: var(--accent-green);
  line-height: 1;
  text-shadow: 0 0 24px rgba(46, 204, 113, 0.4);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.score-hud-number.visible {
  opacity: 1;
  transform: scale(1);
}

.score-rank-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-main);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.score-rank-title.visible {
  opacity: 1;
}

/* Share & Action Deck below Canvas */
.actions-deck {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 20px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.action-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 50px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

.action-btn.primary {
  background: var(--text-main);
  color: #101010;
  border-color: #ffffff;
}

.action-btn.primary:hover {
  background: #ffffff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

/* Info Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

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

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.modal-body strong {
  color: var(--text-main);
}

/* Semantic SEO Article Section */
.seo-article {
  width: 95%;
  max-width: 960px;
  margin: 15px auto 25px auto;
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.seo-article h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.seo-article h3 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 12px 0 6px 0;
}

/* Responsive Mobile Layout */
@media (max-width: 640px) {
  .stage-container {
    height: 420px;
  }
  .score-hud-number {
    font-size: 2.8rem;
  }
  .top-nav {
    padding: 12px 16px;
  }
}
