:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --panel: rgba(19, 23, 31, .82);
  --line: rgba(255, 255, 255, .1);
  --text: #f4f0e8;
  --muted: #a5a7ae;
  --lime: #d7ff58;
  --violet: #9b87ff;
  --orange: #ff805e;
  --radius: 24px;
}

body[data-theme="male-student"] {
  --bg: #05070b;
  --panel: rgba(12, 17, 26, .86);
  --line: rgba(185, 225, 255, .14);
  --text: #f7fbff;
  --muted: #97a7b8;
  --lime: #7df9ff;
  --violet: #6f7cff;
  --orange: #ff9b72;
}

body[data-theme="male-adult"] {
  color-scheme: light;
  --bg: #eeece4;
  --panel: rgba(255, 255, 250, .74);
  --line: rgba(28, 31, 34, .13);
  --text: #151515;
  --muted: #66645d;
  --lime: #1f4f46;
  --violet: #7f765f;
  --orange: #9b3d2e;
}

body[data-theme="female-student"] {
  --bg: #100b13;
  --panel: rgba(31, 18, 33, .84);
  --line: rgba(255, 214, 232, .16);
  --text: #fff8fb;
  --muted: #c8aeb9;
  --lime: #ffcb6f;
  --violet: #f08bc2;
  --orange: #77d7c8;
}

