:root {
  --bg: #f8f5f1;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-warm: #fffaf5;
  --ink: #28232b;
  --muted: #8e838c;
  --line: #eee4e2;
  --rose: #d95772;
  --rose-deep: #b94461;
  --rose-soft: #f9e3e8;
  --plum: #2b2430;
  --gold: #c9974f;
  --shadow: 0 18px 50px rgba(71, 43, 53, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 8% 8%, rgba(217, 87, 114, 0.09), transparent 28rem), radial-gradient(circle at 92% 34%, rgba(201, 151, 79, 0.09), transparent 24rem), var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(217, 87, 114, 0.28); outline-offset: 3px; }

.wrap { width: min(100% - 40px, 700px); margin: 0 auto; padding: 56px 0 72px; }

.hero { display: flex; flex-direction: column; align-items: center; margin-bottom: 28px; text-align: center; }

.hero-emoji {
  display: grid;
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
  place-items: center;
  border: 1px solid rgba(217, 87, 114, 0.16);
  border-radius: 24px;
  background: var(--rose-soft);
  box-shadow: 0 12px 24px rgba(217, 87, 114, 0.12);
  font-size: 34px;
}

h1 { max-width: 620px; margin: 0 0 10px; color: var(--ink); font-size: clamp(28px, 5vw, 40px); line-height: 1.28; letter-spacing: 0; font-weight: 760; }
.sub { max-width: 420px; margin: 0 auto; color: var(--muted); font-size: 15px; line-height: 1.65; }

