@font-face { font-family: "Gloock"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/gloock.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap; src: url("fonts/dm-sans.woff2") format("woff2"); }
*, *::before, *::after { box-sizing: border-box; }
/* Layout: one-screen lab bench. Header strip, shelf of vials centred in the middle, tool row at the bottom. Single dark look by choice (a candlelit workshop). */
:root {
  --night: #12101f;
  --night-2: #1c1830;
  --shelf: #3a2a22;
  --shelf-edge: #5b4334;
  --glass: rgba(214, 226, 255, 0.10);
  --glass-line: rgba(214, 226, 255, 0.42);
  --ink: #efe9ff;
  --ink-dim: #a69fc4;
  --brass: #e2b45c;
  --brass-deep: #9b7433;
  --display: "Gloock", "Georgia", "Times New Roman", serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; margin: 0; }
body { height: 100dvh; }
[hidden] { display: none !important; }
body {
  background: radial-gradient(120% 80% at 50% 0%, #2a2150 0%, var(--night-2) 40%, var(--night) 100%) fixed, var(--night);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  max-width: 760px;
  margin: 0 auto;
  box-sizing: border-box;
}
header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand h1 {
  font-family: var(--display); font-weight: 400; font-size: 1.5rem; margin: 0; line-height: 1.05;
  letter-spacing: 0.01em; color: var(--brass);
}
.brand .sub { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-dim); }
.levelnav { display: flex; align-items: center; gap: 6px; }
.levelnav .lv {
  font-family: var(--display); font-size: 1.25rem; min-width: 5.2em; text-align: center;
  font-variant-numeric: tabular-nums;
}
.iconbtn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--glass-line);
  background: var(--glass); color: var(--ink); font-size: 1rem; cursor: pointer;
  display: grid; place-items: center; font-family: var(--body);
}
.iconbtn:disabled { opacity: 0.3; cursor: default; }
.iconbtn:focus-visible, .tool:focus-visible, .vial:focus-visible, .btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

.bench {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 0; gap: 10px;
}
.status { min-height: 1.4em; font-size: 0.9rem; color: var(--ink-dim); text-align: center; }
.status b { color: var(--brass); font-weight: 600; }
.shelves { display: flex; flex-direction: column; gap: 26px; align-items: center; width: 100%; }
.shelf {
  position: relative; display: flex; justify-content: center; gap: var(--gap, 14px);
  padding: 0 14px 10px; width: fit-content; max-width: 100%;
}
.shelf::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; border-radius: 3px;
  background: linear-gradient(var(--shelf-edge), var(--shelf));
  box-shadow: 0 6px 14px rgba(0,0,0,0.5);
}

