:root {
  --ink: #221d2b;
  --muted: #71697e;
  --accent: #6d28a8;
  --accent-soft: #f1e9fa;
  --line: #e4ddd2;
  --paper: #f7f4ef;
  --card: #ffffff;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(34, 29, 43, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink);
       font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
       font-size: 16px; line-height: 1.5; }

/* header */
header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center;
         justify-content: space-between; gap: 12px; padding: 14px 22px;
         background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
         border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; }
.logo-full { height: 58px; width: auto; display: block; }
.logo-full .lg-the { font-family: "Patrick Hand", "Comic Sans MS", cursive;
                     font-size: 30px; fill: var(--accent); letter-spacing: .03em; }
.logo-full .lg-main { font-family: "Patrick Hand", "Comic Sans MS", cursive;
                      font-size: 56px; letter-spacing: .01em; }
header nav { display: flex; gap: 22px; }
header nav a { color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 600;
               letter-spacing: .12em; text-transform: uppercase; padding: 4px 0;
               border-bottom: 2px solid transparent; }
header nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }

main { max-width: 1020px; margin: 0 auto; padding: 34px 20px 70px; }
footer { text-align: center; color: var(--muted); font-size: .82rem;
         padding: 26px 16px 34px; border-top: 1px solid var(--line); }

.page-title { font-family: "Fraunces", Georgia, serif; font-weight: 600;
              font-size: 2rem; margin: 0 0 4px; letter-spacing: .01em; }
.sub { color: var(--muted); margin: 0 0 8px; }
.err { color: var(--danger); font-weight: 600; }
.ok { background: #e9f6ea; border: 1px solid #bfe3c2; color: #215c26;
      padding: 11px 15px; border-radius: var(--radius); }

/* wallpapers (pure CSS patterns); on the main page one is picked at
   random per visit and applied to the whole page background */
body.wall-body { min-height: 100vh; }
body.wall-body header { background: rgba(96, 92, 104, .30);
                        border-bottom: 1px solid rgba(255, 255, 255, .25);
                        backdrop-filter: blur(6px); }
.wall-cream { background-color: #f3ead9;
  background-image: radial-gradient(rgba(160,130,80,.20) 1.2px, transparent 1.7px);
  background-size: 22px 22px; }
.wall-blush { background-color: #f4e0dc;
  background-image: radial-gradient(circle at 50% 38%, rgba(183,106,118,.30) 5px, transparent 6.5px),
                    radial-gradient(rgba(183,106,118,.22) 1.6px, transparent 2.2px);
  background-size: 54px 54px, 54px 54px; background-position: 0 0, 27px 27px; }