body[data-theme="female-adult"] {
  color-scheme: light;
  --bg: #f5f2eb;
  --panel: rgba(255, 255, 255, .78);
  --line: rgba(44, 51, 45, .13);
  --text: #20221e;
  --muted: #6f746c;
  --lime: #527a5b;
  --violet: #b17966;
  --orange: #b34f43;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
/* ===== V2.2 品牌标题精修 ===== */

.hero-title h1 {
  margin-bottom: -55px;
  position: relative;
  z-index: 2;
}

.hero-outline {
  font-size: clamp(110px, 15vw, 190px);
  line-height: .72;
  font-weight: 900;
  letter-spacing: -.11em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(120,120,120,.35);
  opacity: .45;
  margin-left: -15px;
  position: relative;
  z-index: 1;
}
body[data-theme="female-student"] h1,
body[data-theme="female-student"] .word-title h2 { font-family: Georgia, "Times New Roman", "Songti SC", serif; }
body[data-theme="female-adult"] h1,
body[data-theme="female-adult"] .word-title h2 { font-family: Didot, Georgia, "Songti SC", serif; letter-spacing: -.03em; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.aurora { position: fixed; width: 560px; height: 560px; border-radius: 50%; filter: blur(110px); opacity: .13; pointer-events: none; }
.aurora-one { background: var(--violet); top: -250px; right: -180px; }
.aurora-two { background: var(--lime); bottom: -380px; left: -260px; }
.shell { width: min(1120px, calc(100% - 32px)); margin: auto; position: relative; }
.topbar { height: 84px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { color: var(--text); font-weight: 800; letter-spacing: .08em; text-decoration: none; }
.brand span { display: block; color: var(--muted); font-size: 9px; letter-spacing: .25em; margin-top: 4px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.library-button, #closeLibrary, .profile-chip { border: 1px solid var(--line); border-radius: 999px; padding: 10px 15px; background: rgba(255,255,255,.04); color: var(--text); }
.profile-chip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-button strong { display: inline-grid; place-items: center; margin-left: 8px; min-width: 24px; height: 24px; border-radius: 50%; background: var(--lime); color: #111; }

.profile-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 82%, #000);
  backdrop-filter: blur(20px);
}
.profile-gate[hidden] { display: none; }
.profile-card {
  width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  padding: clamp(28px, 5vw, 54px);
  box-shadow: 0 30px 120px rgba(0,0,0,.32);
}
.profile-card h1 {
  margin: 10px 0 12px;
  font-size: clamp(42px, 7vw, 76px);
}
.profile-copy { color: var(--muted); line-height: 1.7; margin: 0 0 26px; }
fieldset { border: 0; padding: 0; margin: 22px 0; }
legend { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.choice-grid label { position: relative; }
.choice-grid input { position: absolute; opacity: 0; inset: 0; }
.choice-grid span {
  display: grid;
  place-items: center;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.045);
  color: var(--text);
  font-weight: 800;
}
.choice-grid input:checked + span {
  border-color: color-mix(in srgb, var(--lime) 68%, white);
  background: color-mix(in srgb, var(--lime) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lime) 45%, transparent);
}
.profile-submit {
  width: 100%;
  min-height: 60px;
  border: 0;
  border-radius: 16px;
  background: var(--lime);
  color: #10120d;
  font-weight: 900;
  margin-top: 8px;
}

.hero { min-height: calc(100vh - 84px); display: grid; align-content: center; padding: 72px 0 110px; }
.eyebrow { color: var(--lime); font-weight: 800; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
h1 { margin: 14px 0 20px; font-size: clamp(52px, 9.2vw, 108px); line-height: .92; letter-spacing: -.07em; max-width: 980px; }
.hero-title {
  position: relative;
}

.hero-title h1 {
  position: relative;
  z-index: 2;
}

.hero-outline {
  font-size: clamp(70px, 11vw, 150px);
  line-height: .82;
  font-weight: 900;
  letter-spacing: -.08em;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(244,240,232,.45);
  margin-left: -8px;
  opacity: .85;
}
.hero-copy { color: var(--muted); font-size: clamp(16px, 2vw, 20px); line-height: 1.7; max-width: 650px; }
.search-card { margin-top: 42px; padding: 18px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); backdrop-filter: blur(18px); box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.search-card > label { display: block; color: var(--muted); font-size: 13px; padding: 0 6px 12px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.search-row input { width: 100%; min-width: 0; padding: 18px 20px; border: 1px solid transparent; outline: 0; border-radius: 15px; background: #090b10; color: var(--text); font-size: clamp(22px, 4vw, 34px); font-weight: 700; }
.search-row input:focus { border-color: rgba(215,255,88,.55); }
.search-row button { border: 0; border-radius: 15px; padding: 0 24px; background: var(--lime); color: #10120d; font-weight: 900; display: flex; align-items: center; gap: 20px; }
.search-row button b { font-size: 24px; }
.search-row button:disabled { opacity: .55; cursor: wait; }
.context-toggle { margin-top: 12px; border: 0; background: none; color: var(--muted); font-size: 13px; padding: 6px; }
textarea { display: none; width: 100%; resize: vertical; min-height: 90px; margin-top: 8px; border: 1px solid var(--line); border-radius: 14px; background: #090b10; color: var(--text); padding: 14px; outline: none; }
textarea.open { display: block; }
.status { min-height: 20px; margin: 12px 6px 0; color: var(--orange); font-size: 13px; }
.status.loading { color: var(--lime); }

.result { padding: 70px 0 120px; }
.word-head { display: flex; gap: 28px; align-items: end; justify-content: space-between; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.word-title h2 { margin: 0; font-size: clamp(56px, 10vw, 110px); letter-spacing: -.06em; line-height: .9; }
.word-title p { color: var(--muted); font-size: 18px; }
.word-hook { max-width: 430px; padding: 22px; border-left: 3px solid var(--lime); font-size: 20px; line-height: 1.55; }
.card-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-top: 28px; }
.info-card { grid-column: span 6; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: clamp(22px, 4vw, 38px); }
.info-card.wide { grid-column: 1 / -1; }
.info-card h3 { margin: 0 0 22px; color: var(--lime); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.info-card h4 { margin: 22px 0 8px; font-size: 16px; }
.info-card p, .info-card li { color: #d5d4d0; line-height: 1.72; }
.meaning { padding: 15px 0; border-top: 1px solid var(--line); }
.meaning:first-of-type { border-top: 0; }
.meaning strong { display: block; margin-bottom: 6px; }
.example { color: var(--muted) !important; font-size: 14px; }
.chain { display: grid; gap: 10px; }
.chain-step { display: grid; grid-template-columns: 110px 130px 1fr; gap: 14px; padding: 15px; border-radius: 14px; background: rgba(255,255,255,.035); }
.chain-step b { color: var(--violet); }
.pill-list { display: flex; flex-wrap: wrap; gap: 9px; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px; font-size: 13px; color: #ddd; }
.memory-scene { font-size: clamp(21px, 3vw, 30px); line-height: 1.55 !important; }

.library { min-height: calc(100vh - 84px); padding: 70px 0 110px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.section-title h2 { margin: 8px 0 0; font-size: clamp(38px, 7vw, 76px); letter-spacing: -.05em; }
.word-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 44px; }
.word-tile { min-height: 210px; text-align: left; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); color: var(--text); padding: 24px; transition: transform .2s, border-color .2s; }
.word-tile:hover { transform: translateY(-4px); border-color: rgba(215,255,88,.4); }
.word-tile small { color: var(--muted); }
.word-tile h3 { font-size: 32px; margin: 24px 0 10px; letter-spacing: -.04em; }
.word-tile p { color: #c3c3bf; line-height: 1.55; }
.empty { color: var(--muted); padding: 50px 0; }

@media (max-width: 760px) {
  .topbar { height: 72px; }
  .top-actions { gap: 6px; }
  .profile-chip { max-width: 108px; padding-inline: 10px; }
  .library-button { padding-inline: 10px; }
  .hero { min-height: calc(100vh - 72px); padding: 50px 0 80px; }
  .search-row { grid-template-columns: 1fr; }
  .search-row button { min-height: 58px; justify-content: space-between; }
  .word-head { align-items: start; flex-direction: column; }
  .word-hook { border-left: 0; border-top: 3px solid var(--lime); padding-left: 0; }
  .info-card { grid-column: 1 / -1; }
  .chain-step { grid-template-columns: 1fr; gap: 5px; }
  .word-grid { grid-template-columns: 1fr; }
  .section-title { align-items: start; flex-direction: column; }
  .choice-grid { grid-template-columns: 1fr; }
}

.pronunciation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 15px 0 4px;
}
.speak-button {
  border: 1px solid rgba(215,255,88,.28);
  border-radius: 999px;
  padding: 9px 13px;
  background: rgba(215,255,88,.07);
  color: var(--text);
}
.speak-button:active {
  transform: scale(.96);
}
.speak-button span {
  margin-left: 3px;
  color: var(--lime);
  font-weight: 700;
}

.search-row input::placeholder {
 color: rgba(255,255,255,.38);
}

/* ===== 恢复旧版镂空故事层 ===== */

.hero-title {
  position: relative;
}

.hero-title h1 {
  position: relative;
  z-index: 2;
  margin-bottom: -35px;
}

/* “变成一个故事”作为背景镂空层 */
.hero-outline {
  position: relative;
  z-index: 1;
  margin-left: -10px;
  margin-top: 0;

  font-size: clamp(90px, 14vw, 180px);
  font-weight: 900;
  line-height: .78;
  letter-spacing: -.1em;

  color: transparent;
  -webkit-text-stroke: 2px rgba(120,120,120,.45);

  opacity: .65;
}


/* 输入框强制恢复可读 */
.search-row input {
  color: #ffffff !important;
}

.search-row input::placeholder {
  color: rgba(255,255,255,.45) !important;
}


/* 顶部说明文字 */
.hero-copy {
  max-width: 760px;
}


/* ===== V2.3 最终视觉修复 ===== */

/* 1. 让“变成一个故事”真正成为镂空背景层 */

.hero-title {
  position: relative;
}

.hero-title h1 {
  position: relative;
  z-index: 2;
}

.hero-outline {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  -webkit-text-stroke: 1.5px rgba(40,40,40,.25) !important;

  font-size: clamp(100px,14vw,180px);
  font-weight:900;
  line-height:.7;
  letter-spacing:-.1em;

  opacity:.55;
  margin-top:-45px;
  margin-left:-15px;

  position:relative;
  z-index:1;
}


/* 2. 输入框提示文字增强 */

.search-row input::placeholder {
  color: rgba(255,255,255,.65) !important;
}


/* 3. 副标题增加呼吸感 */

.hero-copy {
  margin-top:35px;
}


/* codex quick meanings */
.quick-meanings {
  margin: 6px 0 10px;
  color: #c9ff4a;
  font-weight: 800;
  font-size: clamp(18px, 2vw, 26px);
  letter-spacing: 0;
}

/* codex fallback: hide standalone pronunciation card */
article.info-card[data-codex-pron-card],
article.info-card.codex-hidden-pron-card {
  display: none !important;
}

/* codex final: title spacing + remove standalone pronunciation card */
.word-head .word-title {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  min-width: 0 !important;
}

.word-head .word-title h2 {
  display: block !important;
  line-height: 1.04 !important;
  margin: 0 0 clamp(18px, 2vw, 30px) !important;
  padding-bottom: 0.04em !important;
  letter-spacing: 0 !important;
}

.word-head .word-title .quick-meanings,
.word-head .word-title > p:first-of-type {
  position: static !important;
  display: block !important;
  transform: none !important;
  margin: 0 0 16px !important;
  padding: 0 !important;
  line-height: 1.35 !important;
  color: #555c56 !important;
  font-weight: 800 !important;
  z-index: 2 !important;
}

/* 当前旧结构里第 2 张卡就是“02 · 发音”，先直接隐藏 */
.card-grid > article.info-card:nth-of-type(2) {
  display: none !important;
}

/* 隐藏后，让剩余内容自然铺开 */
.card-grid {
  align-items: stretch !important;
}

/* codex top speaker buttons */
.codex-top-speakers {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin-top: 14px !important;
}

.codex-top-speakers .speak-button {
  min-height: 38px !important;
  padding: 8px 14px !important;
}

/* codex clean render card: top pronunciation only */
.compact-word-head {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 42%) !important;
  align-items: end !important;
  gap: clamp(28px, 5vw, 72px) !important;
}

.compact-word-head .word-title {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  min-width: 0 !important;
}

.compact-word-head .word-title h2 {
  display: block !important;
  line-height: 1.04 !important;
  margin: 0 0 clamp(18px, 2vw, 30px) !important;
  padding-bottom: 0.04em !important;
  letter-spacing: 0 !important;
  overflow-wrap: anywhere !important;
}

.compact-word-head .quick-meanings {
  display: block !important;
  margin: 0 0 16px !important;
  color: #555c56 !important;
  font-size: clamp(18px, 1.8vw, 25px) !important;
  font-weight: 800 !important;
  line-height: 1.35 !important;
}

.word-pron-inline {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 10px 14px !important;
  color: #68706a !important;
  font-size: clamp(16px, 1.25vw, 22px) !important;
}

.word-pron-inline .speak-button {
  min-height: 38px !important;
  padding: 8px 14px !important;
}

@media (max-width: 860px) {
  .compact-word-head {
    grid-template-columns: 1fr !important;
    align-items: start !important;
  }
}
