/* =========================================================================
   layout.css · 启动页、封面、页头、日期栏、导航、设置弹层（设计书 §4.6–4.8）
   手机 < 768px：底部三栏导航；768–1023px：底部紧凑导航 + 日期 chips；
   ≥ 1024px：顶部导航
   ========================================================================= */

/* ---- 启动 ---- */
.boot {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-content: center; justify-items: center; gap: 12px;
  color: var(--cheese-text); font-weight: 600;
}
.boot__mark {
  display: grid; place-items: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--cheese-bg); border: 1px solid var(--cheese-border);
  font-size: 30px;
  animation: boot-bob 1.6s var(--ease) infinite alternate;
}
@keyframes boot-bob { to { transform: translateY(-6px) rotate(-6deg); } }
.noscript { margin: 24px; }

/* ---- 封面 ---- */
.cover {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center;
  padding: 40px var(--gutter) calc(40px + var(--safe-bottom));
  background:
    radial-gradient(circle at 12% 8%, var(--rabbit-bg) 0, transparent 38%),
    radial-gradient(circle at 92% 88%, var(--dog-bg) 0, transparent 40%),
    var(--bg-page);
}
.cover__paper {
  position: relative;
  width: min(100%, 460px);
  display: grid; justify-items: center; gap: 14px;
  padding: 40px 24px 28px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
  background: var(--bg-card);
  text-align: center;
  box-shadow: var(--shadow-2);
}
/* 纸胶带 */
.cover__paper::before {
  content: "";
  position: absolute; top: -13px; left: 50%;
  width: 128px; height: 26px;
  transform: translateX(-50%) rotate(-3deg);
  border-radius: 3px;
  background: repeating-linear-gradient(45deg,
    rgba(247, 217, 107, .8) 0 8px, rgba(255, 247, 214, .85) 8px 16px);
}
.cover__eyebrow { color: var(--cheese-text); font-size: 12px; font-weight: 700; letter-spacing: .22em; }
.cover__title {
  font-family: var(--font-display);
  font-size: clamp(30px, 9vw, 42px); font-weight: 600; line-height: 1.12;
}
.cover__subtitle { color: var(--text-sub); font-size: 15px; }
.cover__art {
  position: relative;
  width: 100%; aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  overflow: hidden;
  border: 1px solid var(--cheese-border); border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 120%, var(--cheese-main) 0, transparent 55%),
    var(--cheese-bg);
  color: var(--cheese-text);
}
.cover__art img { width: 100%; height: 100%; object-fit: cover; }
.cover__tower { width: 34%; height: auto; margin-top: 4%; }
.cover__sticker {
  position: absolute;
  font-size: clamp(28px, 8vw, 38px); line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(63, 58, 53, .2));
}
.cover__sticker--a { left: 12%; top: 20%; transform: rotate(-12deg); }
.cover__sticker--b { right: 12%; top: 26%; transform: rotate(10deg); }
.cover__sticker--c { right: 22%; bottom: 10%; transform: rotate(-6deg); font-size: clamp(22px, 6vw, 28px); }
.cover__dates { font-family: var(--font-display); font-size: 20px; letter-spacing: .04em; }
.cover__pair { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; color: var(--text-sub); font-size: 14px; }
.cover__enter { width: 100%; max-width: 280px; }
.cover__days { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.cover__day {
  display: grid; justify-items: center;
  min-width: 56px; min-height: var(--tap);
  padding: 4px 8px;
  border: 1px solid var(--cheese-border); border-radius: var(--radius-sm);
  background: var(--cheese-bg); color: var(--cheese-text);
  font-size: 14px; font-weight: 700; line-height: 1.25; text-decoration: none;
}
.cover__day small { font-size: 11px; font-weight: 500; }
.cover__day:hover { background: var(--cheese-main); }

/* ---- 档案主界面 ---- */
.app { padding-bottom: calc(var(--nav-h) + var(--safe-bottom)); }
/* 键盘聚焦或跳转定位时，不让元素被吸顶日期栏 / 底部导航挡住 */
html { scroll-padding: calc(var(--datebar-h) + 8px) 0 calc(var(--nav-h) + var(--safe-bottom) + 8px); }

.app-header {
  display: flex; align-items: center; gap: 8px;
  height: var(--header-h);
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  background: var(--bg-page);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0; min-height: var(--tap);
  color: var(--text-main); text-decoration: none;
  font-size: 13px; font-weight: 700; letter-spacing: .14em;
}
.brand__mark {
  display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--cheese-border); background: var(--cheese-bg);
  font-size: 16px; letter-spacing: 0;
}
.brand__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-header__end { display: flex; justify-content: flex-end; }

