/* Beast Mode Buddies — colored-pencil sketchbook UI.
   Everything is drawn in the same sketchbook as the buddy: wobbly pencil
   borders, hatched pencil fills, graphite ink on plain white paper. */

:root {
  --ink: #494a54;          /* warm graphite pencil */
  --ink-soft: #8a8c99;
  /* Text-input color only. Deliberately NOT redefined by body.zombie-mode
     (unlike --ink) — an input keeps a white background in every mode, so its
     text needs to stay dark-on-white rather than following the mode's
     re-skinned --ink, which would go near-white-on-white and vanish. */
  --ink-input: #494a54;
  --blue: #5c77bb;         /* hedgehog-quill periwinkle */
  --blue-deep: #3e5590;
  --amber: #e9a23b;        /* energy pencil */
  --amber-soft: #f6dcae;
  --rose: #d97b8f;         /* bond pencil */
  --rose-soft: #f3d3da;
  --comm-green: #6a9f5a;   /* calls — distinct from --blue, which zombie-mode repurposes as its own "good" green */
  --comm-green-soft: #dbe8d3;
  --comm-blue: #5c77bb;    /* texts */
  --comm-blue-soft: #d8ddf0;
  --comm-grey-blue: #a7b0c2; /* emails — kept distinct from --ink-soft */
  --comm-grey-blue-soft: #e7eaf1;
  --comm-red: #c9573f;     /* negative period-over-period delta */
  --paper: #ffffff;
  --line: 2px solid var(--ink);
  --hand: "Patrick Hand", "Segoe Print", cursive;
  --body: "Nunito", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.45;
}

#app { max-width: 420px; margin: 0 auto; padding: 12px 14px 20px; }

.center { text-align: center; }

/* ---------- pencil primitives ---------- */

.card {
  background: var(--paper);
  border: var(--line);
  /* uneven radii = hand-drawn wobble */
  border-radius: 14px 10px 15px 9px / 10px 15px 9px 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

h1, h2, .hand { font-family: var(--hand); font-weight: 400; letter-spacing: .02em; }

.eyebrow {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .12em; color: var(--ink-soft);
}

.bond-boost { font-size: 13px; margin-left: 2px; animation: boost-pulse 1.6s ease-in-out infinite; }
@keyframes boost-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

button {
  font-family: var(--hand); font-size: 17px; color: var(--ink);
  background: var(--paper); border: var(--line); cursor: pointer;
  border-radius: 12px 9px 13px 8px / 9px 13px 8px 12px;
  padding: 7px 18px;
  transition: transform .12s ease, background .12s ease;
}
button:hover { background: #f2f5fc; transform: rotate(-1deg) scale(1.03); }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 2px;
}
button.primary { background: var(--blue); border-color: var(--blue-deep); color: #fff; }
button.primary:hover { background: var(--blue-deep); }
button:disabled { opacity: .45; cursor: default; transform: none; }

input[type="text"] {
  font-family: var(--hand); font-size: 18px; color: var(--ink-input);
  border: var(--line); border-radius: 10px 13px 9px 12px / 13px 9px 12px 10px;
  padding: 6px 12px; width: 100%;
}

/* ---------- stage (the buddy) ---------- */

.stage { position: relative; padding: 18px 8px 6px; }

.buddy-wrap { position: relative; width: 190px; height: 190px; margin: 0 auto; }
.buddy-wrap.pong-active { width: 240px; height: 170px; }

.pong-close {
  position: absolute; top: -10px; right: -10px; z-index: 1;
  width: 26px; height: 26px; padding: 0; font-size: 12px; line-height: 1;
  border-radius: 50%;
}
.pong-canvas { width: 100%; height: 100%; border: var(--line); border-radius: 10px; touch-action: none; }

.aura {
  position: absolute; inset: -12px; border-radius: 50%;
  background: radial-gradient(circle, rgba(233,162,59,.35) 0%, rgba(233,162,59,0) 65%);
  opacity: 0; transition: opacity 1.2s ease;
}
.aura.on { opacity: 1; animation: aura-pulse 3.2s ease-in-out infinite; }
@keyframes aura-pulse { 50% { transform: scale(1.06); } }

.buddy {
  position: relative; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  transform-origin: 50% 90%;
}
.buddy img { width: 100%; height: 100%; object-fit: contain; }

/* mood motion — same still, different life */
.mood-content  .buddy { animation: breathe 4s ease-in-out infinite; }
.mood-excited  .buddy { animation: bounce 1.1s cubic-bezier(.36,.07,.19,.97) infinite; }
.mood-sleepy   .buddy { animation: sway 5.5s ease-in-out infinite; }
.mood-cozy     .buddy { animation: breathe 7s ease-in-out infinite; transform: scale(.96); }

@keyframes breathe { 50% { transform: scaleY(.975) scaleX(1.01); } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 35% { transform: translateY(-10px) scaleY(1.03); } 55% { transform: translateY(0) scaleY(.97); } }
@keyframes sway { 50% { transform: rotate(2.5deg) scaleY(.98); } }

.buddy.celebrate { animation: hop .55s cubic-bezier(.36,.07,.19,.97) 2 !important; }
@keyframes hop {
  0%,100% { transform: translateY(0) rotate(0); }
  40% { transform: translateY(-16px) rotate(-3deg); }
  70% { transform: translateY(0) scaleY(.94); }
}

/* trick commands ("roll over", "shake") — reuse the current mood sprite, no new art */
.buddy.trick-rollover { animation: trick-rollover .6s ease-in-out !important; }
@keyframes trick-rollover {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.buddy.trick-shake { animation: trick-shake .5s ease-in-out !important; }
@keyframes trick-shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-8px) rotate(-8deg); }
  40% { transform: translateX(7px) rotate(7deg); }
  60% { transform: translateX(-5px) rotate(-5deg); }
  80% { transform: translateX(4px) rotate(4deg); }
}

