/* ==========================================================================
   life tracker — "arcade carpet" theme
   Black ground, neon confetti, chunky stickered panels.
   ========================================================================== */

:root {
  --ink:        #0a0713;
  --panel:      #150e26;
  --panel-2:    #1d1433;
  --panel-3:    #271a45;
  --line:       #3a2a63;
  --text:       #f4efff;
  --muted:      #a99cc9;

  --magenta:    #ff2d95;
  --cyan:       #00e5ff;
  --yellow:     #ffe600;
  --lime:       #3dff5e;
  --orange:     #ff7a1a;
  --purple:     #a24bff;
  --blue:       #2b5cff;
  --danger:     #ff4152;

  --radius:     14px;
  --shadow:     6px 6px 0 rgba(0,0,0,.55);

  --display: "Avenir Next", "Futura", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 7rem;
  font-family: var(--body);
  color: var(--text);
  background-color: var(--ink);
  background-image: url("../img/carpet.svg");
  background-size: 300px;
  background-attachment: fixed;
}

@media (max-width: 720px) {
  /* fixed attachment is janky on mobile browsers */
  body { background-attachment: scroll; background-size: 220px; }
}

[x-cloak] { display: none !important; }

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1rem 0;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
  margin-bottom: 1.4rem;
}

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.5rem, 5vw, 2.3rem);
  letter-spacing: .04em;
  text-transform: lowercase;
  margin: 0;
  color: var(--yellow);
  text-shadow: 2px 2px 0 var(--magenta), 4px 4px 0 var(--blue), 6px 6px 0 rgba(0,0,0,.6);
}
.brand a { color: inherit; text-decoration: none; }

nav.links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-left: auto;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .85rem;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-family: var(--display);
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.chip:hover { transform: translateY(-2px); border-color: var(--cyan); }
.chip:active { transform: translateY(1px); }
.chip.is-active { background: var(--magenta); border-color: var(--yellow); color: #150017; }

/* --------------------------------------------------------------------------
   Panels
   -------------------------------------------------------------------------- */

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 860px) {
  /* Requirement: side-by-side on desktop, stacked on mobile. */
  .columns { grid-template-columns: 1fr; }
}

.panel {
  position: relative;
  background: var(--panel);
  border: 4px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel + .panel { margin-top: 1.25rem; }

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg,
    var(--magenta) 0 20%, var(--orange) 20% 40%, var(--yellow) 40% 60%,
    var(--lime) 60% 80%, var(--cyan) 80% 100%);
}

.panel-head {
  padding: 1.15rem 1.1rem .8rem;
  border-bottom: 3px dashed var(--line);
}

.panel-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  letter-spacing: .02em;
  line-height: 1.25;
}
.panel-title .kicker {
  display: block;
  font-size: .7rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: .3rem;
}
.panel-sub { margin: .4rem 0 0; font-size: .82rem; color: var(--muted); }

.panel-body { padding: .5rem .6rem .9rem; }

/* --------------------------------------------------------------------------
   Task rows
   -------------------------------------------------------------------------- */

.rows { display: flex; flex-direction: column; }

.row {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .62rem .55rem;
  border-radius: 10px;
  transition: background .15s ease;
}
.row + .row { border-top: 1px solid rgba(255,255,255,.06); }
.row:hover { background: var(--panel-2); }

.row[data-done="1"] .row-name { text-decoration: line-through; color: var(--muted); }
.row[data-done="1"] .row-value { opacity: .5; }

@keyframes pop-in { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.row[data-draft="1"] { animation: pop-in .28s cubic-bezier(.34,1.56,.64,1); }

@keyframes flash-win {
  0%   { background: rgba(61,255,94,.35); }
  100% { background: transparent; }
}
.row.just-won { animation: flash-win .7s ease-out; }

.row-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1rem;
  font-weight: 600;
  word-break: break-word;
}

.row-value {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-weight: 700;
  font-size: .95rem;
  color: var(--lime);
  font-variant-numeric: tabular-nums;
}
.row-value.is-zero { color: var(--muted); }

