/* ============================================================
   tokens.css —— 设计变量 · 重置 · 基础排版 · 背景层
   ============================================================ */

/* ---------- 1. 设计变量 ---------- */
:root{
  /* 主色板 */
  --sky:#8FD4E8;
  --sea:#4E9FC4;
  --grass:#8ED07A;
  --forest:#5A9E63;
  --sand:#F3E3BF;
  --cream:#FFFBF0;
  --wood:#C08A5E;
  --ink:#4A3B32;
  --coral:#F2907F;
  --bell:#F6C445;
  --mist:#EAF6F8;

  /* 主题变量（昼夜切换时只改这一组） */
  --bg-top:#BFE9F5;
  --bg-mid:#8FD4E8;
  --bg-bottom:#5FA8C9;
  --panel:#FFFBF0;
  --panel-soft:#FFF6E3;
  --text:#4A3B32;
  --text-sub:#7A6656;
  --edge:rgba(140,98,57,.32);
  --edge-strong:rgba(140,98,57,.55);
  --hard-shadow:rgba(140,98,57,.18);
  --dock-bg:rgba(255,251,240,.93);
  --overlay:rgba(74,59,50,.55);

  /* 形状 */
  --r-card:18px;
  --r-lg:24px;
  --r-sm:12px;
  --r-pill:999px;
  --bw:2px;

  /* 阴影 */
  --sh-card:0 5px 0 var(--hard-shadow), inset 0 2px 0 #fff;
  --sh-lift:0 9px 0 var(--hard-shadow), 0 16px 26px -12px rgba(74,59,50,.28), inset 0 2px 0 #fff;

  /* 字体 */
  --font-round:"Fredoka","Baloo 2","PingFang SC","Yuanti SC","Hiragino Sans GB",
               "Microsoft YaHei UI","Microsoft YaHei",sans-serif;
  --font-body:"PingFang SC","Hiragino Sans GB","Microsoft YaHei UI","Microsoft YaHei",
              system-ui,-apple-system,sans-serif;

  /* 字号 */
  --fs-display:clamp(2rem,6vw,3.6rem);
  --fs-h1:clamp(1.4rem,3.2vw,2rem);
  --fs-h2:clamp(1.05rem,2vw,1.25rem);
  --fs-body:clamp(.94rem,1.15vw,1.02rem);
  --fs-sm:.8125rem;
  --fs-xs:.6875rem;

  /* 动效 */
  --ease-pop:cubic-bezier(.2,.9,.3,1.4);
  --ease-soft:cubic-bezier(.65,0,.35,1);

  /* 布局 */
  --maxw:1080px;
  --dock-h:68px;
}

/* ---------- 2. 夜间主题 ---------- */
html[data-theme="night"]{
  --bg-top:#14213D;
  --bg-mid:#22345A;
  --bg-bottom:#33507A;
  --panel:#2C3B52;
  --panel-soft:#34455F;
  --text:#F2EFE6;
  --text-sub:#B7C3D4;
  --edge:rgba(255,255,255,.16);
  --edge-strong:rgba(255,255,255,.30);
  --hard-shadow:rgba(0,0,0,.38);
  --dock-bg:rgba(30,42,64,.94);
  --overlay:rgba(8,14,26,.7);
  --cream:#2C3B52;
}

/* ---------- 3. 重置 ---------- */
*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0;
  min-height:100vh;
  min-height:100dvh;
  font-family:var(--font-body);
  font-size:var(--fs-body);
  line-height:1.72;
  color:var(--text);
  background:var(--bg-mid);
  overflow-x:hidden;
  -webkit-tap-highlight-color:transparent;
}
h1,h2,h3,h4,p,ul,ol,figure{ margin:0; }
ul,ol{ padding:0; list-style:none; }
button{ font:inherit; color:inherit; }
img{ max-width:100%; display:block; }
a{ color:inherit; }
input,select,textarea{ font:inherit; color:inherit; }

/* 键盘焦点环：清晰但不刺眼 */
:focus-visible{
  outline:3px solid var(--bell);
  outline-offset:3px;
  border-radius:6px;
}
/* 鼠标点击不显示焦点环 */
:focus:not(:focus-visible){ outline:none; }

::selection{ background:rgba(246,196,69,.45); }

