:root {
  --bg: #fbf4e8;
  --ink: #1f1a17;
  --muted: #6e6259;
  --accent: #d94f30;
  --accent-deep: #a93a20;
  --accent-soft: #fde3d9;
  --secondary: #2d7a7a;
  --secondary-soft: #dff0ef;
  --accent-ink: #fff;
  --card: #ffffff;
  --card-tint: #fffaf3;
  --border: #eadfce;
  --border-strong: #d8c9b0;
  --shadow: 0 2px 8px rgba(73, 45, 20, 0.06);
  --shadow-hover: 0 14px 34px rgba(73, 45, 20, 0.16);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Warm, softly glowing background with a few gentle radial blooms.
   `fixed` so it stays put while the page scrolls. */
body {
  background:
    radial-gradient(at 12% 8%,  rgba(255, 196, 150, 0.55) 0%, transparent 48%),
    radial-gradient(at 88% 12%, rgba(255, 218, 176, 0.45) 0%, transparent 52%),
    radial-gradient(at 78% 92%, rgba(217, 183, 216, 0.35) 0%, transparent 55%),
    radial-gradient(at 15% 85%, rgba(183, 219, 209, 0.38) 0%, transparent 55%),
    linear-gradient(135deg, #fff7eb 0%, #fbefd9 55%, #f6e4c3 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.25rem 4rem;
}

/* ---------- Site header (flag + hamburger) ---------- */

/* The native `hidden` attribute is the source of truth for open/closed
   dropdowns. Without this rule, class-level `display: flex` would override
   the UA stylesheet's `display: none`, leaving menus always visible. */
[hidden] { display: none !important; }

.site-header {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem 0;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  position: relative;
  z-index: 20;
}

.control { position: relative; }

.icon-btn {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
}
.icon-btn:hover { background: #fff; border-color: var(--accent); box-shadow: var(--shadow-hover); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
}

.lang-btn { padding: 0; }
#lang-flag { display: flex; align-items: center; justify-content: center; }

.flag-svg {
  display: block;
  width: 22px;
  height: auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}

/* Shared dropdown panel */
.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-hover);
  padding: 0.25rem;
  min-width: 180px;
  display: flex;
  flex-direction: column;
}

/* Hamburger dropdown links */
.menu a {
  display: block;
  padding: 0.6rem 0.85rem;
  text-decoration: none;
  color: var(--ink);
  border-radius: 6px;
  font-size: 0.95rem;
}
.menu a:hover { background: var(--bg); }

/* Language dropdown options */
.lang-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.8rem;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
  text-align: left;
}
.lang-option:hover { background: var(--bg); }
.lang-option .flag-svg { width: 24px; }

/* ---------- Back link ---------- */

.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Stats page ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}
@media (max-width: 540px) {
  .stats-grid { grid-template-columns: 1fr; }
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 3.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.03em;
}
.stat-label {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.stats-note {
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 600px;
}

/* ---------- Admin page ---------- */

.admin-box {
  max-width: 560px;
}
.warning {
  background: #fdf3ef;
  border: 1px solid #f0c6b5;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  color: #8a3a20;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}
.warning strong { color: #6e2a14; }
.create-form button.danger {
  background: #b3271c;
}
.create-form button.danger:hover { opacity: 0.9; }

footer {
  padding: 1rem 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
}

footer a { color: var(--accent-deep); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.crumb {
  color: var(--muted);
  text-decoration: none;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  max-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.crumb:hover {
  background: #fff;
  color: var(--ink);
  border-color: var(--border);
}
.crumb.current {
  color: var(--ink);
  font-weight: 600;
}
.crumb-sep {
  color: #c8c3b8;
  user-select: none;
}

/* Prompt / heading */
.prompt {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 600;
  font-style: normal;
  margin: 0 0 0.75rem;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
}
.sub {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: 1.05rem;
}
.sub em {
  color: var(--accent-deep);
  font-style: normal;
  font-weight: 600;
  font-family: var(--font-display);
}

/* Philosophical intro (root page only) */
.intro {
  max-width: 720px;
  margin: 0.75rem 0 2rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.65;
  font-style: italic;
}
.intro em {
  color: var(--accent);
  font-style: italic;
  font-weight: 700;
  font-family: var(--font-display);
}

/* Encouraging line (all pages except root) */
.encouragement {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.25rem 0.75rem;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Creator's note / description on a page */
.description {
  margin: 0 0 2rem;
  padding: 1rem 1.25rem 1rem 1.5rem;
  border-left: 4px solid var(--accent);
  background: var(--card-tint);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 720px;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.6;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  position: relative;
}
.description-heading {
  display: block;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.72rem;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.description-text {
  display: block;
  white-space: pre-wrap;
}

/* Description textarea on the create form */
.create-form .description-label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}
.create-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  resize: vertical;
  min-height: 70px;
}
.create-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 79, 48, 0.15);
}

/* Choice buttons */
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1rem;
}
@media (max-width: 640px) {
  .choices { grid-template-columns: 1fr; }
}

.choice {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
  position: relative;
}
.choice::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 0 var(--accent);
  transition: box-shadow 0.18s ease;
  pointer-events: none;
}
.choice:hover,
.choice:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
  outline: none;
}
.choice:hover::after,
.choice:focus-visible::after {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.choice:active {
  transform: translateY(-1px);
}

.choice img,
.choice .no-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, #f6eadd 0%, #ead9bf 100%);
}
.choice .no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.15rem;
  font-style: italic;
  font-family: var(--font-display);
}

