/* Buttons, ledger entries, toasts, the closing card. */

.unwrap {
  --pad: clamp(0.7rem, 1.5vh, 0.95rem);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  padding: var(--pad) clamp(1.2rem, 3vw, 2rem);
  border: 2px solid var(--void);
  border-radius: 0;
  background: var(--hot);
  color: var(--void);
  font-family: var(--font-pixel);
  font-size: var(--step-1);
  letter-spacing: 0.02em;
  text-transform: lowercase;
  cursor: pointer;
  box-shadow: var(--hard-shadow), var(--bevel);
  transition: transform 90ms var(--ease-out), box-shadow 90ms, background 200ms, color 200ms;
}

.unwrap:hover:not(:disabled) {
  background: var(--hot-lit);
}

/* the button physically goes down into the page */
.unwrap:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0), var(--bevel-in);
}

.unwrap:disabled {
  background: var(--panel);
  color: var(--ghost-faint);
  border-color: var(--edge-dark);
  box-shadow: var(--bevel-in);
  cursor: not-allowed;
}

.unwrap.is-done .unwrap__cost {
  display: none;
}

.unwrap__cost {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding-left: 0.9rem;
  border-left: 2px solid rgba(11, 6, 20, 0.35);
  font-variant-numeric: tabular-nums;
  font-size: var(--step-2);
  letter-spacing: 0.02em;
}

.unwrap:disabled .unwrap__cost {
  border-left-color: var(--edge);
}

.unwrap__cost svg {
  width: 0.9em;
  height: 0.9em;
}

.ghost-btn {
  appearance: none;
  border: 2px solid var(--void);
  border-radius: 0;
  background: var(--panel-2);
  color: var(--ghost);
  font-family: var(--font-pixel);
  font-size: var(--step-0);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  padding: 0.7em 1.2em;
  cursor: pointer;
  box-shadow: var(--hard-shadow), var(--bevel);
  transition: transform 90ms var(--ease-out), box-shadow 90ms, color 200ms, background 200ms;
}

.ghost-btn:hover {
  color: var(--hot-lit);
  background: var(--panel);
}

.ghost-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0), var(--bevel-in);
}

/* ---- ledger ------------------------------------------------------------ */

.entry {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.5rem;
  border-bottom: var(--rule);
  animation: entry-in 460ms var(--ease-out) backwards;
}

.entry__glyph {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
}

.entry__glyph svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.entry__name {
  display: block;
  font-family: var(--font-flavour);
  font-size: var(--step-1);
  font-style: italic;
  color: var(--ghost-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry__sums {
  display: flex;
  gap: 0.55rem;
  font-size: var(--step-0);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--ghost-faint);
}

.entry__sums .out {
  color: rgba(239, 231, 216, 0.4);
}

.entry__sums .in {
  color: var(--hot);
}

.entry--jackpot .in {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 211, 77, 0.55);
}

@keyframes entry-in {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: none; }
}

/* ---- toasts ------------------------------------------------------------ */

.toasts {
  position: fixed;
  left: clamp(1rem, 3.4vw, 2.6rem);
  bottom: clamp(1rem, 3vh, 2rem);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(22rem, 70vw);
  pointer-events: none;
}

.toast {
  padding: 0.7rem 0.95rem;
  border: 2px solid var(--void);
  border-left: 4px solid var(--hot);
  border-radius: 0;
  background: var(--panel);
  box-shadow: var(--hard-shadow), var(--bevel);
}

.toast__title {
  display: block;
  font-family: var(--font-flavour);
  font-size: var(--step-1);
  font-weight: 400;
  font-style: italic;
  color: var(--ghost);
}

.toast__detail {
  display: block;
  font-size: var(--step-0);
  letter-spacing: 0.08em;
  color: var(--ghost-faint);
}

.toast--jackpot {
  border-left-color: var(--gold);
  background: #2c1f3f;
}

.toast--deny {
  border-left-color: rgba(239, 231, 216, 0.3);
}

/* ---- finale ------------------------------------------------------------ */

.finale {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: clamp(1rem, 4vh, 2.4rem);
  background: linear-gradient(180deg, rgba(10, 9, 16, 0) 30%, rgba(10, 9, 16, 0.62) 56%, rgba(10, 9, 16, 0.95));
  animation: fade-in 700ms var(--ease-out) both;
}

.finale[hidden] {
  display: none;
}

.finale__card {
  width: min(34rem, 100%);
  padding: clamp(1.3rem, 3vw, 2rem) clamp(1.6rem, 4vw, 2.6rem);
  border: 2px solid var(--void);
  border-radius: 0;
  background: var(--panel);
  box-shadow: 6px 6px 0 var(--hot-deep), var(--bevel);
  text-align: center;
}

.finale__eyebrow {
  margin: 0 0 0.8rem;
}

.finale__prize {
  margin: 0 0 1.4rem;
  font-family: var(--font-flavour);
  font-size: var(--step-3);
  font-weight: 400;
  font-style: italic;
  line-height: 1.15;
  color: var(--ghost);
}

.finale__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 0 0 1.6rem;
  padding: 1rem 0;
  border-top: var(--rule);
  border-bottom: var(--rule);
}

.finale__stats div {
  display: grid;
  gap: 0.25rem;
}

.finale__stats b {
  font-family: var(--font-term);
  font-size: var(--step-2);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--hot-lit);
}

.finale__actions {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  /* Bottom-left is where the unwrap button lives on a phone. */
  .toasts {
    top: calc(clamp(0.9rem, 2.2vh, 1.7rem) + 3.4rem);
    bottom: auto;
    left: clamp(1rem, 3.4vw, 2.6rem);
    right: clamp(1rem, 3.4vw, 2.6rem);
    max-width: none;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .entry,
  .finale {
    animation: none;
  }
}
