:root {
  --ink: #0c1026;
  --ink2: #151a3a;
  --ink3: #1f2650;
  --paper: #f7f1e6;
  --paper2: #efe5d2;
  --line: #e2d3b5;
  --gold: #e8b86a;
  --gold2: #f6d79c;
  --berry: #c8416b;
  --berry2: #e2668d;
  --pine: #2f6b57;
  --pine2: #4f9c80;
  --text: #241d33;
  --muted: #6e6479;
  --frost: rgba(255, 255, 255, 0.07);
  --frost2: rgba(255, 255, 255, 0.14);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Manrope", system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.9, 0.25, 1);
  --spring: cubic-bezier(0.2, 1.35, 0.4, 1);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
  background: var(--ink);
}
body {
  font: 15px/1.5 var(--sans);
  color: var(--paper);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(120% 60% at 50% -10%, #2a2f6b 0%, transparent 60%),
    radial-gradient(80% 50% at 100% 100%, #3b1d45 0%, transparent 60%),
    var(--ink);
  background-attachment: fixed;
  min-height: 100dvh;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}
svg.i {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.serif {
  font-family: var(--serif);
}
.hidden {
  display: none !important;
}

/* Schnee */
#snow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.flake {
  position: absolute;
  top: -12px;
  border-radius: 50%;
  background: #fff;
  animation: fall linear infinite;
}
@keyframes fall {
  to {
    transform: translate3d(40px, 110vh, 0);
  }
}

/* Shell */
.app {
  position: relative;
  z-index: 2;
  max-width: 460px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-t)) 16px calc(28px + var(--safe-b));
}
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand small {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.brand b {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  font-style: italic;
}
.ib {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--frost);
  border: 1px solid var(--frost2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  transition:
    transform 0.15s var(--ease),
    background 0.2s;
}
.ib:active {
  transform: scale(0.92);
}
.ib .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--berry);
  font-size: 10.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--ink);
}
.ib.pbtn {
  width: auto;
  padding: 0 12px;
  gap: 7px;
  display: flex;
  font-weight: 700;
  font-size: 13px;
}
.ring {
  width: 22px;
  height: 22px;
}

/* Screens */
.screen {
  animation: enter 0.55s var(--ease) both;
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}
.stagger > * {
  animation: enter 0.6s var(--ease) both;
}
.stagger > *:nth-child(2) {
  animation-delay: 0.06s;
}
.stagger > *:nth-child(3) {
  animation-delay: 0.12s;
}
.stagger > *:nth-child(4) {
  animation-delay: 0.18s;
}
.stagger > *:nth-child(5) {
  animation-delay: 0.24s;
}

/* Map */
.mapwrap {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  box-shadow:
    0 30px 60px -20px #000c,
    0 0 0 1px #ffffff1a,
    inset 0 0 0 1px #ffffff12;
}
.mapwrap svg {
  display: block;
  width: 100%;
  height: auto;
}
.st {
  cursor: pointer;
}
.st .halo {
  opacity: 0;
}
.st.now .halo {
  opacity: 1;
  animation: halo 2s var(--ease) infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes halo {
  0% {
    transform: scale(0.6);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}
.tw {
  animation: tw 3s ease-in-out infinite;
}
@keyframes tw {
  50% {
    opacity: 0.25;
  }
}
.glow {
  animation: glow 4s ease-in-out infinite;
}
@keyframes glow {
  50% {
    opacity: 0.55;
  }
}

.sheet {
  margin-top: -34px;
  position: relative;
  z-index: 3;
  background: var(--paper);
  color: var(--text);
  border-radius: 28px;
  padding: 22px 20px 20px;
  box-shadow: 0 -10px 40px -10px #0008;
}
.sheet .grab {
  width: 38px;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  margin: -8px auto 14px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--berry);
}
.h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: #2a1f3f;
  margin: 6px 0 8px;
}
.h1 em {
  font-style: italic;
  color: var(--berry);
}
.lead {
  color: var(--muted);
  font-size: 15px;
}
.steps {
  display: flex;
  gap: 5px;
  margin: 16px 0 4px;
}
.steps i {
  flex: 1;
  height: 5px;
  border-radius: 5px;
  background: var(--paper2);
  position: relative;
  overflow: hidden;
}
.steps i.d {
  background: var(--pine2);
}
.steps i.n {
  background: var(--paper2);
}
.steps i.n::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--berry);
  animation: fillbar 1.8s ease-in-out infinite alternate;
  transform-origin: left;
}
@keyframes fillbar {
  from {
    transform: scaleX(0.2);
  }
  to {
    transform: scaleX(1);
  }
}
.meta {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 8px;
}

