/* Life Reset — design system
   Tokens lifted from the Claude Design mockup (Life Reset.dc.html) and the
   redesign spec's "Referencia visual": dark plum ground, dense RPG stat-tracker
   cards, glow reserved for ACTIVE elements only, one accent colour per data type. */

:root {
  color-scheme: dark;

  --plum-900: #120A15;   /* page ground */
  --plum-850: #150B18;
  --plum-800: #1A0F1E;   /* device / sheet ground */
  --plum-700: #221224;   /* raised sheet */
  --plum-600: #2A1230;

  --ink:      #F3EAF5;
  --ink-70:   rgba(243,234,245,.7);
  --ink-55:   rgba(243,234,245,.55);
  --ink-45:   rgba(243,234,245,.45);
  --ink-38:   rgba(243,234,245,.38);

  --line:     rgba(255,255,255,.08);
  --line-2:   rgba(255,255,255,.14);
  --fill:     rgba(255,255,255,.04);
  --fill-2:   rgba(255,255,255,.06);

  /* one accent per data type */
  --violet:   #B071F5;   /* mission / level */
  --violet-d: #6B2FA8;
  --teal:     #3FD9C8;   /* reward / HP up */
  --green:    #7BD64B;   /* success */
  --orange:   #FF8A3D;   /* failure / punishment */
  --orange-d: #D9541F;
  --gold:     #F5C542;   /* difficulty / achievement */

  --r-card: 22px;
  --r-lg:   16px;
  --r-md:   12px;
  --r-sm:   9px;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --maxw: 460px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--plum-900);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
::-webkit-scrollbar { width: 0; height: 0; }
button { font: inherit; color: inherit; }
a { color: var(--violet); text-decoration: none; }

@keyframes lrGlow { 0%,100% { opacity:.55 } 50% { opacity:1 } }
@keyframes lrRise { from { opacity:0; transform: translateY(8px) } to { opacity:1; transform:none } }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- app shell ---------- */
#app {
  min-height: 100dvh;
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(520px 380px at 82% -6%, #3A1636 0%, var(--plum-800) 52%, var(--plum-850) 100%);
  position: relative;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.screen.enter { animation: lrRise .2s ease both; }   /* only on real navigation */

/* app header (avatar + name + menu) — hidden during an active timer per spec */
.appbar {
  flex-shrink: 0;
  padding: calc(var(--safe-t) + 16px) 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(150deg, #3A1B45, #241028);
  border: 1px solid rgba(176,113,245,.45);
  display: grid; place-items: center; position: relative; flex-shrink: 0;
}
.brand__mark i { width: 12px; height: 12px; border: 1.5px solid var(--teal); transform: rotate(45deg); display:block; }
.brand__mark b {
  position: absolute; bottom: 1px; right: 1px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--green); border: 2px solid var(--plum-800);
}
.brand__name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.brand__meta { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; color: var(--ink-45); }

.iconbtn {
  border: 1px solid var(--line); background: var(--fill);
  border-radius: var(--r-md); padding: 10px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
}
.iconbtn span { width: 16px; height: 1.5px; background: var(--ink-70); display: block; }
.iconbtn span:last-child { width: 11px; }
.iconbtn:hover { border-color: rgba(176,113,245,.5); }

/* scroll body */
.body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.body--pad-b { padding-bottom: calc(var(--safe-b) + 96px); }

/* ---------- cards ---------- */
.card {
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--fill-2), var(--fill));
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card--plain { background: var(--fill); }
.card--mission {
  border-color: rgba(176,113,245,.3);
  background: linear-gradient(165deg, rgba(176,113,245,.14), var(--fill) 55%);
  box-shadow: 0 0 40px rgba(176,113,245,.12);   /* active mission = glow (spec) */
}
.card--dashed { border: 1px dashed var(--line-2); background: transparent; }

.row { display: flex; align-items: center; gap: 11px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--ink-45); text-transform: uppercase; }
.h1 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.h2 { font-size: 19px; font-weight: 600; letter-spacing: -.015em; }
.h3 { font-size: 14px; font-weight: 600; }
.mission-title { font-size: 23px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em; text-wrap: pretty; }
.muted { color: var(--ink-55); font-size: 13.5px; line-height: 1.45; text-wrap: pretty; }
.fine { font-size: 11.5px; line-height: 1.4; color: var(--ink-45); text-wrap: pretty; }

/* tag chips — colour = data type */
.tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  border: 1px solid currentColor; border-radius: 7px; padding: 4px 8px;
  text-transform: uppercase; white-space: nowrap;
}
.tag--violet { color: var(--violet); }
.tag--gold   { color: var(--gold); }
.tag--teal   { color: var(--teal); }
.tag--orange { color: var(--orange); }
.tag--green  { color: var(--green); }
.tag--muted  { color: var(--ink-45); }

