/* === Glitter Jar === */

.header { margin-bottom: 0.25rem; }


/* segmented control (Twinkle: none / low / med / high) */
.twinkle-seg {
  gap: 0;
  border: 2px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--btn);
}
/* scoped + explicit colors so the global button rule can't make these unreadable */
.twinkle-seg .seg-btn {
  padding: 0.4rem 0.78rem;
  border: none;
  border-radius: 0;
  background: var(--btn);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0s;
}
.twinkle-seg .seg-btn:hover { background: var(--pick-bg); color: var(--ink); transform: none; }
.twinkle-seg .seg-btn.is-active { background: var(--primary); color: #fff; }

/* dark mode is handled site-wide by theme.js + style.css (html.dark);
   the jar keeps its own lit glass look in any theme. */

/* --- Toolbar (shared pattern with the other Calm Corner tools) --- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.4rem;
  align-items: flex-end;
  justify-content: center;          /* center the glitter colors above the jar */
  margin: 0 0 1.4rem;
}
.toolbar .tool-group { align-items: center; }   /* center each label over its control */
/* controls beneath the jar: shake on top, then the sliders, all centered */
.toolbar-below {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin: 1.4rem 0 0;
}
.tool-group { display: flex; flex-direction: column; gap: 0.4rem; }
.tool-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.tools { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tool-btn {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--btn);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tool-btn:hover { border-color: var(--primary); transform: translateY(-1px); }
.shake-btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.shake-btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.shake-btn:active { transform: translateY(0); }

/* amount slider */
.amount-wrap { align-items: center; padding-bottom: 4px; }
.amount-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 160px;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.amount-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: var(--shadow);
  cursor: grab;
}
.amount-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: var(--shadow);
  cursor: grab;
}
.amount-slider:active::-webkit-slider-thumb { cursor: grabbing; }

.swatches { gap: 0.45rem; }
.swatch {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--sw, #ccc);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.swatch:hover { transform: translateY(-1px); }
.swatch.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--pick-bg);
}

/* --- Jar --- */
.jar-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.5rem;
}

/* screw-on lid */
.jar-lid {
  width: 52%;
  max-width: 182px;
  height: 30px;
  border-radius: 11px 11px 5px 5px;
  background: linear-gradient(180deg, #ecca9f 0%, #d8b483 45%, #c2925b 100%);
  box-shadow:
    inset 0 2px 1px rgba(255, 255, 255, 0.5),
    inset 0 -5px 7px rgba(120, 90, 50, 0.28),
    0 3px 7px rgba(120, 90, 50, 0.28);
  z-index: 3;
}

/* neck with screw threads */
.jar-neck {
  width: 50%;
  max-width: 172px;
  height: 28px;
  margin-top: -2px;
  border-radius: 4px 4px 2px 2px;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0) 0 5px, rgba(150, 185, 210, 0.4) 5px 7px),
    linear-gradient(180deg, #e9f3fa, #d3e5f0);
  box-shadow:
    inset 3px 0 4px rgba(255, 255, 255, 0.65),
    inset -4px 0 5px rgba(120, 150, 180, 0.28);
  z-index: 2;
}