/* Buttons */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 0 20px;
  border-radius: 18px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.01em;
  margin-top: 16px;
  transition:
    transform 0.15s var(--ease),
    box-shadow 0.2s;
  overflow: hidden;
}
.btn:active {
  transform: translateY(2px) scale(0.985);
}
.btn.pri {
  background: linear-gradient(180deg, #d64f79, #b83460);
  color: #fff;
  box-shadow:
    0 1px 0 #ffffff40 inset,
    0 12px 24px -8px #c8416baa;
}
.btn.gold {
  background: linear-gradient(180deg, #f3cf8b, #dfa955);
  color: #2a1f3f;
  box-shadow:
    0 1px 0 #ffffff80 inset,
    0 12px 24px -8px #e8b86a99;
}
.btn.soft {
  background: var(--paper2);
  color: var(--text);
}
.btn.line {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.btn.pri::before,
.btn.gold::before {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, #ffffff55, transparent);
  transform: skewX(-20deg);
  animation: sheen 3.6s ease-in-out infinite;
}
@keyframes sheen {
  0%,
  60% {
    left: -60%;
  }
  100% {
    left: 130%;
  }
}
.row {
  display: flex;
  gap: 10px;
}
.row .btn {
  margin-top: 12px;
}

/* Level page */
.lv {
  background: var(--paper);
  color: var(--text);
  border-radius: 28px;
  padding: 16px 18px 22px;
  box-shadow: 0 30px 60px -20px #000c;
  min-height: calc(100dvh - 110px);
}
.lvtop {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.lvtop .back {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--paper2);
  color: var(--text);
}
.lvtop .t {
  flex: 1;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.pill {
  font-size: 12.5px;
  font-weight: 800;
  padding: 7px 11px;
  border-radius: 99px;
  background: var(--paper2);
  color: var(--text);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.pill.b {
  background: #fbe1ea;
  color: var(--berry);
}
.pill.g {
  background: #dcefe6;
  color: var(--pine);
}
.qcard {
  background: #fff;
  border-radius: 20px;
  padding: 22px 18px;
  box-shadow:
    0 1px 0 var(--line),
    0 10px 24px -14px #2a1f3f55;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.25;
  text-align: center;
  color: #2a1f3f;
  margin: 14px 0 6px;
}
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #fff;
  border-radius: 16px;
  padding: 15px 16px;
  margin-top: 10px;
  font-weight: 700;
  font-size: 15.5px;
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition:
    transform 0.15s var(--ease),
    background 0.2s,
    box-shadow 0.2s;
}
.opt .k {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--paper2);
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  flex: none;
}
.opt:active {
  transform: scale(0.98);
}
.opt.ok {
  background: #e3f4ec;
  box-shadow: inset 0 0 0 2px var(--pine2);
}
.opt.ok .k {
  background: var(--pine2);
  color: #fff;
}
.opt.no {
  background: #fde8ee;
  box-shadow: inset 0 0 0 2px var(--berry2);
}
.opt.no .k {
  background: var(--berry);
  color: #fff;
}
.shake {
  animation: shake 0.45s;
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}

/* Memory */
.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  perspective: 800px;
  margin-top: 12px;
}
.mc {
  aspect-ratio: 3/4;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s var(--spring);
}
.mc.open,
.mc.done {
  transform: rotateY(180deg);
}
.mc > div {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.mc .back {
  background: var(--ink2);
  box-shadow: inset 0 0 0 1.5px #e8b86a66;
}
.mc .back svg {
  width: 60%;
  height: 60%;
  opacity: 0.9;
}
.mc .front {
  background: #fff;
  transform: rotateY(180deg);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 28px;
}
.mc .front img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.mc.done .front {
  box-shadow: inset 0 0 0 2.5px var(--pine2);
}
.mc.done {
  animation: pop 0.5s var(--spring);
}
@keyframes pop {
  50% {
    transform: rotateY(180deg) scale(1.08);
  }
}

/* Duel */
.duel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  position: relative;
}
.dc {
  position: relative;
  border-radius: 22px;
  padding: 16px 12px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: left;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 14px 28px -14px #0009;
  transition: transform 0.2s var(--ease);
}
.dc:active {
  transform: scale(0.96);
}
.dc .mono {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 64px;
  line-height: 1;
  opacity: 0.28;
}
.dc b {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.15;
}
.dc small {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  opacity: 0.8;
  margin-bottom: 4px;
}
.dc .crown {
  display: flex;
  gap: 3px;
  margin-bottom: 6px;
  color: var(--gold2);
}
.vs {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--berry);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  box-shadow:
    0 0 0 5px var(--paper),
    0 6px 18px #0004;
  z-index: 2;
  font-size: 17px;
}
.dc.win {
  animation: pop2 0.4s var(--spring);
}
@keyframes pop2 {
  50% {
    transform: scale(1.04);
  }
}
.dc .val {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  margin-top: 4px;
}
.dc.right {
  box-shadow:
    0 0 0 3px var(--pine2),
    0 14px 28px -14px #0009;
}
.dc.wrong {
  box-shadow:
    0 0 0 3px var(--berry2),
    0 14px 28px -14px #0009;
}

/* Score */
.score {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 4px;
}
.score div {
  background: #fff;
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: box-shadow 0.3s;
}
.score div.act {
  box-shadow: inset 0 0 0 2px var(--berry);
}
.score small {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.score b {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  color: #2a1f3f;
}

/* Hearts */
#field {
  position: relative;
  height: 400px;
  border-radius: 22px;
  background: radial-gradient(100% 70% at 50% 0%, #2a2f6b, #0f1330);
  overflow: hidden;
  touch-action: manipulation;
  margin-top: 12px;
  box-shadow: inset 0 0 0 1px #ffffff14;
}
.fall {
  position: absolute;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  user-select: none;
}
.fall svg {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 4px 10px #e2668d88);
}
.fall.bad svg {
  filter: drop-shadow(0 4px 10px #0008);
}
.burst {
  position: absolute;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  pointer-events: none;
  animation: up 0.7s var(--ease) forwards;
}
@keyframes up {
  to {
    transform: translateY(-44px);
    opacity: 0;
  }
}
.timer {
  height: 6px;
  border-radius: 6px;
  background: var(--paper2);
  overflow: hidden;
  margin-top: 10px;
}
.timer i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--berry), var(--gold));
  transition: width 1s linear;
}
.fieldmsg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--paper);
  padding: 24px;
}
.fieldmsg b {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  display: block;
}

