/* =========================================================
   夜喵酷叮 Night Cat Coding
   想調整外觀，幾乎都只要改下面這一段變數
   ========================================================= */
:root {
  /* 顏色：全部取自 A羅喵本體 */
  --night: #0F2A3B;   /* 背景：夜空藍（貓的描邊色調亮） */
  --deep:  #081A26;   /* 更深的夜：對話框、硬陰影 */
  --ink:   #0B2331;   /* 貓的描邊色：淺色塊上的文字 */
  --paper: #EEF3F4;   /* 卡片底 */
  --text:  #E6EEF1;   /* 深底上的文字（刻意不用純白） */
  --muted: #A9BDC8;   /* 次要文字 */
  --cyan:  #39C8E3;   /* 貓的眼睛 */
  --moon:  #F6E3A1;   /* 月亮黃：主要按鈕 */
  --pink:  #F4A9BC;   /* 少量跳色 */

  /* 角落 A羅喵的大小 */
  --cat-size: 84px;

  --zh: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  --px: "Jersey 15", var(--zh);
  --page: 34rem;      /* 內容最大寬度（桌機上置中成一條手機寬） */
}

@font-face {
  font-family: "Jersey 15";
  src: url("fonts/jersey-15.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font-family: var(--zh);
  font-size: 1.0625rem;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ol { margin: 0; }
h1, h2, h3 { font-weight: 900; line-height: 1.2; text-wrap: balance; }
p { text-wrap: pretty; }

:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }

/* ---------- 按鈕：扁平色塊 + 硬陰影，按下去會「壓」下去 ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 1.5rem;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--moon);
  color: var(--ink);
  font-weight: 900;
  font-size: 1.125rem;
  text-decoration: none;
  box-shadow: 0 6px 0 var(--deep);
  transition: transform .08s ease-out, box-shadow .08s ease-out;
  touch-action: manipulation;
}
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--deep); }
.btn-quiet { background: transparent; color: var(--text); border-color: var(--muted); box-shadow: none; }
.btn-quiet:active { transform: translateY(2px); box-shadow: none; background: rgba(255,255,255,.06); }

/* =========================================================
   標題畫面
   ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  max-width: var(--page);
  margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  position: relative;
  z-index: 1;
}
.brand-zh { font-weight: 900; font-size: 1.125rem; letter-spacing: .08em; }
.brand-en { font-family: var(--px); font-size: 1.25rem; line-height: 1; color: var(--cyan); }

/* 像素星星（靜態，不閃，不搶戲） */
.stars { position: absolute; inset: 0; pointer-events: none; }
.star, .dot { position: absolute; color: var(--cyan); }
.moon-c { color: var(--moon); }
.star { width: 4px; height: 16px; background: currentColor; }
.star::after { content: ""; position: absolute; left: -6px; top: 6px; width: 16px; height: 4px; background: currentColor; }
.dot { width: 4px; height: 4px; background: var(--muted); opacity: .7; }

/* 月亮：一整塊平塗圓，貓從下緣探出來 */
.moon {
  position: relative;
  z-index: 1;
  width: min(66vw, 17rem);
  aspect-ratio: 1;
  margin: auto auto 1.75rem;
  border-radius: 50%;
  background: var(--moon);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.moon img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  object-position: center bottom;
}

.hero h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(2.5rem, 12.5vw, 3.75rem);
  letter-spacing: .02em;
}

/* 標題裡「被拿掉」的那兩個字 */
.cut {
  position: relative;
  text-decoration: none;
  color: var(--muted);
}
.cut::after {
  content: "";
  position: absolute;
  left: -4%;
  top: 52%;
  width: 108%;
  height: .11em;
  background: var(--pink);
  border-radius: 2px;
  transform-origin: left center;
}

.lead {
  position: relative;
  z-index: 1;
  margin-top: 1rem;
  color: var(--muted);
  max-width: 26em;
}
.hero .btn { position: relative; z-index: 1; margin-top: 1.75rem; }

/* =========================================================
   區塊共用
   ========================================================= */
.block {
  max-width: var(--page);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 1rem;
  scroll-margin-top: .5rem;
}
.block h2 { font-size: 2rem; letter-spacing: .04em; }
.intro { margin-top: .5rem; color: var(--muted); }

/* =========================================================
   委託板
   ========================================================= */
.quest {
  margin-top: 1.75rem;
  background: var(--paper);
  color: var(--ink);
  border-radius: 20px;
  box-shadow: 0 7px 0 var(--deep);
  overflow: hidden;
}
.quest > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--q);
}
.q-moon { --q: var(--moon); }
.q-cyan { --q: var(--cyan); }
.q-pink { --q: var(--pink); }
.quest h3 { font-size: 1.5rem; letter-spacing: .04em; }
.quest > header img { width: 44px; height: 44px; object-fit: contain; }

.quest-body { padding: 1.1rem 1.25rem 1.4rem; }
.tag {
  margin-top: 1rem;
  font-size: .875rem;
  font-weight: 700;
  color: #4A5B66;
}
.tag:first-child { margin-top: 0; }
.note {
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 2px dashed #C3D0D6;
  font-size: .9375rem;
  color: #3D4E59;
}

/* =========================================================
   對話框
   ========================================================= */