.empty {
  padding: 1.4rem .8rem;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  font-style: italic;
}

/* Checkbox ------------------------------------------------------------- */

.check {
  flex: 0 0 auto;
  position: relative;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 3px solid var(--cyan);
  border-radius: 8px;
  background: var(--panel-3);
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease;
}
.check:hover { transform: scale(1.08); }
.check:active { transform: scale(.92); }
.check:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.check svg {
  position: absolute;
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  stroke: #07110a;
  stroke-width: 3.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: stroke-dashoffset .22s ease .05s;
}
.check[aria-checked="true"] { background: var(--lime); border-color: var(--lime); }
.check[aria-checked="true"] svg { stroke-dashoffset: 0; }

/* Editing -------------------------------------------------------------- */

.field {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--panel-3);
  border: 3px solid var(--line);
  border-radius: 8px;
  padding: .45rem .6rem;
  width: 100%;
  min-width: 0;
}
.field:focus { outline: none; border-color: var(--cyan); }
.field.name { flex: 1 1 auto; }
.field.value { flex: 0 0 6.5rem; width: 6.5rem; font-family: var(--mono); text-align: right; }

.dollar-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .2rem;
  color: var(--lime);
  font-family: var(--mono);
  font-weight: 700;
}

.icon-btn {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  border: 3px solid currentColor;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, color .12s ease;
}
.icon-btn:hover { transform: scale(1.12); }
.icon-btn:active { transform: scale(.9); }
.icon-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.icon-btn.add     { color: var(--cyan); }
.icon-btn.confirm { color: var(--lime); }
.icon-btn.remove  { color: var(--danger); }
.icon-btn.cancel  { color: var(--muted); }
.icon-btn.remove.confirming { background: var(--danger); color: #180003; animation: nudge .4s ease infinite; }

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.row-actions { display: flex; gap: .35rem; flex: 0 0 auto; }

.add-bar {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem .55rem .2rem;
  margin-top: .3rem;
  border-top: 3px dashed var(--line);
}
.add-bar .hint {
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--display);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Dollar counter
   -------------------------------------------------------------------------- */

.counter {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
}

.counter-badge {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  padding: .7rem 1.1rem;
  border: 4px solid var(--yellow);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform .15s ease;
}
.counter-badge:hover { transform: translateY(-3px) rotate(-1deg); }

.counter-label {
  font-family: var(--display);
  font-size: .62rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--cyan);
}
.counter-amount {
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--lime);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.counter-amount.negative { color: var(--danger); }

@keyframes counter-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.22) rotate(-3deg); }
  100% { transform: scale(1); }
}
.counter-amount.bump { animation: counter-bump .45s cubic-bezier(.34,1.56,.64,1); }

.counter-link {
  font-family: var(--display);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--yellow);
  text-decoration: none;
  background: var(--panel);
  border: 3px solid var(--magenta);
  border-radius: 999px;
  padding: .3rem .8rem;
  box-shadow: 3px 3px 0 rgba(0,0,0,.5);
}
.counter-link:hover { background: var(--magenta); color: #16000f; }

@media (max-width: 640px) {
  .counter {
    left: .6rem;
    right: .6rem;
    bottom: .6rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
  }
  .counter-badge { flex: 1 1 auto; }
}

/* Floating "+$5" that flies toward the counter ------------------------- */

.floater {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--lime);
  text-shadow: 0 0 12px rgba(61,255,94,.7), 2px 2px 0 rgba(0,0,0,.6);
  animation: float-away 1s cubic-bezier(.2,.7,.3,1) forwards;
}
.floater.minus { color: var(--danger); text-shadow: 0 0 12px rgba(255,65,82,.6), 2px 2px 0 rgba(0,0,0,.6); }
@keyframes float-away {
  0%   { opacity: 0; transform: translate(0, 0) scale(.7); }
  15%  { opacity: 1; transform: translate(0, -14px) scale(1.15); }
  100% { opacity: 0; transform: translate(0, -80px) scale(.85); }
}