/* Puzzle */
#pz {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  aspect-ratio: 1;
  border-radius: 20px;
  overflow: hidden;
  background: var(--ink2);
  padding: 4px;
  transition:
    gap 0.5s,
    padding 0.5s;
  margin-top: 12px;
}
.tile {
  border-radius: 10px;
  background-size: 300% 300%;
  display: grid;
  place-items: center;
  transition:
    transform 0.2s var(--spring),
    border-radius 0.5s;
  color: #fff8;
}
.tile svg {
  width: 34%;
  height: 34%;
}
.tile.sel {
  transform: scale(0.88);
  box-shadow: 0 0 0 3px var(--gold);
}
#pz.solved {
  gap: 0;
  padding: 0;
}
#pz.solved .tile {
  border-radius: 0;
}

/* Overlay sheet */
.ov {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #060818b3;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.3s both;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.ov.center {
  align-items: center;
  padding: 18px;
}
.ovp {
  width: 100%;
  max-width: 460px;
  max-height: 92dvh;
  overflow: auto;
  background: var(--paper);
  color: var(--text);
  border-radius: 28px 28px 0 0;
  padding: 14px 20px calc(22px + var(--safe-b));
  animation: rise 0.5s var(--ease) both;
}
.ov.center .ovp {
  border-radius: 28px;
  padding-bottom: 22px;
}
@keyframes rise {
  from {
    transform: translateY(100%);
  }
}
.ov.out {
  animation: fade 0.25s reverse both;
}
.ov.out .ovp {
  animation: rise 0.3s reverse both;
}
.ovp .grab {
  width: 38px;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  margin: 0 auto 16px;
}
.reward {
  text-align: center;
}
.seal {
  width: 84px;
  height: 84px;
  margin: 6px auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #f6d79c, #dfa955);
  color: #2a1f3f;
  box-shadow:
    0 0 0 6px #e8b86a33,
    0 16px 30px -10px #dfa955;
  animation: float 3s ease-in-out infinite;
}
.seal svg {
  width: 38px;
  height: 38px;
  stroke-width: 1.6;
}
@keyframes float {
  50% {
    transform: translateY(-6px);
  }
}
.reveal {
  background: #fff;
  border-radius: 20px;
  padding: 18px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.45;
  color: #2a1f3f;
  box-shadow: inset 0 0 0 1.5px var(--line);
  white-space: pre-line;
  margin-top: 12px;
}
.photo {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 18px;
  margin-bottom: 8px;
}
.bigem {
  font-size: 56px;
  line-height: 1;
  margin: 6px 0 10px;
}