/* jar body */
.jar {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 5 / 6;
  margin-top: -4px;
  border-radius: 64px 64px 70px 70px / 92px 92px 72px 72px;
  background: linear-gradient(180deg, #eef6fb 0%, #dceaf3 55%, #cfe0ec 100%);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.5),
    inset 0 -26px 46px rgba(120, 150, 180, 0.22),
    inset 0 18px 34px rgba(255, 255, 255, 0.55),
    0 18px 36px rgba(80, 110, 140, 0.22);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.jar:active { cursor: grabbing; }
.jar canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* faint water surface near the top */
.water-line {
  position: absolute;
  top: 6%;
  left: 9%;
  right: 9%;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  filter: blur(2px);
  pointer-events: none;
}

/* curved glass reflections down each side */
.gloss {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.gloss-l {
  top: 9%;
  left: 7%;
  width: 11%;
  height: 74%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0));
  transform: rotate(7deg);
}
.gloss-r {
  top: 16%;
  right: 8%;
  width: 6%;
  height: 58%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
}

/* --- charm tray --- */
.charm-tray-wrap {
  max-width: 384px;
  margin: 1rem auto 0.3rem;
  background: var(--pick-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.7rem 0.7rem 0.8rem;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.12);
}
.charm-tray-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
  margin-bottom: 0.55rem;
}
.charm-tray {
  /* A fixed 6-per-row grid. Rows no longer line up with tiers — the tiers are 12/13/8/3
     since the catalogue grew to 36 — but the tray reads fine as a flat collection chart,
     and charms stay in tier order, so it still fills roughly rarest-last. */
  display: grid;
  grid-template-columns: repeat(6, auto);
  gap: 0.4rem;
  justify-content: center;
  max-width: 360px;
  margin: 0 auto;
}
.charm-btn {
  flex: 0 0 auto;
  line-height: 0;
  padding: 0.28rem;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.charm-btn canvas { display: block; }
.charm-btn:hover { transform: translateY(-2px); border-color: var(--primary); }
/* a charm that's currently in the jar: pink border (light mode) + a soft glow in dark mode */
.charm-btn.in-jar {
  border-color: var(--primary);
}
html.dark .charm-btn.in-jar {
  box-shadow: 0 0 10px var(--primary);
}

/* --- ⚙ controls dropdown (the sliders) --- */
.settings-btn {
  position: fixed;
  top: 0.85rem;
  right: 4rem;             /* just left of the site's dark-mode toggle (right: 0.85rem) */
  z-index: 230;
  width: 42px;
  height: 42px;
  /* Reset the global `button { padding: .65rem 1.3rem }` from style.css. With border-box
     that padding leaves a ~0-wide content box, so the grid column starts at the padding
     edge instead of the middle and place-items:center has nothing left to centre against —
     the icon lands half its own width right of the button's centre. */
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.settings-btn:hover { transform: translateY(-1px) scale(1.06); border-color: var(--primary); }
.settings-btn[aria-expanded="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.settings-icon { display: block; transition: transform 0.25s ease; }
.settings-btn[aria-expanded="true"] .settings-icon { transform: rotate(60deg); }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.16s ease, visibility 0.16s ease;
}
.scrim.open { opacity: 1; visibility: visible; }

.panel {
  position: fixed;
  top: 3.5rem;
  right: 0.85rem;
  z-index: 220;
  width: min(300px, calc(100vw - 1.7rem));
  max-height: calc(100vh - 4.6rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}
.panel.open { opacity: 1; visibility: visible; transform: none; }
.panel .tool-group { width: 100%; align-items: stretch; }
.panel .tool-label { text-align: left; }
.panel .amount-wrap { padding-bottom: 0; }
.panel .amount-slider { width: 100%; }
.panel .twinkle-seg { width: 100%; }
.panel .twinkle-seg .seg-btn { flex: 1 1 0; padding: 0.45rem 0; }

@media print {
  .toolbar, .charm-tray-wrap, .settle-hint, .settings-btn, .panel, .scrim { display: none !important; }
}

/* ===================== settle-to-unlock (matches the app) ===================== */
/* a colour you haven't earned yet: dimmed, greyed, with a small lock */
.swatch.locked {
  position: relative;
  filter: grayscale(0.85) brightness(0.7);
  cursor: default;
}
.swatch.locked:hover { transform: none; }
.swatch.locked::after {
  content: "🔒";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
}
.swatch.just-unlocked { animation: charmPop 0.6s ease; }

/* a locked charm: dimmed art with a small lock, not interactive until earned */
.charm-btn.locked { position: relative; cursor: default; }
.charm-btn.locked:hover { transform: none; border-color: var(--border); }
.charm-btn.locked canvas { opacity: 0.22; filter: grayscale(1); }
.charm-btn.locked::after {
  content: "🔒";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; opacity: 0.85;
}
.charm-btn.just-unlocked { animation: charmPop 0.6s ease; }
@keyframes charmPop {
  0%   { transform: scale(0.55); }
  55%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* "watch it settle" nudge + the charm count in the tray label */
.settle-hint {
  margin: 0.2rem auto 0.4rem;
  max-width: 340px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
}
.charm-count { font-size: 0.85rem; color: var(--muted); font-weight: 700; }

/* unlock toast */
.glitter-toast {
  position: fixed; left: 50%; bottom: 20%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(20, 16, 40, 0.92); color: #fff;
  padding: 0.6rem 1.1rem; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; white-space: nowrap;
  border: 1px solid var(--primary);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.glitter-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- the choice-of-three: a calm card when a charm settles out of the glitter --- */
.charm-chooser {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: rgba(8, 6, 20, 0.55);
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.charm-chooser.show { opacity: 1; visibility: visible; }
.chooser-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 1.15rem 1.2rem 0.9rem;
  max-width: min(92vw, 380px); text-align: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.chooser-tier {
  display: inline-block; margin-bottom: 0.5rem;
  padding: 0.14rem 0.7rem; border-radius: 999px;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--pick-bg); color: var(--muted);
}
.chooser-card[data-tier="uncommon"] .chooser-tier { color: #6fc7e8; }
.chooser-card[data-tier="rare"] .chooser-tier { color: #ffd76e; box-shadow: 0 0 12px rgba(255, 215, 110, 0.35); }
.chooser-title { margin: 0 0 0.9rem; font-weight: 700; line-height: 1.35; color: var(--ink); }
.chooser-row { display: flex; gap: 0.55rem; justify-content: center; }
.chooser-btn {
  flex: 1 1 0; max-width: 108px;
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  padding: 0.65rem 0.35rem 0.55rem;
  border-radius: 14px; border: 2px solid var(--border);
  background: var(--btn); color: var(--ink);
  font: inherit; cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.chooser-btn:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 0 12px var(--pick-bg); }
.chooser-btn canvas { display: block; }
.chooser-name { font-size: 0.78rem; font-weight: 700; }
.chooser-owned { font-size: 0.66rem; color: var(--muted); }
.chooser-later {
  margin-top: 0.75rem; padding: 0.3rem 0.6rem;
  background: none; border: none; color: var(--muted);
  font: inherit; font-size: 0.78rem; cursor: pointer; text-decoration: underline;
}

/* a soft, tappable reminder while a choice waits (the card was set aside) */
.choose-pill {
  position: fixed; left: 50%; bottom: 13%;
  transform: translateX(-50%) translateY(10px);
  z-index: 65;
  background: rgba(20, 16, 40, 0.92); color: #fff;
  padding: 0.55rem 1.05rem; border-radius: 999px; border: 1px solid var(--primary);
  font: inherit; font-weight: 600; font-size: 0.9rem; white-space: nowrap;
  box-shadow: 0 0 18px rgba(255, 238, 170, 0.35);
  opacity: 0; visibility: hidden; cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}
.choose-pill.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ×N badge on a tray charm you own duplicates of */
.charm-btn { position: relative; }
.charm-copies {
  position: absolute; top: -6px; right: -6px;
  background: var(--primary); color: #fff;
  font-size: 0.62rem; font-weight: 800; line-height: 1;
  padding: 3px 5px; border-radius: 999px;
  pointer-events: none;
}
.charm-copies:empty { display: none; }

/* ===================== painted art pack (from the Godot build) =====================
   The phone app ships painted art packs themed `daylight` (warm) and `stardust` (night),
   which line up with the site's light and dark themes. Converted to WebP at display size.

   Deliberately NOT used here: the packs' full-bleed painted backgrounds. They carry a
   phone app, where the art IS the screen — behind a site page they fight the rest of
   the layout and read as wallpaper someone left on. The page keeps the site background
   from style.css; only the small pieces below borrow from the packs. */

/* Painted gear in place of the ⚙ glyph. */
/* Painted gear in place of the ⚙ glyph. */
.settings-icon {
  width: 22px;
  height: 22px;
  background-image: url("art/gear-daylight.webp");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}
html.dark .settings-icon { background-image: url("art/gear-stardust.webp"); }
/* The open state used to fill the button with --primary and rely on white glyph text.
   A painted icon can't recolour, and pink-on-pink loses the gear — so the open state now
   reads as a ring instead of a fill. */
.settings-btn[aria-expanded="true"] {
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--pick-bg);
}

/* Painted padlock on anything not yet earned, in place of the 🔒 glyph. Sized as a
   percentage so one rule covers both the small colour swatches and the larger charms. */
.swatch.locked::after,
.charm-btn.locked::after {
  content: "";
  background-image: url("art/lock-daylight.webp");
  background-repeat: no-repeat;
  background-position: center;
}
html.dark .swatch.locked::after,
html.dark .charm-btn.locked::after { background-image: url("art/lock-stardust.webp"); }
.swatch.locked::after { background-size: 56%; }
.charm-btn.locked::after { background-size: 42%; }