.zzz {
  position: absolute; top: 6px; right: 14px; font-family: var(--hand);
  color: var(--ink-soft); font-size: 20px; opacity: 0;
}
.mood-sleepy .zzz, .mood-cozy .zzz { opacity: 1; animation: zfloat 3s ease-in-out infinite; }
@keyframes zfloat { 50% { transform: translateY(-6px); opacity: .55; } }

.pet-name { font-size: 26px; margin-top: 2px; }
.bond-chip {
  display: inline-block; font-size: 12px; font-weight: 800;
  color: var(--blue-deep); border: 2px solid var(--blue);
  border-radius: 999px; padding: 1px 10px; margin-top: 2px;
  text-transform: capitalize;
}
.mood-line { color: var(--ink-soft); font-size: 13px; margin-top: 4px; min-height: 1.4em; }
.away-notice { margin-top: 6px; }
.away-title { font-size: 17px; margin: 0; }
.away-notice a { word-break: break-all; }

/* ---------- Calculator Mode ---------- */
.calculator-panel { margin: 4px auto 0; max-width: 220px; }
.calculator { position: relative; display: flex; flex-direction: column; gap: 6px; }
.calc-close {
  position: absolute; top: -10px; right: -10px; z-index: 1;
  width: 26px; height: 26px; padding: 0; font-size: 12px; line-height: 1;
  border-radius: 50%;
}
.calc-display {
  font-family: var(--hand); font-size: 24px; text-align: right;
  border: var(--line); border-radius: 10px 13px 9px 12px / 13px 9px 12px 10px;
  padding: 8px 12px; min-height: 1.3em; overflow-x: auto; white-space: nowrap;
}
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.calc-btn {
  padding: 8px 0; font-size: 15px;
  color: var(--calc-color, var(--blue)); border-color: var(--calc-color, var(--blue));
}
.calc-clear { color: var(--rose); border-color: var(--rose); }
.calc-equals {
  padding: 8px 0; font-size: 16px;
  background: var(--calc-color, var(--blue)); border-color: var(--calc-color, var(--blue)); color: #fff;
}

/* ---------- Rock-Paper-Scissors easter egg ---------- */
.rps-panel { position: relative; }
.rps-buttons { display: flex; justify-content: space-around; gap: 8px; }
.rps-btn { font-size: 28px; padding: 8px 16px; }
.rps-close {
  position: absolute; top: -10px; right: -10px; z-index: 1;
  width: 26px; height: 26px; padding: 0; font-size: 12px; line-height: 1;
  border-radius: 50%;
}

