@import url('https://fonts.googleapis.com/css2?family=DotGothic16&display=swap');

/* Shared reading system: one shell for every IELTS passage. */
:root {
  --reading-ink: #17152d;
  --reading-muted: #706a83;
  --reading-line: #d9d3e5;
  --reading-paper: #fbf8ff;
  --reading-panel: #ffffff;
  --reading-accent: #5d5dff;
  --reading-pink: #f04b9a;
  --reading-yellow: #fff2a6;
}

body {
  color: var(--reading-ink);
  background: var(--reading-paper);
  font-family: 'DotGothic16', Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-image: linear-gradient(rgba(93, 93, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(93, 93, 255, .035) 1px, transparent 1px);
  background-size: 24px 24px;
}

.topbar {
  position: sticky;
  height: 72px;
  padding-inline: clamp(16px, 3vw, 42px);
  border-bottom: 2px solid var(--reading-ink);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 3px 0 rgba(240, 75, 154, .2);
}
.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -6px;
  left: 0;
  height: 4px;
  pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--reading-pink) 0 18px, var(--reading-yellow) 18px 25px, var(--reading-accent) 25px 42px);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border: 2px solid var(--reading-ink);
  border-radius: 0;
  color: #fff;
  background: var(--reading-pink);
  box-shadow: 3px 3px 0 var(--reading-accent);
}

