@import url("../../studio.css");

body.game { min-height: 100dvh; }
body.game .wrap { width: min(30rem, calc(100% - 2rem)); }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0 0.4rem;
}
.top a { text-decoration: none; color: inherit; }
.progress {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.story h2 {
  font-size: clamp(1.55rem, 6vw, 2.05rem);
  line-height: 1.15;
  margin-bottom: 0.45rem;
}
.story .lead { font-size: 1.08rem; color: var(--ink-soft); }

.stage {
  margin: 1rem 0;
  background:
    radial-gradient(800px 180px at 50% 0%, #fffdf7 0%, transparent 70%),
    #fff9ee;
  border-radius: 1.3rem;
  min-height: 300px;
  padding: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(42, 33, 24, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  position: relative;
  overflow: hidden;
}

.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bit {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: fly 0.7s ease-out forwards;
}
.bit-spark { border-radius: 1px; }
@keyframes fly {
  to { transform: translate(var(--dx), var(--dy)) scale(0.15); opacity: 0; }
}

.hint { color: var(--ink-soft); font-size: 0.95rem; text-align: center; margin: 0; }
.year { font-size: 1.15rem; font-weight: 600; color: var(--toast-dark); }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }
.choice, .node, .drop, .item {
  min-width: 76px;
  min-height: 76px;
  border-radius: 1rem;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid rgba(42, 33, 24, 0.12);
  box-shadow: none;
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  font-size: 0.85rem;
  touch-action: none;
  user-select: none;
}
.choice svg, .item svg, .drop svg { display: block; }
.choice.correct, .node.done, .item.correct, .drop.correct {
  border-color: var(--good);
  background: #edf6ea;
}
.choice.wrong { border-color: var(--bad); animation: shake 0.35s; }
.item.held { outline: 3px solid var(--toast); }
.item.dragging { z-index: 5; box-shadow: var(--shadow); cursor: grabbing; }
.drop.ready { border-style: dashed; border-color: var(--toast); }
.node { min-width: 92px; }
.node small { color: var(--ink-soft); }

@keyframes shake {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@keyframes tapFlash {
  50% { filter: brightness(1.08); }
}
.tap-pop { animation: tapFlash 0.18s ease; }

.appliance {
  background: none;
  box-shadow: none;
  border: 0;
  color: var(--ink);
  padding: 0.25rem;
  min-height: 0;
  cursor: pointer;
}
.appliance:focus { outline: 3px solid var(--toast); outline-offset: 4px; }
.big-target { min-width: 160px; min-height: 140px; }
.toaster-drop { min-width: 180px; min-height: 170px; padding: 0.4rem; }

.pop-slices { opacity: 0; }
.toasting .toaster-svg { filter: drop-shadow(0 0 14px rgba(195, 111, 40, 0.55)); }
.popped .pop-slices {
  animation: slicesPop 0.55s cubic-bezier(.18, 1.4, .3, 1) forwards;
}
@keyframes slicesPop {
  0% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(-30px); opacity: 1; }
}

.hearth {
  width: 72px;
  height: 48px;
  position: relative;
}
.hearth::after {
  content: "";
  position: absolute;
  left: 16px;
  bottom: 0;
  width: 40px;
  height: var(--flame, 8%);
  max-height: 46px;
  background: linear-gradient(#fff3c4, #f0d07a, #c36f28);
  border-radius: 18px 18px 8px 8px;
}
.spin svg { animation: whirl 0.35s ease-out; }
@keyframes whirl { 50% { transform: rotate(18deg); } }

.meter {
  width: min(16rem, 100%);
  height: 14px;
  background: rgba(42, 33, 24, 0.1);
  border-radius: 999px;
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--toast);
}

.fact {
  background: #fff;
  border-left: 4px solid var(--butter);
  padding: 0.8rem 1rem;
  border-radius: 0 0.8rem 0.8rem 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}
.actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.4rem;
  align-items: stretch;
}
.actions button { width: 100%; }

.end { text-align: center; }
.end h2 { font-size: 2.4rem; }
.time-line {
  color: var(--toast-dark);
  font-weight: 600;
  font-size: 1.15rem;
}
.receipt-wrap { width: 100%; display: flex; justify-content: center; }
#receipt {
  width: min(22rem, 100%);
  height: auto;
  background: #fff;
  border-radius: 0.4rem;
  box-shadow: var(--shadow);
}

.status { min-height: 1.4em; text-align: center; margin: 0; font-size: 0.95rem; }
#after { width: 100%; }

.credits-page { padding-bottom: 4rem; }
.credits-page h1 { margin-top: 1rem; }
.credits-page h2 { margin-top: 1.8rem; }
.credits-page li { margin: 0 0 0.8rem; color: var(--ink-soft); }
.credits-page a { overflow-wrap: anywhere; }
.credits-page ol { padding-left: 1.25rem; }

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.actions a.btn { width: 100%; }

.stage.done { pointer-events: none; }
.stage:not(.done) > .toaster-svg.appliance {
  animation: glow 1.8s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); }
  50% { filter: drop-shadow(0 0 10px rgba(195, 111, 40, 0.45)); }
}

@media (min-width: 720px) {
  body.game .wrap { width: min(28rem, calc(100% - 3rem)); }
  .actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  .actions button,
  .actions a.btn {
    width: auto;
    flex: 0 1 auto;
    min-width: 8.25rem;
  }
}
