/* ==========================================================================
   Higher or Lower - Search Volume Edition
   SapuSEO Marketing & Interactive Game Stylesheet
   ========================================================================== */

:root {
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --color-brand: #4f46e5;
  --color-brand-hover: #4338ca;
  --color-brand-light: #eef2ff;
  --color-card-a: #0f172a;
  --color-card-a-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --color-card-b: #1e1b4b;
  --color-card-b-gradient: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  --color-success: #16a34a;
  --color-success-bg: #14532d;
  --color-danger: #dc2626;
  --color-danger-bg: #7f1d1d;
  --color-text-white: #ffffff;
  --color-text-muted: #94a3b8;
  --color-text-gold: #fbbf24;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: #0b0f19;
  color: var(--color-text-white);
  user-select: none;
  -webkit-user-select: none;
}

/* ==========================================================================
   HUD Header (Fixed Top Bar)
   ========================================================================== */

.game-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #ffffff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.hud-brand img {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.45rem;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.hud-brand svg {
  width: 1.5rem;
  height: 1.5rem;
  color: #818cf8;
}

.hud-brand span.badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  margin-left: 0.25rem;
}

.hud-scores {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.score-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

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

.score-pill .value {
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
}

.score-pill.high-score .value {
  color: var(--color-text-gold);
}

/* ==========================================================================
   Main Game Container & Cards Split
   ========================================================================== */

.game-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* Mobile: Vertical 50/50 Split */
.card {
  position: relative;
  flex: 1 1 50%;
  height: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem 1.5rem;
  text-align: center;
  transition: background-color 0.4s ease, filter 0.4s ease;
  overflow: hidden;
}

/* Card Backgrounds & Texture */
.card-a {
  background: var(--color-card-a-gradient);
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.card-b {
  background: var(--color-card-b-gradient);
}

/* Background Flash States */
.card-b.flash-correct {
  background: var(--color-success-bg) !important;
  box-shadow: inset 0 0 80px rgba(34, 197, 94, 0.5);
}

.card-b.flash-wrong {
  background: var(--color-danger-bg) !important;
  box-shadow: inset 0 0 80px rgba(239, 68, 68, 0.5);
}

.card-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.04;
  background-image: radial-gradient(rgba(255, 255, 255, 0.8) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

/* Card Content Typography */
.card-content {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 90%;
  margin: 0 auto;
}

.keyword-label {
  font-size: clamp(1.4rem, 4vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.35rem;
  text-transform: capitalize;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  word-break: break-word;
}

.card-has-text {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  text-transform: lowercase;
  font-weight: 500;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.volume-display {
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 900;
  color: var(--color-text-gold);
  line-height: 1;
  margin-bottom: 0.25rem;
  letter-spacing: -0.03em;
  text-shadow: 0 4px 20px rgba(251, 191, 36, 0.3);
  font-variant-numeric: tabular-nums;
}

.volume-unit {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Hidden state for Card B volume */
.volume-b-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.volume-b-wrapper.hidden {
  display: none;
}

/* ==========================================================================
   Center Axis & Guess Controls
   ========================================================================== */

.center-axis {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.vs-badge {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: #0f172a;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 900;
  color: #e2e8f0;
  letter-spacing: 0.05em;
  position: absolute;
  z-index: 42;
  transition: transform 0.2s ease;
}

/* Buttons Container */
.controls-container {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  margin-top: 0.75rem;
  z-index: 10;
  pointer-events: auto;
}

.controls-container.hidden {
  display: none !important;
}

.btn-guess {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.4rem;
  border-radius: 9999px;
  font-size: 0.95rem;
  font-weight: 700;
  border: 2px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

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

.btn-guess:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-higher {
  background: #ffffff;
  color: #0f172a;
  border-color: #ffffff;
}

.btn-higher:hover:not(:disabled) {
  background: #f8fafc;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.btn-lower {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
}

.btn-lower:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.22);
  border-color: #ffffff;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.btn-guess svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* ==========================================================================
   Desktop Layout (@media min-width: 768px)
   Horizontal 50/50 Split
   ========================================================================== */

@media (min-width: 768px) {
  .game-container {
    flex-direction: row;
  }

  .card {
    flex: 1 1 50%;
    width: 50vw;
    height: 100vh;
    height: 100dvh;
    padding: 5rem 3rem;
  }

  .card-a {
    border-bottom: none;
    border-right: 2px solid rgba(255, 255, 255, 0.08);
  }

  .center-axis {
    flex-direction: column;
  }

  .vs-badge {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1rem;
  }

  .controls-container {
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1.25rem;
  }

  .btn-guess {
    padding: 0.9rem 2.2rem;
    font-size: 1.05rem;
    min-width: 170px;
  }
}

/* ==========================================================================
   Game Over Modal Screen
   ========================================================================== */

.game-over-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.game-over-overlay.hidden {
  display: none;
  opacity: 0;
}

.game-over-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.15);
  border-radius: 1.5rem;
  max-width: 480px;
  width: 100%;
  padding: 2.25rem 2rem;
  text-align: center;
  animation: modalPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalPop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.game-over-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.game-over-title {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.game-over-score {
  font-size: 1.25rem;
  color: #e2e8f0;
  margin-bottom: 0.75rem;
}

.game-over-score span.score-highlight {
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--color-text-gold);
  display: block;
  margin-top: 0.25rem;
  line-height: 1;
}

.game-over-message {
  font-size: 1rem;
  color: #94a3b8;
  font-style: italic;
  margin-bottom: 1.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.game-over-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Game Over Action Buttons */
.btn-action-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.95rem 1.5rem;
  background: var(--color-brand);
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  border-radius: 0.875rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.4);
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-action-primary:hover {
  background: var(--color-brand-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -4px rgba(79, 70, 229, 0.5);
}

/* Meta Share Section */
.share-section {
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.share-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.6rem;
}

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

.btn-share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-share:hover {
  transform: translateY(-1px);
}

.btn-share svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.btn-share-whatsapp {
  background: rgba(37, 211, 102, 0.15);
  border-color: rgba(37, 211, 102, 0.3);
  color: #4ade80;
}

.btn-share-whatsapp:hover {
  background: rgba(37, 211, 102, 0.25);
  border-color: rgba(37, 211, 102, 0.5);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

.btn-share-facebook {
  background: rgba(24, 119, 242, 0.15);
  border-color: rgba(24, 119, 242, 0.3);
  color: #60a5fa;
}

.btn-share-facebook:hover {
  background: rgba(24, 119, 242, 0.25);
  border-color: rgba(24, 119, 242, 0.5);
  box-shadow: 0 4px 12px rgba(24, 119, 242, 0.2);
}

.btn-share-threads {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
}

.btn-share-threads:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.btn-share-copy {
  background: rgba(129, 140, 248, 0.15);
  border-color: rgba(129, 140, 248, 0.3);
  color: #a5b4fc;
}

.btn-share-copy:hover {
  background: rgba(129, 140, 248, 0.25);
  border-color: rgba(129, 140, 248, 0.5);
  box-shadow: 0 4px 12px rgba(129, 140, 248, 0.2);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #1e293b;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast.hidden {
  opacity: 0;
  transform: translate(-50%, 10px);
}

.btn-action-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 0.875rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-action-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-action-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  border-radius: 0.875rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
  transition: all 0.2s ease;
  text-decoration: none;
  margin-top: 0.5rem;
}

.btn-action-cta:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-action-cta svg,
.btn-action-secondary svg,
.btn-action-primary svg {
  width: 1.2rem;
  height: 1.2rem;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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