/* 滚动条（桌面端） */
@media (pointer:fine){
  ::-webkit-scrollbar{ width:10px; height:10px; }
  ::-webkit-scrollbar-track{ background:transparent; }
  ::-webkit-scrollbar-thumb{
    background:rgba(140,98,57,.35);
    border-radius:99px;
    border:2px solid transparent;
    background-clip:content-box;
  }
}

/* ---------- 4. 背景层：天空 / 云 / 星星 / 草地 ---------- */
#bg{
  position:fixed; inset:0;
  z-index:0;
  pointer-events:none;
  overflow:hidden;
  background:linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 52%, var(--bg-bottom) 100%);
}
#bg .stars{
  position:absolute; inset:0;
  opacity:0;
  transition:opacity .8s ease;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 14%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 28% 7%, #fff, transparent),
    radial-gradient(2px 2px at 46% 20%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 63% 9%, #fff, transparent),
    radial-gradient(1.7px 1.7px at 79% 17%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 91% 26%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 8% 32%, #fff, transparent),
    radial-gradient(1.2px 1.2px at 55% 36%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 36% 28%, #fff, transparent);
  background-repeat:no-repeat;
}
html[data-theme="night"] #bg .stars{ opacity:.9; }

.cloud{
  position:absolute;
  background:#fff;
  border-radius:999px;
  opacity:.8;
  will-change:transform;
  animation:cloud-drift linear infinite;
}
.cloud::before,.cloud::after{
  content:""; position:absolute; background:#fff; border-radius:999px;
}
.cloud::before{ width:62%; height:160%; left:10%; top:-78%; }
.cloud::after{ width:46%; height:140%; right:8%; top:-52%; }
@keyframes cloud-drift{
  from{ transform:translateX(-18vw); }
  to{ transform:translateX(118vw); }
}
html[data-theme="night"] .cloud{ opacity:.18; background:#C9D8EA; }
html[data-theme="night"] .cloud::before,
html[data-theme="night"] .cloud::after{ background:#C9D8EA; }

/* 底部海浪装饰 */
#bg .wave{
  position:absolute; left:0; right:0; bottom:0;
  height:96px;
  background:
    radial-gradient(60px 28px at 10% 100%, rgba(255,255,255,.30), transparent 70%),
    radial-gradient(80px 30px at 40% 100%, rgba(255,255,255,.22), transparent 70%),
    radial-gradient(70px 26px at 72% 100%, rgba(255,255,255,.26), transparent 70%);
}

/* ---------- 5. 应用骨架 ---------- */
#app{
  position:relative;
  z-index:1;
  min-height:100dvh;
  display:flex;
  flex-direction:column;
}
.wrap{
  width:min(var(--maxw),100% - 32px);
  margin-inline:auto;
}
#scene-root{
  flex:1;
  padding:14px 0 0;
}
/* 有底部 Dock 时给内容留位置 */
body.has-dock #scene-root{ padding-bottom:calc(var(--dock-h) + 28px + env(safe-area-inset-bottom)); }

/* ---------- 6. 通用排版 ---------- */
.h1{
  font-family:var(--font-round);
  font-size:var(--fs-h1);
  line-height:1.25;
  color:#fff;
  letter-spacing:.02em;
  text-shadow:0 3px 0 var(--wood), 0 6px 14px rgba(40,70,90,.28);
}
html[data-theme="night"] .h1{ text-shadow:0 3px 0 #0B1524, 0 8px 18px rgba(0,0,0,.5); }

.sub{
  font-size:var(--fs-sm);
  color:rgba(255,255,255,.94);
  text-shadow:0 1px 6px rgba(40,70,90,.35);
}
html[data-theme="night"] .sub{ color:var(--text-sub); }

.muted{ color:var(--text-sub); }
.tiny{ font-size:var(--fs-xs); }
.center{ text-align:center; }
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}

/* ---------- 7. 降级：减少动态效果 ---------- */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.001ms !important;
  }
}

/* ---------- 8. 简洁模式（长辈友好） ---------- */
html[data-simple="1"]{
  --fs-body:1.08rem;
  --fs-sm:.9rem;
}
html[data-simple="1"] .deco,
html[data-simple="1"] .cloud{ display:none !important; }
html[data-simple="1"] *,
html[data-simple="1"] *::before,
html[data-simple="1"] *::after{
  animation-duration:.001ms !important;
  animation-iteration-count:1 !important;
  transition-duration:.001ms !important;
}
html[data-simple="1"] .map-stage .pet{ display:none; }
html[data-simple="1"] .btn{ min-height:56px; }
