/* Apothecary Night: shared tokens, board and controls for the website and the app. */
:root {
  --ink: #120B1E;
  --panel: #1D1330;
  --panel-2: #2A1D45;
  --line: #3D2C61;
  --gold: #F2C14E;
  --gold-deep: #C28A1E;
  --ruby: #FF5D73;
  --lagoon: #5EE0C1;
  --emerald: #2FCB8A;
  --amethyst: #B388FF;
  --text: #F6EFE6;
  --text-2: #D5CAE6;
  --muted: #A79CBF;
  --void: #0B0613;
  --display: 'Fraunces', Georgia, serif;
  --body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--body); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; margin: 0; }

/* ---------- board ---------- */
/* Vials and orbs are placed in pixels by board.js; this is only how they look. */
.board {
  position: relative; width: 100%; min-height: 120px; border-radius: 18px;
  background: radial-gradient(120% 90% at 50% 0%, #2A1D45 0%, var(--void) 70%);
  box-shadow: 0 0 0 1px var(--line), 0 0 40px rgba(179,136,255,.10);
  user-select: none; -webkit-user-select: none; touch-action: manipulation; overflow: hidden;
  isolation: isolate;   /* keeps the orbs' stacking inside the board, so a cover can sit on top */
}
.vial { position: absolute; padding: 0; border: 0; background: none; border-radius: 10px; }
.vial .glass {
  position: absolute; left: 0; right: 0; bottom: 0; top: var(--head);
  border: 2px solid rgba(246,239,230,.34); border-top: 0;
  border-radius: 4px 4px calc(var(--d) / 2 + 4px) calc(var(--d) / 2 + 4px);
  background: linear-gradient(90deg, rgba(255,255,255,.13), rgba(255,255,255,.02) 38%, rgba(255,255,255,.02) 70%, rgba(255,255,255,.09));
  transition: border-color .2s, box-shadow .2s;
}
/* The lip of the vial */
.vial .glass::before {
  content: ''; position: absolute; left: -5px; right: -5px; top: -3px; height: 5px; border-radius: 3px;
  background: rgba(246,239,230,.42); transition: background .2s;
}
@media (hover: hover) { .vial:hover .glass { border-color: rgba(246,239,230,.6); } }
.vial.picked .glass { border-color: var(--text); }
.vial.target .glass { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242,193,78,.35), 0 0 22px rgba(242,193,78,.5); animation: pulse 1.1s ease-in-out infinite; }
/* Complete: corked and glowing */
.vial.done .glass { border-color: var(--gold); box-shadow: 0 0 16px rgba(242,193,78,.28); }
.vial.done .glass::before { background: #B9825A; height: 9px; top: -7px; left: 3px; right: 3px; border-radius: 4px 4px 2px 2px; }
/* Sealed until other vials are complete */
.vial.sealed .glass { border-style: dashed; border-color: rgba(255,93,115,.75); background: repeating-linear-gradient(135deg, rgba(255,93,115,.10) 0 6px, transparent 6px 12px); }
.vial.sealed .glass::before { background: var(--ruby); }
.vial .seal {
  position: absolute; left: 50%; top: calc(var(--head) - 2px); translate: -50% -50%; z-index: 3;
  width: 24px; height: 24px; border-radius: 50%; display: none; place-items: center;
  background: var(--ruby); color: #2A0A12; font: 700 13px/1 var(--body); box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.vial.sealed .seal { display: grid; }
.vial.shake { animation: shake .3s; }
.vial.pop .glass { animation: vial-pop .45s ease-out; }

.orb {
  position: absolute; left: 0; top: 0; width: var(--d); height: var(--d); border-radius: 50%;
  display: grid; place-items: center; pointer-events: none; z-index: 2;
  background:
    radial-gradient(circle at 32% 27%, rgba(255,255,255,.95) 0 5%, rgba(255,255,255,.35) 13%, transparent 30%),
    radial-gradient(circle at 50% 45%, var(--c) 35%, color-mix(in srgb, var(--c) 58%, #000) 100%);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.28), 0 1px 2px rgba(0,0,0,.45);
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.25), opacity .2s, scale .2s ease-out, box-shadow .2s;   /* the lift has a touch of spring */
  will-change: transform;
}
.orb.flying { z-index: 5; }
.orb.static { position: static; display: inline-grid; vertical-align: middle; box-shadow: none; }
.orb svg { width: 46%; height: 46%; fill: rgba(18,11,30,.55); }
.orb i { display: none; font: 700 calc(var(--d, 22px) * .46)/1 var(--display); font-style: normal; color: var(--muted); }
.board.no-symbols .orb svg { display: none; }
.orb.lifted { z-index: 4; scale: 1.06; box-shadow: inset 0 -2px 4px rgba(0,0,0,.28), 0 8px 14px rgba(0,0,0,.5); }
.orb.dim { opacity: .5; }
/* Clouded: colour unknown until it reaches the top */
.orb.clouded { background: radial-gradient(circle at 34% 28%, #5B4A82 0 10%, #33264F 60%, #231838 100%); }
.orb.clouded svg { display: none; }
.orb.clouded i { display: block; }
.board.won .orb { animation: hop .55s ease-out both; }
@keyframes hop { 40% { translate: 0 -10px; } 70% { translate: 0 2px; } }
@keyframes vial-pop { 30% { scale: 1.07; } }
@keyframes pop { from { transform: scale(.2) rotate(-40deg); } to { transform: scale(1); } }
@keyframes shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
@keyframes pulse { 50% { filter: brightness(1.25); } }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 14px; border: 0;
  font-weight: 700; font-size: 15px; text-decoration: none;
}
.btn-gold { background: var(--gold); color: var(--ink); box-shadow: inset 0 -4px 0 var(--gold-deep); }
.btn-gold:active { box-shadow: inset 0 -1px 0 var(--gold-deep); transform: translateY(2px); }
.btn-dark { background: var(--panel); color: var(--text); }
.btn-light { background: var(--panel-2); color: var(--text); border: 1.5px solid var(--line); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-lg { min-height: 56px; font-size: 17px; font-weight: 700; border-radius: 16px; }

/* Essence */
.coin {
  display: inline-block; width: .78em; height: .78em; margin: 0 .11em; vertical-align: -0.02em; background: var(--gold);
  border-radius: 0 55% 55% 55%; rotate: 45deg;
}

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  max-width: min(440px, calc(100vw - 32px)); background: var(--text); color: var(--ink);
  padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; line-height: 1.4; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
