/* ============================================================
   components.css — 骨架与通用组件。两套主题共用，靠变量换肤。
   ============================================================ */

.shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0 var(--sp-4);
}

/* hidden 属性必须压得住任何 display 声明。
   否则像 .cyc-modal{display:grid} 这种会把 [hidden] 顶掉，弹窗就关不掉了。 */
[hidden] { display: none !important; }

.page {
  flex: 1;
  padding: var(--sp-4) 0 var(--sp-6);
  animation: page-in .45s var(--ease) both;
}

/* 页面切换时各页自己的进场节奏 */
.page > * { animation: rise-in .5s var(--ease) both; }
.page > *:nth-child(1) { animation-delay: .02s; }
.page > *:nth-child(2) { animation-delay: .06s; }
.page > *:nth-child(3) { animation-delay: .10s; }
.page > *:nth-child(4) { animation-delay: .14s; }
.page > *:nth-child(5) { animation-delay: .18s; }
.page > *:nth-child(6) { animation-delay: .22s; }
.page > *:nth-child(7) { animation-delay: .26s; }
.page > *:nth-child(8) { animation-delay: .30s; }

.page-title {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 var(--sp-4);
  letter-spacing: var(--letter-sp);
}

.section-label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 12px;
  color: var(--text-soft);
  letter-spacing: .12em;
  margin: var(--sp-5) 0 var(--sp-3);
}
/* 顺序：文字 → 右侧计数 → 那条延伸出去的横线 */
.section-label .sl-text { order: 0; flex: 0 0 auto; }
.section-label .sl-right { order: 1; flex: 0 0 auto; color: var(--text-faint); letter-spacing: .06em; }
.section-label::after {
  content: "";
  order: 2;
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: var(--card-border);
  box-shadow: var(--shadow-1);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
}
.card-soft { background: var(--surface-2); box-shadow: none; }
.card-flush { padding: var(--sp-4); }

/* 内层卡片的下沉质感 */
body[data-theme="inner"] .card {
  box-shadow: var(--shadow-1), var(--shadow-in);
  background: linear-gradient(170deg, var(--surface-2), var(--surface));
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-5);
  border-radius: var(--r-pill);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--shadow-1);
  transition: transform .18s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { background: var(--primary-deep); }
.btn:active { transform: scale(.97); }
.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-wide { width: 100%; }

body[data-theme="inner"] .btn {
  background: linear-gradient(180deg, var(--accent), var(--primary-deep));
  color: #FFEFF4;
  letter-spacing: .08em;
  box-shadow: 0 0 0 1px rgba(212, 175, 106, .25), 0 10px 24px rgba(201, 56, 92, .22);
}
body[data-theme="inner"] .btn:hover {
  box-shadow: 0 0 0 1px var(--gold), 0 12px 30px rgba(201, 56, 92, .34);
}

/* ---------------- 顶部栏 ---------------- */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) 0 var(--sp-3);
  min-height: 64px;
}

/* ---------------- 左上角的项圈（点三下进内层） ---------------- */
.collar {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  padding: 0;
  border: none;
  background: transparent;
  display: grid;
  place-items: center;
  transition: transform .3s var(--ease);
}
.collar:active { transform: scale(.93); }
.collar svg { width: 100%; height: 100%; overflow: visible; }

/* 粉白色：带子是粉的，底衬是奶白 */
.collar .cl-band {
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
}
.collar .cl-band-in {
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 2.4;
  stroke-linecap: round;
  opacity: .85;
}
.collar .cl-hole { fill: #FFFFFF; opacity: .9; }
.collar .cl-ring {
  fill: none;
  stroke: var(--primary-deep);
  stroke-width: 2.2;
}
.collar .cl-heart { fill: var(--accent); }
.collar .cl-heart { filter: drop-shadow(0 1px 2px rgba(232, 124, 155, .45)); }

/* 点第二下时轻轻缩一下，只有你知道 */
.collar.is-armed { animation: collar-arm .45s var(--ease); }
@keyframes collar-arm {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.18) rotate(-6deg); }
  100% { transform: scale(1); }
}