/* stat mini-boxes */
.stat {
  flex: 1; border-radius: 14px; background: rgba(0,0,0,.28);
  border: 1px solid var(--line); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat b { font-family: var(--mono); font-size: 17px; font-weight: 700; }
.stat--warn { border-color: rgba(255,138,61,.28); }
.stat--warn b { color: var(--orange); }
.stat--warn .eyebrow { color: rgba(255,138,61,.75); }

/* progress bars */
.bar { height: 7px; border-radius: 7px; background: rgba(255,255,255,.08); overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--teal), var(--green)); }
.bar--thin { height: 6px; }
.bar__pen {   /* hatched penalty overlay */
  position: absolute; top: 0; height: 100%;
  background: repeating-linear-gradient(115deg, rgba(255,138,61,.7) 0 3px, transparent 3px 6px);
}
.linebar { display: flex; align-items: center; gap: 11px; }
.linebar > .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.linebar > .lbl { width: 96px; font-size: 12.5px; flex-shrink: 0; }
.linebar > .bar { flex: 1; }
.linebar > .pct { font-family: var(--mono); font-size: 11px; width: 34px; text-align: right; }

/* rings */
.ring { position: relative; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring__big { font-family: var(--mono); font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.ring__cap { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--ink-45); }

/* buttons */
.btn {
  border: 0; border-radius: var(--r-lg); padding: 16px; width: 100%;
  display: block; box-sizing: border-box;
  text-align: center; font-size: 16px; font-weight: 600; cursor: pointer;
  text-decoration: none;
  transition: filter .12s ease, transform .06s ease;
}
a.btn { color: #fff; }
a.btn.btn--ghost { color: var(--ink-70); }
.btn:active { transform: scale(.985); }
.btn--primary { background: linear-gradient(90deg, var(--violet), var(--violet-d)); color: #fff; box-shadow: 0 0 26px rgba(176,113,245,.45); }
.btn--go      { background: linear-gradient(90deg, var(--teal), var(--green)); color: #10210F; box-shadow: 0 0 26px rgba(63,217,200,.35); }
.btn--danger  { background: linear-gradient(90deg, var(--orange), var(--orange-d)); color: #fff; }
.btn--primary:hover, .btn--go:hover, .btn--danger:hover { filter: brightness(1.1); }
.btn--ghost   { background: transparent; border: 1px solid var(--line-2); color: var(--ink-70); font-weight: 500; }
.btn--ghost:hover { border-color: rgba(176,113,245,.6); color: var(--violet); }
.btn--sm { padding: 12px; font-size: 14px; }
.btnstack { display: flex; flex-direction: column; gap: 10px; padding-top: 2px; }

/* checkbox rows (daily tasks) */
.check { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.check__box {
  width: 21px; height: 21px; border-radius: 7px; border: 1.5px solid rgba(123,214,75,.5);
  display: grid; place-items: center; flex-shrink: 0; color: var(--green); font-size: 12px; line-height: 1;
}
.check[aria-checked="true"] .check__box { background: rgba(123,214,75,.14); }
.check__box i { opacity: 0; }
.check[aria-checked="true"] .check__box i { opacity: 1; }

/* history ticks */
.tick { display: flex; align-items: center; gap: 11px; }
.tick > .rail { width: 3px; height: 30px; border-radius: 3px; flex-shrink: 0; }
.tick .t { font-size: 12.5px; }
.tick .s { font-family: var(--mono); font-size: 10px; color: var(--ink-45); }

/* bottom nav */
.tabbar {
  position: sticky; bottom: 0;
  flex-shrink: 0;
  padding: 12px 18px calc(var(--safe-b) + 18px);
  border-top: 1px solid rgba(255,255,255,.07);
  background: rgba(20,11,24,.85);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  display: flex; align-items: center; justify-content: space-between;
}
.tab { background: none; border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; width: 56px; opacity: .5; padding: 0; }
.tab[aria-current="page"] { opacity: 1; }
.tab svg { width: 21px; height: 21px; }
.tab .pip { width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.tab[aria-current="page"] .pip { background: var(--violet); box-shadow: 0 0 8px var(--violet); }

/* sheet / modal */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10,5,12,.72); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 20px; padding-bottom: calc(var(--safe-b) + 20px);
}
.sheet {
  width: 100%; max-width: var(--maxw);
  border-radius: 24px; border: 1px solid rgba(255,138,61,.3);
  background: var(--plum-700); padding: 22px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  animation: lrRise .2s ease both;
}

/* hero blocks for resolution screens */
.hero {
  border-radius: 24px; padding: 26px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
}
.hero--ok    { border: 1px solid rgba(123,214,75,.32); background: radial-gradient(280px 220px at 50% 0%, rgba(123,214,75,.16), var(--fill)); }
.hero--fail  { border: 1px solid rgba(255,138,61,.32); background: radial-gradient(280px 220px at 50% 0%, rgba(255,138,61,.14), var(--fill)); }
.hero--timer { border: 1px solid rgba(176,113,245,.28); background: radial-gradient(300px 240px at 50% 45%, rgba(176,113,245,.16), var(--fill)); padding: 22px 0 26px; }
.hero__badge {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid currentColor; font-size: 26px;
}
.hero--ok .hero__badge   { color: var(--green);  box-shadow: 0 0 28px rgba(123,214,75,.4); }
.hero--fail .hero__badge  { color: var(--orange); box-shadow: 0 0 28px rgba(255,138,61,.35); }

/* forms (onboarding / settings) */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--ink-70); }
.input, select.input, textarea.input {
  width: 100%; border-radius: var(--r-md); border: 1px solid var(--line-2);
  background: rgba(0,0,0,.28); color: var(--ink); padding: 11px 12px; font: inherit;
}
.input:focus { outline: 2px solid rgba(176,113,245,.6); outline-offset: 0; }
.daypick { display: flex; gap: 6px; }
.daypick button {
  flex: 1; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: transparent; color: var(--ink-55); padding: 9px 0; font-family: var(--mono); font-size: 11px; cursor: pointer;
}
.daypick button[aria-pressed="true"] { border-color: var(--violet); color: var(--violet); background: rgba(176,113,245,.12); }

.editlist { display: flex; flex-direction: column; gap: 8px; }
.editrow { display: flex; align-items: center; gap: 8px; }
.editrow .input { flex: 1; }
.editrow button { border: 1px solid var(--line-2); background: var(--fill); border-radius: var(--r-sm); padding: 8px 10px; cursor: pointer; color: var(--ink-70); }
.addbtn { align-self: flex-start; border: 1px dashed var(--line-2); background: transparent; color: var(--teal); border-radius: var(--r-sm); padding: 8px 12px; cursor: pointer; font-size: 12.5px; }

/* wizard progress */
.steps { display: flex; gap: 6px; }
.steps > i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.1); }
.steps > i.on { background: var(--violet); }

/* achievements / prize wall */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge {
  border-radius: 16px; border: 1px solid var(--line); background: var(--fill);
  padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center;
}
.badge[data-locked="true"] { opacity: .38; filter: grayscale(.6); }
.badge__disc {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 20px;
  background: rgba(255,255,255,.06);
}
.badge__disc[data-tier="flat"]    { color: var(--ink-70); background: rgba(255,255,255,.06); }
.badge__disc[data-tier="medal"]   { color: var(--teal);   background: rgba(63,217,200,.12); box-shadow: 0 0 0 1px rgba(63,217,200,.4) inset; }
.badge__disc[data-tier="trophy"]  { color: var(--gold);   background: rgba(245,197,66,.14); box-shadow: 0 0 0 1px rgba(245,197,66,.45) inset; }
.badge__disc[data-tier="crown"]   { color: var(--violet); background: rgba(176,113,245,.16); box-shadow: 0 0 22px rgba(176,113,245,.35), 0 0 0 1px rgba(176,113,245,.5) inset; }
.badge__name { font-size: 10.5px; line-height: 1.25; }
.badge__num { font-family: var(--mono); font-size: 10px; color: var(--ink-45); }

/* empty / info panels */
.panel { border-radius: 20px; border: 1px solid var(--line); background: var(--fill); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.panel--warn { border-color: rgba(255,138,61,.32); background: linear-gradient(160deg, rgba(255,138,61,.13), var(--fill)); }
.callout { border-radius: 20px; border: 1px solid var(--line-2); background: rgba(255,255,255,.045); padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.callout__mk { width: 26px; height: 26px; border-radius: var(--r-sm); border: 1.5px solid rgba(255,138,61,.6); display: grid; place-items: center; flex-shrink: 0; font-size: 12px; color: var(--orange); }

.steps-num {
  margin: 0; padding-left: 20px;
  display: flex; flex-direction: column; gap: 7px;
  font-size: 12.5px; line-height: 1.45; color: var(--ink-55);
}
.steps-num b { color: var(--ink); font-weight: 600; }

/* iOS "add to home screen" hint bar */
.iosbar {
  flex-shrink: 0;
  margin: calc(var(--safe-t) + 8px) 12px 0;
  border-radius: 14px;
  border: 1px solid rgba(63,217,200,.35);
  background: linear-gradient(160deg, rgba(63,217,200,.14), var(--fill));
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-70);
}
.iosbar b { color: var(--ink); font-weight: 600; }
.iosbar button {
  flex-shrink: 0;
  border: 0; background: transparent; color: var(--ink-45);
  font-size: 15px; cursor: pointer; padding: 0 2px; line-height: 1;
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 84px); transform: translateX(-50%);
  z-index: 120; max-width: 88vw;
  background: var(--plum-700); border: 1px solid var(--line-2); color: var(--ink);
  border-radius: 14px; padding: 12px 16px; font-size: 13px; box-shadow: 0 16px 40px rgba(0,0,0,.5);
  animation: lrRise .18s ease both;
}

/* utility */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack--sm { gap: 9px; }
.center { text-align: center; }
[hidden] { display: none !important; }
