:root {
  --bg: #faf5ef;
  --primary: #d97706;
  --primary-soft: #fbbf24;
  --text: #111827;
  --muted: #6b7280;
  --card-bg: #ffffff;
  --radius: 18px;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans Devanagari", "Noto Sans Bengali", sans-serif;
}

body {
  background: radial-gradient(circle at top, #fff7ed, var(--bg));
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.app {
  max-width: 640px;
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.8rem 1.8rem 2.4rem;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.logo-circle {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: conic-gradient(from 160deg, #f97316, #facc15, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff7ed;
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: 0 6px 16px rgba(248, 113, 22, 0.6);
}

.title {
  font-size: 1.1rem;
  font-weight: 700;
}

.subtitle {
  font-size: 0.86rem;
  color: var(--muted);
}

/* Progress */
.progress-wrapper {
  margin-bottom: 1rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.progress-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #f97316, #facc15);
  transition: width 0.25s ease-out;
}

/* Question */
.question-text {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.9rem;
}

.options {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.2rem;
}

.option-btn {
  width: 100%;
  text-align: left;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  background: #f9fafb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.08s ease;
}

.option-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  border-color: rgba(217, 119, 6, 0.65);
  background: #ffffff;
}

.option-btn.selected {
  border-color: rgba(217, 119, 6, 0.95);
  background: #fff7ed;
  box-shadow: 0 6px 16px rgba(248, 113, 22, 0.25);
}

.option-btn .label {
  flex: 1;
}

.option-btn .bubble {
  font-size: 0.7rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.06);
  color: var(--primary);
  border: 1px solid rgba(217, 119, 6, 0.28);
  margin-left: 0.6rem;
}

/* Navigation */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.btn {
  border-radius: 999px;
  border: none;
  padding: 0.55rem 1rem;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.08s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #f97316, #facc15);
  color: #fff7ed;
  box-shadow: 0 8px 20px rgba(248, 113, 22, 0.7);
}

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

.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(248, 113, 22, 0.75);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.btn-ghost:hover {
  background: #f9fafb;
}

.helper-text {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* Result container */
.result {
  display: none;
  justify-content: center;
  align-items: center;
  margin-top: 0.5rem;
}

/* Modern share-card style */
.result-card {
  width: 100%;
  max-width: 480px;
  padding: 2.5rem 1.8rem 1.7rem;
  border-radius: 26px;
  background: radial-gradient(circle at top left, #fed7aa, #f97316 40%, #111827 130%);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.55);
  color: #f9fafb;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Glow ring behind the percentage */
.result-card::before {
  content: "";
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 320px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(254, 243, 199, 0.22), transparent 70%);
  pointer-events: none;
}

/* Subtle corner accent */
.result-card::after {
  content: "ॐ";
  position: absolute;
  bottom: 14px;
  right: 16px;
  font-size: 1.4rem;
  opacity: 0.14;
}

.result-title {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 0.2rem;
}

.result-subtitle {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-bottom: 1.5rem;
}

.result-percentage {
  font-size: 5.5rem;
  font-weight: 900;
  margin-bottom: 0.3rem;
  letter-spacing: 0.08em;
  line-height: 1;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.result-percentage span {
  font-size: 2.5rem;
  margin-left: 0.1rem;
  opacity: 0.9;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(252, 211, 77, 0.35);
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
}

.result-badge-emoji {
  font-size: 1.1rem;
}

.result-text {
  font-size: 0.96rem;
  margin-bottom: 0rem;
  opacity: 0.94;
  line-height: 1.5;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.8rem;
  flex-wrap: wrap;
}

/* Slightly tweak buttons on result card */
.result-actions .btn-primary {
  background: linear-gradient(135deg, #22c55e, #bef264);
  color: #052e16;
  box-shadow: 0 10px 30px rgba(21, 128, 61, 0.75);
}

.result-actions .btn-primary:hover {
  box-shadow: 0 12px 34px rgba(21, 128, 61, 0.85);
}

.result-actions .btn-share {
  border-color: rgba(248, 250, 252, 0.35);
  color: #e5e7eb;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.5);
}

.result-actions .btn-share:hover {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 12px 34px rgba(59, 130, 246, 0.65);
}

.result-actions .btn-share:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result-actions .btn-ghost {
  border-color: rgba(248, 250, 252, 0.35);
  color: #e5e7eb;
  background: rgba(15, 23, 42, 0.38);
}

.result-actions .btn-ghost:hover {
  background: rgba(15, 23, 42, 0.65);
}

.restart-wrapper {
  margin-top: 1rem;
}

/* Better image capture */
.result-card.capturing {
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.65);
}

.result-card.capturing .result-actions {
  display: none !important;
}

/* Share Modal */
.share-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.share-modal-content {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

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

.share-modal-content h3 {
  margin: 0 0 1rem 0;
  color: var(--primary);
  font-size: 1.4rem;
  text-align: center;
}

.share-modal-content p {
  margin: 0.5rem 0 1.5rem 0;
  color: var(--text);
  font-size: 0.95rem;
  text-align: center;
}

.image-preview {
  margin: 1.5rem 0;
  text-align: center;
}

.image-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 1rem;
}

.image-url-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.5rem 0 0.25rem 0 !important;
}

.share-url {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0.5rem 0 1rem 0;
  word-break: break-all;
  font-size: 0.75rem;
  color: var(--primary);
  font-family: monospace;
  text-align: center;
  max-height: 60px;
  overflow-y: auto;
}

.share-buttons {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.share-option {
  width: 100%;
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  transition: all 0.2s ease;
  color: white;
}

.share-option svg {
  width: 24px;
  height: 24px;
}

.facebook-share {
  background: #1877f2;
}

.facebook-share:hover {
  background: #165dcc;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(24, 119, 242, 0.4);
}

.twitter-share {
  background: #1da1f2;
}

.twitter-share:hover {
  background: #1a8cd8;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(29, 161, 242, 0.4);
}

.whatsapp-share {
  background: #25d366;
}

.whatsapp-share:hover {
  background: #20ba5a;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.copy-link {
  background: #6b7280;
}

.copy-link:hover {
  background: #4b5563;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

.share-url {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
  word-break: break-all;
  font-size: 0.85rem;
  color: var(--primary);
  font-family: monospace;
  text-align: center;
}

.share-instruction {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.close-modal {
  width: 100%;
  margin-top: 1rem;
}

/* Result Page Styles */
.result-page {
  max-width: 800px;
}

.result-display {
  margin-top: 2rem;
  text-align: center;
}

.result-image {
  max-width: 100%;
  max-height: 600px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  margin-bottom: 3rem;
}

.cta-section {
  background: linear-gradient(135deg, #fff7ed, #fed7aa);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  margin-top: 2rem;
}

.cta-section h3 {
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.cta-section p {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.cta-section .btn {
  display: inline-flex;
  text-decoration: none;
}

.error-message {
  font-size: 1.1rem;
  color: var(--muted);
  padding: 3rem;
}

/* Language Selector */
.language-selector {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--card-bg);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.lang-toggle:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.15);
}

.lang-toggle svg {
  width: 20px;
  height: 20px;
  stroke: var(--muted);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--card-bg);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  min-width: 150px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.language-selector.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  transition: background 0.2s ease;
}

.lang-option:first-child {
  border-radius: 8px 8px 0 0;
}

.lang-option:last-child {
  border-radius: 0 0 8px 8px;
}

.lang-option:hover {
  background: #fef3c7;
}

.lang-option.active {
  background: #fef3c7;
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 540px) {
  .app {
    padding: 1.4rem 1.25rem 1.9rem;
  }

  .nav-buttons {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .language-selector {
    top: 1rem;
    right: 1rem;
  }

  .lang-toggle {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }
}

