/* ===================================================================
   ✿ PIXEL PLANNER ✿  —  styles
   A cozy, cute, retro-pixel aesthetic. No build step required.
   =================================================================== */

:root {
  /* palette — soft pastels + a friendly dark-plum "ink" outline */
  --bg:        #ffe7f1;
  --bg-2:      #ffd9ec;
  --panel:     #fffafd;
  --panel-2:   #fff0f7;
  --ink:       #5b4a6b;
  --ink-soft:  #8a7a9b;

  --pink:      #ff9ec9;
  --pink-deep: #ff6fa8;
  --mint:      #93e6c0;
  --mint-deep: #4fd6a0;
  --lav:       #c3b2ff;
  --yellow:    #ffdd86;
  --blue:      #a6d8ff;
  --red:       #ff8b9a;

  --shadow:    rgba(91, 74, 107, 0.25);
  --ink-shadow: #c9a7d6;

  /* themeable surfaces (overridden by body.night) */
  --field:     #ffffff;   /* inputs, checkboxes */
  --track:     #ffffff;   /* progress-bar tracks */
  --on-accent: #4a3b5c;   /* dark text that sits on light accent fills (buttons etc.) */
  --toast-bg:  #5b4a6b;

  --b: 4px;            /* standard border width */
}

/* ===================================================================
   🌙 NIGHT THEME — moonlit cute-witch vibes
   =================================================================== */
body.night {
  --bg:        #171231;
  --bg-2:      #261c4d;
  --panel:     #271f48;
  --panel-2:   #322857;
  --ink:       #efe7ff;
  --ink-soft:  #aa9ed1;

  --pink:      #ff8fc4;
  --pink-deep: #ff6fb0;
  --mint:      #6fe0bf;
  --mint-deep: #46c79e;
  --lav:       #b69bff;
  --yellow:    #ffe7a0;
  --blue:      #8fd0ff;
  --red:       #ff7e96;

  --shadow:    rgba(0, 0, 0, 0.5);
  --ink-shadow: #4c3c80;

  --field:     #1b1539;
  --track:     #1b1539;
  --toast-bg:  #1b1539;

  background:
    repeating-linear-gradient(45deg, transparent 0 18px, rgba(255,255,255,0.03) 18px 20px),
    radial-gradient(circle at 82% 12%, var(--bg-2), var(--bg) 65%);
}
body.night .bg-deco { opacity: 1; filter: drop-shadow(0 0 2px rgba(255,255,255,0.6)); animation: twinkle 3s steps(2) infinite alternate; }
@keyframes twinkle { from { opacity: 0.55; } to { opacity: 1; } }
/* the logo glows softly at night */
body.night .logo h1 { text-shadow: 3px 3px 0 var(--lav), 0 0 14px rgba(182,155,255,0.6); }

/* ===================================================================
   ★ SECRET "ARCADE" THEME — unlocks at LV 100 (say hi to Byte!)
   Near-black CRT cabinet with neon magenta + gold. Cheat-code energy.
   =================================================================== */
body.secret {
  --bg:        #08060f;
  --bg-2:      #160c26;
  --panel:     #150e22;
  --panel-2:   #1d1433;
  --ink:       #ffe6b0;   /* warm cream-gold body text */
  --ink-soft:  #c79ad8;   /* muted magenta-lavender */

  --pink:      #ff4fa3;   /* neon magenta — the main accent */
  --pink-deep: #ff2e8e;
  --mint:      #5ef0c0;
  --mint-deep: #38d6a0;
  --lav:       #b06bff;
  --yellow:    #ffd34d;   /* arcade gold */
  --blue:      #6bd0ff;
  --red:       #ff5d7a;

  --shadow:    rgba(0, 0, 0, 0.6);
  --ink-shadow: #6a1f55;

  --field:     #160e24;
  --track:     #160e24;
  --on-accent: #1a0a16;   /* dark text on neon fills */
  --toast-bg:  #2a0f24;

  background: radial-gradient(circle at 50% -8%, #241338, #08060f 72%);
}
/* CRT scanlines + a faint flicker over everything (clicks pass through) */
body.secret::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 9000;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0) 0 2px, rgba(0,0,0,0.13) 3px 3.5px);
  animation: crt-flicker 3.4s steps(2, end) infinite;
}
@keyframes crt-flicker { 0%, 96%, 100% { opacity: 1; } 97% { opacity: 0.82; } 98% { opacity: 1; } }
body.secret .bg-deco { display: none; }
body.secret .moon { display: none; }
/* neon glow on the brand bits */
body.secret .logo h1 { color: var(--yellow); text-shadow: 2px 2px 0 var(--pink), 0 0 14px rgba(255,79,163,0.7); }
body.secret .logo-star { color: var(--pink); text-shadow: 0 0 8px var(--pink); }
body.secret .panel-title { text-shadow: 0 0 8px rgba(255,79,163,0.45); }
body.secret .mascot { filter: drop-shadow(0 0 7px rgba(255,79,163,0.55)); }
body.secret .mascot-name { color: var(--yellow); text-shadow: 0 0 10px rgba(255,211,77,0.85), 0 0 4px var(--pink); }
body.secret .studio-logo { filter: drop-shadow(0 0 7px rgba(255,79,163,0.5)); }

