/* Fennel Shrew Pharmacy — glassmorphism apothecary
   System fonts ONLY (constraint). No external assets. */

:root {
  --ink: #f4f1ff;
  --ink-dim: rgba(244, 241, 255, 0.72);
  --ink-faint: rgba(244, 241, 255, 0.5);
  --glass: rgba(255, 255, 255, 0.10);
  --glass-strong: rgba(255, 255, 255, 0.16);
  --stroke: rgba(255, 255, 255, 0.22);
  --accent: #b8f36d;
  --accent2: #7ee0d2;
  --danger: #ff9d9d;
  --radius: 22px;
  --shadow: 0 18px 50px rgba(10, 6, 30, 0.45);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #14102b;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- animated botanical backdrop ---- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(1200px 800px at 15% 0%, #3b2a6e 0%, transparent 60%),
    radial-gradient(1000px 700px at 90% 20%, #0f4c4c 0%, transparent 55%),
    radial-gradient(900px 900px at 50% 110%, #5c2547 0%, transparent 60%),
    linear-gradient(160deg, #171233 0%, #14102b 60%, #101a2e 100%);
}
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55;
  animation: drift 18s ease-in-out infinite alternate; }
.b1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax;
  background: radial-gradient(circle at 40% 40%, #8b5cf6, transparent 70%); }
.b2 { width: 40vmax; height: 40vmax; right: -10vmax; top: 8vh;
  background: radial-gradient(circle at 60% 40%, #14b8a6, transparent 70%);
  animation-delay: -6s; }
.b3 { width: 44vmax; height: 44vmax; left: 20vw; bottom: -18vmax;
  background: radial-gradient(circle at 50% 50%, #ec4899, transparent 70%);
  animation-delay: -12s; opacity: 0.4; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(4vmax, 3vmax) scale(1.12); }
}
.grain { position: absolute; inset: 0; opacity: 0.5; mix-blend-mode: overlay;
  background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 5px 5px; }

/* ---- layout ---- */
#app { max-width: 1060px; margin: 0 auto; padding: 28px 18px 60px; }

.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}

.hero { padding: 22px 24px; margin-bottom: 18px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.08) 45%, transparent 55%);
  background-size: 250% 100%; animation: sheen 9s ease-in-out infinite; }
@keyframes sheen { 0%,100% { background-position: 120% 0; } 50% { background-position: -20% 0; } }

.hero-top { display: flex; gap: 16px; align-items: center; }
.shrew { font-size: 52px; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
  animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-7px) rotate(5deg); } }

h1 { font-size: clamp(26px, 4.5vw, 38px); margin: 0; letter-spacing: -0.02em;
  background: linear-gradient(92deg, #fff, var(--accent) 55%, var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { margin: 6px 0 0; color: var(--ink-dim); font-size: 15px; }

.hero-stats { display: flex; gap: 12px; margin-top: 16px; }
.stat { flex: 1; text-align: center; padding: 10px 6px; border-radius: 14px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.14); }
.stat-num { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-faint); }

.layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; } }

.card { padding: 20px 20px 22px; }
.card h2 { margin: 0 0 14px; font-size: 17px; letter-spacing: 0.01em; }

/* ---- base pills ---- */
.base-row { border: 0; margin: 0 0 14px; padding: 0; }
.base-row legend { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-faint); margin-bottom: 8px; padding: 0; }
.base-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { border: 1px solid var(--stroke); background: rgba(255,255,255,0.07);
  color: var(--ink); border-radius: 999px; padding: 8px 14px; font-size: 14px;
  cursor: pointer; transition: transform 0.12s ease, background 0.2s, box-shadow 0.2s; }
.pill:hover { transform: translateY(-1px); background: rgba(255,255,255,0.14); }
.pill[aria-pressed="true"] { background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #14210a; font-weight: 700; border-color: transparent;
  box-shadow: 0 6px 18px rgba(184, 243, 109, 0.35); }

/* ---- ingredients ---- */
.ingredients { display: grid; gap: 10px; }
.ing { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 16px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12); transition: border-color 0.2s, background 0.2s; }
.ing:hover { background: rgba(255,255,255,0.09); }
.ing.active { border-color: var(--dot); box-shadow: 0 0 0 1px var(--dot), 0 4px 16px rgba(0,0,0,0.25); }
.ing-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--dot);
  box-shadow: 0 0 12px var(--dot), inset -3px -4px 8px rgba(0,0,0,0.35);
  display: grid; place-items: center; font-size: 15px; }
.ing-info b { display: block; font-size: 14.5px; }
.ing-info small { color: var(--ink-faint); font-size: 12px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 30px; height: 30px; border-radius: 10px; border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.1); color: var(--ink); font-size: 17px; line-height: 1;
  cursor: pointer; transition: transform 0.1s, background 0.15s; }