.choice-label {
  display: block;
  padding: 1rem 1.25rem;
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.015em;
  color: var(--ink);
}

/* ---------- Create page: a moment of arrival ---------- */

.create-hero {
  max-width: 720px;
  margin: 0 0 2rem;
}

.celebrate-badge {
  display: inline-block;
  margin: 0 0 1.25rem;
  padding: 0.35rem 0.95rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: var(--accent-ink);
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(217, 79, 48, 0.28);
}

.prompt-celebrate {
  font-size: clamp(2.25rem, 5.5vw, 3.75rem);
  line-height: 1.08;
  margin: 0 0 1.25rem;
  background: linear-gradient(120deg, #3b2618 0%, var(--accent-deep) 60%, var(--accent) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent-deep);        /* fallback for older browsers */
  letter-spacing: -0.03em;
}

.celebration {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.1rem, 1.6vw, 1.3rem);
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 1.5rem;
  max-width: 680px;
}

.flourish {
  color: var(--border-strong);
  letter-spacing: 0.6em;
  font-size: 1.25rem;
  margin: 0 0 1.25rem;
  user-select: none;
}

.call-to-action {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-style: italic;
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink);
  max-width: 680px;
  margin: 0 0 2rem;
}
.call-to-action em {
  color: var(--accent-deep);
  font-weight: 700;
  font-style: normal;
  font-family: var(--font-display);
}

/* Create form */
.create-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 600px;
  box-shadow: var(--shadow);
}

/* Extra dressing for the create flow specifically */
.create-form-celebrate {
  background: linear-gradient(180deg, #ffffff 0%, var(--card-tint) 100%);
  border-color: var(--border-strong);
  box-shadow: 0 12px 32px rgba(73, 45, 20, 0.08);
  padding: 1.75rem;
}
.create-form-celebrate button[type="submit"] {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  padding: 0.85rem 1.5rem;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px rgba(217, 79, 48, 0.28);
}
.create-form-celebrate button[type="submit"]:hover {
  box-shadow: 0 8px 22px rgba(217, 79, 48, 0.36);
  opacity: 1;
  transform: translateY(-1px);
}

/* Two option inputs side by side */
.create-form .options-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.create-form .options-row label { margin-bottom: 0; }
@media (max-width: 480px) {
  .create-form .options-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .create-form .options-row label { margin-bottom: 1rem; }
}

/* Smaller, tucked-away name field */
.create-form .name-label {
  max-width: 240px;
  font-size: 0.85rem;
}
.create-form .name-label input {
  font-size: 0.95rem;
}
.create-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}
.create-form input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
.create-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 79, 48, 0.15);
}
.create-form button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  padding: 0.7rem 1.25rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.create-form button:hover { opacity: 0.9; }
.create-form button:active { transform: translateY(1px); }
.create-form button:disabled { opacity: 0.5; cursor: not-allowed; }

.create-form .hint {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.error {
  color: #b3271c;
  font-size: 0.95rem;
}

.loading {
  color: var(--muted);
  font-size: 1rem;
  padding: 2rem 0;
}

.rate-limit-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 520px;
  box-shadow: var(--shadow);
}
.rate-limit-box p {
  margin-top: 0;
}
