/* ============================================================
   各畫面：首頁、選關、結算、解鎖慶祝
   ============================================================ */
.screen { display: none; }
.screen.is-active { display: block; animation: screen-in .28s ease both; }

/* ---------- 首頁 ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  gap: clamp(16px, 3vw, 30px);
  padding: clamp(18px, 3.4vw, 34px);
  align-items: center;
  background:
    radial-gradient(circle at 92% 12%, rgba(244, 207, 74, .35), transparent 28%),
    radial-gradient(circle at 4% 96%, rgba(47, 156, 149, .14), transparent 34%),
    var(--cream-2);
}
.hero__text { min-width: 0; }
.hero__title {
  display: flex;
  flex-direction: column;
  margin: 4px 0 12px;
  font-size: clamp(2.5rem, 7.2vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: .04em;
  font-weight: 900;
  text-shadow: 0 4px 0 rgba(255, 255, 255, .7);
}
.hero__title span:first-child { color: var(--coral); }
.hero__title span:last-child { color: var(--teal-dark); }
.hero__tagline {
  font-size: clamp(.95rem, 2.4vw, 1.08rem);
  color: var(--ink-soft);
  max-width: 34em;
  overflow-wrap: anywhere;
}
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 10px; }
.hero__progress { font-size: .88rem; color: var(--teal-dark); font-weight: 700; min-height: 1.6em; }
.hero__art {
  position: relative;
  min-height: 220px;
  aspect-ratio: 3 / 2;
  border-radius: 20px;
  overflow: hidden;
  border: 3px solid var(--line);
  background: linear-gradient(160deg, #fff7e2, #ffe6d4 55%, #d9f2ee);
  display: grid;
  place-items: center;
}
.hero__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero__art img.is-missing { display: none; }
.hero__fallback { position: absolute; inset: 0; display: none; pointer-events: none; }
.hero__art img.is-missing + .hero__fallback { display: block; }
.hero__sun { position: absolute; top: 12%; left: 10%; width: 60px; height: 60px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 14px rgba(244, 207, 74, .22); }
.hero__rainbow {
  position: absolute; left: 50%; bottom: 34%; transform: translateX(-50%);
  width: 78%; aspect-ratio: 2 / 1;
  border-radius: 999px 999px 0 0;
  border: 16px solid var(--coral);
  border-bottom: 0;
  box-shadow: inset 0 0 0 14px var(--yellow), inset 0 0 0 28px var(--blue);
  opacity: .8;
}
.hero__house { position: absolute; bottom: 12%; left: 50%; transform: translateX(-50%); width: 34%; aspect-ratio: 1.2; background: var(--teal); border-radius: 10px 10px 4px 4px; }
.hero__house::before { content: ""; position: absolute; left: -14%; right: -14%; bottom: 100%; height: 0; border-left: 58px solid transparent; border-right: 58px solid transparent; border-bottom: 42px solid var(--coral); }

.zone-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.zone-mini {
  padding: 16px 16px 14px;
  border-radius: 18px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--zc) 14%, #fffdf8), #fffdf8 70%);
  border: 2px solid color-mix(in srgb, var(--zc) 28%, var(--line));
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.zone-mini__emoji { font-size: 1.7rem; display: block; line-height: 1.2; }
.zone-mini h2 { font-size: 1rem; color: var(--zc); margin: 4px 0 3px; overflow-wrap: anywhere; }
.zone-mini p { font-size: .8rem; color: var(--ink-soft); overflow-wrap: anywhere; }

/* ---------- 選關 ---------- */
.screen-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 6px;
}
.screen-head h1 {
  font-size: clamp(1.55rem, 5.4vw, 2.25rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.screen-note { color: var(--ink-soft); font-size: .9rem; margin-bottom: 16px; }
.level-zones {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.zone-card {
  border: 2px solid color-mix(in srgb, var(--zc) 30%, var(--line));
  border-radius: var(--radius);
  background: var(--cream-2);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.zone-card__head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 16px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--zc) 16%, #fffdf8), #fffdf8);
  border-bottom: 2px solid var(--line);
}
.zone-card__badge {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  flex: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--zc) 16%, #fff);
  font-size: 1.45rem;
  line-height: 1;
}
.zone-card__head > div:last-child { min-width: 0; }
.zone-card__title { font-size: 1.08rem; color: var(--zc); overflow-wrap: anywhere; }
.zone-card__sub { font-size: .82rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.nodes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 12px;
  list-style: none;
}
.nodes__item { display: flex; min-width: 0; }
.node {
  position: relative;
  display: grid;
  grid-template-columns: 34px 28px minmax(0, 1fr);
  grid-template-areas: "num emoji name" "num emoji stars";
  align-items: center;
  gap: 0 7px;
  width: 100%;
  min-height: 74px;
  padding: 9px 10px;
  text-align: left;
  background: #fffdf8;
  border: 2px solid var(--line);
  border-radius: 14px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  overflow-wrap: anywhere;
}
.node:hover { transform: translateY(-2px); border-color: var(--zc); box-shadow: var(--shadow-sm); }
.node__num {
  grid-area: num;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--zc) 16%, #fff);
  color: var(--zc);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.node__emoji { grid-area: emoji; place-self: center; font-size: 1.35rem; line-height: 1; }
.node__name { grid-area: name; font-weight: 800; font-size: 1rem; line-height: 1.3; }
.node__stars { grid-area: stars; font-size: .85rem; letter-spacing: .08em; color: #b98a1c; }
.node.is-locked { opacity: .62; background: #f3ecdf; }
.node.is-locked .node__num { background: #e7ddcc; color: #8a7d6d; }
.node.is-done { border-color: color-mix(in srgb, var(--zc) 45%, var(--line)); }
.node.is-next { border-color: var(--zc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--zc) 18%, transparent); }
.node.is-next::after {
  content: "現在玩";
  position: absolute; top: -9px; right: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--zc);
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .04em;
}

/* ---------- 結算 ---------- */
.screen--result { display: none; }
.screen--result.is-active { display: block; }
.result-card {
  width: min(680px, 100%);
  margin: 4px auto;
  padding: clamp(20px, 4vw, 36px);
  text-align: center;
  background:
    radial-gradient(circle at 50% 0, rgba(244, 207, 74, .26), transparent 45%),
    var(--cream-2);
}
.result-card h1 { font-size: clamp(1.7rem, 6vw, 2.5rem); margin: 4px 0 6px; overflow-wrap: anywhere; }
.result-stars { font-size: clamp(2.2rem, 10vw, 3.6rem); letter-spacing: .12em; color: #d9a51c; line-height: 1.2; text-shadow: 0 3px 0 #fff; }
.result-score { font-size: clamp(1.5rem, 6vw, 2.1rem); font-weight: 900; color: var(--coral-dark); font-variant-numeric: tabular-nums; }
.result-line { color: var(--ink-soft); margin: 6px 0 16px; overflow-wrap: anywhere; }
.result-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 20px;
}
.result-stats div { padding: 10px 8px; border-radius: 13px; background: #fff8ec; border: 2px solid var(--line); min-width: 0; }
.result-stats dt { font-size: .72rem; color: var(--ink-soft); }
.result-stats dd { margin: 2px 0 0; font-weight: 900; font-size: 1.05rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }

/* ---------- 解鎖慶祝 ---------- */
.cheat {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 16px;
  background: linear-gradient(140deg, #e8503a, #f4cf4a 28%, #5da95b 52%, #4a9fd8 76%, #8e63c4);
}
.cheat[hidden] { display: none; }
.cheat__card {
  width: min(460px, 100%);
  padding: 28px 22px;
  border-radius: var(--radius);
  background: var(--cream-2);
  border: 4px solid #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  text-align: center;
  animation: pop-in .35s ease both;
}
.cheat__card h2 { font-size: clamp(1.4rem, 5.4vw, 1.9rem); margin: 4px 0 8px; overflow-wrap: anywhere; }
.cheat__card p { color: var(--ink-soft); margin-bottom: 18px; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .level-zones { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero__art { min-height: 180px; aspect-ratio: 16 / 9; }
}
@media (max-width: 560px) {
  .nodes { grid-template-columns: 1fr; }
  .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
