/* Sleep Duck — shared styles */

:root {
  /* Default theme: 鸭子黄 */
  --bg: #FFF8E7;
  --bg-soft: #FFEFC4;
  --bg-card: #FFFFFF;
  --ink: #2A1F0E;
  --ink-soft: #6B5A3E;
  --ink-mute: #9E8C6E;
  --duck: #FFC93C;
  --duck-deep: #F2A100;
  --beak: #FF8A3D;
  --hat: #6FB7E8;
  --hat-deep: #3F8FCF;
  --accent: #2A1F0E;
  --line: rgba(42, 31, 14, 0.12);
  --shadow-sm: 0 2px 0 0 rgba(42, 31, 14, 0.08);
  --shadow-md: 0 8px 24px -8px rgba(242, 161, 0, 0.25), 0 2px 0 rgba(42, 31, 14, 0.06);
  --shadow-lg: 0 30px 60px -20px rgba(242, 161, 0, 0.35);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --radius-pill: 999px;

  --font-display: "Smiley Sans", "ZCOOL KuaiLe", "Nunito", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  --font-body: "Nunito", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --weight-display: 800;
  --letter-display: -0.01em;
}

[data-theme="night"] {
  --bg: #0F1330;
  --bg-soft: #1A2050;
  --bg-card: #1B2253;
  --ink: #F4EBD0;
  --ink-soft: #BFB4D9;
  --ink-mute: #7A82B5;
  --duck: #FFD24D;
  --duck-deep: #FFB300;
  --beak: #FF8A3D;
  --hat: #8FCBFF;
  --hat-deep: #4F9CE0;
  --accent: #FFE9A6;
  --line: rgba(255, 233, 166, 0.14);
  --shadow-sm: 0 2px 0 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.6), 0 2px 0 rgba(255, 255, 255, 0.04);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
}

[data-theme="cream"] {
  --bg: #FAF4E4;
  --bg-soft: #F1E7CE;
  --bg-card: #FFFCF3;
  --ink: #3B2E1A;
  --ink-soft: #7A6A4A;
  --ink-mute: #B0A07F;
  --duck: #FFD86F;
  --duck-deep: #E8A93A;
  --beak: #F08A4B;
  --hat: #B8D6E8;
  --hat-deep: #7FB0CC;
  --accent: #3B2E1A;
  --line: rgba(59, 46, 26, 0.1);
}

[data-font="serious"] {
  --font-display: "Source Han Sans SC", "Inter", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --font-body: "Source Han Sans SC", "Inter", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --weight-display: 700;
  --letter-display: -0.02em;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s ease, color 0.3s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  letter-spacing: var(--letter-display);
  margin: 0;
  line-height: 1.1;
  color: var(--ink);
}

h1 { font-size: clamp(40px, 6vw, 72px); }
h2 { font-size: clamp(32px, 4.5vw, 52px); }
h3 { font-size: clamp(20px, 2.4vw, 28px); line-height: 1.25; }

p { margin: 0; text-wrap: pretty; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ───── NAV ───── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 16px 24px;
  max-width: 1200px;
  margin: 0 auto;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: 20px;
  white-space: nowrap;
}
.nav__logo {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
}
.nav__logo img { width: 100%; height: 100%; object-fit: contain; }
.nav__links {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}
.nav__links a {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.18s ease;
}
.nav__links a:hover { background: var(--bg-soft); color: var(--ink); }
.nav__links a.is-active {
  background: var(--ink);
  color: var(--bg);
}
.nav__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--duck);
  color: var(--ink);
  font-weight: 800;
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.12s, box-shadow 0.12s;
}
.nav__cta:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.nav__cta:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.nav__lang {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
}
.nav__lang a {
  min-width: 34px;
  padding: 5px 8px;
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}
.nav__lang a.is-active {
  background: var(--ink);
  color: var(--bg);
}

@media (max-width: 720px) {
  .nav__inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 16px 14px;
  }
  .nav__brand {
    font-size: 18px;
  }
  .nav__logo {
    width: 34px;
    height: 34px;
  }
  .nav__logo img {
    width: 28px;
    height: 28px;
  }
  .nav__cta { display: none; }
  .nav__lang {
    position: absolute;
    top: 14px;
    right: 16px;
  }
  .nav__links {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-left: 0;
  }
  .nav__links a {
    min-width: 0;
    padding: 7px 4px;
    font-size: 14px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .nav__inner { padding: 10px 12px 12px; }
  .nav__links { gap: 4px; }
  .nav__links a {
    padding: 6px 2px;
    font-size: 13px;
  }
}