/* 第三下没点完的时候，冒一行小字提示 */
.collar-hint {
  position: absolute;
  left: 0;
  top: calc(100% + 2px);
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--accent);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-1);
  animation: rise-in .2s var(--ease);
}

.brand { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name { font-weight: 700; font-size: 16px; color: var(--text); }
.brand-sub { font-size: 11px; color: var(--text-faint); }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-2) calc(var(--sp-2) + env(safe-area-inset-bottom));
  margin: 0 calc(var(--sp-4) * -1);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--tap);
  padding: var(--sp-2) 0;
  border-radius: var(--r-md);
  color: var(--text-faint);
  font-size: 11px;
  text-decoration: none;
  transition: color .2s var(--ease), background-color .2s var(--ease), transform .2s var(--ease);
}
.tab .ic { font-size: 17px; line-height: 1; }
.tab:hover { color: var(--text-soft); }
.tab.is-active { color: var(--accent); font-weight: 600; }
.tab.is-active .ic { animation: tab-pop .4s var(--ease); }

body[data-theme="inner"] .tabbar {
  border-top: 1px solid var(--line-strong);
  background: color-mix(in srgb, #0B050F 86%, transparent);
}
body[data-theme="inner"] .tab.is-active {
  color: var(--gold);
  background: linear-gradient(180deg, rgba(201, 56, 92, .16), transparent);
}

/* ---------------- 内层顶部栏 ---------------- */
.inner-topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) 0 var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.inner-brand { display: flex; align-items: center; gap: var(--sp-2); }
.inner-mark {
  width: 8px; height: 8px;
  background: var(--accent);
  transform: rotate(45deg);
  box-shadow: 0 0 10px var(--accent);
}
.inner-title {
  font-family: var(--font-serif);
  font-size: 17px;
  letter-spacing: .22em;
  color: var(--text);
}
.inner-name {
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--gold);
  border: 1px solid rgba(212, 175, 106, .35);
  border-radius: var(--r-pill);
  padding: 1px 7px;
  opacity: .85;
}
.inner-meta {
  flex: 1;
  text-align: right;
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: .1em;
}

/* 内层导航 */
.inner-nav {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: var(--sp-2) 0 calc(var(--sp-2) + env(safe-area-inset-bottom));
  margin: 0 calc(var(--sp-4) * -1);
  border-top: 1px solid var(--line-strong);
  background: color-mix(in srgb, #0B050F 88%, transparent);
  backdrop-filter: blur(14px);
}
.inner-nav .tab { border-radius: var(--r-sm); font-size: 10px; letter-spacing: .14em; }
.inner-nav .tab .ic { font-size: 15px; }

/* ---------------- 退出键 ---------------- */
.inner-exit {
  position: fixed;
  right: 14px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 40;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .35);
  color: var(--text-faint);
  font-size: 12px;
  opacity: .32;
  transition: opacity .3s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
  display: none;
}
.inner-exit:hover { opacity: 1; color: var(--accent); border-color: var(--accent); }
body[data-theme="inner"] .inner-exit { display: block; }

/* ---------------- 空状态 / 占位 ---------------- */
.placeholder {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  color: var(--text-soft);
  font-size: 13px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.placeholder b { color: var(--text); font-weight: 600; }
.placeholder .tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  font-size: 10px;
  letter-spacing: .1em;
  background: var(--accent-soft);
  color: var(--accent);
}
body[data-theme="inner"] .placeholder .tag { background: rgba(212, 175, 106, .12); color: var(--gold); }

/* ---------------- 轻提示 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 90;
  max-width: min(86vw, 420px);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: rgba(20, 10, 24, .94);
  color: #F6E9F0;
  font-size: 13px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
body[data-theme="outer"] .toast { background: rgba(92, 74, 80, .94); }

.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;
}
