/* The Wall — cute pixel-art love wall.
   Design tokens locked in /plan-design-review (2026-06-24). See DESIGN.md. */
:root {
  --bg:        #ffd9e6;   /* light pastel pink wall */
  --frame:     #f5aac0;
  --outline:   #6b4f3a;   /* soft brown pixel outline */
  --ink:       #5a4636;   /* note text */
  --heart:     #e8364f;
  --note-pink:    #ffe1ea;  --ac-pink:    #ff9db6;
  --note-mint:    #dcf3e6;  --ac-mint:    #9fd9ba;
  --note-lemon:   #fff2c6;  --ac-lemon:   #ffd87a;
  --note-lav:     #eadcff;  --ac-lav:     #c2a6ee;
  --font-pixel: 'Silkscreen', monospace;
  --font-read:  'VT323', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-read);
  color: var(--ink);
  background:
    repeating-linear-gradient(0deg,  rgba(255,150,185,.13) 0 5px, transparent 5px 10px),
    repeating-linear-gradient(90deg, rgba(255,150,185,.13) 0 5px, transparent 5px 10px),
    var(--bg);
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* sprite renderer cells */
.sprite { display: inline-grid; line-height: 0; vertical-align: middle; }
.sprite > i { display: block; }

/* masthead */
.masthead { text-align: center; padding: 26px 16px 10px; }
.masthead .row1 { display: flex; align-items: center; justify-content: center; gap: 9px; }
.masthead .for { font-family: var(--font-pixel); font-weight: 700; font-size: 20px; color: #ff5d7a; }
.masthead .sub { font-family: var(--font-read); font-size: 18px; color: #d28aa0; margin-top: 8px; }

/* wall canvas — scattered, scrollable */
.wall {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 8px auto 90px;
  min-height: 70vh;
  padding: 0 12px;
}

/* a note */
.note {
  position: absolute;
  width: 150px;
  padding: 11px 12px 9px;
  background: var(--note-pink);
  border: 3px solid var(--outline);
  border-radius: 3px;
  box-shadow: 4px 4px 0 0 var(--ac-pink);
  cursor: grab;
  touch-action: none;
  transition: box-shadow .12s ease;
}
.note.dragging { cursor: grabbing; box-shadow: 7px 7px 0 0 var(--ac-pink); z-index: 50; }
.note .top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.note .msg { font-family: var(--font-read); font-size: 21px; line-height: 1.0; }
/* legibility: timestamp bumped to a readable size (design decision #5) */
.note .byline { font-family: var(--font-read); font-size: 16px; color: #b06a80; margin-top: 6px; line-height: 1; }
.note .stamp { font-family: var(--font-pixel); font-size: 11px; color: #a9876f; margin-top: 7px; letter-spacing: .01em; }

/* owner-only delete button */
.note .del {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-pixel); font-size: 9px; color: #fff4ec;
  background: #e8364f; border: 2px solid var(--outline); border-radius: 3px;
  box-shadow: 2px 2px 0 0 rgba(107,79,58,.5); cursor: pointer; padding: 0;
}
.note .del:active { transform: translate(1px, 1px); }

.note.pink  { background: var(--note-pink);  box-shadow: 4px 4px 0 0 var(--ac-pink); }
.note.mint  { background: var(--note-mint);  box-shadow: 4px 4px 0 0 var(--ac-mint); }
.note.lemon { background: var(--note-lemon); box-shadow: 4px 4px 0 0 var(--ac-lemon); }
.note.lav   { background: var(--note-lav);   box-shadow: 4px 4px 0 0 var(--ac-lav); }

/* sealed (time-locked) note */
.note.sealed {
  width: 158px; text-align: center; color: #8a7560; cursor: default;
  border: 3px dashed #c2a98f;
  box-shadow: 4px 4px 0 0 #e6cfa8;
  background: repeating-linear-gradient(45deg,#f7ecd9,#f7ecd9 7px,#f1e2c9 7px,#f1e2c9 14px);
}
.note.sealed .seal-msg { font-family: var(--font-read); font-size: 19px; color: #9c8568; margin-top: 5px; }
.note.sealed .seal-date { font-family: var(--font-pixel); font-size: 10px; margin-top: 9px; color: #b29a7a; line-height: 1.7; }

/* sealed note that is ready to open (D4) */
.note.sealed.ready { cursor: pointer; animation: seal-pulse 1.6s ease-in-out infinite; }
.note.sealed.ready .seal-date { color: #ff5d7a; }
@keyframes seal-pulse {
  0%, 100% { box-shadow: 4px 4px 0 0 #e6cfa8; }
  50%      { box-shadow: 5px 5px 0 0 #ff9db6; }
}
/* gentle fade when a note reveals (opacity only — keeps the note's rotation) */
.note.revealing { animation: reveal-pop .42s ease-out; }
@keyframes reveal-pop { from { opacity: .2; } to { opacity: 1; } }
/* burst of pixel hearts on unwrap */
.spark {
  position: absolute; z-index: 55; pointer-events: none;
  transform: translate(-50%, -50%);
  animation: spark-fly .9s ease-out forwards;
}
@keyframes spark-fly {
  0%   { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .note.sealed.ready { animation: none; }
  .spark { animation-duration: .01s; }
}

/* full-screen states: loading / error / empty */
.overlay {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 26px;
  background:
    repeating-linear-gradient(0deg,  rgba(255,150,185,.13) 0 5px, transparent 5px 10px),
    repeating-linear-gradient(90deg, rgba(255,150,185,.13) 0 5px, transparent 5px 10px),
    var(--bg);
}
.overlay[hidden] { display: none; }  /* [hidden] needs help vs display:flex */
.overlay-text { font-family: var(--font-pixel); font-weight: 700; font-size: 16px; color: #ff5d7a; margin-top: 18px; }
.overlay-sub { font-family: var(--font-read); font-size: 20px; color: #d28aa0; margin-top: 12px; }
.retry {
  margin-top: 18px; font-family: var(--font-pixel); font-size: 11px; color: var(--ink);
  background: var(--note-pink); border: 3px solid var(--outline); border-radius: 3px;
  box-shadow: 3px 3px 0 0 var(--ac-pink); padding: 9px 14px; cursor: pointer;
}
.retry:active { box-shadow: 1px 1px 0 0 var(--ac-pink); transform: translate(2px, 2px); }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* demo-mode banner */
.demo-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: #6b4f3a; color: #fff4ec; text-align: center;
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: .02em; padding: 6px 8px;
}
.demo-banner[hidden] { display: none; }

/* drag hint */
.hint {
  position: fixed; bottom: 14px; left: 0; right: 0; text-align: center;
  font-family: var(--font-read); font-size: 16px; color: #d98ba6; pointer-events: none;
}

/* owner: discreet floating button */
.owner-fab {
  position: fixed; right: 12px; bottom: 12px; z-index: 60;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: #fff7f1; border: 3px solid var(--outline); border-radius: 3px;
  box-shadow: 3px 3px 0 0 var(--ac-pink); cursor: pointer; opacity: .8;
}
.owner-fab[hidden] { display: none; }
.owner-fab:active { box-shadow: 1px 1px 0 0 var(--ac-pink); transform: translate(2px, 2px); }

/* owner: panel + scrim */
.scrim { position: fixed; inset: 0; background: rgba(90,70,60,.35); z-index: 70; }
.scrim[hidden] { display: none; }
.panel {
  position: fixed; z-index: 80; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 380px;
  background: var(--note-pink);
  border: 3px solid var(--outline); border-bottom: none; border-radius: 6px 6px 0 0;
  box-shadow: 0 -6px 0 0 var(--ac-pink); padding: 18px 18px 26px;
}
.panel[hidden] { display: none; }
.panel-close {
  position: absolute; top: 8px; right: 10px; background: none; border: none;
  font-family: var(--font-pixel); font-size: 14px; color: var(--outline); cursor: pointer;
}
.panel-title { font-family: var(--font-pixel); font-size: 13px; color: #ff5d7a; margin-bottom: 14px; }
.field {
  width: 100%; font-family: var(--font-read); font-size: 19px; color: var(--ink);
  background: #fff9f4; border: 3px solid var(--outline); border-radius: 3px;
  padding: 8px 10px; margin-bottom: 12px; resize: vertical;
}
.field:focus { outline: none; box-shadow: 3px 3px 0 0 var(--ac-pink); }
.field-date { width: auto; font-size: 16px; margin: 0 0 0 6px; padding: 4px 6px; }
.btn {
  width: 100%; font-family: var(--font-pixel); font-size: 12px; color: var(--ink);
  background: var(--note-mint); border: 3px solid var(--outline); border-radius: 3px;
  box-shadow: 4px 4px 0 0 var(--ac-mint); padding: 11px; cursor: pointer;
}
.btn:active { box-shadow: 1px 1px 0 0 var(--ac-mint); transform: translate(3px, 3px); }
.panel-msg { font-family: var(--font-read); font-size: 16px; color: #b06a80; min-height: 20px; margin-top: 8px; }
.link-btn {
  display: block; margin: 12px auto 0; background: none; border: none;
  font-family: var(--font-read); font-size: 16px; color: #b79a86; text-decoration: underline; cursor: pointer;
}
/* color chips */
.chips { display: flex; gap: 10px; margin-bottom: 12px; }
.chip { width: 30px; height: 30px; border: 3px solid var(--outline); border-radius: 3px; cursor: pointer; }
.chip.selected { box-shadow: 0 0 0 2px #fff7f1, 0 0 0 5px var(--outline); }
.chip.pink  { background: var(--note-pink); }
.chip.mint  { background: var(--note-mint); }
.chip.lemon { background: var(--note-lemon); }
.chip.lav   { background: var(--note-lav); }
.lock-row { display: flex; align-items: center; gap: 6px; font-family: var(--font-read); font-size: 17px; color: var(--ink); margin-bottom: 14px; }

@media (prefers-reduced-motion: reduce) { .blink { animation: none; } }

/* ==========================================================================
   CUSTOMIZATION — themes, floor, critters, decorate control (CEO plan)
   ========================================================================== */

/* background themes (JS sets exactly one theme-* class on <body>) */
body.theme-pink {
  background:
    repeating-linear-gradient(0deg,  rgba(255,150,185,.13) 0 5px, transparent 5px 10px),
    repeating-linear-gradient(90deg, rgba(255,150,185,.13) 0 5px, transparent 5px 10px),
    #ffd9e6;
}
body.theme-flower {
  background:
    radial-gradient(circle at 12% 18%, #ff9db6 0 2px, transparent 3px),
    radial-gradient(circle at 32% 52%, #ffd87a 0 2px, transparent 3px),
    radial-gradient(circle at 68% 30%, #ff9db6 0 2px, transparent 3px),
    radial-gradient(circle at 86% 70%, #c9a6f0 0 2px, transparent 3px),
    radial-gradient(circle at 48% 84%, #ffd87a 0 2px, transparent 3px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px),
    #d8f0d2;
  background-size: 90px 90px, 90px 90px, 90px 90px, 90px 90px, 90px 90px, auto, auto;
}
body.theme-bricks {
  background:
    repeating-linear-gradient(0deg, #b5603f 0 22px, #8a4730 22px 26px),
    repeating-linear-gradient(90deg, transparent 0 48px, #8a4730 48px 52px);
}
body.theme-lav {
  background:
    repeating-linear-gradient(0deg, rgba(180,150,230,.14) 0 5px, transparent 5px 10px),
    repeating-linear-gradient(90deg, rgba(180,150,230,.14) 0 5px, transparent 5px 10px),
    #eadcff;
}

/* day/night tint (E2) — subtle, sits BELOW notes so text stays readable */
#daynight {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  transition: background 1.2s ease; background: transparent;
}
/* floor strip + roaming critters live above the tint, below notes */
#floor {
  position: fixed; left: 0; right: 0; bottom: 0; height: 40px; z-index: 2;
  border-top: 3px solid var(--outline);
}
body.theme-pink   #floor { background: repeating-linear-gradient(90deg,#ffc2d2 0 6px,#ffb3c7 6px 12px); border-top-color:#f5aac0; }
body.theme-flower #floor { background: repeating-linear-gradient(90deg,#7cc36b 0 6px,#6fb85f 6px 12px); border-top-color:#4f8a43; }
body.theme-bricks #floor { background: repeating-linear-gradient(90deg,#9b8f82 0 10px,#8a7e72 10px 12px); border-top-color:#6f655b; }
body.theme-lav    #floor { background: repeating-linear-gradient(90deg,#d9c2f5 0 6px,#cbb0ee 6px 12px); border-top-color:#b79fe0; }

#critters { position: fixed; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
/* critters are full-body image sprites; JS positions them (natural wandering) */
.critter { position: absolute; pointer-events: auto; cursor: pointer; z-index: 3; }
.critter-img { display: block; width: 44px; height: auto; image-rendering: pixelated; }
.pet-tag {
  position: absolute; left: 50%; top: -13px; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--font-pixel); font-size: 8px; color: var(--ink); text-shadow: 0 0 3px rgba(255,250,244,.9);
}
.critter.pop .critter-img { animation: critter-pop .5s ease-out; }
@keyframes critter-pop { 0%{transform:translateY(0);} 40%{transform:translateY(-8px) scale(1.15);} 100%{transform:translateY(0);} }
/* a cat napping on a note sits above the note */
.critter.napping { z-index: 6; }

/* theme-matched ambient particles (E5) */
#particles { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.particle { position: absolute; top: -16px; will-change: transform, opacity; }
.p-petal { width: 6px; height: 6px; background: #ff9db6; border-radius: 1px; animation: p-fall var(--dur,12s) linear infinite; }
.p-leaf  { width: 6px; height: 6px; background: #9fd9ba; border-radius: 1px; animation: p-fall var(--dur,13s) linear infinite; }
.p-dust  { width: 3px; height: 3px; background: rgba(120,90,60,.55); animation: p-drift var(--dur,16s) linear infinite; }
.p-spark { width: 4px; height: 4px; background: #fff7d6; box-shadow: 0 0 4px #fff7d6; animation: p-twinkle var(--dur,4s) ease-in-out infinite; }
@keyframes p-fall    { 0%{transform:translate(0,-20px) rotate(0);opacity:0;} 10%{opacity:.9;} 100%{transform:translate(var(--dx,20px),102vh) rotate(300deg);opacity:0;} }
@keyframes p-drift   { 0%{transform:translate(0,-20px);opacity:0;} 10%{opacity:.55;} 100%{transform:translate(var(--dx,30px),102vh);opacity:0;} }
@keyframes p-twinkle { 0%,100%{opacity:0;transform:scale(.5);} 50%{opacity:.9;transform:scale(1);} }
body.anim-paused .particle { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { #particles { display: none; } }

/* keep notes/halo above the ambient layers (legibility rule) */
.note { z-index: 5; }
.note { box-shadow: 4px 4px 0 0 var(--ac-pink), 0 0 0 4px rgba(255,250,244,.6); }
.note.mint  { box-shadow: 4px 4px 0 0 var(--ac-mint),  0 0 0 4px rgba(255,250,244,.6); }
.note.lemon { box-shadow: 4px 4px 0 0 var(--ac-lemon), 0 0 0 4px rgba(255,250,244,.6); }
.note.lav   { box-shadow: 4px 4px 0 0 var(--ac-lav),   0 0 0 4px rgba(255,250,244,.6); }

/* decorate button + panel (in-world control) */
.decorate-fab {
  position: fixed; left: 12px; bottom: 50px; z-index: 60;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: #fff7f1; border: 3px solid var(--outline); border-radius: 3px;
  box-shadow: 3px 3px 0 0 var(--ac-pink); cursor: pointer; opacity: .85; font-size: 18px;
}
.decorate-fab[hidden] { display: none; }
.decorate-fab.nudge { animation: fab-wiggle 1.4s ease-in-out 3; }
@keyframes fab-wiggle { 0%,100%{transform:rotate(0);} 25%{transform:rotate(-12deg);} 75%{transform:rotate(12deg);} }
.fab-tip {
  position: fixed; left: 58px; bottom: 58px; z-index: 60;
  font-family: var(--font-read); font-size: 16px; color: var(--ink);
  background: #fff9f4; border: 3px solid var(--outline); border-radius: 3px; padding: 5px 9px;
  box-shadow: 3px 3px 0 0 var(--ac-pink); transition: opacity .6s ease;
}
.fab-tip[hidden] { display: none; }

.decorate-panel {
  position: fixed; left: 12px; bottom: 50px; z-index: 80; width: min(320px, calc(100vw - 24px));
  background: var(--note-pink); border: 3px solid var(--outline); border-radius: 6px;
  box-shadow: 5px 5px 0 0 var(--ac-pink); padding: 14px;
}
.decorate-panel[hidden] { display: none; }
.decorate-panel h4 { font-family: var(--font-pixel); font-size: 11px; color: #ff5d7a; margin-bottom: 10px; }
.decorate-panel .close { position: absolute; top: 8px; right: 10px; background: none; border: none; font-family: var(--font-pixel); font-size: 13px; color: var(--outline); cursor: pointer; }
.swatches { display: flex; gap: 10px; margin-bottom: 12px; }
.sw { width: 36px; height: 36px; min-width: 36px; border: 3px solid var(--outline); border-radius: 3px; cursor: pointer; padding: 0; }
.sw.sel { box-shadow: 0 0 0 2px #fff7f1, 0 0 0 5px var(--outline); }
.sw[data-bg=pink]   { background: #ffd9e6; }
.sw[data-bg=flower] { background: #d8f0d2; }
.sw[data-bg=bricks] { background: #b5603f; }
.sw[data-bg=lav]    { background: #eadcff; }
.crit-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.crit-chip { display: flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 9px; cursor: pointer;
  font-family: var(--font-pixel); font-size: 8px; color: var(--ink);
  background: #fff9f4; border: 2px solid var(--outline); border-radius: 3px; }
.crit-chip.on { background: var(--note-mint); }
.pet-field { width: 100%; min-height: 40px; font-family: var(--font-read); font-size: 18px; color: var(--ink);
  background: #fff9f4; border: 3px solid var(--outline); border-radius: 3px; padding: 7px 9px; }
.pet-label { font-family: var(--font-pixel); font-size: 8px; color: #a07d68; display: block; margin-bottom: 5px; }

/* pause every animation when the tab is hidden (battery/perf) */
body.anim-paused .critter,
body.anim-paused .blink { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .critter.runner, .critter.roamer, .decorate-fab.nudge { animation: none; }
  .critter.roamer { transform: translate(20vw, 0); }
}