.brand strong { font-size: 14px; }
.brand small { letter-spacing: .08em; }
.topbar-center { font-size: 11px; letter-spacing: .04em; }
.status-dot { width: 7px; height: 7px; background: var(--reading-pink); box-shadow: 0 0 0 2px #ffd3e8; }
.topbar-actions { gap: 8px; }

.blog-link,
.icon-button,
.blog-theme-button {
  height: 40px;
  min-height: 40px;
  border: 1px solid var(--reading-ink);
  border-radius: 0;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.blog-link {
  width: 122px;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--reading-accent);
  background: #f0efff;
  text-decoration: none !important;
}
.blog-link > span { display: inline-grid; place-items: center; width: 15px; font-size: 16px; line-height: 1; text-decoration: none; }
.blog-link b { display: inline-block; font-size: 12px; font-weight: 900; text-decoration: none; }
.blog-link:hover { color: #fff; border-color: var(--reading-pink); background: var(--reading-pink); }
.icon-button { min-width: 92px; justify-content: center; color: var(--reading-muted); background: #fff; }
.icon-button:hover, .icon-button[aria-pressed="true"] { color: var(--reading-ink); background: var(--reading-yellow); }

.workspace {
  grid-template-columns: 246px minmax(0, 780px) 310px;
  gap: 28px;
  width: min(1450px, calc(100% - 48px));
  align-items: start;
}

.left-rail,
.insight-panel { padding-top: 38px; }
.left-rail { position: sticky; top: 72px; max-height: calc(100vh - 72px); overflow: auto; border-right: 2px solid rgba(23, 21, 45, .12); scrollbar-width: thin; }
.insight-panel { top: 72px; }
.rail-heading, .insight-header { padding-bottom: 12px; border-bottom: 2px solid var(--reading-ink); }
.rail-heading span, .insight-header span { color: var(--reading-pink); letter-spacing: .08em; }
.rail-heading strong, .insight-header strong { font-size: 18px; }
.nav-link { border-left-width: 3px; }
.nav-link:hover, .nav-link.is-active { border-left-color: var(--reading-pink); background: #fff; }
.rail-tool:hover { background: #fff; }

.reading-pane { padding-bottom: 110px; }
.article-intro {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 54px 34px 38px;
  border: 2px solid var(--reading-ink);
  border-top: 0;
  background-position: center;
}
.article-intro::before { background: linear-gradient(90deg, rgba(16, 15, 38, .84), rgba(16, 15, 38, .42)); }
.article-intro::after {
  content: "READING / FIELD NOTES";
  position: absolute;
  top: 22px;
  right: 24px;
  color: rgba(255,255,255,.78);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  letter-spacing: .14em;
}
.intro-overline { color: #ffe16b; letter-spacing: .1em; }
.article-intro h1 { max-width: 720px; font-size: clamp(46px, 5vw, 72px); }
.article-intro h1 em { color: #ffb3d6; }
.article-intro h1 { text-shadow: 3px 3px 0 rgba(240, 75, 154, .22); }
.article-intro p { max-width: 650px; margin-top: 20px; font-size: 15px; }
.intro-meta { flex-wrap: wrap; gap: 12px 20px; margin-top: 22px; }

.reading-toolbar {
  top: 72px;
  min-height: 58px;
  padding-inline: 4px;
  border-bottom: 2px solid var(--reading-line);
}
.view-button.is-active, .question-tab.is-active { color: #fff; background: var(--reading-accent); }
.view-button, .small-button, .question-tab, .answer-toggle { border-radius: 0; }
.small-button { border-color: var(--reading-ink); }

.passage-section { padding-top: 54px; }
.passage-heading h2, .question-studio-heading h2 { letter-spacing: 0; }
.sentence-card { border-radius: 0; }
.sentence-card:hover, .sentence-card.is-selected { border-color: var(--reading-accent); box-shadow: 4px 4px 0 rgba(240, 75, 154, .22); }
.en-line mark.key { background: var(--reading-yellow); }
.en-line mark.structure { color: #3431b8; background: #e7e4ff; }
.en-line mark.contrast { color: #c91f72; background: #ffe0ef; }
.ielts-note { border-left-width: 3px; }

.selection-card, .progress-card, .saved-card, .key-card { border: 2px solid var(--reading-ink); border-radius: 0; box-shadow: 4px 4px 0 rgba(93, 93, 255, .22); }
.selection-card, .progress-card, .saved-card, .key-card { position: relative; }
.selection-card::before, .key-card::before { content: ""; position: absolute; top: -2px; right: 14px; width: 18px; height: 4px; background: var(--reading-pink); }
.answer-toggle, .answer-chip { border-radius: 0; background: var(--reading-pink); }
.question-studio { border-top-width: 2px; }

body.is-blog-theme .topbar { height: 72px; }
body.is-blog-theme .article-intro::after { color: #fff3a6; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 210px minmax(0, 1fr); width: min(980px, calc(100% - 36px)); }
  .insight-panel { display: none; }
}

@media (max-width: 720px) {
  .topbar { height: 62px; }
  .topbar::after { bottom: -5px; height: 3px; }
  .blog-link { width: 40px; justify-content: center; gap: 0; padding: 0; font-size: 16px; }
  .blog-link b { display: none; }
  .icon-button { min-width: 40px; padding-inline: 8px; }
  .workspace { width: calc(100% - 28px); }
  .left-rail { top: 62px; max-height: none; }
  .reading-toolbar { top: 111px; }
  .article-intro { min-height: 340px; padding: 42px 0 30px; border-inline-width: 0; }
  .article-intro::after { top: 16px; right: 0; font-size: 8px; }
  .article-intro h1 { font-size: 42px; }
  .intro-meta { font-size: 10px; }
}

/* Load-order finalizer for the NGOD task desktop.  This file is included after
   article-specific styles on every passage, so the desktop layer stays shared. */
body.is-blog-theme {
  background-color:#17142a !important;
  background-image:radial-gradient(circle at 8% 18%,rgba(126,97,183,.34),transparent 23rem),radial-gradient(circle at 92% 75%,rgba(239,91,156,.17),transparent 22rem),linear-gradient(rgba(255,255,255,.026) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.026) 1px,transparent 1px) !important;
  background-size:auto,auto,7px 7px,7px 7px !important;
}
body.is-blog-theme .topbar { height:42px !important; border:0 !important; background:linear-gradient(90deg,#292043,#63488d 50%,#34244e) !important; box-shadow:0 2px 0 rgba(0,0,0,.55) !important; }
body.is-blog-theme .topbar::after { bottom:-3px !important; height:2px !important; background:linear-gradient(90deg,#ef5b9c,#ffb4d6 45%,#8be0e5) !important; }
body.is-blog-theme .workspace { grid-template-columns:188px minmax(0,760px) 242px !important; gap:17px !important; width:min(1240px,calc(100% - 32px)) !important; padding-top:24px !important; }
body.is-blog-theme .reading-pane { overflow:hidden !important; padding:0 25px 80px !important; border:1px solid #eee1ed !important; background:#fffafe !important; box-shadow:0 0 0 1px #2a213e,6px 7px 0 rgba(0,0,0,.55) !important; }
body.is-blog-theme .left-rail,body.is-blog-theme .insight-panel { padding:0 !important; border:1px solid #eee1ed !important; background:#fff9fd !important; box-shadow:0 0 0 1px #2a213e,4px 5px 0 rgba(0,0,0,.5) !important; }
body.is-blog-theme .left-rail { top:64px !important; border-right:1px solid #eee1ed !important; } body.is-blog-theme .insight-panel { top:64px !important; }
body.is-blog-theme .rail-heading,body.is-blog-theme .insight-header { padding:9px 10px !important; border-bottom:0 !important; color:#fff !important; background:linear-gradient(90deg,#ef5b9c,#a866af) !important; }
body.is-blog-theme .reading-toolbar { top:42px !important; min-height:48px !important; margin:0 -25px !important; padding:8px 25px !important; border-bottom:1px solid #d9c9df !important; background:#f7eafa !important; }
body.is-blog-theme .article-intro { min-height:330px !important; margin:0 -25px !important; padding:48px 27px 28px !important; border:0 !important; border-bottom:3px solid #ef5b9c !important; }
@media (max-width:1180px){body.is-blog-theme .workspace{grid-template-columns:170px minmax(0,1fr)!important;width:min(920px,calc(100% - 28px))!important;}body.is-blog-theme .insight-panel{display:none!important;}}
@media (max-width:720px){body.is-blog-theme .topbar{height:52px!important;}body.is-blog-theme .workspace{display:block!important;width:calc(100% - 18px)!important;padding-top:15px!important;}body.is-blog-theme .left-rail{position:relative!important;top:auto!important;display:flex!important;max-height:none!important;margin-bottom:12px!important;overflow:auto!important;white-space:nowrap!important;}body.is-blog-theme .rail-heading{display:none!important;}body.is-blog-theme .nav-link{flex:0 0 auto!important;border-bottom:0!important;border-right:1px solid #eee2ed!important;}.rail-divider,body.is-blog-theme .rail-tool{display:none!important;}body.is-blog-theme .reading-pane{padding:0 15px 64px!important;}body.is-blog-theme .article-intro,body.is-blog-theme .reading-toolbar{margin-inline:-15px!important;}body.is-blog-theme .reading-toolbar{top:52px!important;padding-inline:15px!important;}}


/* TRUE FULLSCREEN READING FOCUS ------------------------------------------------
   This mode deliberately leaves the desktop shell/iframe constraints behind.
   The parent desktop promotes the study iframe; this layout keeps the reader
   itself readable and preserves the same article state and controls. */
html:has(body.is-focus) { overflow: hidden !important; }
body.is-focus {
  overflow: hidden !important;
  min-height: 100dvh !important;
  background: #17142a !important;
}
body.is-focus .app-shell {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1000 !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  overflow: hidden !important;
  background: #fffaff !important;
}
body.is-focus .topbar {
  position: relative !important;
  top: auto !important;
  height: 52px !important;
  min-height: 52px !important;
  z-index: 40 !important;
}
body.is-focus .workspace {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 300px !important;
  gap: 0 !important;
  width: 100% !important;
  height: calc(100dvh - 52px) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}
body.is-focus .left-rail { display: none !important; }
body.is-focus .reading-pane {
  grid-column: 1 !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: auto !important;
  padding: 0 clamp(18px, 5vw, 88px) 100px !important;
  background: #fffaff !important;
}
body.is-focus .insight-panel {
  display: block !important;
  grid-column: 2 !important;
  position: relative !important;
  top: auto !important;
  width: auto !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: auto !important;
  padding: 18px !important;
  border-left: 2px solid #4930bd !important;
  background: #f4e8f8 !important;
}
body.is-focus .article-intro {
  min-height: 250px !important;
  margin: 0 !important;
  padding: 38px clamp(0px, 2vw, 24px) 28px !important;
}
body.is-focus .reading-toolbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
}
body.is-focus .passage-section { padding-top: 32px !important; }
body.is-focus .sentence-card { padding: 18px !important; }
body.is-focus .en-line {
  font-size: clamp(17px, 1.45vw, 22px) !important;
  line-height: 1.85 !important;
}
body.is-focus .cn-line { font-size: 15px !important; line-height: 1.8 !important; }
body.is-focus .question-studio { padding-bottom: 100px !important; }
body.is-focus .reading-toolbar .icon-button[aria-pressed="true"] {
  color: #fff !important;
  background: #4930bd !important;
}
@media (max-width: 760px) {
  body.is-focus .topbar { height: 56px !important; min-height: 56px !important; }
  body.is-focus .workspace {
    display: block !important;
    height: calc(100dvh - 56px) !important;
    overflow: hidden !important;
  }
  body.is-focus .reading-pane {
    width: 100% !important;
    height: 100% !important;
    padding: 0 14px 90px !important;
  }
  body.is-focus .insight-panel { display: none !important; }
  body.is-focus .article-intro {
    min-height: 220px !important;
    padding: 28px 0 22px !important;
  }
  body.is-focus .article-intro h1 { font-size: clamp(32px, 10vw, 46px) !important; }
  body.is-focus .en-line { font-size: 17px !important; line-height: 1.75 !important; }
}
@media (prefers-reduced-motion: reduce) {
  body.is-focus * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}


/* Keep the NGOD shell language visible while focused: the reader is fullscreen,
   but its title strip still reads as a Windose game window rather than a plain
   white document. */
body.is-focus .topbar {
  color: #fff8ff !important;
  background: linear-gradient(90deg, #241a42, #5c3c83 52%, #2a1d48) !important;
  border-bottom: 2px solid #4930bd !important;
  box-shadow: 0 3px 0 #ec6cac !important;
}
body.is-focus .topbar a,
body.is-focus .topbar button { color: #fff8ff !important; }
body.is-focus .topbar button[aria-pressed="true"] {
  color: #3b266f !important;
  background: #fff0a7 !important;
  border-color: #4930bd !important;
}


/* =====================================================================
   Mobile availability patch (2026-08-17)
   手机端之前把「句子精读侧栏」和「词汇表 / 题目入口」用 display:none 藏掉，
   导致：加词到墨墨、查看收藏、句子解析、全文词汇表、题目与答案 这些按钮
   全部失效。这里统一恢复：侧栏落到正文下方，工具入口显示在导航条下方。
   ===================================================================== */

/* 平板 (721–1180px)：三栏变单列，侧栏落到底部可见 */
@media (min-width: 721px) and (max-width: 1180px) {
  .workspace { display: flex !important; flex-direction: column !important; gap: 22px !important; }
  .left-rail { position: static !important; top: auto !important; max-height: none !important; width: 100% !important; border-right: 0 !important; }
  .left-rail #sectionNav { display: flex !important; flex-wrap: wrap !important; gap: 4px !important; }
  .left-rail .nav-link { flex: 0 0 auto !important; }
  .reading-pane { width: 100% !important; }
  .insight-panel { display: block !important; position: static !important; top: auto !important; width: 100% !important; padding-top: 0 !important; }
}

/* 手机 (≤720px)：保持顶部横向导航，恢复侧栏与工具入口 */
@media (max-width: 720px) {
  .insight-panel { display: block !important; position: static !important; top: auto !important; width: 100% !important; padding-top: 0 !important; }
  .insight-panel .selection-card,
  .insight-panel .progress-card,
  .insight-panel .saved-card,
  .insight-panel .key-card { max-width: none !important; }
  .rail-tool { display: inline-flex !important; align-items: center !important; gap: 5px !important; margin: 0 6px 0 0 !important; padding: 6px 10px !important; border: 1px solid var(--reading-line) !important; font-size: 11px !important; }
  .left-rail { padding: 0 0 6px !important; }
}


/* =====================================================================
   Focus exit control (2026-08-17)
   专注模式现在会请求原生全屏；移动端没有 Esc 键，注入一个悬浮「退出专注」
   按钮，仅进入专注后显示，桌面端也通用。 */
.focus-exit-button {
  display: none;
  position: fixed;
  z-index: 9999;
  right: 14px;
  bottom: 20px;
  padding: 11px 15px;
  border: 2px solid #4930bd;
  border-radius: 0;
  color: #fff;
  background: #ec5cad;
  box-shadow: 3px 3px 0 #4930bd;
  font: 800 13px/1 'DotGothic16', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.focus-exit-button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #4930bd; }
body.is-focus .focus-exit-button { display: block; }


/* =====================================================================
   Inline note editor (2026-08-17)
   替代 iOS 上无效的 window.prompt，作为句子笔记的输入界面。 */
.note-editor { position: fixed; z-index: 9999; inset: 0; display: grid; place-items: center; padding: 18px; }
.note-editor[hidden] { display: none; }
.note-editor-backdrop { position: absolute; inset: 0; background: rgba(23, 20, 42, .55); }
.note-editor-panel { position: relative; width: min(440px, 100%); border: 2px solid var(--reading-ink); background: #fff; box-shadow: 5px 5px 0 var(--reading-accent); }
.note-editor-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 2px solid var(--reading-ink); color: #fff; background: var(--reading-pink); font-size: 13px; }
.note-editor-head button { border: 0; color: #fff; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; }
.note-editor-panel textarea { display: block; width: 100%; min-height: 120px; padding: 12px; border: 0; resize: vertical; color: var(--reading-ink); background: #fff; font: 14px/1.7 'DotGothic16', 'Microsoft YaHei', 'PingFang SC', sans-serif; }
.note-editor-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--reading-line); }
.note-editor-foot button { padding: 8px 14px; border: 1px solid var(--reading-ink); border-radius: 0; color: var(--reading-ink); background: #fff; font: 800 12px/1 'DotGothic16', 'Microsoft YaHei', sans-serif; cursor: pointer; }
.note-editor-foot button[type="submit"] { color: #fff; background: var(--reading-accent); }
