/* sfpurity-style theme: Hacker News beige, orange accents, left-aligned,
   tight checklist. Values mirror the Tailwind sizes used there. */

:root {
  --bg: #f6f6ef;        /* page beige */
  --orange: #ff6600;    /* title orange */
  --orange-btn: #f97316;/* button orange (orange-500) */
  --orange-btn-hover: #ea580c; /* orange-600 */
  --ink: #111827;
  --gray: #374151;
  --border: #9ca3af;
}

* { box-sizing: border-box; }

/* the hidden attribute must always win, even over display:flex rules */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.container {
  max-width: 48rem; /* max-w-3xl */
  margin: 0 auto;
  padding: 1rem;    /* p-4 */
}

/* ---------- Header ---------- */
.title {
  font-size: 2.25rem;   /* text-4xl */
  font-weight: 700;
  color: var(--orange);
  margin: 0 0 1.5rem;   /* mb-6 */
  line-height: 1.15;
}

.intro { margin: 0 0 1rem; }

.caution {
  font-weight: 700;
  margin: 0 0 2.5rem;   /* mb-10 */
}

/* ---------- Question list ---------- */
.question-list {
  list-style: none;
  margin: 0 0 1.5rem;  /* mb-6 */
  padding: 0;
}

.question-list li + li { margin-top: 0.25rem; } /* space-y-1 */

.question {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 1.125rem; /* text-lg */
}

.question input {
  appearance: none;
  width: 1rem;         /* h-4 w-4 */
  height: 1rem;
  min-width: 1rem;
  margin: 0 0.75rem 0 0; /* mr-3 */
  border: 1px solid var(--ink);
  border-radius: 0.125rem; /* rounded-sm */
  background: transparent;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
}

.question input:checked {
  background: var(--orange-btn);
  border-color: var(--orange-btn);
}

.question input:checked::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  background: #fff;
}

.question input:focus-visible {
  outline: 2px solid var(--orange-btn);
  outline-offset: 2px;
}

.load-error {
  color: #b00020;
  font-weight: bold;
}

/* ---------- Buttons ---------- */
.calc-row {
  display: flex;
  justify-content: center;
  width: 100%;
}

.btn-primary {
  font: inherit;
  font-size: 0.875rem;   /* text-sm */
  font-weight: 500;
  color: #fff;
  background: var(--orange-btn);
  border: none;
  border-radius: 0.375rem; /* rounded-md */
  height: 2.5rem;          /* h-10 */
  padding: 0.5rem 1rem;
  width: 100%;
  max-width: 24rem;        /* max-w-sm */
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-primary:hover { background: var(--orange-btn-hover); }

.btn-dark {
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: #0f172a;
  border: none;
  border-radius: 0.375rem;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.15s;
}

.btn-dark:hover { background: #1e293b; }

.btn-outline {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--orange-btn-hover);
  background: transparent;
  border: 1px solid var(--orange-btn);
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.15s;
}

.btn-outline:hover { background: rgba(249, 115, 22, 0.08); }

/* ---------- Dedicated results page ---------- */
.result-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-container {
  width: 100%;
  max-width: 52rem;
  padding: 2rem 1rem;
}

.result-panel {
  text-align: center;
}

.result-title {
  margin: 0 0 1.5rem;
  color: #020617;
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.1;
}

.result-score {
  margin: 0 0 1.5rem;
  color: var(--orange);
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 1;
}

.result-score strong {
  font: inherit;
}

.result-score span {
  font: inherit;
}

.result-comment {
  max-width: 42rem;
  margin: 0 auto 1rem;
  color: #020617;
  font-size: 1.9rem;
  line-height: 1.35;
}

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

.result-actions .btn-result {
  width: auto;
  max-width: none;
  height: auto;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.result-ai-control {
  position: relative;
  display: inline-block;
}

.result-ai-bubble {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.75rem);
  width: min(18rem, 80vw);
  margin: 0;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--orange-btn);
  border-radius: 0.75rem 0.75rem 0.125rem 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.result-extra-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

/* ---------- Ask an AI Assistant pill ---------- */
.ask-ai {
  position: fixed;
  bottom: 1rem;   /* bottom-4 */
  right: 1rem;    /* right-4 */
  width: 200px;
  height: 3rem;   /* h-12 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background: var(--orange-btn);
  border: none;
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  transition: background-color 0.15s;
  z-index: 10;
}

.ask-ai:hover { background: var(--orange-btn-hover); }

.ask-ai svg { width: 1.5rem; height: 1.5rem; }

.ask-ai-bubble {
  position: fixed;
  bottom: 4.5rem;
  right: 1rem;
  max-width: 16rem;
  background: #fff;
  border: 1px solid var(--orange-btn);
  border-radius: 0.75rem 0.75rem 0.125rem 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  z-index: 10;
  margin: 0;
}

/* ---------- Share modal ---------- */
.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.share-modal {
  position: relative;
  background: #fff;
  border-radius: 1rem;
  padding: 2rem 2rem 1.75rem;
  width: 100%;
  max-width: 26rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modal-in 0.2s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.share-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--gray);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.share-modal-close:hover { background: rgba(0, 0, 0, 0.05); }

.share-modal-title {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.share-modal-section {
  text-align: center;
}

.share-modal-section-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.share-modal-desc {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--gray);
}

.share-modal-btn {
  width: 100%;
  text-align: center;
  margin-bottom: 0.5rem;
}

.share-modal-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.share-modal-grid .share-modal-btn { margin-bottom: 0; }

.share-modal-link-photo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.share-modal-link-photo .share-modal-btn { margin-bottom: 0; }

.share-modal-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.25rem 0;
}

/* ---------- Footer ---------- */
.footer {
  color: var(--gray);
  text-align: center;
  padding: 1.5rem 1rem; /* py-6 */
  margin-top: 2rem;     /* mt-8 */
  font-size: 0.875rem;  /* text-sm */
}

.footer p { margin: 0 0 1rem; }

@media (max-width: 480px) {
  .title { font-size: 1.9rem; }
  .result-body { align-items: flex-start; }
  .result-container { padding-top: 4rem; }
  .result-title { font-size: 2rem; }
  .result-score { font-size: 3.5rem; }
  .result-comment { font-size: 1.35rem; }
  .result-actions { gap: 0.75rem; }
  .result-actions .btn-result,
  .result-actions .btn-dark {
    flex: 1 1 100%;
    text-align: center;
  }
  .result-ai-control {
    display: block;
    width: 100%;
  }
  .result-ai-control .btn-result {
    width: 100%;
  }
}