/* the secret-mode ★ toggle — hidden via [hidden] until unlocked */
.secret-toggle.active { color: #fff; background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.secret-toggle.reveal { animation: secret-reveal 0.9s ease-in-out 6; }
@keyframes secret-reveal {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(255,79,163,0); }
  50% { transform: scale(1.28) rotate(-8deg); box-shadow: 0 0 16px rgba(255,79,163,0.9); }
}

/* Byte's animated bits: a blade that gleams + a twinkling crown gem */
.byte-blade { transform-box: fill-box; transform-origin: 50% 100%; animation: blade-gleam 3.6s ease-in-out infinite; }
@keyframes blade-gleam { 0%, 82%, 100% { filter: none; } 90% { filter: brightness(1.6) drop-shadow(0 0 1.5px #fff); } }
.byte-gem { transform-box: fill-box; transform-origin: center; animation: gem-twinkle 2.6s steps(3, end) infinite; }
@keyframes gem-twinkle { 0%, 66%, 100% { opacity: 1; } 80% { opacity: 0.45; } }
/* on success Byte raises his sword and waves it around */
.byte-cast .byte-blade { animation: blade-cast 0.9s ease-in-out; }
@keyframes blade-cast {
  0%   { transform: rotate(0); }
  15%  { transform: rotate(-26deg) translateY(-1px); filter: brightness(1.8) drop-shadow(0 0 2px #fff); }
  40%  { transform: rotate(20deg); filter: brightness(1.5); }
  62%  { transform: rotate(-16deg); filter: brightness(1.4) drop-shadow(0 0 2px #fff); }
  82%  { transform: rotate(10deg); }
  100% { transform: rotate(0); filter: none; }
}
body.night .panel-title { color: var(--lav); }

/* ---- the moon (only at night) ---- */
.moon { display: none; }
body.night .moon {
  display: block; position: fixed; top: 26px; right: 34px; z-index: 0;
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #fffbe9, #ffe9a0 68%, #f0cf78);
  box-shadow: 0 0 34px 10px rgba(255, 231, 160, 0.35), inset -7px -6px 0 rgba(120,90,40,0.12);
}
.moon-crater { position: absolute; background: rgba(120, 90, 40, 0.14); border-radius: 50%; }
.moon-crater.c1 { width: 14px; height: 14px; top: 16px; left: 30px; }
.moon-crater.c2 { width: 9px;  height: 9px;  top: 36px; left: 18px; }

/* ---- mascots (Bitsy / Pixie) render as SVG pixel sprites ---- */
.mascot svg {
  width: auto; height: auto; display: block; margin: 0 auto;
  image-rendering: pixelated; overflow: visible; /* let the swishing tail spill past the box */
  filter: drop-shadow(0 3px 0 rgba(91,74,107,0.22));
}
body.night .mascot svg { filter: drop-shadow(0 3px 0 rgba(0,0,0,0.3)) drop-shadow(0 0 8px rgba(182,155,255,0.4)); }

/* Bitsy's fluffy tail gives a happy little swish (pivots at its base, behind her body) */
.cat-tail {
  transform-box: fill-box;
  transform-origin: 18% 90%;
  animation: tail-swish 1.9s ease-in-out infinite;
}
@keyframes tail-swish {
  0%, 100% { transform: rotate(-7deg); }
  50%      { transform: rotate(9deg); }
}

/* both mascots blink now and then */
.m-eyes { transform-box: fill-box; transform-origin: center; animation: mascot-blink 4.4s ease-in-out infinite; }
@keyframes mascot-blink {
  0%, 90%, 100% { transform: scaleY(1); }
  94%, 96%      { transform: scaleY(0.1); }
}

/* Bitsy's right ear gives an occasional little twitch — flicks outward */
.m-ear { transform-box: fill-box; transform-origin: 50% 100%; animation: ear-twitch 5.3s ease-in-out infinite; }
@keyframes ear-twitch {
  0%, 84%, 100% { transform: rotate(0deg); }
  88%, 93%      { transform: rotate(13deg); }
  90%           { transform: rotate(-3deg); }
}

/* Pixie's hair is static — a sway rotated the pixels off-grid and created a shifting edge artifact */

/* Pixie's pink wand twinkles, and casts a burst when a task is finished */
.wand-star { transform-box: fill-box; transform-origin: center; animation: wand-twinkle 2.3s ease-in-out infinite; }
@keyframes wand-twinkle {
  0%, 100% { opacity: 0.82; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.15); }
}
.wand-cast .wand-star { animation: wand-cast-pulse 0.6s ease-out; }
@keyframes wand-cast-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(2); filter: drop-shadow(0 0 5px rgba(255,126,200,0.95)); }
  100% { transform: scale(1); }
}
/* Bitsy wags her tail excitedly when a task is finished */
.cat-happy .cat-tail { animation: tail-wag 0.16s ease-in-out 4; }
@keyframes tail-wag {
  0%, 100% { transform: rotate(-15deg); }
  50%      { transform: rotate(17deg); }
}

/* ---- Pixie's hair-color picker (night mode only) ---- */
.hair-picker { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
body:not(.night) .hair-picker { display: none; }
.hair-swatch {
  width: 18px; height: 18px; border: 2px solid var(--ink); cursor: pointer;
  box-shadow: 2px 2px 0 var(--shadow); transition: transform 0.08s;
}
.hair-swatch:hover { transform: translateY(-2px); }
.hair-swatch.selected { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ink); transform: scale(1.1); }

/* ---------- reset-ish ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { image-rendering: pixelated; }

body {
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 20px;
  color: var(--ink);
  background:
    repeating-linear-gradient(45deg, transparent 0 18px, rgba(255,255,255,0.25) 18px 20px),
    radial-gradient(circle at 20% 10%, var(--bg-2), var(--bg) 60%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.15;
  -webkit-font-smoothing: none;
}

/* floating pixel hearts/stars in the far background */
.bg-deco {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 10% 30%, var(--pink) 50%, transparent 51%),
    radial-gradient(2px 2px at 80% 20%, var(--lav) 50%, transparent 51%),
    radial-gradient(2px 2px at 65% 70%, var(--mint) 50%, transparent 51%),
    radial-gradient(2px 2px at 35% 85%, var(--yellow) 50%, transparent 51%),
    radial-gradient(2px 2px at 90% 60%, var(--pink-deep) 50%, transparent 51%);
  opacity: 0.7;
}

/* ---------- layout shell ---------- */
.app {
  position: relative; z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 18px 40px;
  /* keep content clear of notches / home indicator when installed as an app */
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}

.layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 18px;
  margin-top: 16px;
  align-items: start;
}

/* ---------- the reusable pixel panel ---------- */
.panel {
  background: var(--panel);
  border: var(--b) solid var(--ink);
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 14px;
  position: relative;
}
/* little corner notches to sell the "pixel" feel */
.panel::before,
.panel::after {
  content: ""; position: absolute; width: 8px; height: 8px;
  background: var(--bg); z-index: 2;
}
.panel::before { top: -4px; left: -4px; box-shadow: 0 0 0 0 transparent; }
.panel::after  { bottom: -4px; right: -4px; }

.panel-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--pink-deep);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

/* ===================================================================
   HEADER
   =================================================================== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  background: linear-gradient(var(--panel), var(--panel-2));
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 20px;
  color: var(--pink-deep);
  text-shadow: 3px 3px 0 var(--yellow), 5px 5px 0 var(--shadow);
  letter-spacing: 1px;
}
.logo-star { color: var(--lav); font-size: 22px; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hud { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hud-block {
  display: flex; align-items: center; gap: 6px;
  background: var(--panel-2);
  border: 3px solid var(--ink);
  padding: 4px 10px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.hud-label {
  font-family: 'Press Start 2P', monospace; font-size: 9px; color: var(--ink-soft);
}
.hud-value { font-size: 24px; font-weight: bold; }
.hud-icon { font-size: 18px; }
.streak .hud-value { color: var(--pink-deep); }
.coins .hud-value { color: #e0a32a; }

.xp { display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.xp-bar {
  height: 16px; background: var(--track);
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--panel-2);
  overflow: hidden;
}
.xp-fill {
  height: 100%; width: 0%;
  background:
    repeating-linear-gradient(90deg, var(--lav) 0 6px, var(--blue) 6px 12px);
  transition: width 0.4s steps(12);
}
.xp-text { font-size: 15px; color: var(--ink-soft); text-align: right; }

/* ===================================================================
   BUTTONS & INPUTS
   =================================================================== */
.btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--on-accent);
  background: var(--pink);
  border: 3px solid var(--on-accent);
  box-shadow: 4px 4px 0 var(--on-accent);
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.05s, box-shadow 0.05s, background 0.15s;
  user-select: none;
  line-height: 1.4;
}
.btn:hover { background: var(--pink-deep); color: #fff; }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--on-accent); }
.btn-add { background: var(--mint); }
.btn-add:hover { background: var(--mint-deep); }
.btn-small { font-size: 9px; padding: 8px 10px; box-shadow: 3px 3px 0 var(--on-accent); }
.btn-small:active { transform: translate(3px,3px); }
.btn-ghost { background: var(--panel); color: var(--ink); }
.btn-ghost:hover { background: var(--yellow); color: var(--on-accent); }

.icon-btn {
  font-size: 20px; background: var(--panel-2);
  border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--shadow);
  width: 40px; height: 40px; cursor: pointer; line-height: 1;
  transition: transform 0.05s, box-shadow 0.05s;
}
.icon-btn:active { transform: translate(3px,3px); box-shadow: 0 0 0 transparent; }
.icon-btn.muted { filter: grayscale(1) opacity(0.6); }
/* the cloud-sync button is labeled: ☁ with pixel "sync" underneath */
.sync-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; width: auto; height: 40px; padding: 2px 7px; line-height: 1; margin-left: 6px;
}
.sync-btn .sync-ico { font-size: 16px; line-height: 1; }
.sync-btn .sync-lbl { font-family: 'Press Start 2P', monospace; font-size: 6px; letter-spacing: 0.5px; line-height: 1; color: var(--ink); }

