:root {
  --paper: #FBF7F0;
  --paper-2: #FFFDF9;
  --ink: #2C2825;
  --muted: #8A8178;
  --line: #E9E1D4;
  --accent: #C56A3E;
  --accent-deep: #A84F2A;
  --accent-soft: #F3E3D5;
  --glow-1: #E7A35C;
  --glow-2: #D8772F;
  --glow-3: #B8431D;
  --shadow: 0 1px 2px rgba(44, 40, 37, .04), 0 8px 30px rgba(44, 40, 37, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.sky {
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
  /* a soft dawn sky from the top */
  background:
    radial-gradient(120% 60% at 50% -10%, #FCEBDA 0%, rgba(252,235,218,0) 60%),
    var(--paper);
}

/* header */
.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin: 8px 2px 22px;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.mark {
  font-family: "Lora", Georgia, serif;
  font-weight: 600;
  font-size: 30px;
  letter-spacing: .2px;
  line-height: 1;
}
.sub {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  font-family: "Lora", Georgia, serif;
}
.when {
  font-family: "Inter", sans-serif;
  font-size: 13px;
  color: var(--accent-deep);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

/* card */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px 20px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.field { display: flex; flex-direction: column; gap: 11px; }
.q {
  font-family: "Lora", Georgia, serif;
  font-weight: 500;
  font-size: 18px;
  letter-spacing: .1px;
}

.text {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.text::placeholder { color: #BBB1A4; }
.text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.area { resize: none; line-height: 1.45; }

/* pills */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.pills.subtle { margin-top: 2px; }
.pills-label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 2px;
  letter-spacing: .3px;
}
.pill {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--tint, var(--paper));
  border: 1px solid var(--pill-border, var(--line));
  border-radius: 999px;
  padding: 9px 15px;
  cursor: pointer;
  transition: all .14s ease;
  line-height: 1;
}
.pill.sm { font-size: 13px; padding: 7px 12px; color: var(--muted); }
.pill:hover { filter: brightness(0.96); }
.pill[aria-pressed="true"] {
  background: var(--tint-strong, var(--accent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(60, 42, 30, .20);
}
.pill.sm[aria-pressed="true"] {
  box-shadow: 0 3px 10px rgba(60, 42, 30, .14);
}
/* tinted (gradient) pills carry their own text color, theme-independent,
   because the tint is always a light pastel — fixes dark-mode readability */
.pill.tinted { color: #2A2622; }
.pill.tinted[aria-pressed="true"] { color: #fff; }

/* fuel flames */
.flames { margin-top: 2px; }
.flame { display: inline-flex; align-items: center; gap: 8px; }
.flame .dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block;
}
/* dark (flicker) -> light (blaze), matching the dark->light gradient */
.f1 .dot { background: var(--glow-3); }
.f2 .dot { background: var(--glow-2); }
.f3 .dot { background: var(--glow-1); }
.flame[aria-pressed="true"] { border-color: transparent; }
.f1[aria-pressed="true"] { background: var(--glow-3); color: #fff; box-shadow: 0 6px 20px rgba(184,67,29,.34); }
.f2[aria-pressed="true"] { background: var(--glow-2); color: #fff; box-shadow: 0 4px 16px rgba(216,119,47,.32); }
.f3[aria-pressed="true"] { background: var(--glow-1); color: #2A2622; box-shadow: 0 4px 14px rgba(231,163,92,.34); }
.f1[aria-pressed="true"] .dot, .f2[aria-pressed="true"] .dot { background: rgba(255,255,255,.9); }
.f3[aria-pressed="true"] .dot { background: rgba(42,38,34,.55); }

/* save */
.save {
  margin-top: 4px;
  font-family: "Lora", Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: var(--accent-deep);
  border: none;
  border-radius: 14px;
  padding: 15px;
  cursor: pointer;
  transition: transform .1s ease, background .15s ease, opacity .2s ease;
  box-shadow: 0 6px 20px rgba(168, 79, 42, .26);
}
.save:hover { background: #97461F; }
.save:active { transform: translateY(1px); }
.save.saved { background: #6E8B5B; box-shadow: 0 6px 20px rgba(110,139,91,.3); }

.status {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  min-height: 16px;
  margin: 2px 0 0;
  font-style: italic;
  font-family: "Lora", Georgia, serif;
}

.foot {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1C1A18;
    --paper-2: #232020;
    --ink: #ECE5DB;
    --muted: #9A9087;
    --line: #34302B;
    --accent-soft: #3A2A20;
  }
  .sky { background: radial-gradient(120% 60% at 50% -10%, #2A211B 0%, rgba(42,33,27,0) 60%), var(--paper); }
  .pill[aria-pressed="true"], .save { color: #fff; }
}