/* 底部导航（< 1024px） */
.view-nav {
  position: fixed; z-index: 900; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding: 7px max(12px, env(safe-area-inset-right)) calc(7px + var(--safe-bottom)) max(12px, env(safe-area-inset-left));
  border-top: 1px solid var(--border-soft);
  background: rgba(255, 253, 248, .96);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.view-nav__tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1px solid transparent; border-radius: var(--radius);
  color: var(--text-sub); text-decoration: none;
  font-size: 12px; font-weight: 700;
}
.view-nav__icon { font-size: 19px; line-height: 1.1; }
.view-nav__tab:hover { background: var(--cheese-bg); }
.view-nav__tab[aria-current="page"] {
  background: var(--cheese-main);
  border-color: var(--cheese-text);
  color: var(--cheese-text);
}

/* 日期栏（公共芝士黄） */
.date-bar {
  position: sticky; top: 0; z-index: 800;
  display: flex; align-items: center; gap: 6px;
  height: var(--datebar-h);
  padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  border-top: 1px solid var(--cheese-border);
  border-bottom: 1px solid var(--cheese-border);
  background: var(--cheese-bg);
  color: var(--cheese-text);
}
.date-bar__select-wrap { position: relative; flex: 1; min-width: 0; }
.date-bar__select-wrap::after {
  content: "▾";
  position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.date-bar__select {
  width: 100%; min-height: var(--tap);
  padding: 0 34px;
  border: 1px solid var(--cheese-border); border-radius: var(--radius-pill);
  background: var(--bg-card); color: var(--cheese-text);
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
  text-align: center; text-align-last: center;
  -webkit-appearance: none; appearance: none;
}
.date-bar__chips { display: none; }
.date-chip {
  display: grid; justify-items: center;
  min-width: 68px; min-height: var(--tap);
  padding: 3px 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--cheese-text);
  font-size: 15px; font-weight: 700; line-height: 1.25;
}
.date-chip small { font-size: 11px; font-weight: 500; }
.date-chip:hover { background: var(--bg-card); border-color: var(--cheese-border); }
.date-chip[aria-current="date"] { background: var(--cheese-main); border-color: var(--cheese-text); }

.sample-banner { margin: 12px var(--gutter) 0; }

main:focus { outline: none; }

/* ---- 设置弹层 ---- */
.settings {
  width: min(100% - 32px, 440px);
  padding: 0;
  border: 1px solid var(--cheese-border); border-radius: var(--radius-lg);
  background: var(--bg-card); color: var(--text-main);
  box-shadow: var(--shadow-2);
}
.settings::backdrop { background: rgba(63, 58, 53, .35); }
.settings__form { display: grid; gap: 18px; padding: 16px 20px 22px; }
.settings__head { display: flex; align-items: center; justify-content: space-between; }
.settings__head h2 { font-size: 18px; }
.settings fieldset { margin: 0; padding: 0; border: 0; }
.settings legend { margin-bottom: 8px; padding: 0; color: var(--text-sub); font-size: 14px; font-weight: 700; }
.settings__note { color: var(--text-sub); font-size: 13px; }

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
  padding: 4px;
  border: 1px solid var(--cheese-border); border-radius: var(--radius);
  background: var(--cheese-bg);
}
.segmented label { position: relative; }
.segmented input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented span {
  display: grid; place-items: center;
  min-height: 40px; padding: 0 6px;
  border: 1px solid transparent; border-radius: 12px;
  color: var(--cheese-text); font-size: 14px; font-weight: 600; text-align: center;
}
.segmented input:checked + span { background: var(--cheese-main); border-color: var(--cheese-text); }
.segmented input:focus-visible + span { outline: 3px solid var(--cheese-text); outline-offset: 2px; }


/* ---- 平板 ---- */
@media (min-width: 768px) {
  .date-bar__select-wrap { display: none; }
  .date-bar__chips { display: flex; flex: 1; justify-content: center; gap: 4px; min-width: 0; }
  .view-nav { left: 50%; right: auto; width: min(480px, 100%); transform: translateX(-50%); border: 1px solid var(--border-soft); border-bottom: 0; border-radius: 20px 20px 0 0; }
}

/* ---- 电脑 ---- */
@media (min-width: 1024px) {
  :root { --header-h: 64px; }
  .app { padding-bottom: 0; }
  html { scroll-padding: calc(var(--header-h) + var(--datebar-h) + 8px) 0 8px; }
  .app-header { position: sticky; top: 0; z-index: 900; border-bottom: 1px solid var(--border-soft); }
  .view-nav {
    position: static; transform: none; width: auto;
    display: flex; gap: 6px;
    height: auto; padding: 0;
    border: 0; border-radius: 0; background: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .view-nav__tab { flex-direction: row; gap: 6px; min-height: 40px; padding: 0 18px; border-radius: var(--radius-pill); font-size: 15px; }
  .view-nav__icon { font-size: 16px; }
  .app-header__end { flex: 1; }
  .date-bar { top: var(--header-h); border-top: 0; }
  .toast { bottom: 24px; }
}