.vial {
  --w: 46px; --h: 172px;
  position: relative; width: var(--w); height: calc(var(--h) + 16px);
  padding: 0; border: 0; background: none; cursor: pointer; z-index: 1;
  transition: transform 0.22s cubic-bezier(.3,.7,.4,1);
  transform-origin: 50% 0;
}
.vial.lift { transform: translateY(-18px); }
.vial.pouring { z-index: 5; }
.vial .cork {
  position: absolute; left: 50%; top: -12px; width: 60%; height: 12px; transform: translateX(-50%);
  border-radius: 3px 3px 2px 2px; background: linear-gradient(#c79a62, #8b6237);
  opacity: 0; transition: opacity 0.3s, top 0.3s;
}
.vial.sealed .cork { opacity: 1; top: 4px; }
.vial .glass {
  position: absolute; left: 0; right: 0; top: 16px; bottom: 0;
  border: 2px solid var(--glass-line); border-top: 0;
  border-radius: 0 0 calc(var(--w) / 2) calc(var(--w) / 2);
  background: var(--glass); overflow: hidden;
  box-shadow: inset 6px 0 10px rgba(255,255,255,0.06), inset -4px 0 8px rgba(0,0,0,0.25);
}
.vial .lip {
  position: absolute; left: -5px; right: -5px; top: 10px; height: 7px; border-radius: 4px;
  border: 2px solid var(--glass-line); background: rgba(214,226,255,0.06);
}
.vial .sheen {
  position: absolute; top: 22px; left: 7px; width: 5px; bottom: 18px; border-radius: 3px;
  background: linear-gradient(rgba(255,255,255,0.32), rgba(255,255,255,0.04)); pointer-events: none; z-index: 3;
}
.slots { position: absolute; inset: 0; display: flex; flex-direction: column-reverse; padding-top: 8%; }
.slot { position: relative; flex: 1; }
.fill {
  position: absolute; inset: 0; transform-origin: 50% 100%;
  transition: transform 0.38s ease-in-out, background-color 0.2s;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: rgba(0,0,0,0.55);
}
.fill::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255,255,255,0.22);
}
.fill.empty { transform: scaleY(0); }
.fill.hidden { background: repeating-linear-gradient(135deg, #2c2742 0 6px, #241f38 6px 12px) !important; color: var(--ink-dim); }
.fill .glyph { position: relative; z-index: 1; opacity: 0; transition: opacity .2s; line-height: 1; }
.symbols .fill .glyph, .fill.hidden .glyph { opacity: 1; }

.stream {
  position: fixed; width: 6px; border-radius: 3px; pointer-events: none; z-index: 4;
  transform-origin: 50% 0; transform: scaleY(0); transition: transform 0.16s ease-out;
}

.tools { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; padding-top: 8px; }
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 68px; padding: 8px 10px; border-radius: 14px; cursor: pointer;
  border: 1px solid rgba(226,180,92,0.35); background: rgba(226,180,92,0.07); color: var(--ink);
  font-family: var(--body); font-size: 0.78rem; font-weight: 600;
}
.tool .ic { font-size: 1.15rem; line-height: 1; }
.tool .ct { font-size: 0.68rem; color: var(--brass); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: 0.04em; }
.tool:disabled { opacity: 0.35; cursor: default; }
.tool.on { background: rgba(226,180,92,0.22); }

.overlay {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: rgba(10, 8, 20, 0.72); backdrop-filter: blur(3px);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.card {
  width: min(360px, 100%); box-sizing: border-box; text-align: center; padding: 26px 22px 22px;
  border-radius: 20px; background: linear-gradient(#251f3d, #1a1630); border: 1px solid rgba(226,180,92,0.4);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.card h2 { font-family: var(--display); font-weight: 400; font-size: 1.9rem; margin: 0; color: var(--brass); text-wrap: balance; }
.card p { margin: 0; color: var(--ink-dim); line-height: 1.5; max-width: 30ch; }
.card .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn {
  border: 0; border-radius: 999px; padding: 11px 22px; font-family: var(--body); font-weight: 700; font-size: 0.95rem;
  background: var(--brass); color: #231a08; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--glass-line); }
.how { text-align: left; color: var(--ink-dim); line-height: 1.5; padding-left: 1.1em; margin: 0; font-size: 0.9rem; }
.how li + li { margin-top: 4px; }
.how b { color: var(--ink); }

@keyframes sealpop { 0% { transform: scale(1); } 40% { transform: scale(1.06) translateY(-4px); } 100% { transform: scale(1); } }
.vial.justsealed { animation: sealpop 0.45s ease-out; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.vial.nope { animation: shake 0.25s; }
@keyframes hintglow { 0%,100% { filter: none; } 50% { filter: drop-shadow(0 0 10px var(--brass)); } }
.vial.hint { animation: hintglow 0.9s ease-in-out 2; }

@media (max-width: 520px) {
  .brand h1 { font-size: 1.2rem; }
  .brand .sub { display: none; }
  .levelnav .lv { font-size: 1.05rem; }
  .tools { flex-wrap: nowrap; gap: 6px; }
  .tool { min-width: 0; flex: 1 1 0; padding: 8px 2px; font-size: 0.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .vial, .fill, .stream { transition: none !important; }
  .vial.justsealed, .vial.nope, .vial.hint { animation: none; }
}