/* Collect cards */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.cd {
  aspect-ratio: 3/4;
  perspective: 800px;
}
.cd > div {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s var(--spring);
  transform-style: preserve-3d;
}
.cd.got > div {
  transform: rotateY(180deg);
}
.cd .f,
.cd .b {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
}
.cd .f {
  background: var(--ink2);
  box-shadow: inset 0 0 0 1.5px #e8b86a55;
  color: #e8b86a88;
}
.cd .f svg {
  width: 32px;
  height: 32px;
}
.cd .b {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #fffaf0, #f3e6cc);
  box-shadow:
    inset 0 0 0 1.5px var(--gold),
    inset 0 0 0 5px #fffaf0,
    inset 0 0 0 6px #e8b86a77;
  color: #2a1f3f;
}
.cd .b .cic {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink2);
  color: var(--gold);
  margin-bottom: 10px;
}
.cd .b .cic svg {
  width: 24px;
  height: 24px;
}
.cd .b strong {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.15;
}
.cd .b small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.35;
}
.cd .b .no {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #b69a66;
}
.single {
  max-width: 210px;
  margin: 6px auto 0;
  grid-template-columns: 1fr;
}
.single .cd {
  filter: drop-shadow(0 20px 30px #2a1f3f40);
}

/* Wheel */
.dark .ovp {
  background: radial-gradient(120% 80% at 50% 0%, #3a1430, #12060f);
  color: #fde3ea;
}
.dark .eyebrow {
  color: #ff8fb0;
}
.dark .h1 {
  color: #fff0f4;
}
.dark .lead {
  color: #d9a9b8;
}
.dark .grab {
  background: #ffffff22;
}
.wheelbox {
  position: relative;
  width: 290px;
  height: 290px;
  margin: 14px auto 4px;
}
.wheelbox svg.wh {
  width: 100%;
  height: 100%;
  transition: transform 4.8s cubic-bezier(0.12, 0.85, 0.15, 1);
  filter: drop-shadow(0 20px 40px #000a);
}
.pin {
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  z-index: 2;
  width: 30px;
  height: 38px;
}
.dark .reveal {
  background: #2a0f22;
  color: #ffe3ec;
  box-shadow: inset 0 0 0 1.5px #ff8fb066;
}
.flash {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 80;
  pointer-events: none;
  animation: flash 0.5s forwards;
}
@keyframes flash {
  from {
    opacity: 0.5;
  }
  to {
    opacity: 0;
  }
}

/* Protein */
.pmeter {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 10px 0 4px;
}
.pmeter svg {
  width: 108px;
  height: 108px;
  flex: none;
}
.pmeter .v {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 600;
  color: #2a1f3f;
  line-height: 1;
}
.pmeter .v small {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.chips button {
  background: #fff;
  border-radius: 99px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: transform 0.15s;
}
.chips button:active {
  transform: scale(0.94);
  background: #e3f4ec;
}
.chips button span {
  color: var(--pine);
  font-weight: 800;
}

/* Finale */
.home {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.home div {
  background: #fff;
  border-radius: 18px;
  padding: 14px;
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.home .hic {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--ink2);
  color: var(--gold);
  margin-bottom: 10px;
}
.home .hic svg {
  width: 18px;
  height: 18px;
}
.home b {
  display: block;
  font-size: 14px;
  line-height: 1.3;
}
.letter {
  background: #fffdf7;
  border-radius: 20px;
  padding: 22px 20px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  white-space: pre-line;
  color: #2a1f3f;
  box-shadow:
    inset 0 0 0 1.5px var(--line),
    0 20px 30px -20px #2a1f3f55;
  margin-top: 12px;
  position: relative;
}
.letter::before {
  content: "";
  position: absolute;
  top: -10px;
  right: 20px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e2668d, #a52a52);
  box-shadow: 0 4px 10px #a52a5266;
}
.h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  color: #2a1f3f;
  margin-top: 24px;
}
input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: none;
  box-shadow: inset 0 0 0 1.5px var(--line);
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  outline: none;
}
input:focus {
  box-shadow: inset 0 0 0 2px var(--berry);
}
.add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.add .btn {
  width: 56px;
  flex: none;
  margin: 0;
  padding: 0;
}
.list {
  list-style: none;
  margin-top: 8px;
}
.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border-radius: 14px;
  margin-top: 8px;
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-weight: 600;
}
.list li .cb {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px var(--line);
  display: grid;
  place-items: center;
  flex: none;
}
.list li.d {
  color: var(--muted);
  text-decoration: line-through;
}
.list li.d .cb {
  background: var(--pine2);
  box-shadow: none;
  color: #fff;
}
.list li .cb svg {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

/* Loader */
#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  background: radial-gradient(90% 60% at 50% 35%, #262b66, #0c1026);
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
}
#loader.go {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}
.lmoon {
  width: 96px;
  height: 96px;
  margin-bottom: 26px;
  animation: float 3.2s ease-in-out infinite;
}
#loader .eyebrow {
  color: var(--gold);
}
#loader h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: 38px;
  line-height: 1.05;
  margin: 10px 0 26px;
}
.lbar {
  width: 200px;
  height: 2px;
  background: #ffffff1f;
  border-radius: 2px;
  overflow: hidden;
}
.lbar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.25s;
}
#ltxt {
  font-size: 13px;
  color: #cfc6e8;
  margin-top: 14px;
  min-height: 20px;
  transition: opacity 0.2s;
}