.dialog {
  position: relative;
  margin-top: 2.25rem;
  min-height: 10.5rem;
  padding: 1.5rem 1.1rem 2.6rem 6.6rem;
  background: var(--deep);
  border: 3px solid var(--paper);
  border-radius: 16px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.dialog-name {
  position: absolute;
  left: 1rem;
  top: -1rem;
  padding: 0 .8rem;
  background: var(--moon);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 10px;
  font-weight: 900;
  font-size: .9375rem;
  line-height: 1.8;
}
.dialog-face {
  position: absolute;
  left: .9rem;
  top: 1.5rem;
  width: 4.75rem;
  height: 4.75rem;
  padding-top: .35rem;
  background: var(--moon);
  border-radius: 14px;
  object-fit: contain;
  object-position: center bottom;
}
.dialog-lines p + p { margin-top: .6rem; }           /* 沒有 JS 時全部列出 */
.dialog.js .dialog-lines p { display: none; margin: 0; }
.dialog.js .dialog-lines p.on { display: block; }

.dialog-next {
  position: absolute;
  right: .4rem;
  bottom: .2rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 48px;
  min-height: 44px;
  padding: 0 .6rem;
  background: none;
  border: 0;
  color: var(--muted);
  font-family: var(--px);
  font-size: 1.25rem;
  cursor: pointer;
}
.dialog-next i {
  width: 0; height: 0;
  border: 7px solid transparent;
  border-top: 10px solid var(--moon);
  border-bottom: 0;
}
.dialog:not(.js) .dialog-next { display: none; }

/* =========================================================
   三步
   ========================================================= */
.steps {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.9rem 4rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -.1rem;
  width: 2.75rem; height: 2.75rem;
  display: grid;
  place-items: center;
  background: var(--cyan);
  color: var(--ink);
  border-radius: 10px;
  font-family: var(--px);
  font-size: 2rem;
  line-height: 1;
}
.steps li:not(:last-child)::after {   /* 連接三步的虛線 */
  content: "";
  position: absolute;
  left: calc(1.375rem - 2px);
  top: 3rem; bottom: .35rem;
  border-left: 4px dotted #2C5168;
}
.steps h3 { font-size: 1.25rem; padding-top: .35rem; }
.steps p { margin-top: .3rem; color: var(--muted); }

/* =========================================================
   聯絡
   ========================================================= */
.contact { padding-bottom: 2rem; }
.continue {
  font-family: var(--px);
  font-size: clamp(3.2rem, 18vw, 5rem);
  line-height: 1;
  color: var(--cyan);
  margin-bottom: 1rem;
}
.contact .btn { margin-top: 1.25rem; }
.contact .btn + .btn { margin-top: 1rem; }

.foot {
  max-width: var(--page);
  margin: 0 auto;
  /* 底部留白：讓角落的貓不會蓋到最後的內容 */
  padding: 2rem 1.5rem calc(var(--cat-size) + 2.5rem + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: .875rem;
}

/* =========================================================
   角落的 A羅喵
   狀態由 main.js 掛在 .mascot 上：
     .is-down 往下滾（往下跳）  .is-up 往上滾（往上跳）
     .land 落地   .away 躲起來（在標題畫面時）
   ========================================================= */
.mascot {
  position: fixed;
  z-index: 10;
  right: max(.6rem, env(safe-area-inset-right));
  bottom: max(.6rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
  transition: transform .45s cubic-bezier(.3, 1.5, .5, 1);
}
.mascot.away { transform: translateY(calc(100% + 2rem)); transition-timing-function: ease-in; transition-duration: .25s; }

.mascot-btn {
  pointer-events: auto;
  width: var(--cat-size);
  height: var(--cat-size);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
/* 圖片位置：不管你給的圖多大、什麼比例，都會等比縮進這個方框、貼齊底部 */
.mascot-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  transform-origin: 50% 100%;
  transition: transform .16s ease-out;
  /* 貼紙白邊：讓深色的貓在深色背景上也看得清楚 */
  filter:
    drop-shadow( 2px 0 0 var(--paper)) drop-shadow(-2px 0 0 var(--paper))
    drop-shadow(0  2px 0 var(--paper)) drop-shadow(0 -2px 0 var(--paper));
}
.mascot.is-down .mascot-btn img { transform: translateY(-16px) rotate(7deg)  scale(.96, 1.06); }
.mascot.is-up   .mascot-btn img { transform: translateY(-22px) rotate(-7deg) scale(.96, 1.08); }
.mascot.land    .mascot-btn img { animation: land .32s ease-out; }
@keyframes land {
  0%   { transform: translateY(-10px); }
  45%  { transform: scale(1.1, .86); }
  75%  { transform: scale(.97, 1.04); }
  100% { transform: none; }
}

.bubble {
  pointer-events: none;
  margin: 0 .3rem .5rem 0;
  max-width: 13.5rem;
  padding: .45rem .8rem;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 14px 14px 4px 14px;
  font-weight: 700;
  font-size: .9375rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(6px) scale(.94);
  transform-origin: 100% 100%;
  transition: opacity .15s, transform .15s;
}
.bubble.show { opacity: 1; transform: none; }

/* =========================================================
   開場唯一一段自動動畫：把「東西」劃掉
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  .cut { animation: fade-cut .4s 1.25s both; }
  .cut::after { animation: strike .45s .8s cubic-bezier(.6, 0, .2, 1) both; }
  @keyframes strike { from { transform: scaleX(0); } }
  @keyframes fade-cut { from { color: var(--text); } }
}

/* 使用者在系統裡開了「減少動態效果」：貓只換姿勢、不位移，其餘動畫關閉 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .mascot.is-down .mascot-btn img,
  .mascot.is-up   .mascot-btn img { transform: none; }
}

/* 寬螢幕：內容維持一條好讀的寬度，貓稍微放大 */
@media (min-width: 48rem) {
  :root { --cat-size: 112px; }
  .mascot { right: 2rem; bottom: 1.5rem; }
}
