:root {
  color-scheme: dark;
  --ink: #120f16;
  --panel: #19151d;
  --paper: #f6d0a0;
  --paper-deep: #cc7a81;
  --line: rgba(255, 218, 162, 0.44);
  --cyan: #65d5cd;
  --blue: #3477c8;
  --violet: #6e4aa5;
  --peach: #ff956d;
  --gold: #ffd483;
  --mint: #9bdca9;
  --pink: #ea7f9a;
  --text: #fff4db;
  --muted: #dec2d7;
  font-family: "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 8%, rgba(101, 213, 205, 0.42), transparent 29%),
    radial-gradient(circle at 82% 5%, rgba(255, 149, 109, 0.32), transparent 28%),
    linear-gradient(145deg, #151018 0%, #24132f 46%, #0d1118 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(45deg, transparent 47%, rgba(255, 212, 131, 0.75) 48%, transparent 51%),
    radial-gradient(circle, transparent 48%, rgba(101, 213, 205, 0.55) 49%, transparent 53%);
  background-size: 54px 54px, 92px 92px;
  mix-blend-mode: screen;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom));
  position: relative;
}

.hero {
  min-height: 28vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px 6px 12px;
}

.hero-mark,
#taskBranch {
  color: var(--cyan);
  font-size: 12px;
  letter-spacing: 0;
}

h1,
h2 {
  font-family: "Noto Serif SC", "Noto Sans SC", serif;
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(42px, 18vw, 76px);
  line-height: 0.98;
  color: var(--gold);
  text-shadow: 0 5px 0 rgba(91, 55, 118, 0.9), 0 0 28px rgba(255, 149, 109, 0.42);
}

.hero p {
  width: min(94%, 380px);
  margin: 10px 0 18px;
  color: #f7d6c7;
  line-height: 1.7;
  font-size: 14px;
}

.progress-wrap {
  padding: 10px;
  background: rgba(9, 9, 12, 0.62);
  border: 1px solid var(--line);
}

.progress-wrap span {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.progress-bar {
  height: 10px;
  background: #2a2131;
  overflow: hidden;
}

.progress-bar i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--gold), var(--peach));
  transition: width 0.35s ease;
}

.album {
  margin-top: 12px;
}

.album-title,
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 8px;
  color: var(--gold);
  font-weight: 900;
}

.album-title button,
.card-header button {
  min-width: 64px;
  min-height: 34px;
  padding: 0 14px;
  background: rgba(101, 213, 205, 0.17);
  border: 1px solid rgba(101, 213, 205, 0.45);
}

.book {
  display: grid;
  grid-template-columns: 1fr 8px 1fr;
  gap: 0;
  min-height: 510px;
  border: 2px solid rgba(255, 212, 131, 0.5);
  background: linear-gradient(90deg, #472844, #111016 48%, #111016 52%, #472844);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.36);
}

.book-page {
  padding: 12px 8px 14px;
  background:
    linear-gradient(rgba(248, 208, 160, 0.88), rgba(235, 157, 124, 0.78)),
    radial-gradient(circle at 48% 10%, rgba(101, 213, 205, 0.7), transparent 42%);
  color: #241525;
  overflow: hidden;
}

.book-spine {
  background: linear-gradient(#0b0b0d, #4f2a5d, #0b0b0d);
}

.stamp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
}

.stamp {
  min-height: 76px;
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 7px;
  background: rgba(25, 21, 29, 0.86);
  border: 1px dashed rgba(255, 244, 219, 0.58);
  color: var(--text);
  overflow: hidden;
}

.stamp::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(101, 213, 205, 0.35);
  pointer-events: none;
}

.stamp img {
  width: 52px;
  height: 62px;
  object-fit: contain;
  filter: grayscale(1) contrast(0.4) opacity(0.42);
  transition: filter 0.25s ease, transform 0.25s ease;
}

.stamp.unlocked {
  background:
    linear-gradient(135deg, rgba(55, 119, 200, 0.72), rgba(110, 74, 165, 0.72)),
    rgba(25, 21, 29, 0.86);
  border-style: solid;
  border-color: rgba(255, 212, 131, 0.82);
}

.stamp.unlocked img {
  filter: drop-shadow(0 4px 10px rgba(255, 212, 131, 0.4));
  transform: scale(1.06);
}

.stamp b {
  display: block;
  font-size: 16px;
  color: var(--gold);
}

.stamp small {
  color: #efd4df;
  line-height: 1.45;
}

