:root {
  --navy: #083b74;
  --navy-dark: #061f39;
  --blue: #1685ca;
  --sky: #e5f5fe;
  --sky-strong: #9bdaf6;
  --burgundy: #8f1837;
  --burgundy-dark: #681025;
  --ink: #142435;
  --muted: #5c6d7d;
  --paper: #ffffff;
  --soft: #f4f8fb;
  --line: #d8e6ef;
  --shadow: 0 18px 50px rgba(8, 59, 116, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  color: var(--ink);
  background: #eef5f9;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.68;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p { text-wrap: pretty; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100% - 1380px) / 2));
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--navy); font-weight: 850; text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; color: white; background: var(--navy); border-radius: 11px; font-size: 21px; }
.topbar-label { color: var(--muted); font-size: 14px; font-weight: 700; }

.intro {
  display: grid;
  width: min(1380px, calc(100% - 40px));
  min-height: 590px;
  grid-template-columns: 1.15fr .85fr;
  gap: 64px;
  align-items: center;
  margin: 28px auto 34px;
  padding: 70px 76px;
  overflow: hidden;
  background: linear-gradient(135deg, #fff 35%, #e5f5fe);
  border: 1px solid var(--line);
  border-radius: 34px;
  box-shadow: var(--shadow);
}
.eyebrow, .chapter-kicker { margin: 0 0 12px; color: var(--burgundy); font-size: 13px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
h1 { max-width: 790px; margin: 0; color: var(--navy); font-size: clamp(48px, 5vw, 78px); line-height: 1.02; letter-spacing: -.045em; }
.intro-lead { max-width: 720px; margin: 27px 0; color: #40576a; font-size: 21px; }
.intro-result { display: grid; max-width: 690px; grid-template-columns: 150px 1fr; gap: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.intro-result strong { color: var(--navy); }
.intro-result span { color: var(--muted); }
.intro-image { width: 100%; border-radius: 30px; box-shadow: 0 24px 60px rgba(8,59,116,.17); }

.manual-layout {
  display: grid;
  width: min(1380px, calc(100% - 40px));
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
  margin: 0 auto 34px;
}
.toc {
  position: sticky;
  top: 98px;
  padding: 25px 20px;
  background: var(--navy-dark);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.toc > p { margin: 0 0 15px; color: #b9d8eb; font-size: 13px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.toc nav { display: grid; }
.toc a {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  padding: 9px 8px;
  color: #e7f4fc;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.28;
  text-decoration: none;
}
.toc a:hover { background: rgba(255,255,255,.1); }
.toc a span { color: var(--sky-strong); font-size: 12px; }

.manual { min-width: 0; }
.chapter {
  position: relative;
  margin-bottom: 24px;
  padding: 58px 64px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 8px 30px rgba(8,59,116,.06);
}
.chapter-number {
  position: absolute;
  top: 21px;
  right: 30px;
  color: #d9eaf4;
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
}
.chapter h2 { max-width: 820px; margin: 0 0 24px; color: var(--navy); font-size: clamp(35px, 4vw, 55px); line-height: 1.08; letter-spacing: -.035em; }
.chapter h3 { margin: 40px 0 12px; color: var(--navy); font-size: 27px; line-height: 1.22; }
.chapter > p { max-width: 870px; color: #405467; }
.chapter p + p { margin-top: 14px; }

.principle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 34px 0;
}
.principle-grid div { display: grid; gap: 5px; padding: 22px; background: var(--soft); border-radius: 18px; }
.principle-grid strong { color: var(--navy); font-size: 19px; }
.principle-grid span { color: var(--muted); font-size: 15px; }

.callout { margin: 32px 0 0; padding: 24px 26px; background: var(--sky); border-left: 5px solid var(--blue); border-radius: 16px; }
.callout.warning { background: #fff1f4; border-left-color: var(--burgundy); }
.callout strong { color: var(--navy); font-size: 18px; }
.callout.warning strong { color: var(--burgundy-dark); }
.callout p { margin: 5px 0 0; color: #405467; }

.steps { display: grid; gap: 12px; padding: 0; margin: 32px 0; list-style: none; }
.steps li { display: grid; grid-template-columns: 46px 1fr; gap: 17px; align-items: start; padding: 20px; background: var(--soft); border-radius: 17px; }
.steps li > span { display: grid; width: 42px; height: 42px; place-items: center; color: white; background: var(--blue); border-radius: 50%; font-weight: 900; }
.steps strong { color: var(--navy); font-size: 18px; }
.steps p { margin: 2px 0 0; color: var(--muted); }

.screen { width: min(680px, 100%); margin: 32px auto; padding: 10px; background: var(--navy-dark); border-radius: 28px; box-shadow: var(--shadow); }
.screen img { width: 100%; border-radius: 20px; }
.screen.compact { width: min(560px, 100%); }
.screen.wide { width: min(800px, 100%); }
.screen.with-caption { padding-bottom: 0; }
.screen figcaption { padding: 15px 13px 18px; color: #d8e8f2; font-size: 13px; line-height: 1.45; }

.definition-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 32px 0; }
.definition-list div { padding: 21px; background: var(--soft); border: 1px solid var(--line); border-radius: 17px; }
.definition-list strong { color: var(--navy); font-size: 18px; }
.definition-list p { margin: 5px 0 0; color: var(--muted); font-size: 15px; }

.instruction-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 30px 0; }
.instruction-cards.two { grid-template-columns: 1fr 1fr; }
.instruction-cards div { padding: 21px; background: var(--navy); border-radius: 17px; }
.instruction-cards strong { color: white; font-size: 17px; }
.instruction-cards p { margin: 7px 0 0; color: #d6e9f6; font-size: 14px; }

.spending-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 30px 0; }
.spending-flow div { position: relative; padding: 24px 22px 22px 63px; background: var(--soft); border-radius: 18px; }
.spending-flow span { position: absolute; top: 20px; left: 18px; display: grid; width: 34px; height: 34px; place-items: center; color: white; background: var(--burgundy); border-radius: 50%; font-weight: 900; }
.spending-flow strong { color: var(--navy); font-size: 18px; }
.spending-flow p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

.plain-list { display: grid; gap: 9px; padding: 0; margin: 22px 0; list-style: none; }
.plain-list li { position: relative; padding-left: 28px; color: #405467; }
.plain-list li::before { content: "✓"; position: absolute; left: 0; color: var(--blue); font-weight: 900; }

.daily-routine { display: grid; gap: 12px; padding: 0; margin: 30px 0; list-style: none; }
.daily-routine li { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.daily-routine span { color: var(--burgundy); font-weight: 900; }
.daily-routine p { margin: 0; color: #405467; }

.finish { margin-top: 42px; padding: 34px; color: white; background: var(--burgundy-dark); border-radius: 23px; }
.finish h3 { margin: 0 0 8px; color: white; }
.finish p { margin: 0 0 20px; color: #f0d7dd; }
.finish a { display: inline-block; padding: 10px 15px; color: var(--navy); background: white; border-radius: 10px; font-size: 14px; font-weight: 800; text-decoration: none; }

footer {
  display: flex;
  min-height: 125px;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 30px max(24px, calc((100% - 1380px) / 2));
  color: white;
  background: var(--navy-dark);
}
.footer-brand { color: white; }
.footer-brand .brand-mark { background: var(--blue); }
footer p { margin: 0; color: #a9bfd2; font-size: 14px; }

@media (max-width: 1040px) {
  .intro { grid-template-columns: 1fr; padding: 54px; }
  .intro-image { width: min(580px, 100%); margin: 0 auto; }
  .manual-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc nav { grid-template-columns: repeat(3, 1fr); gap: 4px; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .topbar { height: 66px; padding: 0 14px; }
  .topbar-label { display: none; }
  .brand { font-size: 15px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .intro, .manual-layout { width: min(100% - 20px, 1380px); }
  .intro { min-height: 0; gap: 36px; margin-top: 10px; padding: 38px 20px 20px; border-radius: 24px; }
  h1 { font-size: 43px; }
  .intro-lead { font-size: 18px; }
  .intro-result { grid-template-columns: 1fr; gap: 4px; }
  .intro-image { border-radius: 21px; }
  .toc { padding: 20px 14px; border-radius: 20px; }
  .toc nav { grid-template-columns: 1fr 1fr; }
  .chapter { padding: 47px 20px 30px; border-radius: 22px; }
  .chapter-number { top: 17px; right: 18px; font-size: 42px; }
  .chapter h2 { font-size: 36px; }
  .chapter h3 { font-size: 24px; }
  .principle-grid, .definition-list, .instruction-cards, .instruction-cards.two, .spending-flow { grid-template-columns: 1fr; }
  .screen { padding: 7px; border-radius: 21px; }
  .screen img { border-radius: 15px; }
  .daily-routine li { grid-template-columns: 1fr; gap: 3px; padding: 17px 4px; }
  .finish { padding: 25px 20px; }
  footer { align-items: flex-start; flex-direction: column; gap: 12px; }
}

@media (max-width: 420px) {
  .toc nav { grid-template-columns: 1fr; }
  h1 { font-size: 39px; }
  .chapter h2 { font-size: 33px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Approved Word instruction */
.intro-copy>p {font-size:17px;line-height:1.65;} .intro h1{font-size:clamp(32px,4vw,52px);} .manual-list{padding-left:25px;} .manual-list li{margin:12px 0;} .chapter p{overflow-wrap:anywhere;} .chapter h3{font-size:23px;margin-top:30px;} .back-top{display:inline-block;margin:20px 0 40px;} .toc{max-height:calc(100vh - 100px);overflow:auto;} @media(max-width:1040px){.toc{max-height:none;overflow:visible;}} @media(max-width:720px){.chapter h2{font-size:30px;} .intro h1{font-size:34px;}}

/* Compact images with natural proportions */
img { height: auto; }
.intro-image { width: min(400px, 100%); height: auto; justify-self: center; align-self: center; object-fit: contain; }
.screen.compact { width: min(400px, 100%); }
.screen.button-menu { width: min(320px, 100%); }
.screen.budget-screen { width: min(420px, 100%); }
.screen.transition-screen { width: min(400px, 100%); }
.screen img { width: 100%; height: auto; object-fit: contain; }
@media (max-width: 720px) { .intro-image { width: min(320px, 100%); } }

/* Center chapter titles and remove screenshot frames */
.chapter h2 { text-align: center; margin-left: auto; margin-right: auto; }
.screen { background: transparent; padding: 0; border: 0; box-shadow: none; border-radius: 0; }
.screen img { border-radius: 0; }
.screen figcaption { color: var(--muted); padding: 12px 0 0; }

/* Floating return button */
.back-top { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 50; margin: 0; padding: 12px 18px; border-radius: 12px; background: var(--navy); color: white; font-size: 14px; font-weight: 600; text-decoration: none; box-shadow: 0 4px 16px rgba(8,59,116,.2); }
.back-top[hidden] { display: none; }
.back-top:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
footer { padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px)); }
@media(max-width:720px) { .back-top { right: 12px; padding: 11px 15px; } }

/* Underlined navigation links */
.back-top { left: 20px; right: auto; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--navy-dark); box-shadow: none; font-weight: 400; text-decoration: underline; text-underline-offset: 3px; }
.toc a { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 720px) { .back-top { left: 12px; right: auto; padding: 0; } }

/* Simple contents and translucent return button */
.toc a { display: block; }
.back-top { padding: 11px 16px; border-radius: 12px; background: rgba(173, 216, 245, .72); color: var(--navy-dark); font-weight: 700; text-decoration: underline; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
@media (max-width: 720px) { .back-top { padding: 10px 14px; } }

/* Softer return button */
.back-top { background: radial-gradient(ellipse at center, rgba(220, 239, 252, .5) 0%, rgba(220, 239, 252, .28) 55%, rgba(220, 239, 252, 0) 78%); border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }

/* Slightly clearer button contour and heading-blue label */
.back-top { color: var(--navy); border: 1px solid rgba(120, 174, 211, .32); box-shadow: 0 0 5px rgba(120, 174, 211, .10); }