/* ---------- Pig / Big Pig dice mini-game ---------- */
.pig-panel { position: relative; text-align: center; }
.pig-close {
  position: absolute; top: -10px; right: -10px; z-index: 1;
  width: 26px; height: 26px; padding: 0; font-size: 12px; line-height: 1;
  border-radius: 50%;
}
.pig-status { min-height: 1.4em; }
.pig-dice { display: flex; justify-content: center; gap: 10px; margin: 6px 0; }
.die {
  --pig-color: var(--blue);
  width: 56px; height: 56px; padding: 6px;
  display: grid; grid-template-areas: "a . b" "c d e" "f . g";
  grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  border: 3px solid var(--ink); border-radius: 12px; background: var(--paper);
}
.die.pet-turn { border-color: var(--pig-color); }
.die .pip { width: 10px; height: 10px; border-radius: 50%; opacity: 0; align-self: center; justify-self: center; background: var(--ink); }
.die.pet-turn .pip { background: var(--pig-color); }
.die .pip.on { opacity: 1; }
.die .pip-a { grid-area: a; } .die .pip-b { grid-area: b; } .die .pip-c { grid-area: c; }
.die .pip-d { grid-area: d; } .die .pip-e { grid-area: e; } .die .pip-f { grid-area: f; }
.die .pip-g { grid-area: g; }

.chat-form { display: flex; gap: 7px; margin: 10px 4px 2px; }
.chat-form input { min-width: 0; flex: 1; font-size: 16px; }
.chat-form button { flex: none; font-size: 15px; padding: 5px 12px; }

/* floating reward chips */
.floater {
  position: absolute; left: 50%; top: 20%;
  font-family: var(--hand); font-size: 22px; color: var(--amber);
  text-shadow: 0 0 2px #fff;
  animation: float-up 1.6s ease-out forwards; pointer-events: none;
}
.floater.bond { color: var(--rose); }
@keyframes float-up {
  0% { transform: translate(-50%, 0) scale(.7); opacity: 0; }
  20% { opacity: 1; transform: translate(-50%, -12px) scale(1.1); }
  100% { transform: translate(-50%, -70px) scale(1); opacity: 0; }
}

/* confetti — pencil shavings */
.confetti {
  position: absolute; width: 8px; height: 12px; top: -10px;
  border-radius: 2px 5px 2px 5px; opacity: .9; pointer-events: none;
  animation: confetti-fall 1.8s ease-in forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(230px) rotate(540deg); opacity: 0; }
}

/* ---------- Hocus Pocus: frog curse / restore ---------- */
.buddy.spellcast { animation: spellcast .6s ease-in-out !important; }
@keyframes spellcast {
  0%, 100% { transform: scale(1) rotate(0); filter: brightness(1) saturate(1); }
  30% { transform: scale(1.18) rotate(-5deg); filter: brightness(1.5) saturate(1.6); }
  60% { transform: scale(.82) rotate(5deg); filter: brightness(1.7) saturate(1.8); }
}

.sparkle {
  position: absolute; left: 50%; top: 50%; font-size: 20px;
  pointer-events: none; opacity: 0; z-index: 2;
  animation: sparkle-burst .9s ease-out forwards;
}
@keyframes sparkle-burst {
  0% { transform: translate(-50%, -50%) translate(0, 0) scale(.2) rotate(0deg); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translate(-50%, -50%) translate(var(--sx), var(--sy)) scale(1.15) rotate(var(--sr)); opacity: 0; }
}

/* ---------- stat bars: colored-pencil hatching ---------- */

.stat { margin-bottom: 10px; }
.stat-head { display: flex; justify-content: space-between; align-items: baseline; }
.stat-value { font-family: var(--hand); font-size: 18px; }

.bar {
  height: 16px; border: var(--line); background: var(--paper);
  border-radius: 9px 12px 8px 11px / 12px 8px 11px 9px;
  overflow: hidden; margin-top: 3px;
}
.bar > .fill {
  height: 100%; width: 0;
  transition: width .8s cubic-bezier(.22,1,.36,1);
  /* diagonal pencil strokes */
  background:
    repeating-linear-gradient(115deg,
      var(--stroke) 0 3px, transparent 3px 5.5px),
    var(--wash);
}
.fill.energy { --stroke: var(--amber); --wash: var(--amber-soft); }
.fill.bond   { --stroke: var(--rose);  --wash: var(--rose-soft); }