.stepper button:hover { background: rgba(255,255,255,0.2); }
.stepper button:active { transform: scale(0.88); }
.stepper output { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 14px; background: rgba(0,0,0,0.25); border-radius: 8px; padding: 5px 4px; }

.bench-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.hint { color: var(--ink-faint); font-size: 13px; margin: 10px 2px 0; font-variant-numeric: tabular-nums; }

/* ---- buttons ---- */
.btn { border: 1px solid var(--stroke); border-radius: 14px; padding: 11px 18px;
  font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer;
  background: rgba(255,255,255,0.1); transition: transform 0.12s, box-shadow 0.2s, background 0.2s; }
.btn:hover { transform: translateY(-2px); background: rgba(255,255,255,0.17);
  box-shadow: 0 10px 24px rgba(0,0,0,0.3); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn.primary { background: linear-gradient(135deg, #c9f77e, #5eead4); color: #13230b;
  border: none; box-shadow: 0 8px 26px rgba(184, 243, 109, 0.4); }
.btn.primary:hover { box-shadow: 0 12px 32px rgba(184, 243, 109, 0.55); }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 11px; }

/* ---- flask ---- */
.flask-card { display: flex; flex-direction: column; }
.flask-wrap { display: grid; place-items: center; padding: 6px;
  background: radial-gradient(circle at 50% 65%, rgba(255,255,255,0.09), transparent 70%);
  border-radius: 16px; }
#flask { width: 100%; max-width: 300px; height: auto; }
.flask-wrap.shake #flask { animation: shake 0.55s ease; }
@keyframes shake {
  0%,100% { transform: rotate(0); } 20% { transform: rotate(-7deg) translateY(-4px); }
  40% { transform: rotate(6deg); } 60% { transform: rotate(-4deg) translateY(2px); } 80% { transform: rotate(3deg); }
}
.potion-name { font-size: 19px; font-weight: 800; margin: 12px 0 6px; letter-spacing: -0.01em; }
.swatches { display: flex; align-items: center; gap: 10px; }
.swatch { width: 26px; height: 26px; border-radius: 8px; background: #222;
  border: 1px solid rgba(255,255,255,0.4); box-shadow: 0 2px 10px rgba(0,0,0,0.4); }
#hexCode { font-size: 13px; color: var(--ink-dim); }
.potency { margin-left: auto; font-size: 12px; font-weight: 800; padding: 4px 12px;
  border-radius: 999px; background: rgba(255,255,255,0.12); border: 1px solid var(--stroke);
  text-transform: uppercase; letter-spacing: 0.1em; }
.notes { color: var(--ink-dim); font-size: 14px; font-style: italic; margin: 8px 0 10px; min-height: 20px; }
.meter { height: 10px; border-radius: 999px; background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.14); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0%; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent2), var(--accent), #ffd166, #ff8fa3);
  transition: width 0.7s cubic-bezier(0.2, 0.9, 0.25, 1.2); }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---- shelf ---- */
.shelf-head { display: flex; align-items: center; justify-content: space-between; }
.shelf-head h2 { margin: 0; }
.count { color: var(--ink-faint); font-weight: 400; font-size: 14px; }
.shelf { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.shelf li { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 14px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12); animation: pop 0.3s ease; }
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.shelf .mini { width: 30px; height: 38px; border-radius: 8px; flex: none;
  border: 1px solid rgba(255,255,255,0.35); }
.shelf .shelf-name { flex: 1; min-width: 0; }
.shelf .shelf-name b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf .shelf-name small { color: var(--ink-faint); font-size: 12px; }
.shelf .icon-btn { border: 1px solid var(--stroke); background: rgba(255,255,255,0.08);
  color: var(--ink); border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.shelf .icon-btn:hover { background: rgba(255,255,255,0.18); }
.shelf .icon-btn.del:hover { background: rgba(255, 120, 120, 0.3); }
.empty-shelf { color: var(--ink-faint); font-size: 14px; margin: 12px 2px 0; }

/* ---- misc ---- */
.foot { text-align: center; color: var(--ink-faint); font-size: 12.5px; margin-top: 22px; }
.foot code { background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 6px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 80px);
  background: rgba(20, 14, 40, 0.85); border: 1px solid var(--stroke); color: var(--ink);
  padding: 12px 20px; border-radius: 14px; font-size: 14px; font-weight: 600;
  backdrop-filter: blur(12px); box-shadow: var(--shadow); opacity: 0;
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3), opacity 0.25s;
  max-width: min(92vw, 480px); text-align: center; z-index: 50; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 480px) {
  #app { padding: 16px 12px 48px; }
  .card { padding: 16px 14px 18px; }
  .hero-stats { gap: 8px; }
  .bench-actions .btn { flex: 1 1 100%; }
  .share-row .btn { flex: 1 1 calc(50% - 4px); text-align: center; }
}