/* Confetti burst ------------------------------------------------------- */

.confetti-bit {
  position: fixed;
  z-index: 55;
  width: 10px;
  height: 14px;
  pointer-events: none;
  border-radius: 2px;
  animation: confetti-fly var(--dur, 900ms) cubic-bezier(.15,.6,.4,1) forwards;
}
@keyframes confetti-fly {
  0%   { opacity: 1; transform: translate(0,0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.5); }
}

/* --------------------------------------------------------------------------
   Buttons / general controls
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .6rem 1.1rem;
  border: 4px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--display);
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 4px 4px 0 rgba(0,0,0,.5);
  transition: transform .1s ease, box-shadow .1s ease, background .15s ease;
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 rgba(0,0,0,.5); }
.btn:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 rgba(0,0,0,.5); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 4px 4px 0 rgba(0,0,0,.5); }
.btn.primary { background: var(--lime); color: #06170a; border-color: var(--lime); }
.btn.hot { background: var(--magenta); color: #1a0011; border-color: var(--yellow); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); color: #1a0004; border-color: var(--danger); }

.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1.25rem 0; }
.toolbar .spacer { flex: 1 1 auto; }

/* --------------------------------------------------------------------------
   Dev time-travel bar
   -------------------------------------------------------------------------- */

.devbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  padding: .55rem .9rem;
  background: repeating-linear-gradient(45deg, #ffe600 0 14px, #1a1200 14px 28px);
  border-bottom: 4px solid #000;
  color: #1a1200;
  font-family: var(--display);
  font-weight: 800;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.devbar .tag {
  background: #1a1200;
  color: var(--yellow);
  padding: .25rem .6rem;
  border-radius: 999px;
}
.devbar .now { background: rgba(255,255,255,.9); padding: .25rem .6rem; border-radius: 6px; font-family: var(--mono); text-transform: none; }
/* The diagonal stripes eat plain text, so every label gets its own solid chip. */
.devbar .tag.shifted { background: var(--magenta); color: #16000f; white-space: nowrap; }
.devbar button {
  border: 3px solid #1a1200;
  background: #fff;
  color: #1a1200;
  border-radius: 8px;
  padding: .25rem .6rem;
  font: inherit;
  cursor: pointer;
}
.devbar button:hover { background: var(--cyan); }

/* --------------------------------------------------------------------------
   Prize room
   -------------------------------------------------------------------------- */

.prize-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.1rem;
  padding: 1rem .9rem;
}
@media (max-width: 420px) {
  .prize-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
}

.prize {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  border: 4px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 4px 4px 0 rgba(0,0,0,.5);
  transition: transform .15s ease, border-color .15s ease;
}
.prize:hover { transform: translateY(-3px); border-color: var(--cyan); }
.prize[data-purchased="1"] { opacity: .48; filter: saturate(.55); }
.prize[data-purchased="1"]:hover { transform: none; }
.prize[data-afford="0"] .prize-cost { color: var(--danger); }

.prize-img {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  background: var(--panel-3);
  display: block;
}
.prize-img.placeholder {
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  color: var(--line);
}

.prize-body { padding: .7rem .75rem .85rem; display: flex; flex-direction: column; gap: .5rem; flex: 1 1 auto; }
.prize-name { font-weight: 700; font-size: .98rem; line-height: 1.25; word-break: break-word; }
.prize-cost {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
}
.prize-foot { margin-top: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.prize .btn { padding: .45rem .7rem; font-size: .72rem; border-width: 3px; }

.ribbon {
  position: absolute;
  top: .55rem;
  right: -2.2rem;
  transform: rotate(38deg);
  background: var(--lime);
  color: #06170a;
  font-family: var(--display);
  font-weight: 800;
  font-size: .62rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  padding: .25rem 2.4rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}

.upload-drop {
  display: block;
  border: 3px dashed var(--line);
  border-radius: 10px;
  padding: .55rem .7rem;
  color: var(--muted);
  font-size: .8rem;
  cursor: pointer;
  text-align: center;
}
.upload-drop:hover { border-color: var(--cyan); color: var(--cyan); }
.upload-drop input { display: none; }

/* --------------------------------------------------------------------------
   History
   -------------------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .6rem .7rem; text-align: left; border-bottom: 1px solid rgba(255,255,255,.08); }
.table th {
  font-family: var(--display);
  font-size: .7rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--cyan);
}
.table td.num { font-family: var(--mono); text-align: right; color: var(--lime); font-variant-numeric: tabular-nums; }
.table td.date { font-family: var(--mono); color: var(--muted); white-space: nowrap; }

.cal-card { padding: .9rem 1rem 1.1rem; border-bottom: 3px dashed var(--line); }
.cal-card:last-child { border-bottom: 0; }

.cal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem .9rem;
  margin-bottom: .6rem;
}
.cal-name { font-family: var(--display); font-weight: 800; font-size: 1.02rem; }
.cal-name .gone { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border: 2px solid var(--line); border-radius: 999px; padding: .1rem .5rem; margin-left: .4rem; vertical-align: middle; }
.cal-stats { margin-left: auto; font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.cal-stats b { color: var(--lime); }

.cal-scroll { overflow-x: auto; padding-bottom: .35rem; }

.cal-months {
  display: grid;
  gap: 3px;
  width: max-content;
  margin-bottom: 4px;
  height: 1em;
  font-family: var(--display);
  font-weight: 700;
  font-size: .62rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cal-months span { white-space: nowrap; }
.cal-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  gap: 3px;
  width: max-content;
}
.cal-day {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: rgba(255,255,255,.07);
}
.cal-day.pre { background: rgba(255,255,255,.03); }
.cal-day.future { background: transparent; }
.cal-day.done { background: var(--lime); box-shadow: 0 0 6px rgba(61,255,94,.5); }
.cal-day.done.today { outline: 2px solid var(--yellow); outline-offset: 1px; }
.cal-day.today { outline: 2px solid var(--cyan); outline-offset: 1px; }

.cal-legend {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .5rem;
  font-size: .7rem;
  color: var(--muted);
  font-family: var(--display);
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Login / settings
   -------------------------------------------------------------------------- */

.centered { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.card { width: min(420px, 100%); }
.card .panel-body { padding: 1.2rem 1.2rem 1.4rem; display: flex; flex-direction: column; gap: .9rem; }

label.stack { display: flex; flex-direction: column; gap: .35rem; font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); font-family: var(--display); font-weight: 700; }

.error {
  background: rgba(255,65,82,.15);
  border: 3px solid var(--danger);
  border-radius: 8px;
  padding: .55rem .7rem;
  font-size: .85rem;
  color: #ffc9cf;
}
.notice {
  background: rgba(0,229,255,.12);
  border: 3px solid var(--cyan);
  border-radius: 8px;
  padding: .55rem .7rem;
  font-size: .85rem;
}

.divider { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; flex: 1 1 auto; height: 3px; background: var(--line); border-radius: 2px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.list li {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: var(--panel-2);
  border: 3px solid var(--line);
  border-radius: 10px;
  padding: .55rem .7rem;
  font-size: .9rem;
}
.list li .grow { flex: 1 1 auto; }
.list li small { color: var(--muted); font-family: var(--mono); font-size: .72rem; }

/* Toasts ---------------------------------------------------------------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 6.5rem;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: center;
  pointer-events: none;
  width: min(440px, calc(100vw - 2rem));
}
.toast {
  background: var(--panel);
  border: 4px solid var(--yellow);
  border-radius: 10px;
  padding: .6rem .9rem;
  font-size: .88rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toast-in .25s cubic-bezier(.34,1.56,.64,1);
  text-align: center;
}
.toast.bad { border-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.95); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
