/* The "My charms" shelf (js/shelf-screen.js), a shared charm's screen (js/view-screen.js) and the Start
   screen's My charms button. Both screens use the maker's shell (.maker: the stage + the panel; two
   columns on a wide screen); this file adds what is their own. Loaded after css/app.css. */

/* ---------------------------------------------------------------- Start: My charms */
.btn.shelf-btn { min-height: 46px; padding: 0 12px 0 22px; font-size: 16px; gap: 10px; }
.shelf-count {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  background: #f1ecff; color: var(--lilac-ink); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
@media (max-height: 600px) { .btn.shelf-btn { min-height: 42px; } .start-group { gap: 8px; } }

/* ---------------------------------------------------------------- the wall */
.shelf-stage { background: linear-gradient(180deg, #fdfaff 0%, #fbf5fd 60%, #fdf5f1 100%); }
.shelf-wall {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding: 66px 12px 36px; scrollbar-width: thin; touch-action: pan-y;
  --cw: 80px;
}
.rail-row {
  position: relative; display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
  justify-items: center; margin: 0 0 30px;
}
.rail-row:last-child { margin-bottom: 8px; }
/* the rail: a soft round dowel with a knob at each end */
.rail {
  position: absolute; left: 6px; right: 6px; top: 10px; height: 12px; border-radius: 999px;
  background: linear-gradient(180deg, var(--r1) 0%, var(--r2) 100%);
  box-shadow: 0 3px 0 var(--r3), 0 10px 14px -10px rgba(110, 90, 140, .45);
  transform-origin: 50% 50%;
}
.rail::before, .rail::after {
  content: ''; position: absolute; top: -4px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--r1); box-shadow: inset 0 -3px 0 var(--r2), 0 3px 0 var(--r3);
}
.rail::before { left: -6px; }
.rail::after { right: -6px; }
.rail-0 { --r1: #efe9ff; --r2: #ddd3fb; --r3: #c9bcf6; }
.rail-1 { --r1: #ffe9ef; --r2: #fbd3de; --r3: #f1b7c7; }
.rail-2 { --r1: #e3f8ee; --r2: #cbeedd; --r3: #a9dcc4; }

.peg-charm {
  appearance: none; position: relative; z-index: 1; margin: 0; padding: 0; border: 0; background: none;
  width: var(--cw); cursor: pointer; color: inherit; border-radius: 16px;
}
.peg-charm .peg {
  position: absolute; z-index: 2; top: 9px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: #fff; box-shadow: inset 0 0 0 3px #ddd3fb, 0 2px 0 #c9bcf6;
}
.rail-1 ~ .peg-charm .peg { box-shadow: inset 0 0 0 3px #fbd3de, 0 2px 0 #f1b7c7; }
.rail-2 ~ .peg-charm .peg { box-shadow: inset 0 0 0 3px #cbeedd, 0 2px 0 #a9dcc4; }
/* the loop's top (y = 5 of the 80-wide box) sits just under the peg's centre */
.peg-charm .pop { display: block; margin-top: calc(15px - var(--cw) * .0625); }
.peg-charm .hang { display: block; transform-origin: 50% 4.5%; animation: peg-sway var(--sw, 3.4s) ease-in-out var(--sd, 0s) infinite; }
.peg-charm svg { width: 100%; height: auto; }
.peg-charm svg > ellipse:first-of-type { opacity: 0; }   /* no swinging ground shadow on the wall */
.peg-charm:focus-visible { outline: 3px solid var(--lilac-deep); outline-offset: 4px; }
@media (hover: hover) { .peg-charm:hover .pop { transform: translateY(-3px); transition: transform .2s; } }
@keyframes peg-sway { 0%, 100% { transform: rotate(-3.5deg); } 50% { transform: rotate(3.5deg); } }

.rail-row.empty { display: block; min-height: 120px; }
.shelf-empty { margin: 0; padding: 48px 12px 0; text-align: center; color: var(--ink-soft); font-size: 16px; }

/* list: the panel is just the title and Back */
.shelf[data-mode="list"] .shelf-opts { display: none; }

/* ---------------------------------------------------------------- one charm, large (the shelf's detail, a shared charm) */
.shelf-big, .gift-view {
  position: absolute; z-index: 0; inset: 60px 12px 34px;
  display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; container-type: size;
}
.big-charm { position: relative; z-index: 0; height: min(100cqh, 140cqw); aspect-ratio: 80 / 112; }
.big-charm svg { width: 100%; height: 100%; transform-origin: 50% 4.5%; animation: sway 3.2s ease-in-out infinite; }
.big-charm svg > ellipse:first-of-type { opacity: 0; }
.big-charm::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: 4%; height: 4%; border-radius: 50%; background: rgba(110, 90, 140, .12); z-index: -1; }

.confirm-q { color: var(--ink); font-weight: 600; font-size: 16px; }
.btn.remove-btn { color: #a24d6a; border-color: #f6d6df; box-shadow: 0 4px 0 #f6d6df; }
.btn.remove-btn.sure { background: #ffd9e3; border-color: #eb9fb3; box-shadow: 0 4px 0 #eb9fb3; }
.btn.remove-btn:active { box-shadow: 0 1px 0 #f6d6df; }
.btn.keep-btn[data-state="kept"] { background: var(--mint); border-color: var(--mint-deep); color: #2f6b55; box-shadow: 0 4px 0 var(--mint-deep); }

/* ---------------------------------------------------------------- a shared charm */
.gift-eyebrow { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.gift .panel-head h2 { outline: none; }
.gift-opts .done-actions { padding-top: 2px; }
.done-actions .btn.own-btn { min-height: 56px; font-size: 19px; }

/* ---------------------------------------------------------------- wide */
html[data-layout="wide"] .shelf-wall { padding: 76px 36px 40px; }
html[data-layout="wide"] .rail-row { margin-bottom: 40px; }
html[data-layout="wide"] .shelf-big, html[data-layout="wide"] .gift-view { inset: 72px 40px 40px; }
html[data-layout="wide"] .gift-eyebrow { font-size: 17px; }
html[data-layout="wide"] .gift-opts { display: flex; flex-direction: column; justify-content: center; }
html[data-layout="wide"] .shelf[data-mode="detail"] .shelf-opts { display: flex; flex-direction: column; justify-content: center; }
html[data-layout="wide"] .done-actions .btn.own-btn { min-height: 60px; font-size: 20px; }

/* ---------------------------------------------------------------- small phones */
@media (max-height: 640px) {
  .shelf-wall { padding-top: 58px; }
  .shelf-big, .gift-view { inset: 54px 10px 24px; }
  .gift-eyebrow { font-size: 13px; }
  .done-actions .btn.own-btn { min-height: 50px; font-size: 18px; }
  .confirm-q { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .peg-charm .hang, .big-charm svg { animation: none !important; }
}

/* Remove? — the question sits right above Remove / Keep (Save image steps aside meanwhile) */
.shelf-actions.confirming .save-btn { display: none; }
/* the list on a wide screen: a few quiet words in the panel (on a phone the panel is just the title) */
.shelf-about p { margin: 0 0 10px; color: var(--ink-soft); font-size: 16px; line-height: 1.45; }
html[data-layout="wide"] .shelf[data-mode="list"] .shelf-opts { display: block; }