.bond-note { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- communications counters ---------- */

.comm-header { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; }
.comm-period-arrow {
  background: none; border: none; font-size: 20px; line-height: 1; cursor: pointer;
  color: var(--ink); padding: 0 4px;
}
.comm-counters { display: flex; justify-content: space-around; gap: 8px; }
.comm-counter { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.comm-meter-slot { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; }
.comm-ring { width: 52px; height: 52px; }
.comm-ring-track { fill: none; stroke: var(--wash); stroke-width: 5; }
.comm-ring-fill {
  fill: none; stroke-width: 5; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: center;
  transition: stroke-dashoffset .8s cubic-bezier(.22,1,.36,1);
}
.comm-ring-num { font-family: var(--hand); font-size: 17px; font-weight: 700; fill: var(--ink); }
.comm-ring-num.comm-ring-num-md { font-size: 14px; }
.comm-ring-num.comm-ring-num-sm { font-size: 11px; }
/* Accelerator: past-goal counts get a second, thicker lap in amber (same
   hue regardless of comm type, so "over goal" reads as one consistent
   signal) plus a soft pulsing glow on the whole ring. */
.comm-ring-overflow {
  fill: none; stroke: var(--amber); stroke-width: 9; stroke-linecap: round;
  opacity: .6;
  transform: rotate(-90deg); transform-origin: center;
  transition: stroke-dashoffset .8s cubic-bezier(.22,1,.36,1);
}
.comm-ring.comm-ring-exceeded { animation: comm-ring-glow 1.6s ease-in-out infinite; }
@keyframes comm-ring-glow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(233,162,59,0)); }
  50% { filter: drop-shadow(0 0 3px rgba(233,162,59,.85)); }
}
.comm-call .comm-ring-fill  { stroke: var(--comm-green);     --wash: var(--comm-green-soft); }
.comm-text .comm-ring-fill  { stroke: var(--comm-blue);      --wash: var(--comm-blue-soft); }
.comm-email .comm-ring-fill { stroke: var(--comm-grey-blue); --wash: var(--comm-grey-blue-soft); }
.comm-call .comm-ring-track  { stroke: var(--comm-green-soft); }
.comm-text .comm-ring-track  { stroke: var(--comm-blue-soft); }
.comm-email .comm-ring-track { stroke: var(--comm-grey-blue-soft); }
.comm-plain-num { font-family: var(--hand); font-size: 26px; font-weight: 700; line-height: 1; }
.comm-call .comm-plain-num, .comm-call .comm-ring-num { color: var(--comm-green); fill: var(--comm-green); }
.comm-text .comm-plain-num, .comm-text .comm-ring-num { color: var(--comm-blue); fill: var(--comm-blue); }
.comm-email .comm-plain-num, .comm-email .comm-ring-num { color: var(--comm-grey-blue); fill: var(--comm-grey-blue); }
.comm-label { font-size: 11px; color: var(--ink-soft); }
.comm-goal-link {
  border: 0; background: transparent; color: var(--blue-deep); font-size: 13px;
  padding: 0; text-decoration: underline; line-height: 1.1;
}
.comm-goal-link:hover { background: transparent; transform: none; color: var(--blue); }

.comm-goals-grid {
  display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 6px;
  align-items: center; margin-top: 8px;
}
.comm-goals-grid input[type="number"] { width: 100%; }
.comm-goal-col-label, .comm-goal-row-label { font-size: 11px; color: var(--ink-soft); }

/* ---------- streak ---------- */

.streak-row { display: flex; align-items: center; gap: 10px; }
.streak-count { font-family: var(--hand); font-size: 30px; line-height: 1; }
.streak-label { font-size: 12px; color: var(--ink-soft); }
.shields { margin-left: auto; display: flex; gap: 3px; font-size: 16px; }
.shields .dim { opacity: .22; }
.calibrating-note { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }

/* ---------- onboarding ---------- */

.onboard-preview { width: 140px; height: 140px; margin: 0 auto 8px; }
.onboard-preview img { width: 100%; height: 100%; object-fit: contain; }

/* auto-fit + a fixed minmax floor (not 1fr alone) lets the grid drop to
   fewer columns as the panel narrows instead of forcing every column wide
   enough for its longest label and overflowing the panel. */