.card {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.card::after { position: absolute; top: 0; right: 0; width: 90px; height: 90px; border-radius: 0 0 0 100%; background: rgba(217, 87, 114, 0.055); content: ""; pointer-events: none; }
.card:hover { border-color: rgba(217, 87, 114, 0.2); box-shadow: 0 22px 58px rgba(71, 43, 53, 0.12); transform: translateY(-2px); }

.card-label { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 12px; line-height: 1.2; letter-spacing: 0.08em; font-weight: 700; }
.card-label::before { width: 7px; height: 7px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 0 5px rgba(217, 87, 114, 0.1); content: ""; }

/* 音乐 */
.music-card { padding: 28px; border: 0; background: var(--plum); box-shadow: 0 22px 52px rgba(43, 36, 48, 0.2); }
.music-card::after { width: 180px; height: 180px; background: rgba(255, 255, 255, 0.06); }
.music-card .card-label { color: rgba(255, 255, 255, 0.62); }
.music-card .card-label::before { background: #f4c978; box-shadow: 0 0 0 5px rgba(244, 201, 120, 0.12); }

.music-title { position: relative; z-index: 1; margin: 0; color: #fff; font-size: clamp(20px, 4vw, 28px); line-height: 1.35; font-weight: 760; }
.music-description { position: relative; z-index: 1; margin: 8px auto 18px; color: rgba(255, 255, 255, 0.62); font-size: 13px; line-height: 1.6; }
.music-controls { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.music-picker-btn, .qq-music-link, .robot-btn { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 14px; text-decoration: none; font-size: 15px; font-weight: 750; transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease; }
.music-picker-btn { gap: 9px; min-width: 198px; padding: 13px 20px; color: var(--plum); background: #fff; box-shadow: 0 12px 22px rgba(0, 0, 0, 0.16); cursor: pointer; }
.music-picker-btn:hover, .qq-music-link:hover, .robot-btn:hover { transform: translateY(-2px); }
.music-picker-btn:hover { box-shadow: 0 16px 28px rgba(0, 0, 0, 0.2); }
.music-note { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #fff; background: var(--rose); font-size: 17px; }

/* 播放器 + 播放列表 */
.player { position: relative; z-index: 1; width: 100%; margin-top: 16px; }
.playlist { position: relative; z-index: 1; list-style: none; margin: 16px 0 0; padding: 0; max-height: 280px; overflow-y: auto; }
.playlist-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: rgba(255, 255, 255, 0.82); font-size: 14px; cursor: pointer; transition: background 160ms ease; }
.playlist-item:hover { background: rgba(255, 255, 255, 0.1); }
.playlist-item.active { background: rgba(255, 255, 255, 0.16); color: #fff; }
.playlist-index { color: rgba(255, 255, 255, 0.4); font-size: 12px; font-weight: 700; min-width: 22px; }
.playlist-title { flex: 1; }

/* 音乐平台链接（两行居中） */
.music-links { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 16px; }
.track-select { width: min(100%, 330px); min-height: 48px; padding: 0 38px 0 14px; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 14px; color: #fff; background: rgba(255, 255, 255, 0.1); cursor: pointer; font-size: 14px; outline: none; }
.track-select:focus { border-color: rgba(255, 255, 255, 0.55); }
.track-select:disabled { cursor: not-allowed; opacity: 0.62; }
.track-select option { color: var(--ink); background: #fff; }
.track-status { position: relative; z-index: 1; min-height: 20px; margin: 13px 0 8px; color: rgba(255, 255, 255, 0.72); font-size: 12px; line-height: 1.6; }
.local-player { position: relative; z-index: 1; display: block; width: min(100%, 520px); height: 42px; margin: 0 auto 14px; }
.qq-music-link { min-height: auto; color: #f4c978; font-size: 13px; }

/* ===== LITE 模式（板子 ESP32 托管，没有本地歌曲）=====
   见 app.js 顶部说明。这里只隐藏，节点本身保留。 */
.lite .music-title,
.lite .player,
.lite .playlist,
.lite .music-card .hint,
.lite #robotLink,
.lite .beian { display: none; }
.qq-music-link:hover { color: #fff; }
.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; }

.hint { position: relative; z-index: 1; margin: 13px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.music-card .hint { color: rgba(255, 255, 255, 0.58); }

/* 每日一词 */
.word { position: relative; z-index: 1; margin-top: 2px; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: clamp(34px, 7vw, 50px); line-height: 1.12; letter-spacing: 0; font-weight: 700; overflow-wrap: anywhere; }
.meaning { position: relative; z-index: 1; margin-top: 12px; color: var(--rose-deep); font-size: 16px; line-height: 1.5; font-weight: 700; }
.sentence { position: relative; z-index: 1; max-width: 560px; margin: 16px auto 0; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.7; }

/* 鼓励 */
.cheer { position: relative; z-index: 1; display: flex; min-height: 76px; align-items: center; justify-content: center; max-width: 580px; margin: 0 auto; color: var(--ink); font-size: clamp(20px, 4vw, 28px); line-height: 1.45; letter-spacing: 0; font-weight: 700; overflow-wrap: anywhere; }
.cheer-btn { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 42px; margin-top: 16px; padding: 9px 17px; border: 1px solid rgba(217, 87, 114, 0.4); border-radius: 12px; color: var(--rose-deep); background: transparent; cursor: pointer; font-size: 13px; font-weight: 700; transition: color 180ms ease, background 180ms ease, transform 180ms ease; }
.cheer-btn:hover { color: #fff; background: var(--rose); transform: translateY(-2px); }
.cheer-btn:active { transform: translateY(0); }
.cheer-btn.active { color: #fff; background: var(--rose); }
.cheer-actions { position: relative; z-index: 1; display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

/* 机器人 */
.robot-card { background: var(--surface-warm); }
.robot-intro { position: relative; z-index: 1; max-width: 430px; margin: -4px auto 18px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.robot-actions { position: relative; z-index: 1; display: flex; justify-content: center; }
.robot-btn { min-width: 150px; padding: 13px 20px; color: #fff; background: var(--rose); box-shadow: 0 12px 22px rgba(217, 87, 114, 0.22); }
.robot-btn:hover { background: var(--rose-deep); box-shadow: 0 16px 28px rgba(217, 87, 114, 0.26); }
.drive-panel { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 22px auto 0; }
.drive-row { display: flex; justify-content: center; gap: 8px; }
.drive-btn { display: inline-flex; width: 76px; min-height: 58px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fff; cursor: pointer; font-size: 23px; line-height: 1; box-shadow: 0 8px 18px rgba(71, 43, 53, 0.06); transition: transform 180ms ease, color 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease; }
.drive-btn span { color: var(--muted); font-size: 11px; line-height: 1.2; }
.drive-btn:hover { border-color: rgba(217, 87, 114, 0.34); color: var(--rose-deep); background: #fffafb; box-shadow: 0 12px 22px rgba(71, 43, 53, 0.1); transform: translateY(-2px); }
.drive-btn:active { transform: translateY(0); }
.drive-stop { color: var(--rose-deep); background: var(--rose-soft); }
.drive-stop span { color: var(--rose-deep); }
.say-panel { position: relative; z-index: 1; max-width: 480px; margin: 22px auto 0; padding-top: 18px; border-top: 1px solid var(--line); }
.say-label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 13px; font-weight: 700; }
.say-controls { display: flex; align-items: stretch; justify-content: center; gap: 8px; }
.say-input { min-width: 0; flex: 1; min-height: 44px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--ink); background: #fff; font-size: 14px; text-align: center; transition: border-color 180ms ease, box-shadow 180ms ease; }
.say-input:focus { border-color: rgba(217, 87, 114, 0.5); box-shadow: 0 0 0 4px rgba(217, 87, 114, 0.1); }
.say-btn { min-width: 72px; padding: 10px 14px; border: 0; border-radius: 12px; color: #fff; background: var(--plum); cursor: pointer; font-size: 14px; font-weight: 750; transition: transform 180ms ease, background 180ms ease; }
.say-btn:hover { background: #493d4e; transform: translateY(-2px); }
.say-btn:active { transform: translateY(0); }
.robot-status { position: relative; z-index: 1; min-height: 20px; margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.robot-status.is-success { color: #38805d; }
.robot-status.is-error { color: var(--rose-deep); }

.foot { margin: 28px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.foot-line { margin: 0; }
/* 备案信息。工信部要求展示在网站底部，且备案号要能点进 beian.miit.gov.cn */
.beian { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; margin: 10px 0 0; }
.beian a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; }
.beian a:hover { color: var(--rose-deep); }
.beian-icon { width: 14px; height: 14px; vertical-align: middle; }

/* 暗号验证门 */
.gate { position: fixed; z-index: 100; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at 18% 20%, rgba(217, 87, 114, 0.24), transparent 24rem), var(--plum); }
.gate-inner { width: min(100%, 360px); padding: 36px 30px 32px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 24px; background: rgba(255, 255, 255, 0.06); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24); text-align: center; backdrop-filter: blur(12px); }
.gate-emoji { display: grid; width: 64px; height: 64px; margin: 0 auto 20px; place-items: center; border-radius: 20px; background: rgba(255, 255, 255, 0.1); font-size: 30px; }
.gate-title { margin: 0; color: #fff; font-size: 22px; line-height: 1.4; font-weight: 750; }
.gate-sub { margin: 8px 0 22px; color: rgba(255, 255, 255, 0.58); font-size: 14px; line-height: 1.6; }
.gate input { width: 100%; min-height: 48px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 13px; outline: none; color: #fff; background: rgba(255, 255, 255, 0.09); font-size: 16px; text-align: center; transition: border-color 180ms ease, background 180ms ease; }
.gate input::placeholder { color: rgba(255, 255, 255, 0.38); }
.gate input:focus { border-color: rgba(255, 255, 255, 0.52); background: rgba(255, 255, 255, 0.13); }
.gate button { width: 100%; min-height: 48px; padding: 12px; border: 0; border-radius: 13px; color: #fff; background: var(--rose); cursor: pointer; font-size: 15px; font-weight: 750; transition: background 180ms ease, transform 180ms ease; }
.gate button:hover { background: var(--rose-deep); transform: translateY(-2px); }
.gate-error { min-height: 18px; margin: 10px 0 0; color: #ffacbd; font-size: 13px; }

@media (max-width: 560px) {
  .wrap { width: min(100% - 28px, 700px); padding-top: 32px; }
  .hero { margin-bottom: 22px; }
  .hero-emoji { width: 56px; height: 56px; margin-bottom: 14px; border-radius: 18px; font-size: 27px; }
  h1 { margin-top: 0; font-size: 28px; }
  .sub { font-size: 14px; }
  .card, .music-card { padding: 21px; border-radius: 18px; }
  .card-label { margin-bottom: 16px; }
  .music-picker-btn, .qq-music-link, .robot-btn, .track-select { width: 100%; }
  .drive-btn { width: 70px; }
  .say-controls { flex-direction: column; }
  .say-btn { width: 100%; }
  .gate-inner { padding: 30px 22px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
