/* Title layout owns its typography and footer across all screen sizes. */
.title-screen {
  --title-label: 14px;
  --title-caption: 12px;
  --title-ink: #40553d;
  --title-muted: #666b53;
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #faf2dc;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
.title-art { position: relative; grid-area: 1 / 1; min-height: 0; pointer-events: none; mask-image: linear-gradient(90deg, transparent 20%, #000 42%); }
.title-art img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; object-position: right bottom; }
.title-shade {
  background: linear-gradient(90deg, #fff9e9e8 0%, #fff9e9b8 31%, #fff9e900 60%),
    linear-gradient(0deg, #faf2dce8 0%, #faf2dc00 23%);
}
.title-copy {
  position: relative; grid-area: 1 / 1; inset: auto; align-self: center;
  margin: 70px 0 20px 6%; width: 44%;
}
.title-copy h1 { font-size: clamp(42px, 5.5vw, 82px); letter-spacing: -.04em; }
.title-copy .eyebrow { color: #63774e; }
.title-screen .subtitle { color: #536545; margin-bottom: 24px; }
.title-screen .subtitle small { color: var(--title-muted); line-height: 1.8; }
.title-screen .adventure-actions { max-width: 330px; gap: 8px; }
.title-screen .adventure-actions:has(#continueBtn:not(.hidden)) #startBtn {
  font-size: var(--title-label); min-height: 32px; line-height: 1.5; padding: 4px 0;
  color: var(--title-muted); font-weight: 400;
}
.title-screen .save-summary {
  color: var(--title-muted); font-size: var(--title-caption); line-height: 1.6;
  margin: 8px 0 0; font-variant-numeric: tabular-nums;
}
.title-footer {
  position: relative; grid-area: 2 / 1; z-index: 3; padding: 10px 6% 20px;
  background: linear-gradient(0deg, #faf2dc 0%, #faf2dcf5 60%, #faf2dcd9 100%);
  border-top: 1px solid #c8bea15c;
}
.title-footer-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.title-footer .title-links { display: flex; align-items: center; gap: 28px; margin: 0; }
.title-footer .title-links a, .title-footer .title-links .text-btn {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px;
  color: var(--title-ink); font: inherit; font-size: var(--title-label);
  font-weight: 600; line-height: 1.5; letter-spacing: 0; margin: 0; padding: 0;
  text-decoration: none; background: none; white-space: nowrap;
}
.title-footer .title-links span { margin: 0; color: #7c8267; font-size: var(--title-caption); }
.title-footer .title-links a:hover, .title-footer .title-links button:hover { color: #277064; }
.title-footer .micro-copy { display: block; margin: 0; color: var(--title-muted); font-size: var(--title-caption); line-height: 1.5; white-space: nowrap; }
.title-footer .chapter-route {
  position: static; inset: auto; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 16px; margin: 0; padding: 0;
}
.title-footer .chapter-route::before { content: none; }
.title-footer .chapter-route li {
  display: flex; align-items: baseline; justify-content: flex-start; gap: 8px;
  min-width: 0; padding-top: 10px; border-top: 2px solid #d8d0b9; color: var(--title-muted);
}
.title-footer .chapter-route b {
  display: inline; width: auto; height: auto; padding: 0; border: 0; border-radius: 0;
  background: none; box-shadow: none; color: inherit; font-family: inherit;
  font-size: var(--title-caption); font-weight: 500; line-height: 1.5; font-variant-numeric: tabular-nums;
}
.title-footer .chapter-route span { color: inherit; font-size: var(--title-label); font-weight: 400; line-height: 1.5; }
.title-footer .chapter-route .completed { border-color: #9bad82; }
.title-footer .chapter-route .current { border-color: #bc8a2f; color: #5c542b; }
.title-footer .chapter-route .current span { font-weight: 700; }
.title-top { left: 6%; right: 5%; }
.brand { color: #4e6445; }

@media (max-width: 1100px) and (orientation: landscape) {
  .title-copy { margin-top: 58px; margin-bottom: 14px; width: 47%; }
  .title-copy h1 { margin-bottom: 12px; }
  .title-screen .subtitle { margin-bottom: 18px; }
  .title-footer { padding-top: 6px; padding-bottom: 14px; }
  .title-footer-top { margin-bottom: 6px; }
  .title-footer .chapter-route { gap: 12px; }
  .title-footer .chapter-route li { gap: 6px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .title-screen { --title-label: 12px; --title-caption: 11px; }
  .title-copy { margin-top: 48px; margin-bottom: 10px; }
  .title-copy h1 { font-size: clamp(32px, 5vw, 54px); margin-bottom: 8px; }
  .title-screen .subtitle { margin-bottom: 10px; line-height: 1.6; }
  .title-screen .adventure-actions { max-width: 280px; gap: 3px; }
  .title-screen .adventure-actions:has(#continueBtn:not(.hidden)) #startBtn { min-height: 24px; padding: 2px 0; }
  .title-screen .save-summary { margin-top: 4px; }
  .title-footer { padding-top: 2px; padding-bottom: 10px; }
  .title-footer .title-links a, .title-footer .title-links .text-btn { min-height: 30px; }
  .title-footer-top { margin-bottom: 4px; }
  .title-footer .chapter-route li { padding-top: 6px; }
}

@media (max-width: 700px) and (orientation: portrait) {
  .stage:has(.title-screen:not(.hidden)) { height: auto; min-height: 100dvh; }
  .title-screen { position: relative; display: block; min-height: 100dvh; padding-top: 1px; }
  .title-art { position: absolute; inset: 0; height: min(100%, 178vw); mask-image: none; }
  .title-art img { object-fit: cover; object-position: center top; }
  .title-shade { background: linear-gradient(0deg, #faf2dc 0%, #faf2dc 13%, #faf2dc00 62%); }
  .title-top { top: max(20px, env(safe-area-inset-top)); left: 22px; right: 22px; }
  /* The portrait scene ends just below one viewport width; keep copy below its feet. */
  .title-copy { position: relative; inset: auto; width: auto; margin: 100vw 24px 30px; text-align: center; }
  .title-copy h1 { font-size: clamp(36px, 10.8vw, 60px); margin-bottom: 10px; }
  .title-copy .eyebrow { justify-content: center; font-size: 10px; }
  .title-screen .subtitle { font-size: 15px; margin-bottom: 18px; }
  .title-screen .subtitle small { display: inline-block; max-width: 290px; font-size: 12px; }
  .title-screen .adventure-actions { margin: 0 auto; align-items: center; }
  .title-screen .adventure-actions:has(#continueBtn:not(.hidden)) #startBtn { align-self: center; min-height: 36px; }
  .title-footer { padding: 12px 24px max(24px, env(safe-area-inset-bottom)); }
  .title-footer-top { flex-direction: column; gap: 2px; margin-bottom: 18px; }
  .title-footer .title-links { justify-content: center; gap: 22px; }
  .title-footer .title-links a, .title-footer .title-links .text-btn { min-height: 44px; }
  .title-footer .chapter-route { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 10px; }
  .title-footer .chapter-route li { display: grid; justify-items: start; gap: 2px; padding-top: 6px; }
}

@media (max-width: 360px) and (orientation: portrait) {
  .title-copy { margin: 100vw 20px 26px; }
  .title-copy h1 { font-size: 36px; }
  .title-top { left: 18px; right:18px; }
  .title-screen .subtitle { font-size: 14px; }
  .title-footer { padding-left: 20px; padding-right: 20px; }
  .title-footer .title-links { gap: 18px; }
}