.species-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 6px; margin: 10px 0; }
.species-pick {
  min-width: 0; padding: 8px 2px 4px; text-align: center;
  border: 2px solid transparent; border-radius: 12px; cursor: pointer;
  background: none; transition: transform .12s ease;
}
.species-pick img { width: 36px; height: 36px; object-fit: contain; display: block; margin: 0 auto; }
.species-pick small {
  display: block; font-size: 10px; font-weight: 800; color: var(--ink-soft); text-transform: capitalize;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.species-pick:hover { transform: scale(1.1) rotate(-2deg); }
.species-pick.selected { border: 2px solid var(--blue); background: #f2f5fc; }

/* ---------- manage buddies ---------- */

.pet-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.pet-card {
  display: flex; flex-direction: column; gap: 8px; padding: 10px;
  border: var(--line); border-radius: 12px 14px 11px 13px / 13px 11px 14px 12px;
}
.pet-card-main { display: flex; align-items: center; gap: 10px; }
.pet-card-thumb { width: 44px; height: 44px; flex: none; }
.pet-card-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pet-card-info { flex: 1; min-width: 0; }
.pet-card-info strong { font-family: var(--hand); font-size: 18px; }
.pet-card-info .bond-note { margin: 0; text-transform: capitalize; }
.pet-card-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pet-card-badge {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--blue-deep); border: 2px solid var(--blue); border-radius: 8px; padding: 3px 8px;
  align-self: center;
}
.pet-activate { font-size: 14px; padding: 6px 10px; }
.pet-release { font-size: 13px; padding: 6px 10px; color: var(--rose); border-color: var(--rose-soft); }

.pet-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-style: dashed; color: var(--ink-soft); background: none; padding: 16px 10px;
}
.pet-add-plus { font-size: 20px; }

/* ---------- trophy case ---------- */

.bond-ladder { list-style: none; display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.bond-ladder-tier {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px; border-radius: 8px; color: var(--ink-soft);
}
.bond-ladder-tier.current { color: var(--ink); background: var(--rose-soft); font-weight: 800; }
.bond-ladder-threshold { font-size: 12px; }

.trophy-grid { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.trophy-card {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border: var(--line); border-radius: 12px 14px 11px 13px / 13px 11px 14px 12px;
}
.trophy-icon { width: 56px; height: 56px; flex: none; }
.trophy-icon img { width: 100%; height: 100%; object-fit: contain; }
.trophy-info { flex: 1; min-width: 0; }
.trophy-info strong { font-family: var(--hand); font-size: 17px; }
.trophy-info .bond-note { margin: 2px 0 0; }
.trophy-date { font-size: 11px; color: var(--ink-soft); }

.streak-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.streak-badge {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 10px; border: var(--line); border-radius: 10px;
  color: var(--ink-soft); opacity: .5;
}
.streak-badge.reached { color: var(--ink); opacity: 1; border-color: var(--amber); background: var(--amber-soft); }
.streak-badge-days { font-family: var(--hand); font-size: 16px; }

/* ---------- shareable profile page ---------- */

.profile-header { display: flex; flex-direction: column; align-items: center; }
.profile-art { width: 140px; height: 140px; object-fit: contain; }

.profile-achv-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0;
}
.profile-achv-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px; border: var(--line); border-radius: 12px 14px 11px 13px / 13px 11px 14px 12px;
  text-align: center;
}
.profile-achv-tile .trophy-icon { width: 44px; height: 44px; }
.profile-achv-tile strong { font-family: var(--hand); font-size: 13px; }

.profile-share-row {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px;
}
.profile-share-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: var(--line); border-radius: 50%;
  font-size: 16px; text-decoration: none;
}

/* profile-editor achievement picker: a .trophy-card that's also a <button> */
.profile-pick { width: 100%; text-align: left; transform: none; }
.profile-pick:hover { transform: none; }
.profile-pick.selected { background: var(--rose-soft); border-color: var(--rose); }

/* ---------- banner moments (milestones, stage ups) ---------- */

.banner {
  border-color: var(--amber);
  background: linear-gradient(0deg, #fff8ec, #fff8ec);
  animation: banner-in .5s cubic-bezier(.22,1,.36,1);
}
@keyframes banner-in { from { transform: translateY(-8px) scale(.97); opacity: 0; } }
.banner h2 { font-size: 22px; }

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

.settings-row { text-align: right; margin-bottom: 8px; }
.settings-row button { font-size: 13px; padding: 3px 10px; color: var(--ink-soft); }

#holiday-search { font-size: 15px; margin-bottom: 6px; }

.holiday-list {
  max-height: 160px; overflow-y: auto; border: var(--line); border-radius: 8px;
  padding: 4px 10px; margin-bottom: 6px;
}
.holiday-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 0; font-size: 14px; gap: 8px;
}
.holiday-item input { margin-right: 6px; }
.holiday-next { color: var(--ink-soft); font-size: 12px; white-space: nowrap; }

.custom-holiday-list { margin: 0 0 6px; padding: 0; list-style: none; }
.custom-holiday-list li {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; padding: 2px 0; gap: 8px;
}
.custom-holiday-list button.remove-custom,
.custom-holiday-list button.remove-timeoff {
  background: none; border: none; color: var(--ink-soft); font-size: 16px;
  padding: 0 4px; cursor: pointer;
}