.conf {
  position: fixed;
  top: -20px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 85;
  animation: fallc linear forwards;
}
@keyframes fallc {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  transform: translateX(-50%);
  background: #151a3af2;
  border: 1px solid #ffffff22;
  padding: 12px 18px;
  border-radius: 16px;
  z-index: 95;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  animation: enter 0.4s var(--ease);
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Mobile finishing touches and accessible controls. */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
.sheet :focus-visible,
.ovp :focus-visible {
  outline-color: var(--berry);
}
#view:focus {
  outline: none;
}
button {
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 4px 4px;
  font-size: 12px;
  color: #c5c6db;
}
.app-footer button {
  min-height: 44px;
  padding: 8px;
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 4px;
}
#offline-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--gold);
}
#offline-status[data-ready="true"]::before {
  background: #77c7a6;
}
.update-banner {
  position: sticky;
  bottom: calc(10px + var(--safe-b));
  z-index: 80;
  border: 1px solid #e8b86a55;
  border-radius: 18px;
  background: #151a3af5;
  box-shadow: 0 12px 30px #0005;
  padding: 12px 16px;
  font-size: 13px;
}
.update-banner:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.update-banner button {
  min-height: 44px;
  font-weight: 800;
  color: var(--gold);
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  background: var(--paper);
  color: var(--ink);
  padding: 12px;
  border-radius: 10px;
}
.skip-link:focus {
  top: 12px;
}
.noscript {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: var(--ink);
  padding: 30px;
}
.toast {
  white-space: normal;
  width: max-content;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.ovp {
  overscroll-behavior: contain;
}
body:has(.ov) {
  overflow: hidden;
}
.brand b {
  letter-spacing: -0.03em;
}
.mapwrap {
  border: 1px solid #e8b86a30;
}
.mc:focus-visible {
  outline-offset: 2px;
}
.tile:disabled {
  opacity: 1;
}
@media (max-width: 360px) {
  .app {
    padding-left: 12px;
    padding-right: 12px;
  }
  .brand b {
    font-size: 17px;
  }
  .brand small {
    font-size: 9px;
  }
  .topbar {
    gap: 5px;
  }
  .ib.pbtn {
    padding: 0 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #snow,
  .conf,
  .flash {
    display: none !important;
  }
  .fall {
    transition: none !important;
  }
}

.chapter {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 12px;
  color: #c5c6db;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.chapter span:last-child {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.mapwrap > svg {
  height: clamp(340px, 51svh, 460px);
  width: 100%;
  background: linear-gradient(#151a3a, #1c3e44);
}
.sheet .eyebrow,
.ovp .eyebrow {
  color: #ac2850;
}
.dark .eyebrow {
  color: #ffd3df;
}