/* ───── BUTTONS ───── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 16px;
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  font-family: var(--font-body);
}
.btn--primary { background: var(--duck); color: var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.btn--primary:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn--primary:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.btn--ghost:hover { background: var(--bg-soft); }

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 14px;
  font-weight: 700;
  border: 2px solid var(--ink);
  transition: transform 0.12s;
}
.store-btn:hover { transform: translateY(-2px); }
.store-btn svg { width: 38px; height: 38px; flex-shrink: 0; }
.store-btn__small { font-size: 11px; opacity: 0.75; line-height: 1; }
.store-btn__big { font-size: 16px; line-height: 1.1; font-weight: 800; }

/* ───── SECTIONS ───── */
section { padding: 96px 0; position: relative; }
@media (max-width: 720px) { section { padding: 64px 0; } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
}
.eyebrow__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--duck-deep);
}

.section__head { text-align: center; margin-bottom: 48px; }
.section__head p { color: var(--ink-soft); font-size: 18px; max-width: 620px; margin: 14px auto 0; }

/* ───── CARDS ───── */
.card {
  background: var(--bg-card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 28px;
}

/* ───── FOOTER ───── */
.footer {
  padding: 56px 0 36px;
  border-top: 2px solid var(--ink);
  background: var(--bg-soft);
  margin-top: 80px;
}
.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}
@media (max-width: 720px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
}
.footer__brand h4 { font-size: 22px; margin-bottom: 8px; }
.footer__brand h4 span {
  display: inline-block;
  white-space: nowrap;
}
.footer__brand p { color: var(--ink-soft); font-size: 14px; max-width: 280px; }
.footer__col h5 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 14px;
}
.footer__col a {
  display: block;
  padding: 5px 0;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
  transition: color 0.15s;
}
.footer__col a:hover { color: var(--ink); }
.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-mute);
  font-size: 13px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ───── DOCUMENT (privacy/terms) ───── */
.doc {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 56px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 24px 96px;
}
@media (max-width: 900px) { .doc { grid-template-columns: 1fr; gap: 32px; } }

.doc__toc {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  font-size: 14px;
}
.doc__toc h6 {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 12px;
}
.doc__toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--line);
}
.doc__toc li { padding: 0; }
.doc__toc a {
  display: block;
  padding: 7px 14px;
  color: var(--ink-soft);
  font-weight: 600;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: all 0.15s;
}
.doc__toc a:hover { color: var(--ink); background: var(--bg-soft); }
.doc__toc a.is-active {
  color: var(--ink);
  border-left-color: var(--duck-deep);
  background: var(--bg-soft);
}

@media (max-width: 900px) {
  .doc {
    gap: 32px;
    padding-top: 28px;
  }
  .doc__toc {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

.doc__body { max-width: 720px; }
.doc__head { margin-bottom: 24px; padding-bottom: 0; }
.doc__head h1 { font-size: clamp(36px, 5vw, 56px); margin-bottom: 10px; }
.doc__meta { color: var(--ink-mute); font-size: 14px; display: flex; gap: 18px; flex-wrap: wrap; }
.doc__body section { padding: 0; }
.doc__body section + section { margin-top: 34px; }
.doc__body h2 { font-size: 26px; margin: 0 0 14px; padding-top: 0; }
.doc__body h3 { font-size: 18px; margin: 24px 0 10px; color: var(--ink); }
.doc__body p { margin: 10px 0; color: var(--ink-soft); line-height: 1.75; font-size: 15.5px; }
.doc__body ul, .doc__body ol { padding-left: 24px; color: var(--ink-soft); line-height: 1.75; font-size: 15.5px; }
.doc__body li { margin: 6px 0; }
.doc__body strong { color: var(--ink); font-weight: 700; }
.doc__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14.5px;
}
.doc__body th, .doc__body td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.doc__body th { background: var(--bg-soft); font-weight: 700; color: var(--ink); }
.doc__callout {
  background: var(--bg-soft);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 14.5px;
}
.doc__callout strong { display: block; margin-bottom: 4px; }

/* Tweaks panel host */
.tweaks-host { position: fixed; bottom: 16px; right: 16px; z-index: 100; }
