/* ========== 顏色：每個時段一組 ========== */
:root {
  --purple: #7b68d9;
  --pink: #e889b0;
  --blue: #5fb8e4;

  --ink: #2b2450;
  --ink-soft: #423b68;
  --card: rgba(255, 255, 255, 0.72);
  --card-line: rgba(255, 255, 255, 0.9);
  --chip: rgba(123, 104, 217, 0.12);
  --chip-ink: #4a3d9e;
  --face-front: #ffffff;
  --face-back: #efeaff;
  --grass: #9fd08f;
  --orb: #fff1b8;
  --orb-glow: rgba(255, 241, 184, 0.55);
  --sky-top: #6fbdec;

  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --radius: 18px;
}
html[lang="ja"] { --font: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif; }

html[data-sky="dawn"] {
  --sky-top: #9fb6e8;
  --grass: #a7c99d;
  --orb: #ffd9c2;
  --orb-glow: rgba(255, 200, 190, 0.5);
}
html[data-sky="sunset"] {
  --sky-top: #a493e0;
  --ink: #2f1f4f;
  --ink-soft: #3d2d60;
  --card: rgba(255, 246, 250, 0.74);
  --face-back: #fde6f0;
  --chip: rgba(232, 137, 176, 0.18);
  --chip-ink: #8a2f5b;
  --grass: #8fae8c;
  --orb: #ffb59a;
  --orb-glow: rgba(255, 150, 140, 0.5);
}
html[data-sky="night"] {
  --sky-top: #0f0c2a;
  --ink: #f1edff;
  --ink-soft: #c3bce8;
  --card: rgba(34, 27, 78, 0.62);
  --card-line: rgba(191, 230, 250, 0.18);
  --chip: rgba(191, 230, 250, 0.14);
  --chip-ink: #cfeefc;
  --face-front: #2c2466;
  --face-back: #3b2f80;
  --grass: #1f2c3f;
  --orb: #f3f0ff;
  --orb-glow: rgba(191, 230, 250, 0.45);
}