.wall-sage { background-color: #dde5d0;
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.35) 0 22px, transparent 22px 30px, rgba(90,110,70,.14) 30px 32px, transparent 32px 56px); }
.wall-sky { background-color: #dcecf7;
  background-image: radial-gradient(#ffffff 3px, transparent 3.8px), radial-gradient(#ffffff 3px, transparent 3.8px);
  background-size: 34px 34px; background-position: 0 0, 17px 17px; }
.wall-lavender { background-color: #e6dcf2;
  background-image: repeating-linear-gradient(45deg, rgba(109,40,168,.10) 0 2px, transparent 2px 26px),
                    repeating-linear-gradient(-45deg, rgba(109,40,168,.10) 0 2px, transparent 2px 26px); }

/* the wall itself: no panel, the page is the wall */
.wall-room { position: relative; }
.wall { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start;
        gap: 52px 40px; padding: 30px 10px 64px; }
.hang { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto;
        transition: transform .25s ease; }
.hang.sz-s { width: 232px; }
.hang.sz-m { width: 292px; }
.hang.sz-l { width: 352px; }

/* frames: three kinds, dealt at random */
.frame { margin: 0; width: 100%; border-radius: 4px; padding: 13px; }
.frame-gold {
  background: linear-gradient(135deg, #8a6a2f 0%, #d9b45f 28%, #a37f36 52%, #e8cd85 76%, #8a6a2f 100%);
  box-shadow: inset 0 0 0 2px #6d5322, inset 0 0 0 5px #efe0a8, inset 0 0 0 7px #7a5c26,
              inset 0 0 22px rgba(80,58,10,.45), 0 26px 38px rgba(43,32,10,.38); }
.frame-wood {
  background:
    repeating-linear-gradient(93deg, rgba(0,0,0,.12) 0 3px, transparent 3px 9px, rgba(255,220,160,.05) 9px 11px, transparent 11px 19px),
    linear-gradient(120deg, #4a2e1b 0%, #6f4527 30%, #54341e 55%, #7b4f2c 80%, #462b17 100%);
  box-shadow: inset 0 0 0 2px #2e1c0e, inset 0 0 0 5px #8a5f36, inset 0 0 0 6px #caa64f,
              inset 0 0 0 8px #3a2412, inset 0 0 26px rgba(20,10,2,.55), 0 26px 38px rgba(30,18,6,.42); }
.frame-black {
  background:
    repeating-linear-gradient(90deg, rgba(255,215,130,.05) 0 2px, transparent 2px 4px),
    linear-gradient(135deg, #17150f 0%, #28241a 40%, #191712 70%, #221d13 100%);
  box-shadow: inset 0 0 0 2px #0c0b08, inset 0 0 0 4px #b08d3e, inset 0 0 0 6px #100e09,
              inset 0 0 18px rgba(0,0,0,.65), 0 26px 38px rgba(10,8,4,.45); }

/* minimal header sign-in icon */
.icon-btn { display: inline-flex; align-items: center; justify-content: center;
            width: 43px; height: 43px; border-radius: 50%; flex: 0 0 auto;
            border: 1.5px solid var(--line); background: #fff; color: var(--accent); }
.icon-btn svg { width: 22px; height: 22px; display: block; }
.icon-btn:hover { border-color: var(--accent); }
.frame .mat { background: #fdfbf4; padding: 11% 11% 9%;
  box-shadow: inset 0 0 0 1px #ddd5bf, inset 0 2px 10px rgba(80,58,10,.20); }
.frame img { width: 100%; height: auto; display: block;
  box-shadow: 0 0 0 1px rgba(90,70,40,.25); }
.frame .empty-mat { text-align: center; color: var(--muted); padding: 44px 26px; }
.frame .empty-title { font-family: "Fraunces", Georgia, serif; font-size: 1.25rem;
                      color: var(--ink); margin: 0 0 6px; }
.frame .empty-mat p { margin: 0; font-size: .92rem; }

/* brass plaque under each frame */
.plaque { margin-top: 16px; max-width: 86%; text-align: center; padding: 7px 16px 8px;
  background: linear-gradient(#efd98f, #c9a44a); color: #4a3a12; border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(110,84,20,.55), 0 3px 8px rgba(43,32,10,.30); }
.plaque .p-artist { display: block; font-size: .74rem; font-weight: 700;
                    letter-spacing: .2em; text-transform: uppercase; }
.plaque .p-meta { display: block; font-size: .78rem; margin-top: 1px; }

@media (max-width: 640px) {
  .wall { flex-direction: column; align-items: center; gap: 44px; padding: 40px 18px 52px; }
  .hang.sz-s, .hang.sz-m, .hang.sz-l { width: min(86vw, 330px); }
}

/* capture flow */
.step { margin: 26px 0; }
.label { font-weight: 600; font-size: .92rem; letter-spacing: .02em; margin: 0 0 10px; }
.big-upload { display: block; text-align: center; background: var(--accent); color: #fff;
              padding: 20px; border-radius: var(--radius); font-size: 1.08rem; font-weight: 600;
              cursor: pointer; box-shadow: var(--shadow); }
.big-upload:active { transform: translateY(1px); }
.cambtn { display: block; width: 100%; margin-top: 10px; padding: 15px;
          font-size: 1rem; font-weight: 600; border-radius: var(--radius);
          border: 1.5px solid var(--accent); color: var(--accent); background: #fff; }
.cambtn:hover { background: var(--accent-soft); }
#camvideo { width: 100%; height: auto; display: block; border-radius: 14px;
            background: #17141d; box-shadow: var(--shadow); }
.snapbtn { background: var(--accent); color: #fff; border: none; font-weight: 600;
           padding: 12px 22px; }
.snapbtn:hover { color: #fff; filter: brightness(1.07); }
.stage-wrap { position: relative; background: #17141d; border-radius: 16px; padding: 10px;
              box-shadow: var(--shadow); }
#stage { width: 100%; height: auto; display: block; border-radius: 8px; }
#overlay { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px);
           touch-action: none; }
#overlay #quad { fill: rgba(167, 139, 250, .14); stroke: #c4a7f5; stroke-width: 2.5px; }
#overlay .dot { fill: var(--accent); stroke: #fff; cursor: grab; }
#overlay .hit { fill: transparent; cursor: grab; }
.preview-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
                padding: 18px; text-align: center; box-shadow: var(--shadow); }
#preview { max-width: 100%; height: auto; border: 1px solid #eee7da; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-top: 12px; }
.row label { display: flex; flex-direction: column; gap: 5px; font-size: .88rem; font-weight: 500; }
.row label.grow { flex: 1; min-width: 180px; }
button { font: inherit; font-weight: 500; padding: 10px 18px; border-radius: 999px;
         border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
button:hover { border-color: var(--accent); color: var(--accent); }
.kids { display: flex; gap: 12px; }
.kid { flex: 1; padding: 20px 10px; font-size: 1.15rem; font-weight: 600; border-radius: var(--radius);
       border: 1.5px solid var(--line); background: var(--card); }
.kid.picked { background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
              box-shadow: 0 0 0 1px var(--accent) inset; }
.kid:hover { color: var(--ink); border-color: var(--accent); }
.kid.picked:hover { color: var(--accent); }
.save { display: block; width: 100%; padding: 18px; font-size: 1.12rem; font-weight: 600;
        background: var(--accent); color: #fff; border: none; border-radius: var(--radius);
        box-shadow: var(--shadow); }
.save:hover { color: #fff; filter: brightness(1.07); }
.save:disabled { opacity: .55; }
input[type="date"], input[type="text"] { font: inherit; padding: 11px 13px; border-radius: 10px;
        border: 1px solid var(--line); background: var(--card); color: var(--ink); width: 100%; }
input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* login */
.login-form { display: flex; gap: 10px; max-width: 430px; margin-top: 14px; }
.login-form input { flex: 1; }
.login-form button { background: var(--accent); color: #fff; border: none; font-weight: 600; }
.login-form button:hover { color: #fff; filter: brightness(1.07); }

/* archive */
.filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin: 18px 0 22px; }
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: .88rem; font-weight: 500; }
.filters select { font: inherit; padding: 10px 12px; border-radius: 10px;
                  border: 1px solid var(--line); background: var(--card); }
.buttonish { padding: 11px 18px; border-radius: 999px; background: var(--accent); color: #fff;
             text-decoration: none; font-weight: 600; font-size: .95rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        overflow: hidden; box-shadow: 0 4px 16px rgba(34,29,43,.05); }
.card img { width: 100%; height: 190px; object-fit: cover; display: block; background: #f1ede6; }
.card .meta { padding: 12px 14px 4px; font-size: .92rem; }
.card .meta .date { color: var(--muted); font-size: .84rem; }
.card .actions { display: flex; gap: 8px; padding: 10px 14px 14px; }
.card .actions form { display: contents; }
.card .actions button { flex: 1; padding: 8px 10px; font-size: .85rem; }
.card .actions button.on { background: #fdf3d7; border-color: #d9a400; color: #7a5b00; }
.card .actions button.danger { color: var(--danger); flex: 0 0 auto; }
.card .actions button.danger:hover { border-color: var(--danger); color: var(--danger); }

@media (max-width: 560px) {
  header { padding: 12px 16px; }
  header nav { gap: 14px; }
  .logo-full { height: 46px; }
  .page-title { font-size: 1.65rem; }
  main { padding: 24px 14px 56px; }
  .frame .mat { padding: 14px; }
}

/* piece detail: full image + edit */
.backlink { margin: 0 0 14px; }
.backlink a { color: var(--accent); text-decoration: none; font-weight: 600; }
.full-img { width: 100%; height: auto; display: block; border-radius: 14px;
            box-shadow: var(--shadow); background: #fff; }
.orig-link { margin: 10px 0 4px; font-size: .92rem; }
.orig-link a { color: var(--muted); }
.kidpick { flex: 1; position: relative; }
.kidpick input { position: absolute; opacity: 0; pointer-events: none; }
.kidpick span { display: block; text-align: center; padding: 15px 0; font-size: 1.12rem;
                font-weight: 600; border: 1.5px solid var(--line); border-radius: var(--radius);
                background: #fff; cursor: pointer; }
.kidpick input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.checkrow { display: flex; align-items: center; gap: 10px; margin: 18px 0 4px;
            font-weight: 600; cursor: pointer; }
.checkrow input { width: 22px; height: 22px; accent-color: var(--accent); }
.dangerbtn { color: var(--danger); }
.dangerbtn:hover { border-color: var(--danger); color: var(--danger); }
.card a { display: block; }

/* icon-only header navigation */
.iconnav { display: flex; gap: 10px; align-items: center; }
.hint { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }

/* add-flow step navigation */
.stepnav { margin-top: 20px; justify-content: space-between; }
.stepnav .snapbtn { margin-left: auto; }
#step-details .backlink { margin-top: 22px; }

/* corner-step icon toolbar */
.iconrow { display: flex; gap: 14px; justify-content: center; margin-top: 16px; }
.tool-btn { display: inline-flex; align-items: center; justify-content: center;
            width: 52px; height: 52px; border-radius: 50%; cursor: pointer;
            border: 1.5px solid var(--line); background: #fff; color: var(--accent); }
.tool-btn svg { width: 25px; height: 25px; display: block; }
.tool-btn:hover { border-color: var(--accent); }

/* camera: full-screen, centered, shutter always in reach */
#campanel { position: fixed; inset: 0; z-index: 200; margin: 0; background: #12101a;
            display: flex; flex-direction: column; align-items: center;
            justify-content: center; gap: 18px; padding: 20px; }
#campanel[hidden] { display: none; }
#camvideo { width: auto; max-width: 100%; max-height: 74vh; }
#campanel #camcancel { background: transparent; color: #eee;
                       border-color: rgba(255,255,255,.45); }

/* star toggle on upload */
.starbtn { display: block; width: 100%; padding: 15px; font-size: 1.02rem;
           font-weight: 600; border-radius: var(--radius); cursor: pointer;
           border: 1.5px solid var(--line); background: #fff; color: var(--muted); }
.starbtn.on { background: #fdf3d7; border-color: #d9a400; color: #7a5b00; }

/* passkeys */
.pk-link { margin: -6px 0 0; font-size: .92rem; }
.pk-link a { color: var(--accent); font-weight: 600; text-decoration: none; }
.pk-or { text-align: center; color: var(--muted); margin: 20px 0 4px; }
.pkrow { display: flex; justify-content: space-between; align-items: center;
         gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pkrow form { margin: 0; }

/* nails, hanging wires, and scalloped frames on the wall */
.hang { position: relative; }
.wire { width: 100%; height: 22px; display: block; margin-bottom: -3px; flex: 0 0 auto; }
.nail { position: absolute; top: 0; left: 50%; width: 11px; height: 11px;
        transform: translateX(-50%); border-radius: 50%;
        background: radial-gradient(circle at 35% 30%, #f6e5ae, #caa64f 55%, #7a5c26);
        box-shadow: 0 1px 2px rgba(40,30,5,.55), inset 0 -1px 2px rgba(90,64,10,.65); }
.frame { position: relative; }
.frame-sc { background: none; box-shadow: none; }
.sc-svg { position: absolute; inset: 0; width: 100%; height: 100%;
          pointer-events: none;
          filter: drop-shadow(0 16px 20px rgba(43,32,10,.35)); }

/* big admiring view */
.wall .hang.tappable { cursor: pointer; }
.bigview { position: fixed; inset: 0; z-index: 60; display: flex;
           align-items: center; justify-content: center;
           background: rgba(24,18,12,.92); padding: 18px; overflow: auto; }
.bigview[hidden] { display: none; }
.bv-hang { width: min(92vw, 820px); }
.bv-hang .frame img { max-height: 64vh; object-fit: contain; }
.bv-close { position: absolute; top: 14px; right: 14px; width: 46px; height: 46px;
            border-radius: 50%; border: 1px solid rgba(255,255,255,.35);
            background: rgba(255,255,255,.12); color: #fff; cursor: pointer;
            display: flex; align-items: center; justify-content: center; }