input[type="text"], select, input[type="date"] {
  font-family: 'VT323', monospace;
  font-size: 19px;
  color: var(--ink);
  background: var(--field);
  border: 3px solid var(--ink);
  padding: 7px 10px;
  outline: none;
}
body.night input[type="date"] { color-scheme: dark; }
input[type="text"]:focus, select:focus, input[type="date"]:focus {
  background: var(--panel-2);
  box-shadow: inset 0 0 0 2px var(--pink);
}
input::placeholder { color: #c0b3cc; }
select { cursor: pointer; }

/* ===================================================================
   SIDEBAR
   =================================================================== */
.sidebar { display: flex; flex-direction: column; gap: 18px; }

/* mascot */
.mascot-card { text-align: center; background: linear-gradient(var(--panel), var(--lav) 260%); }
.speech {
  background: var(--field); border: 3px solid var(--ink);
  padding: 8px; font-size: 17px; margin-bottom: 10px;
  position: relative; min-height: 52px;
  display: flex; align-items: center; justify-content: center;
}
.speech::after {
  content: ""; position: absolute; bottom: -10px; left: 50%; margin-left: -6px;
  width: 0; height: 0; border: 7px solid transparent;
  border-top-color: var(--ink);
}
.mascot-wrap {
  position: relative; display: inline-block; margin: 6px 0;
  animation: bob 2.4s ease-in-out infinite;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.mascot-wrap.happy { animation: hop 0.5s ease infinite; }
/* a squishy bounce when you click the mascot */
.mascot-wrap.poked { animation: poke-pop 0.46s ease; }
@keyframes poke-pop {
  0%   { transform: translateY(0) scale(1, 1); }
  30%  { transform: translateY(-12px) scale(1.12, 0.9); }
  55%  { transform: translateY(0) scale(0.92, 1.08); }
  75%  { transform: translateY(-3px) scale(1.03, 0.98); }
  100% { transform: translateY(0) scale(1, 1); }
}
/* a startled jolt + wide eyes when you click really fast */
.mascot-wrap.surprised { animation: surprise-jolt 0.6s ease; }
@keyframes surprise-jolt {
  0%   { transform: translateY(0) rotate(0); }
  12%  { transform: translateY(-18px) scale(1.06); }
  26%  { transform: translate(4px, -12px) rotate(2deg); }
  40%  { transform: translate(-4px, -7px) rotate(-2deg); }
  55%  { transform: translate(2px, -2px); }
  100% { transform: translateY(0); }
}
.mascot-wrap.surprised .m-eyes { animation: eye-pop 0.6s ease; }
@keyframes eye-pop {
  0%   { transform: scale(1); }
  18%  { transform: scale(1.4, 1.45); }
  70%  { transform: scale(1.25, 1.3); }
  100% { transform: scale(1); }
}
.mascot { font-size: 56px; line-height: 1; display: block; }
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-7px);} }
@keyframes hop { 0%,100%{ transform: translateY(0) scale(1);} 50%{ transform: translateY(-12px) scale(1.1);} }
.mascot-name {
  font-family: 'Press Start 2P', monospace; font-size: 10px; color: var(--ink-soft);
}

