/* In-app guide and contextual help entry points. */
@layer rs-normal, rs-inline, rs-priority;
@layer rs-normal {
  :root {
    color-scheme: dark;
    --manual-bg: #070a0e;
    --manual-panel: rgba(16, 17, 18, .96);
    --manual-panel-soft: rgba(27, 24, 20, .94);
    --manual-line: rgba(217, 171, 76, .42);
    --manual-line-soft: rgba(217, 171, 76, .20);
    --manual-gold: #f0d584;
    --manual-gold-deep: #9b7133;
    --manual-text: #f5edd8;
    --manual-muted: #c5baa3;
    --manual-blue: #8dc8f3;
    --manual-red: #c64539;
    --manual-green: #63c68e;
    --manual-safe-top: max(env(safe-area-inset-top), 14px);
    --manual-safe-bottom: max(env(safe-area-inset-bottom), 18px);
  }

  .manual-page,
  .manual-page * {
    box-sizing: border-box;
  }

  body.manual-page {
    min-width: 0;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--manual-text);
    background:
      radial-gradient(circle at 14% 7%, rgba(70, 113, 166, .20), transparent 24rem),
      radial-gradient(circle at 88% 22%, rgba(155, 93, 43, .18), transparent 25rem),
      linear-gradient(180deg, rgba(4, 7, 10, .96), rgba(10, 11, 12, .91)),
      url('./assets/app_bg.webp') center / cover fixed no-repeat;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", "Noto Sans JP", sans-serif;
  }

  body.manual-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(3, 5, 8, .22), rgba(3, 5, 8, .72));
  }

  .manual-page [hidden] {
    display: none;
  }

  .manual-page a,
  .manual-page button {
    -webkit-tap-highlight-color: transparent;
  }

  .manual-page a:focus-visible,
  .manual-page button:focus-visible,
  .manual-page summary:focus-visible,
  .manual-page [tabindex="-1"]:focus-visible {
    outline: 3px solid #9bd5ff;
    outline-offset: 3px;
  }

  .manual-shell {
    width: min(920px, 100%);
    margin: 0 auto;
    padding: calc(var(--manual-safe-top) + 4px) 13px calc(var(--manual-safe-bottom) + 22px);
  }

  .manual-hero,
  .manual-section,
  .manual-footer {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--manual-line);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(27, 24, 20, .98), rgba(8, 10, 12, .98));
    box-shadow: 0 15px 36px rgba(0, 0, 0, .38), inset 0 0 0 1px rgba(255, 230, 167, .035);
  }

  .manual-hero::after,
  .manual-section::after,
  .manual-footer::after {
    content: "";
    position: absolute;
    inset: 5px;
    z-index: 0;
    border: 1px solid rgba(239, 204, 121, .055);
    border-radius: 12px;
    pointer-events: none;
  }

  .manual-hero > *,
  .manual-section > *,
  .manual-footer > * {
    position: relative;
    z-index: 1;
  }

  .manual-hero {
    padding: 23px 18px 19px;
    text-align: center;
    background:
      linear-gradient(180deg, rgba(20, 28, 38, .84), rgba(10, 11, 12, .96)),
      url('./assets/app_bg.webp') center / cover no-repeat;
  }

  .manual-hero::before {
    content: "";
    position: absolute;
    left: 14%;
    right: 14%;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #d2a44d, transparent);
    opacity: .78;
  }

  .manual-kicker,
  .manual-section-kicker {
    color: #bda77f;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .16em;
  }

  .manual-hero h1 {
    margin: 6px 0 8px;
    color: #fff8e8;
    font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
    font-size: clamp(25px, 7vw, 38px);
    line-height: 1.3;
    text-shadow: 0 2px 0 #000, 0 0 18px rgba(224, 181, 84, .14);
  }

  .manual-hero p,
  .manual-footer p {
    max-width: 700px;
    margin: 0 auto;
    color: var(--manual-muted);
    font-size: 14px;
    line-height: 1.8;
  }

  .manual-hero-actions,
  .manual-action-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px;
    margin-top: 16px;
  }

  .manual-back-button,
  .manual-home-button,
  .manual-primary-link,
  .manual-secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 0;
    padding: 0 16px;
    border: 1px solid rgba(240, 213, 132, .50);
    border-radius: 12px;
    color: #fff8e8;
    background: linear-gradient(180deg, rgba(155, 113, 51, .86), rgba(83, 51, 23, .94));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .13), 0 7px 16px rgba(0, 0, 0, .25);
    font: inherit;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
  }

  .manual-home-button,
  .manual-secondary-link {
    border-color: rgba(141, 200, 243, .36);
    color: #e6f5ff;
    background: linear-gradient(180deg, rgba(49, 91, 143, .88), rgba(20, 44, 74, .96));
  }

  .manual-toc {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 7px;
    margin: 10px 0;
    padding: 9px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    border: 1px solid rgba(217, 171, 76, .35);
    border-radius: 14px;
    background: rgba(6, 8, 10, .94);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
  }

  .manual-toc a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(217, 171, 76, .25);
    border-radius: 10px;
    color: #efe4cd;
    background: rgba(33, 29, 24, .90);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
  }

  .manual-section {
    margin-top: 12px;
    padding: 18px;
    scroll-margin-top: 72px;
  }

  .manual-section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--manual-line-soft);
  }

  .manual-section-number {
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border: 1px solid rgba(240, 213, 132, .44);
    border-radius: 13px;
    color: var(--manual-gold);
    background: linear-gradient(180deg, rgba(111, 75, 31, .48), rgba(32, 23, 15, .80));
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
    font-weight: 900;
  }

  .manual-section h2 {
    margin: 2px 0 0;
    color: #fff8e8;
    font-size: clamp(20px, 5vw, 27px);
    line-height: 1.35;
  }

  .manual-lead {
    margin: 0 0 13px;
    color: var(--manual-muted);
    font-size: 14px;
    line-height: 1.8;
  }

  .manual-step-list {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .manual-step-list li {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--manual-line-soft);
    border-radius: 13px;
    background: rgba(255, 255, 255, .025);
  }

  .manual-step-number {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #1b1408;
    background: linear-gradient(180deg, #f3dc99, #bd8938);
    font-weight: 1000;
  }

  .manual-step-list strong {
    display: block;
    color: #fff5db;
    font-size: 15px;
    line-height: 1.5;
  }

  .manual-step-list p,
  .manual-detail-body p,
  .manual-detail-body li {
    color: var(--manual-muted);
    font-size: 13px;
    line-height: 1.75;
  }

  .manual-step-list p {
    margin: 3px 0 0;
  }

  .manual-details-grid,
  .manual-faq-list {
    display: grid;
    gap: 9px;
  }

  .manual-page details {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--manual-line-soft);
    border-radius: 13px;
    background: rgba(8, 10, 12, .72);
  }

  .manual-page summary {
    position: relative;
    min-height: 48px;
    padding: 13px 42px 12px 13px;
    color: #f7ecd3;
    background: linear-gradient(90deg, rgba(105, 70, 28, .20), transparent 75%);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.55;
    cursor: pointer;
    list-style: none;
  }

  .manual-page summary::-webkit-details-marker {
    display: none;
  }

  .manual-page summary::after {
    content: "+";
    position: absolute;
    top: 50%;
    right: 13px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    transform: translateY(-50%);
    border: 1px solid rgba(240, 213, 132, .38);
    border-radius: 50%;
    color: var(--manual-gold);
    font-size: 18px;
    line-height: 1;
  }

  .manual-page details[open] > summary::after {
    content: "−";
  }

  .manual-detail-body {
    padding: 12px 13px 14px;
    border-top: 1px solid var(--manual-line-soft);
  }

  .manual-detail-body p {
    margin: 0;
  }

  .manual-detail-body p + p {
    margin-top: 9px;
  }

  .manual-detail-body ul,
  .manual-detail-body ol {
    display: grid;
    gap: 7px;
    margin: 0;
    padding-left: 1.35em;
  }

  .manual-callout {
    margin-top: 13px;
    padding: 13px 14px;
    border: 1px solid rgba(86, 166, 218, .35);
    border-radius: 13px;
    color: #d8ecf9;
    background: rgba(31, 80, 115, .20);
    font-size: 13px;
    line-height: 1.75;
  }

  .manual-callout strong {
    color: #a9dcff;
  }

  .manual-callout-warn {
    border-color: rgba(222, 157, 72, .44);
    color: #f1dfbd;
    background: rgba(117, 66, 25, .20);
  }

  .manual-callout-warn strong {
    color: #ffd990;
  }

  .manual-definition-list,
  .manual-glossary {
    display: grid;
    gap: 8px;
    margin: 0;
  }

  .manual-definition-list > div,
  .manual-glossary > div {
    display: grid;
    grid-template-columns: minmax(108px, .34fr) minmax(0, 1fr);
    gap: 12px;
    padding: 10px 11px;
    border: 1px solid rgba(217, 171, 76, .16);
    border-radius: 11px;
    background: rgba(255, 255, 255, .022);
  }

  .manual-definition-list dt,
  .manual-glossary dt {
    color: #ffe5a5;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.65;
  }

  .manual-definition-list dd,
  .manual-glossary dd {
    margin: 0;
    color: var(--manual-muted);
    font-size: 13px;
    line-height: 1.7;
  }

  .manual-formula {
    margin: 10px 0;
    padding: 12px;
    overflow-wrap: anywhere;
    border: 1px solid rgba(141, 200, 243, .28);
    border-radius: 11px;
    color: #dcedf9;
    background: rgba(35, 72, 104, .20);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.7;
  }

  .manual-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 10px;
  }

  .manual-compare-grid article {
    min-width: 0;
    padding: 13px;
    border: 1px solid rgba(217, 171, 76, .24);
    border-radius: 13px;
    background: linear-gradient(180deg, rgba(94, 60, 25, .26), rgba(9, 11, 13, .76));
  }

  .manual-compare-grid article:last-child {
    border-color: rgba(93, 174, 226, .28);
    background: linear-gradient(180deg, rgba(31, 82, 119, .25), rgba(9, 11, 13, .76));
  }

  .manual-compare-grid span,
  .manual-compare-grid strong {
    display: block;
  }

  .manual-compare-grid span {
    color: #ffe2a2;
    font-size: 12px;
    font-weight: 900;
  }

  .manual-compare-grid article:last-child span {
    color: #a9dcff;
  }

  .manual-compare-grid strong {
    margin-top: 5px;
    color: #fff8e8;
    font-size: 15px;
  }

  .manual-compare-grid p {
    margin: 5px 0 0;
    color: var(--manual-muted);
    font-size: 12px;
    line-height: 1.65;
  }

  .manual-controls {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin-bottom: 9px;
  }

  .manual-controls button {
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(217, 171, 76, .28);
    border-radius: 10px;
    color: #eadfc8;
    background: rgba(40, 34, 27, .88);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
  }

  .manual-footer {
    margin-top: 12px;
    padding: 18px;
    text-align: center;
  }

  .manual-home-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    margin-top: 14px;
    padding: 16px;
    overflow: hidden;
    border: 1px solid rgba(217, 171, 76, .50);
    border-radius: 18px;
    color: #f5edd8;
    background: linear-gradient(135deg, rgba(45, 55, 71, .96), rgba(19, 17, 15, .98));
    box-shadow: 0 13px 30px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .07);
  }

  .manual-home-card::before {
    content: "?";
    position: absolute;
    right: 116px;
    bottom: -30px;
    color: rgba(240, 213, 132, .055);
    font: 900 130px/1 system-ui, sans-serif;
    pointer-events: none;
  }

  .manual-home-card > * {
    position: relative;
    z-index: 1;
  }

  .manual-home-card-kicker {
    color: #d9c18a;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
  }

  .manual-home-card h2 {
    margin: 4px 0 5px;
    color: #fff8e8;
    font-size: 20px;
    line-height: 1.4;
  }

  .manual-home-card p {
    margin: 0;
    color: #c5baa3;
    font-size: 13px;
    line-height: 1.7;
  }

  .manual-home-card a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 15px;
    border: 1px solid rgba(240, 213, 132, .52);
    border-radius: 12px;
    color: #fff8e8;
    background: linear-gradient(180deg, #a3372d, #681d1c);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 7px 15px rgba(0, 0, 0, .22);
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
  }

  .rs-manual-shortcut {
    position: relative;
    z-index: 8;
    display: flex;
    justify-content: flex-end;
    width: min(1040px, 100%);
    margin: 7px auto 0;
    padding: 0 13px;
  }

  .rs-manual-shortcut a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    max-width: 100%;
    padding: 0 13px;
    border: 1px solid rgba(217, 171, 76, .42);
    border-radius: 999px;
    color: #f6e9cb;
    background: linear-gradient(180deg, rgba(53, 46, 37, .97), rgba(16, 17, 18, .98));
    box-shadow: 0 7px 16px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .06);
    font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans JP", sans-serif;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.25;
    text-decoration: none;
  }

  .rs-manual-shortcut a::before {
    content: "?";
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-right: 7px;
    border-radius: 50%;
    color: #211708;
    background: linear-gradient(180deg, #f2d98e, #b98638);
    font-size: 13px;
    font-weight: 1000;
  }

  .rs-manual-shortcut a:focus-visible,
  .manual-home-card a:focus-visible {
    outline: 3px solid #9bd5ff;
    outline-offset: 3px;
  }

  @media (hover: hover) {
    .manual-back-button:hover,
    .manual-home-button:hover,
    .manual-primary-link:hover,
    .manual-secondary-link:hover,
    .manual-home-card a:hover,
    .rs-manual-shortcut a:hover,
    .manual-toc a:hover,
    .manual-controls button:hover {
      filter: brightness(1.10);
    }
  }

  @media (max-width: 560px) {
    .manual-shell {
      padding-inline: 9px;
    }

    .manual-hero,
    .manual-section,
    .manual-footer {
      border-radius: 15px;
    }

    .manual-hero,
    .manual-section {
      padding: 15px 13px;
    }

    .manual-hero-actions,
    .manual-action-row {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .manual-back-button,
    .manual-home-button,
    .manual-primary-link,
    .manual-secondary-link {
      width: 100%;
      padding-inline: 10px;
      font-size: 13px;
    }

    .manual-definition-list > div,
    .manual-glossary > div {
      grid-template-columns: 1fr;
      gap: 3px;
    }

    .manual-compare-grid {
      grid-template-columns: 1fr;
    }

    .manual-home-card {
      grid-template-columns: 1fr;
      gap: 11px;
      margin-top: 12px;
      padding: 14px;
    }

    .manual-home-card::before {
      right: 4px;
    }

    .manual-home-card a {
      width: 100%;
    }

    .rs-manual-shortcut {
      padding-inline: 9px;
    }
  }

  @media (max-width: 370px) {
    .manual-hero-actions,
    .manual-action-row {
      grid-template-columns: 1fr;
    }

    .manual-section-heading {
      gap: 9px;
    }

    .manual-section-number {
      width: 40px;
      height: 40px;
      flex-basis: 40px;
    }

    .manual-controls {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
}