.stamp .seal {
  position: absolute;
  right: 8px;
  top: 7px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 149, 109, 0.9);
  border-radius: 50%;
  color: var(--peach);
  font-size: 11px;
  transform: rotate(-12deg);
  opacity: 0.34;
}

.stamp.unlocked .seal {
  opacity: 1;
}

.complete-card {
  margin-top: 16px;
}

.result-poster {
  min-height: 560px;
  padding: 22px 14px;
  border: 2px solid var(--gold);
  background:
    linear-gradient(rgba(18, 15, 22, 0.82), rgba(18, 15, 22, 0.88)),
    repeating-linear-gradient(45deg, rgba(101, 213, 205, 0.28) 0 10px, rgba(234, 127, 154, 0.2) 10px 20px);
  text-align: center;
}

.result-poster p {
  margin: 0;
  color: var(--cyan);
}

.result-poster h2 {
  margin: 8px 0 16px;
  font-size: 40px;
  color: var(--gold);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.result-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 4px;
  background: rgba(246, 208, 160, 0.12);
  border: 1px solid rgba(255, 212, 131, 0.45);
}

.task-dialog {
  width: min(94vw, 440px);
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.task-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.task-panel {
  position: relative;
  padding: 16px;
  background: linear-gradient(160deg, #18131d, #33203b);
  border: 1px solid rgba(255, 212, 131, 0.58);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.icon-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 34px;
  height: 34px;
  background: transparent;
  font-size: 30px;
  line-height: 1;
}

.task-top {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding-right: 24px;
  align-items: center;
}

.task-top img {
  width: 92px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.24));
}

.task-top h2 {
  font-size: 28px;
  color: var(--gold);
}

.task-top p {
  margin: 6px 0 0;
  color: #f3c9d7;
  line-height: 1.55;
  font-size: 13px;
}

.task-stage {
  position: relative;
  height: 280px;
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid rgba(101, 213, 205, 0.45);
  background:
    radial-gradient(circle at 22% 18%, rgba(101, 213, 205, 0.26), transparent 26%),
    linear-gradient(160deg, rgba(5, 9, 16, 0.9), rgba(60, 36, 74, 0.82));
  touch-action: none;
}

.primary-action {
  width: 100%;
  min-height: 48px;
  background: linear-gradient(90deg, var(--peach), var(--gold));
  color: #251521;
  font-weight: 900;
}

.task-chip,
.task-target,
.task-node,
.task-lane,
.task-door,
.task-sun {
  position: absolute;
  display: grid;
  place-items: center;
  user-select: none;
}

.task-chip {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--peach));
  color: #351a2f;
  font-weight: 900;
  box-shadow: 0 7px 0 rgba(83, 46, 111, 0.85);
}

.task-target {
  width: 88px;
  height: 88px;
  border: 2px dashed var(--gold);
  color: var(--gold);
  background: rgba(255, 212, 131, 0.08);
}

.task-node {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: #21152b;
  color: var(--cyan);
}

.task-node.hit {
  background: var(--cyan);
  color: #111015;
}

.task-line {
  position: absolute;
  height: 6px;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  opacity: 0.7;
}

.evil {
  background: linear-gradient(135deg, #6e4aa5, #111015);
  color: #f3c9d7;
}

.glow-on {
  box-shadow: 0 0 0 999px rgba(255, 212, 131, 0.1), 0 0 30px rgba(255, 212, 131, 0.95);
}

.task-lane {
  left: 18px;
  right: 18px;
  bottom: 70px;
  height: 16px;
  border-top: 2px dashed rgba(255, 212, 131, 0.5);
}

.runner {
  position: absolute;
  bottom: 82px;
  left: 20px;
  width: 58px;
  transition: left 0.2s ease;
}

.task-door {
  bottom: 18px;
  width: 88px;
  height: 124px;
  border: 3px solid var(--gold);
  color: var(--gold);
  background: rgba(20, 10, 20, 0.65);
}

.task-sun {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold), var(--peach));
  color: #3a1930;
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(30px);
  width: min(86vw, 360px);
  padding: 12px 14px;
  background: rgba(18, 15, 22, 0.94);
  border: 1px solid rgba(255, 212, 131, 0.58);
  color: var(--gold);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.24s ease, opacity 0.24s ease;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 430px) {
  .stamp-grid {
    gap: 10px;
  }

  .stamp {
    min-height: 82px;
  }
}