#custom-holiday-form summary,
#time-off-form summary { cursor: pointer; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.custom-holiday-fields { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.custom-holiday-fields input[type="text"] { width: auto; flex: 1 1 120px; font-size: 15px; }
.custom-holiday-fields input[type="number"] { width: 60px; font-family: var(--hand); font-size: 15px; }
.custom-holiday-fields input[type="date"] {
  font-family: var(--hand); font-size: 14px; color: var(--ink);
  border: var(--line); border-radius: 8px; padding: 3px 6px;
}
.custom-holiday-fields select {
  font-family: var(--hand); font-size: 14px; color: var(--ink);
  border: var(--line); border-radius: 8px; padding: 3px 6px;
}

#tz {
  width: 100%; font-family: var(--hand); font-size: 15px; color: var(--ink);
  border: var(--line); border-radius: 10px 13px 9px 12px / 13px 9px 12px 10px;
  padding: 6px 12px;
}

textarea {
  width: 100%; font-family: var(--hand); font-size: 15px; color: var(--ink-input);
  border: var(--line); border-radius: 10px 13px 9px 12px / 13px 9px 12px 10px;
  padding: 6px 12px; resize: vertical;
}

/* ---------- Zombie Mode ---------- */

.app-title { text-align: left; margin-bottom: 2px; }

/* Redefining the palette tokens here is what re-skins every card, button,
   bar, and input for free — they all already read colors through var(). */
body.zombie-mode {
  --ink: #e7e5ea;
  --ink-soft: #97939f;
  --blue: #6fbf6f;
  --blue-deep: #3f8f4a;
  --amber: #8fbf5a;
  --amber-soft: #24301c;
  --rose: #b26fd6;
  --rose-soft: #2a2033;
  --comm-green: #7fcf6a;
  --comm-green-soft: #223018;
  --comm-blue: #7f93d6;
  --comm-blue-soft: #232a3f;
  --comm-grey-blue: #8891a5;
  --comm-grey-blue-soft: #23262f;
  --comm-red: #e2685a;
  --paper: #16141a;
  background: var(--paper);
  color: var(--ink);
  transition: background .3s ease, color .3s ease;
}
body.zombie-mode .app-title { color: #ff6b6b; letter-spacing: .16em; }
body.zombie-mode .banner { background: linear-gradient(0deg, #1c1a22, #1c1a22); border-color: #ff6b6b; }

.mood-zombie .buddy { animation: zombie-shuffle 2.2s ease-in-out infinite; filter: saturate(.65) brightness(.92); }
@keyframes zombie-shuffle {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25%      { transform: translateX(-4px) rotate(-2deg); }
  50%      { transform: translateX(0) translateY(3px) rotate(0deg); }
  75%      { transform: translateX(4px) rotate(2deg); }
}

.exit-zombie-btn { width: 100%; margin-top: 4px; font-size: 16px; animation: manifest .5s ease; }
@keyframes manifest { from { opacity: 0; transform: translateY(8px); } }
body.zombie-mode .exit-zombie-btn { color: #ff6b6b; border-color: #ff6b6b; background: #1f1414; }

/* ---------- Pirate Mode ---------- */

body.pirate-mode { background: #f8f0df; }
body.pirate-mode .app-title { color: #76512d; letter-spacing: .12em; }
body.pirate-mode .banner { background: #fff9ec; border-color: #76512d; }
.exit-pirate-btn { width: 100%; margin-top: 4px; font-size: 16px; animation: manifest .5s ease; }
body.pirate-mode .exit-pirate-btn { color: #76512d; border-color: #76512d; background: #fff9ec; }

.banner-icon { width: 64px; height: 64px; object-fit: contain; display: block; margin: 0 auto 4px; }

/* Full-screen white -> black -> reveal, played once on "play dead" while the
   underlying UI repaints itself for Zombie Mode behind the black phase. */
.zombie-transition {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: #fff; opacity: 0;
  transition: opacity .45s ease, background-color .45s ease;
}
.zombie-transition.phase-white { opacity: 1; background: #fff; }
.zombie-transition.phase-black { opacity: 1; background: #000; }
.zombie-transition.fade-out { opacity: 0; }

/* ---------- misc states ---------- */

.state-card p { margin-top: 6px; color: var(--ink-soft); }

.pencil-spinner {
  width: 30px; height: 30px; margin: 10px auto;
  border: 3px solid var(--ink); border-right-color: transparent;
  border-radius: 50% 45% 52% 47%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