/* ========== 基本 ========== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: #a9dbf5;
  -webkit-font-smoothing: antialiased;
  transition: color 0.8s ease;
}
h1, h2, h3 { line-height: 1.3; margin: 0; }
p { margin: 0; }
button { font: inherit; color: inherit; }

/* ========== 天空 ========== */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.sky-layer { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease; }
.sky-dawn   { background: linear-gradient(180deg, #9fb6e8 0%, #d8c1ea 45%, #f8cfdc 75%, #fde3d6 100%); }
.sky-day    { background: linear-gradient(180deg, #6fbdec 0%, #9fd5f3 45%, #cdebfa 80%, #e9f6fc 100%); }
.sky-sunset { background: linear-gradient(180deg, #a493e0 0%, #cfa3df 35%, #f1b1cc 68%, #fcd8cc 100%); }
.sky-night  { background: linear-gradient(180deg, #0f0c2a 0%, #211a52 45%, #3a2d7c 80%, #4f3d94 100%); }
html[data-sky="dawn"]   .sky-dawn,
html[data-sky="day"]    .sky-day,
html[data-sky="sunset"] .sky-sunset,
html[data-sky="night"]  .sky-night { opacity: 1; }

.stars { position: absolute; inset: 0; opacity: 0; transition: opacity 1.6s ease; }
html[data-sky="night"] .stars { opacity: 1; }
.star {
  position: absolute; border-radius: 50%; background: #fff;
  animation: twinkle var(--t, 3s) ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.star.blue { background: #bfe6fa; }
@keyframes twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.shooting {
  position: absolute; width: 90px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0), #ffffff);
  transform: rotate(-28deg);
  animation: shoot 1.1s ease-out forwards;
}
@keyframes shoot {
  from { opacity: 0; translate: 0 0; }
  15%  { opacity: 1; }
  to   { opacity: 0; translate: -260px 140px; }
}

.clouds { position: absolute; inset: 0; transition: opacity 1.6s ease; }
html[data-sky="night"] .clouds { opacity: 0; }
.cloud {
  position: absolute; display: block; border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  filter: blur(2px);
  animation: drift linear infinite;
}
html[data-sky="sunset"] .cloud { background: rgba(255, 222, 236, 0.7); }
html[data-sky="dawn"]   .cloud { background: rgba(255, 240, 246, 0.7); }
.cloud::before, .cloud::after {
  content: ""; position: absolute; border-radius: 50%; background: inherit;
}
.cloud::before { width: 55%; height: 160%; left: 15%; bottom: 30%; }
.cloud::after  { width: 40%; height: 130%; right: 12%; bottom: 25%; }
.c1 { width: 130px; height: 34px; top: 14%; animation-duration: 95s; animation-delay: -20s; }
.c2 { width: 90px;  height: 24px; top: 32%; animation-duration: 130s; animation-delay: -70s; opacity: 0.8; }
.c3 { width: 160px; height: 40px; top: 58%; animation-duration: 160s; animation-delay: -110s; opacity: 0.6; }
@keyframes drift { from { left: -200px; } to { left: 110%; } }

/* ========== 頂部列 ========== */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 16px 0;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
/* 頂部淡出：顏色跟天空最上面一樣，捲動時文字不會撞到太陽 */
.topbar::before {
  content: ""; position: absolute; inset: 0 0 -28px 0; z-index: -1;
  background: linear-gradient(180deg, var(--sky-top) 55%, transparent);
  transition: background 1.6s ease;
}

.celestial {
  width: 46px; height: 46px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center; border-radius: 50%;
}
.orb {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--orb);
  box-shadow: 0 0 0 6px var(--orb-glow), 0 0 24px 8px var(--orb-glow);
  transition: background 1.2s ease, box-shadow 1.2s ease, transform 0.3s ease;
}
html[data-sky="night"] .orb {
  background: radial-gradient(circle at 68% 35%, transparent 9px, var(--orb) 10px);
  box-shadow: 0 0 22px 6px var(--orb-glow);
}
.celestial:hover .orb, .celestial:focus-visible .orb { transform: scale(1.1); }
.celestial:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.lang {
  display: flex; gap: 2px; padding: 3px;
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.lang button {
  border: 0; background: none; cursor: pointer;
  min-width: 38px; height: 32px; padding: 0 10px; border-radius: 999px;
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
}
.lang button[aria-pressed="true"] { background: var(--purple); color: #fff; }

.toast {
  position: fixed; top: 74px; left: 50%; z-index: 20;
  transform: translate(-50%, -8px); opacity: 0;
  padding: 8px 16px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--card-line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font-size: 14px; white-space: nowrap;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ========== 首頁 ========== */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 90px 16px 110px; text-align: center;
}
.hero-inner { max-width: 520px; }
.avatar {
  width: 148px; height: 148px; margin: 0 auto 22px; border-radius: 50%;
  display: grid; place-items: center; padding: 26px;
  background: var(--card); border: 3px solid var(--card-line);
  font-size: 13px; line-height: 1.5; color: var(--ink-soft);
  white-space: pre-line;
}
.hello { font-size: 16px; color: var(--ink-soft); }
.name { font-size: clamp(34px, 9vw, 52px); font-weight: 700; letter-spacing: 0.02em; margin: 2px 0 2px; }
.realname { font-size: 16px; letter-spacing: 0.3em; color: var(--ink-soft); margin-bottom: 20px; }
.tagline { font-size: clamp(20px, 5.4vw, 26px); font-weight: 500; }
.tagline-sub { margin-top: 8px; color: var(--ink-soft); }
.sky-note { margin-top: 26px; font-size: 13px; color: var(--ink-soft); }

.dig {
  position: absolute; bottom: 36px; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  font-size: 14px; color: var(--ink); text-decoration: none;
}
.dig-arrow { font-size: 18px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

/* ========== 內容 ========== */
main { padding: 0 16px 40px; }
main > .block { max-width: 640px; margin: 0 auto; padding: 40px 0 8px; }

.kicker { font-size: 13px; font-weight: 700; letter-spacing: 0.15em; color: var(--ink-soft); }
h2 { font-size: 26px; font-weight: 700; margin: 2px 0 14px; }
h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.lead { font-size: 16px; }
.hint { font-size: 13px; color: var(--ink-soft); margin-top: 10px; }
.pending { color: var(--ink-soft); font-style: italic; }

.card {
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--radius); padding: 18px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: background 1.2s ease;
}
.card + .card, .card h3 + p, .card p + p, .card p + .photos, .photos + p { margin-top: 12px; }
.card .chips + h3 { margin-top: 20px; }

/* 翻牌卡片 */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 20px; }
@media (min-width: 600px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.flip {
  height: 172px; padding: 0; border: 0; background: none; cursor: pointer;
  perspective: 900px; text-align: center;
}
.flip-inner {
  position: relative; display: block; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform 0.65s cubic-bezier(.3,.7,.3,1);
}
.flip[aria-pressed="true"] .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 14px; border-radius: var(--radius);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  border: 1px solid var(--card-line);
}
.front { background: var(--face-front); font-size: 18px; font-weight: 700; }
.front::after {
  content: ""; position: absolute; right: 12px; bottom: 12px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--pink);
}
.back { background: var(--face-back); transform: rotateY(180deg); font-size: 14px; line-height: 1.6; }
.flip:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; border-radius: var(--radius); }

/* 展開區塊 */
details > summary {
  list-style: none; cursor: pointer; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: "+"; flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 500;
  background: var(--chip); color: var(--chip-ink);
  transition: transform 0.3s ease;
}
details[open] > summary::after { transform: rotate(45deg); }
details > :not(summary) { margin-top: 12px; }
.story-body p + p { margin-top: 10px; }
.inner { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--chip-ink); }
.thoughts { display: grid; gap: 10px; margin-top: 16px; }

/* 照片位置 */
.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ph {
  aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--chip-ink);
  display: grid; place-items: center; padding: 6px; text-align: center;
  font-size: 12px; line-height: 1.4; color: var(--chip-ink); background: var(--chip);
}

/* 標籤 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chips li {
  padding: 5px 12px; border-radius: 999px; font-size: 14px;
  background: var(--chip); color: var(--chip-ink);
}
.chips .new small { font-size: 11px; margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--pink); color: #fff; }
.talk .chips { margin-top: 8px; }

.cta {
  display: flex; justify-content: center; align-items: center;
  margin-top: 20px; height: 48px; border-radius: 999px;
  background: var(--purple); color: #fff; font-weight: 700; text-decoration: none;
}
.cta:hover { filter: brightness(1.08); }

.foot { margin-top: 40px; font-size: 14px; text-align: center; }
.hill { display: block; width: 100%; height: 80px; margin-bottom: -1px; }
.hill path { fill: var(--grass); transition: fill 1.6s ease; }
.ground {
  background: var(--grass); transition: background 1.6s ease;
  padding: 8px 16px max(40px, env(safe-area-inset-bottom));
}

/* 減少動態 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