/* projects */
.project-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.project-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px; cursor: pointer;
  border: 3px solid var(--ink);
  background: var(--field);
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform 0.05s, box-shadow 0.05s;
}
.project-item:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--shadow); }
.project-item.active { background: var(--panel-2); box-shadow: inset 0 0 0 3px var(--pink); }
.project-dot { width: 16px; height: 16px; border: 2px solid var(--ink); flex-shrink: 0; }
.project-info { flex: 1; min-width: 0; }
.project-name-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.project-name { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-count { font-size: 14px; color: var(--ink-soft); flex-shrink: 0; }
.project-bar {
  height: 8px; background: var(--track); border: 2px solid var(--ink); margin-top: 4px; overflow: hidden;
}
.project-bar-fill { height: 100%; width: 0%; transition: width 0.4s steps(8); }
.project-cost { display: block; font-size: 14px; color: var(--mint-deep); font-weight: bold; margin-top: 3px; }
.project-actions { display: flex; gap: 2px; align-items: flex-start; flex-shrink: 0; }
.project-del, .project-edit-btn {
  background: none; border: none; cursor: pointer; font-size: 15px; color: var(--ink-soft);
  padding: 0 2px; opacity: 0; transition: opacity 0.15s, color 0.15s; line-height: 1;
}
.project-item:hover .project-del, .project-item:hover .project-edit-btn { opacity: 1; }
.project-del:hover { color: var(--red); }
.project-edit-btn:hover { color: var(--lav); }

/* inline rename / recolor form */
.project-item.editing { display: block; cursor: default; box-shadow: 3px 3px 0 var(--shadow); }
.project-item.editing:hover { transform: none; }
.project-edit { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.pe-name { width: 100%; font-size: 17px; padding: 6px 8px; }
.pe-swatches { display: flex; gap: 5px; flex-wrap: wrap; }
.pe-actions { display: flex; gap: 6px; }

/* inline delete confirmation */
.project-item.confirming { display: block; cursor: default; box-shadow: inset 0 0 0 3px var(--red), 3px 3px 0 var(--shadow); }
.project-item.confirming:hover { transform: none; }
.project-confirm { display: flex; flex-direction: column; gap: 9px; text-align: center; }
.pc-msg { font-size: 16px; color: var(--ink); line-height: 1.3; }
.pc-actions { display: flex; gap: 6px; justify-content: center; }
.pc-yes { background: var(--red); }
.pc-yes:hover { background: var(--pink-deep); }

.add-project { display: flex; flex-direction: column; gap: 8px; }
.add-project input { width: 100%; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch {
  width: 22px; height: 22px; border: 2px solid var(--ink); cursor: pointer;
  box-shadow: 2px 2px 0 var(--shadow);
}
.swatch.selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); transform: scale(1.05); }

/* stats */
.stat-row {
  display: flex; justify-content: space-between;
  font-size: 18px; padding: 5px 0;
  border-bottom: 2px dotted var(--ink-shadow);
}
.stat-row:last-child { border-bottom: none; }
.stat-row span:last-child { font-weight: bold; color: var(--pink-deep); }

/* ===================================================================
   MAIN — add task
   =================================================================== */
.main { display: flex; flex-direction: column; gap: 16px; }

.add-task { display: flex; flex-direction: column; gap: 12px; }
#taskInput { width: 100%; font-size: 22px; padding: 12px; }
.add-task-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 14px; color: var(--ink-soft); }
.field span { font-family: 'Press Start 2P', monospace; font-size: 8px; letter-spacing: 0.5px; }
.field select, .field input { min-width: 110px; }
.btn-add { margin-left: auto; }

/* toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.view-title {
  font-family: 'Press Start 2P', monospace; font-size: 15px; color: var(--ink);
  text-shadow: 2px 2px 0 var(--ink-shadow);
}
.filters { display: flex; gap: 6px; }
.chip {
  font-family: 'VT323', monospace; font-size: 18px;
  background: var(--panel); border: 3px solid var(--ink);
  padding: 4px 14px; cursor: pointer; box-shadow: 2px 2px 0 var(--shadow);
  transition: transform 0.05s;
}
.chip:hover { background: var(--panel-2); }
.chip.active { background: var(--lav); color: #fff; box-shadow: inset 0 0 0 2px #fff, 2px 2px 0 var(--shadow); }
.chip:active { transform: translate(2px,2px); }
.toolbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.view-switch { display: flex; gap: 6px; }
.view-switch .chip.active { background: var(--mint-deep); }

/* view progress */
.view-progress { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.bar {
  flex: 1; height: 22px; background: var(--track);
  border: 3px solid var(--ink); overflow: hidden;
  box-shadow: inset 0 0 0 2px var(--panel-2);
}
.bar-fill {
  height: 100%; width: 0%;
  background: repeating-linear-gradient(90deg, var(--mint) 0 10px, var(--mint-deep) 10px 20px);
  transition: width 0.5s steps(16);
}
.view-progress-text { font-family: 'Press Start 2P', monospace; font-size: 12px; color: var(--mint-deep); min-width: 48px; text-align: right; }
.view-cost-text { font-family: 'VT323', monospace; font-size: 19px; color: var(--mint-deep); font-weight: bold; white-space: nowrap; }
.view-cost-text:empty { display: none; }

/* ===================================================================
   TASK LIST
   =================================================================== */
.task-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.task {
  display: flex; flex-direction: column;
  background: var(--panel); border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 12px 14px;
  animation: pop-in 0.25s ease;
  border-left-width: 8px;
}
.task-main { display: flex; align-items: center; gap: 12px; }
@keyframes pop-in { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* drag-to-reorder */
.drag-handle {
  flex-shrink: 0; cursor: grab; color: var(--ink-soft); font-size: 18px;
  line-height: 1; padding: 0 2px; user-select: none; touch-action: none;
  letter-spacing: -2px; align-self: stretch; display: flex; align-items: center;
}
.drag-handle:hover { color: var(--lav); }
.drag-handle:active { cursor: grabbing; }
.task.dragging { opacity: 0.55; box-shadow: 0 0 0 3px var(--lav), 6px 6px 0 var(--shadow); }
.task.dragging .task-steps { display: none; }
body.reordering, body.reordering * { -webkit-user-select: none; user-select: none; cursor: grabbing; }
.task.removing { animation: pop-out 0.3s ease forwards; }
@keyframes pop-out { to { transform: translateX(40px) scale(0.9); opacity: 0; } }

/* the cute pixel checkbox */
.check {
  width: 30px; height: 30px; flex-shrink: 0;
  border: 3px solid var(--ink); background: var(--field); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: transparent; box-shadow: 2px 2px 0 var(--shadow);
  transition: background 0.15s;
}
.check:hover { background: var(--panel-2); }
.task.done .check { background: var(--mint); color: var(--on-accent); box-shadow: none; }

.task-body { flex: 1; min-width: 0; }
.task-text { font-size: 21px; word-break: break-word; }
.task.done .task-text { text-decoration: line-through; color: var(--ink-soft); }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.tag {
  font-size: 13px; padding: 1px 8px; border: 2px solid var(--ink);
  display: inline-flex; align-items: center; gap: 4px; line-height: 1.5;
}
.tag-due.overdue { background: var(--red); color: #fff; font-weight: bold; }
.tag-due.soon { background: var(--yellow); color: var(--on-accent); }
/* project + repeat chips adapt to the theme via color-mix over the panel color */
.tag-proj {
  background: var(--panel-2);
  background: color-mix(in srgb, var(--c, var(--pink)) 28%, var(--panel));
  border-color: var(--c, var(--ink)); color: var(--ink);
}
.tag-repeat {
  background: var(--panel-2);
  background: color-mix(in srgb, var(--lav) 26%, var(--panel));
  border-color: var(--lav); color: var(--ink);
}
.tag-cost {
  background: var(--panel-2);
  background: color-mix(in srgb, var(--mint) 30%, var(--panel));
  border-color: var(--mint-deep); color: var(--ink); font-weight: bold;
}
.tag-note { background: var(--panel-2); border-color: var(--yellow); padding: 1px 5px; }
.prio { font-size: 15px; letter-spacing: -1px; }
.prio-2 { color: var(--pink-deep); }
.prio-1 { color: var(--lav); }
.prio-0 { color: var(--ink-soft); }

.task-del {
  background: none; border: 3px solid transparent; cursor: pointer;
  font-size: 20px; color: var(--ink-soft); padding: 2px 6px; flex-shrink: 0;
}
.task-del:hover { color: var(--red); border-color: var(--red); }

/* ---- subtasks / steps ---- */
.steps-toggle {
  font-family: 'VT323', monospace; font-size: 15px;
  background: none; border: 2px solid var(--ink-shadow); color: var(--ink-soft);
  padding: 0 8px; cursor: pointer; line-height: 1.6;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.steps-toggle:hover { background: var(--panel-2); color: var(--ink); border-color: var(--ink); }
.steps-toggle.has-steps { color: var(--lav); border-color: var(--lav); }
.steps-toggle .chev { display: inline-block; transition: transform 0.15s steps(2); }
.steps-toggle.open .chev { transform: rotate(90deg); }

.task-steps {
  margin: 12px 0 2px 42px;
  padding: 12px;
  background: var(--panel-2);
  border: 2px dashed var(--lav);
}
.task-steps.hidden { display: none; }
.steps-hint { font-size: 15px; color: var(--ink-soft); text-align: center; margin-bottom: 8px; }

.substep-bar { height: 8px; background: var(--track); border: 2px solid var(--ink); overflow: hidden; margin-bottom: 10px; }
.substep-bar-fill {
  height: 100%; width: 0%;
  background: repeating-linear-gradient(90deg, var(--lav) 0 6px, var(--blue) 6px 12px);
  transition: width 0.4s steps(8);
}

.substep-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.substep { display: flex; align-items: center; gap: 9px; }
.subcheck {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--ink); background: var(--field); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: transparent;
}
.subcheck:hover { background: var(--panel-2); }
.substep.done .subcheck { background: var(--mint); color: var(--on-accent); }
.substep-text { flex: 1; font-size: 18px; word-break: break-word; }
.substep.done .substep-text { text-decoration: line-through; color: var(--ink-soft); }
.substep-del {
  background: none; border: none; cursor: pointer; color: var(--ink-soft);
  font-size: 15px; padding: 0 4px; opacity: 0.5; transition: opacity 0.12s, color 0.12s;
}
.substep:hover .substep-del { opacity: 1; }
.substep-del:hover { color: var(--red); }

.add-substep { display: flex; gap: 6px; }
.add-substep input { flex: 1; font-size: 17px; padding: 6px 9px; min-width: 0; }
.add-substep .btn { font-size: 8px; }

/* ---- editable task details (notes, due, cost, repeat) ---- */
.details-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.dfield { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--ink-soft); }
.dfield span { font-family: 'Press Start 2P', monospace; font-size: 7px; letter-spacing: 0.5px; }
.dfield input, .dfield select { font-size: 16px; padding: 4px 7px; min-width: 92px; }
.edit-cost { max-width: 90px; }
.task-notes {
  width: 100%; font-family: 'VT323', monospace; font-size: 17px; color: var(--ink);
  background: var(--field); border: 2px solid var(--ink); padding: 7px 9px;
  resize: vertical; outline: none; margin-bottom: 10px; line-height: 1.2;
}
.task-notes:focus { box-shadow: inset 0 0 0 2px var(--pink); background: var(--panel-2); }
.task-notes::placeholder { color: #b9acc8; }
.steps-divider { text-align: center; margin: 4px 0 10px; }
.steps-divider span {
  font-family: 'Press Start 2P', monospace; font-size: 8px; color: var(--lav);
}

/* empty state */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.empty-art { font-size: 34px; margin-bottom: 14px; animation: bob 3s ease-in-out infinite; }
.empty p { font-size: 20px; }
.empty.hidden { display: none; }

.footer-actions { display: flex; justify-content: center; margin-top: 4px; }

.credits { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; margin-top: 28px; font-size: 16px; color: var(--ink-soft); }
.studio-logo {
  width: 170px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity: 0.9;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.studio-logo:hover { opacity: 1; transform: translateY(-2px); }
body.night .studio-logo { filter: drop-shadow(0 0 6px rgba(173, 158, 235, 0.45)); }

/* ===================================================================
   CALENDAR VIEW
   =================================================================== */
.calendar-view { padding: 16px; }
.cal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-title {
  font-family: 'Press Start 2P', monospace; font-size: 13px; color: var(--pink-deep);
  flex: 1; text-align: center; min-width: 130px;
}
#calToday { margin-left: auto; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-weekday { text-align: center; font-family: 'Press Start 2P', monospace; font-size: 8px; color: var(--ink-soft); padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  min-height: 84px; border: 3px solid var(--ink); background: var(--field);
  padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  box-shadow: 2px 2px 0 var(--shadow); transition: transform 0.05s, box-shadow 0.05s, background 0.1s;
}
.cal-cell:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--shadow); background: var(--panel-2); }
.cal-cell.muted { opacity: 0.4; }
.cal-cell.today { box-shadow: inset 0 0 0 3px var(--pink), 2px 2px 0 var(--shadow); }
.cal-daynum { font-size: 16px; text-align: right; color: var(--ink-soft); line-height: 1; }
.cal-cell.today .cal-daynum { color: var(--pink-deep); font-weight: bold; }
.cal-tasks { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-chip {
  font-size: 13px; line-height: 1.3; padding: 1px 4px; border: 2px solid var(--ink);
  background: var(--c, var(--pink)); color: var(--on-accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.cal-chip.done { opacity: 0.5; text-decoration: line-through; }
.cal-chip:hover { filter: brightness(1.08); }
.cal-more { font-size: 13px; color: var(--ink-soft); padding-left: 2px; }

/* ---- Someday / no-date bucket ---- */
.cal-someday { margin-top: 16px; border-top: 3px dashed var(--ink-shadow); padding-top: 12px; }
.someday-title { font-family: 'Press Start 2P', monospace; font-size: 10px; color: var(--lav); margin-bottom: 10px; }
.someday-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.someday-chips .cal-chip { white-space: normal; max-width: 200px; }
.someday-empty { font-size: 15px; color: var(--ink-soft); }

.cal-hint { text-align: center; font-size: 15px; color: var(--ink-soft); margin-top: 14px; }
@media (max-width: 760px) {
  .cal-cell { min-height: 56px; padding: 2px; }
  .cal-daynum { font-size: 13px; }
  .cal-chip { font-size: 11px; padding: 0 3px; }
  .cal-grid, .cal-weekdays { gap: 3px; }
}

/* ===================================================================
   GARDEN VIEW — a cozy room that grows with your tasks
   =================================================================== */
.garden-view { padding: 16px; }
.garden-header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.garden-title { font-family: 'Press Start 2P', monospace; font-size: 13px; color: var(--pink-deep); }
.garden-count { font-size: 17px; color: var(--mint-deep); font-weight: bold; }
.garden-room {
  position: relative; min-height: 290px;
  border: 3px solid var(--ink);
  background: linear-gradient(#fff3fa 0%, #ffe7f3 70%, #e8c79a 70%, #d8b07e 100%); /* soft wall + warm floor */
  box-shadow: inset 0 0 0 3px var(--panel);
  padding: 16px 14px 0; overflow: hidden;
}
body.night .garden-room { background: linear-gradient(#2c2255 0%, #271f48 70%, #3b2e57 70%, #2c2147 100%); }
body.secret .garden-room { background: linear-gradient(#160e26 0%, #0e0820 70%, #2a0f33 70%, #190a22 100%); border-color: var(--pink); box-shadow: 3px 3px 0 var(--shadow), 0 0 14px rgba(255,79,163,0.25) inset; }
.garden-plot {
  display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center;
  gap: 4px 10px; padding-bottom: 96px; /* keep clear of the mascot on the floor */
}
.garden-plant svg { width: 34px; height: auto; display: block; image-rendering: pixelated; }
.garden-plant { animation: pop-in 0.3s ease; }
.garden-empty { width: 100%; text-align: center; color: var(--ink-soft); font-size: 18px; padding: 46px 12px; }
.garden-mascot { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); }
.garden-mascot svg { width: 96px; height: auto; image-rendering: pixelated; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.18)); }
.garden-hint { text-align: center; font-size: 15px; color: var(--ink-soft); margin-top: 12px; }

/* focus / pomodoro timer (inside the garden) */
.focus-timer { text-align: center; border: 3px solid var(--ink); background: var(--panel-2); padding: 14px 12px; margin-bottom: 14px; box-shadow: 3px 3px 0 var(--shadow); }
.focus-mode { font-family: 'Press Start 2P', monospace; font-size: 11px; color: var(--pink-deep); margin-bottom: 8px; }
.focus-clock { font-family: 'Press Start 2P', monospace; font-size: 36px; color: var(--ink); letter-spacing: 2px; line-height: 1; }
.focus-dots { margin: 8px 0 2px; font-size: 16px; letter-spacing: 3px; }
.focus-controls { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.focus-len { font-size: 17px; min-width: 36px; color: var(--ink-soft); }
.focus-go { min-width: 96px; }
.focus-controls .btn[disabled] { opacity: 0.4; cursor: not-allowed; }
/* the mascot "studies" with a warm glow + book during a focus session */
body.focusing .garden-mascot svg { filter: drop-shadow(0 0 7px rgba(255,221,134,0.65)) drop-shadow(0 3px 0 rgba(0,0,0,0.18)); }
body.focusing .garden-mascot::after { content: '📖'; position: absolute; right: -20px; bottom: 4px; font-size: 20px; animation: bob 2.2s ease-in-out infinite; }

/* ===================================================================
   WARDROBE / SHOP modal
   =================================================================== */
.open-shop-btn { margin-top: 10px; width: 100%; }
.shop-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(40, 30, 60, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.shop-overlay[hidden] { display: none; }
.shop { width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto; background: var(--panel); }
.shop-head { display: flex; align-items: center; justify-content: space-between; }
.shop-head .panel-title { margin-bottom: 0; }
.shop-close { width: 34px; height: 34px; font-size: 16px; }

/* ---- cloud sync modal ---- */
.sync-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(40, 30, 60, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sync-overlay[hidden] { display: none; }
.sync { width: 100%; max-width: 380px; background: var(--panel); }
.sync-head { display: flex; align-items: center; justify-content: space-between; }
.sync-head .panel-title { margin-bottom: 0; }
.sync-close { width: 34px; height: 34px; font-size: 16px; }
.sync-body { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; font-size: 17px; color: var(--ink); }
.sync-msg { margin: 0; line-height: 1.4; }
.sync-note { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.4; }
.sync-status { margin: 0; font-size: 15px; color: var(--mint-deep); }
.sync-status.sync-error { color: var(--red); }
.sync-form { display: flex; flex-direction: column; gap: 10px; }
.sync-form input { font-family: inherit; font-size: 18px; padding: 10px 12px; border: 3px solid var(--ink); background: var(--field); color: var(--ink); box-shadow: 3px 3px 0 var(--shadow); width: 100%; box-sizing: border-box; }
.sync-form input:focus { outline: none; border-color: var(--pink-deep); }
.icon-btn.synced { box-shadow: 3px 3px 0 var(--shadow), 0 0 0 2px var(--mint-deep); } /* ☁ glows minty when synced */
.shop-coins-line { font-size: 16px; color: var(--ink-soft); margin: 8px 0 14px; }
.shop-coins-line span { color: #e0a32a; font-weight: bold; }
.shop-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.shop-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 3px solid var(--ink); background: var(--field); padding: 12px 8px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.shop-item.equipped { box-shadow: inset 0 0 0 3px var(--mint-deep), 3px 3px 0 var(--shadow); }
.shop-preview {
  width: 64px; height: 64px; display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 2px solid var(--ink); image-rendering: pixelated;
}
.shop-name { font-size: 16px; text-align: center; line-height: 1.15; }
.shop-buy[disabled] { opacity: 0.45; cursor: not-allowed; }
.shop-equip.on { background: var(--mint); }

/* ===================================================================
   FX — sparkles, confetti, toast
   =================================================================== */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti {
  position: absolute; width: 10px; height: 10px;
  animation: fall 1.2s ease-in forwards;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(110vh) rotate(540deg); opacity: 0; }
}
.spark {
  position: absolute; font-size: 20px;
  animation: spark-out 0.7s ease-out forwards;
}
/* shift the orange 🐾 emoji to a soft pastel pink (keeps the paw's toe-bean detail) */
.spark-paw { filter: hue-rotate(310deg) saturate(0.6) brightness(1.28); }
@keyframes spark-out {
  0% { transform: translate(0,0) scale(0.4); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.3); opacity: 0; }
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120px);
  background: var(--toast-bg); color: #fff;
  font-family: 'Press Start 2P', monospace; font-size: 11px;
  padding: 14px 18px; border: 3px solid #fff;
  box-shadow: 0 0 0 3px var(--ink), 5px 5px 0 var(--shadow);
  z-index: 200; transition: transform 0.3s cubic-bezier(.2,1.4,.5,1); max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 760px) {
  body { font-size: 18px; }
  .layout { grid-template-columns: 1fr; }
  .logo h1 { font-size: 15px; }
  .btn-add { margin-left: 0; width: 100%; }
  .hud { width: 100%; justify-content: space-between; }
  .xp { flex: 1; }
}

/* touch devices have no hover — always show the per-item action buttons and give bigger tap targets */
@media (hover: none) {
  .project-del, .project-edit-btn { opacity: 1; padding: 5px 8px; font-size: 18px; }
  .substep-del { opacity: 1; }
  .drag-handle { padding: 2px 9px; font-size: 22px; }
}
