/* Roda da Vida — folha única, sem framework.
   Paleta: papel sálvia, tinta pinho, viridiano como cor de ação,
   âmbar reservado ao apoio/doação. As cores das áreas vêm do próprio
   círculo cromático da roda (ver wheel.js). */

:root {
  --paper: #f5f8f6;
  --card: #ffffff;
  --ink: #22312e;
  --muted: #67766f;
  --line: #dfe8e3;
  --primary: #2e7d6b;
  --primary-deep: #1e5b4d;
  --primary-soft: #e3f0ec;
  --amber: #d9a24e;
  --amber-deep: #a8742a;
  --danger: #b0574a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(34, 49, 46, 0.06), 0 8px 24px -12px rgba(34, 49, 46, 0.18);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; }

button { font-family: inherit; cursor: pointer; }

:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 14px 90px; }

/* ---------- Landing ---------- */
.landing { min-height: 100svh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 28px 20px; }
.landing h1 { font-size: clamp(2.1rem, 8vw, 3rem); letter-spacing: -0.02em; }
.landing .tagline { color: var(--muted); max-width: 30rem; margin: 10px auto 4px; }
.landing .how { max-width: 32rem; margin: 18px auto; }
.landing .privacy { font-size: 0.8rem; color: var(--muted); margin-top: 22px; max-width: 26rem; }
.landing .wheel-hero { width: min(62vw, 300px); height: auto; margin-bottom: 18px; }
.g_id_signin { display: flex; justify-content: center; margin-top: 18px; }

/* ---------- Cabeçalho do app ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 2px 10px; }
.topbar .who h1 { font-size: 1.25rem; line-height: 1.2; }
.topbar .who p { margin: 2px 0 0; color: var(--muted); font-size: 0.8rem; }
.topbar .actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.btn { border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font-size: 0.85rem; font-weight: 500;
  transition: background 0.15s, border-color 0.15s; }
.btn:hover { border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-deep); }
.btn-amber { background: var(--amber); border-color: var(--amber); color: #3d2c10; }
.btn-amber:hover { background: #c78f3d; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); border-color: var(--line); }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-flex;
  align-items: center; justify-content: center; font-size: 1rem; }

select.lang { border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 7px 10px; font-size: 0.8rem; font-family: inherit; }

/* ---------- Roda ---------- */
.wheel-card { position: sticky; top: 0; z-index: 20; background: var(--paper);
  padding: 6px 0 10px; }
.wheel-frame { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px;
  display: flex; justify-content: center; }
#wheelCanvas { width: 100%; max-width: 460px; height: auto; touch-action: manipulation; }
.save-state { text-align: center; font-size: 0.72rem; color: var(--muted);
  min-height: 1.1em; margin-top: 6px; }
.save-state.err { color: var(--danger); }

/* ---------- Lista de áreas ---------- */
.hint { color: var(--muted); font-size: 0.82rem; margin: 14px 2px 10px; text-align: left; }

.area-card { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 12px 10px; margin-bottom: 10px;
  text-align: left; border-left: 5px solid var(--line); }
.area-card .name { font-family: var(--font-display); font-size: 1.02rem;
  font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.area-card .desc { color: var(--muted); font-size: 0.8rem; margin: 3px 0 9px; }
.area-card .remove { border: 0; background: none; color: var(--muted);
  font-size: 0.72rem; padding: 4px 6px; border-radius: 6px; flex-shrink: 0; }
.area-card .remove:hover { color: var(--danger); background: #f7ecea; }

.scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.scale button { border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); border-radius: 8px; padding: 7px 0; font-size: 0.85rem;
  font-variant-numeric: tabular-nums; transition: transform 0.08s; }
.scale button:active { transform: scale(0.92); }
.scale button.on { background: var(--area-color, var(--primary));
  border-color: var(--area-color, var(--primary)); color: #fff; font-weight: 700; }

.add-row { display: flex; gap: 8px; margin: 14px 0 6px; }
.add-row input { flex: 1; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 0.9rem; font-family: inherit; background: var(--card); }
.add-row input:focus { border-color: var(--primary); outline: none; }

/* ---------- Barra inferior ---------- */
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(245, 248, 246, 0.92); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); }
.bottombar .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 8px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
.bottombar .btn { flex: 1; padding: 11px 8px; font-size: 0.88rem; }

/* ---------- Overlays (evolução e doação) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(34, 49, 46, 0.45);
  display: none; align-items: flex-end; justify-content: center; z-index: 50; }
.overlay.open { display: flex; }
.sheet { background: var(--card); border-radius: 18px 18px 0 0; width: 100%;
  max-width: 640px; max-height: 88svh; overflow-y: auto; padding: 18px 16px 26px;
  animation: rise 0.22s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet h2 { font-size: 1.3rem; }

/* Evolução */
.spark-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px;
  align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.spark-row .label { font-size: 0.86rem; font-weight: 600; }
.spark-row .delta { font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.spark-row .delta.up { color: var(--primary-deep); }
.spark-row .delta.down { color: var(--danger); }
.spark-row svg { grid-column: 1 / -1; width: 100%; height: 44px; display: block; }

/* Doação */
.donate-text { font-size: 0.9rem; color: var(--ink); }
.donate-type { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 10px; }
.donate-type button { border: 1.5px solid var(--line); background: var(--paper);
  border-radius: 10px; padding: 10px; font-size: 0.85rem; }
.donate-type button.on { border-color: var(--amber-deep); background: #fbf3e4; font-weight: 600; }
.amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.amounts button { border: 1.5px solid var(--line); background: var(--paper);
  border-radius: 10px; padding: 12px 4px; font-size: 0.95rem; font-weight: 600;
  font-variant-numeric: tabular-nums; }
.amounts button.on { border-color: var(--amber-deep); background: #fbf3e4; }
.custom-amount { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.custom-amount input { flex: 1; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 0.95rem; font-family: inherit; }
.donate-secure { font-size: 0.72rem; color: var(--muted); text-align: center; margin-top: 10px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 0.84rem; z-index: 60; opacity: 0; pointer-events: none;
  transition: opacity 0.25s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; }

/* ---------- Admin ---------- */
.admin-card { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin: 12px 0; text-align: left; }
.admin-card label { display: block; font-size: 0.8rem; font-weight: 600; margin: 10px 0 4px; }
.admin-card input, .admin-card textarea { width: 100%; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 0.9rem; font-family: inherit; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--primary-soft); border-radius: 10px; padding: 12px; }
.stat b { font-family: var(--font-display); font-size: 1.5rem; display: block; }
.stat span { font-size: 0.75rem; color: var(--muted); }

@media (min-width: 700px) {
  body { font-size: 16px; }
  .wheel-card { position: static; }
}

/* ---------- Compartilhar / Instalar no iOS ---------- */
.share-options { display: grid; gap: 10px; margin-bottom: 14px; }
.share-options .btn { width: 100%; padding: 13px; }
.share-options .btn:not(.btn-primary) { background: var(--primary-soft); color: var(--primary-deep); border: 0; border-radius: 999px; }
.ios-steps { margin: 0 0 14px; padding-left: 22px; }
.ios-steps li { margin-bottom: 10px; }
