/* User guide: reader and administration. Colours come from the portal theme (app.css), so dark mode applies. */

.guide-reader { min-height: 100vh; background: var(--page); color: var(--ink); -webkit-user-select: none; user-select: none; }
.guide-reader input { -webkit-user-select: text; user-select: text; }
.guide-top {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .6rem 1.25rem;
    background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 4px 16px rgba(13, 27, 56, .05);
}
.guide-title { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.guide-title:hover { text-decoration: none; color: var(--primary-dark); }
.guide-book { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--accent-dark), var(--primary-dark)); }
.guide-search { flex: 1; min-width: 200px; max-width: 560px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--page); overflow: hidden; }
.guide-search input { border: 0 !important; background: transparent !important; outline: none; padding: .5rem 1rem; }
.guide-search button { border: 0; background: none; color: var(--primary); padding: 0 .9rem; cursor: pointer; display: grid; place-items: center; }
.guide-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-inline-start: auto; }
.guide-lang { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--page); border: 1px solid var(--line); }
.guide-lang a { padding: .25rem .8rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.guide-lang a:hover { text-decoration: none; color: var(--ink); }
.guide-lang a.active { background: var(--primary-dark); color: #fff; }

.guide-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1.25rem; align-items: start; padding: 1.25rem; max-width: 1500px; margin: 0 auto; }
.guide-toc {
    position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; padding: .7rem; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--line);
}
.guide-toc-head { font-size: .8rem; font-weight: 700; color: var(--muted); padding: .2rem .5rem .5rem; }
.guide-toc details { margin-bottom: .15rem; }
.guide-toc summary { list-style: none; display: flex; align-items: center; gap: .5rem; padding: .45rem .55rem; border-radius: 9px; cursor: pointer; }
.guide-toc summary::-webkit-details-marker { display: none; }
.guide-toc summary a { flex: 1; font-weight: 700; color: var(--ink); font-size: .92rem; }
.guide-toc summary:hover, .guide-toc summary.current { background: var(--primary-soft); }
.guide-toc summary.current a { color: var(--primary-dark); }
.guide-toc ul { list-style: none; margin: .1rem 0 .4rem; padding: 0; padding-inline-start: .8rem; border-inline-start: 2px solid var(--line); margin-inline-start: .7rem; }
.guide-toc ul ul { margin-top: .15rem; }
.guide-toc li a { display: block; padding: .3rem .55rem; border-radius: 7px; color: var(--muted); font-size: .87rem; line-height: 1.45; }
.guide-toc li a:hover { color: var(--ink); background: var(--primary-softer); text-decoration: none; }
.guide-toc li a.active { color: var(--primary-dark); background: var(--primary-soft); font-weight: 600; }
.guide-count { font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--chip-muted); border-radius: 999px; padding: .05rem .5rem; white-space: nowrap; }
.guide-toc-toggle { position: absolute; opacity: 0; pointer-events: none; }
.guide-toc-button { display: none; }

.guide-main { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem 1.75rem 2rem; }
.guide-main h1 { font-size: 1.6rem; margin: 0; }
.guide-crumbs { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .85rem; color: var(--muted); margin-bottom: .7rem; }
.guide-crumbs a { color: var(--primary-dark); }
.guide-headline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.guide-pager { display: flex; gap: .4rem; }
.guide-pager.bottom { justify-content: space-between; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.guide-lead { color: var(--muted); font-size: 1.02rem; margin: 0 0 1.2rem; }
.guide-hero { padding: .5rem 0 1rem; }
.guide-hero h1 { font-size: 1.9rem; margin-bottom: .6rem; }
.guide-hero p { color: var(--muted); max-width: 75ch; line-height: 1.8; margin: 0 0 .5rem; }
.guide-note { background: var(--primary-softer); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .8rem; display: inline-block; }

.guide-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; margin-top: 1rem; }
.guide-card {
    display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.1rem; border-radius: 14px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s;
}
.guide-card:hover { text-decoration: none; border-color: var(--primary); box-shadow: 0 10px 24px rgba(29, 79, 150, .1); transform: translateY(-2px); }
.guide-card b { font-size: 1.02rem; }
.guide-card small { color: var(--muted); line-height: 1.55; }
.guide-card .guide-count { align-self: flex-start; margin-top: .2rem; }

.guide-article { font-size: 1.03rem; line-height: 1.95; max-width: 85ch; }
.guide-article h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; color: var(--primary-dark); }
.guide-article p { margin: 0 0 .9rem; }
.guide-article ul { margin: 0 0 1rem; padding-inline-start: 1.3rem; }
.guide-article li { margin-bottom: .35rem; }
.guide-article li::marker { color: var(--primary); }
.guide-shot { margin: 1.5rem 0 1rem; }
.guide-shot img { width: 100%; max-width: 1100px; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(13, 27, 56, .12); pointer-events: none; }
.guide-shot figcaption { color: var(--muted); font-size: .8rem; margin-top: .5rem; }

.guide-results { display: flex; flex-direction: column; gap: .6rem; }
.guide-result { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
.guide-result:hover { text-decoration: none; border-color: var(--primary); background: var(--primary-softer); }
.guide-result small { color: var(--primary-dark); font-weight: 600; }
.guide-result span { color: var(--muted); font-size: .9rem; }
.guide-empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }

.guide-watermark { position: fixed; inset: 0; z-index: 40; pointer-events: none; background-image: var(--wm); background-repeat: repeat; }
.guide-print-block { display: none; }
@media print {
    .guide-reader > *:not(.guide-print-block) { display: none !important; }
    .guide-print-block { display: block !important; padding: 3rem; font-size: 1.3rem; text-align: center; }
}

@media (max-width: 900px) {
    .guide-body { grid-template-columns: 1fr; padding: .75rem; }
    .guide-toc-button {
        display: inline-flex; align-items: center; gap: .4rem; justify-self: start; padding: .45rem .9rem; border-radius: 999px;
        border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600;
    }
    .guide-toc { display: none; position: static; max-height: none; }
    .guide-toc-toggle:checked ~ .guide-toc { display: block; }
    .guide-main { padding: 1.1rem 1rem 1.5rem; }
    .guide-main h1 { font-size: 1.3rem; }
}

/* ---------- guide administration ---------- */
.guide-admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.guide-admin-head p { color: var(--muted); max-width: 90ch; margin: .3rem 0 0; }
.code-text { font-family: Consolas, "Courier New", monospace; font-weight: 700; letter-spacing: 1px; direction: ltr; }
.code-opens { display: flex; flex-wrap: wrap; gap: .25rem; max-width: 420px; }
.row-ended td { opacity: .6; }
.scope-part { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; margin-bottom: .6rem; }
.scope-part.restricted { border-style: dashed; background: var(--warn-soft); }
.scope-part-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-weight: 700; }
.scope-sections { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin: .5rem 0 .2rem; padding-top: .5rem; border-top: 1px dashed var(--line); }
.scope-sections .check { padding: 0; font-size: .9rem; }
.guide-tree-part { border: 1px solid var(--line); border-radius: 12px; margin-bottom: .6rem; background: var(--surface); }
.guide-tree-part > summary { list-style: none; display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; cursor: pointer; }
.guide-tree-part > summary::-webkit-details-marker { display: none; }
.guide-tree-part > summary b { flex: 1; }
.guide-tree-part > summary small { color: var(--muted); }
.guide-tree-body { padding: 0 .9rem .8rem; }
.guide-tree-section { border-top: 1px solid var(--line); padding: .6rem 0; }
.guide-tree-section-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.guide-tree-section-head b { flex: 1; }
.guide-tree-screens { list-style: none; margin: .4rem 0 0; padding: 0; padding-inline-start: 1rem; }
.guide-tree-screens li { display: flex; align-items: center; gap: .5rem; padding: .25rem 0; }
.guide-tree-screens li span { flex: 1; }
.guide-tree-screens .thumb { width: 54px; height: 34px; }
.mini-actions { display: flex; gap: .25rem; }
.mini-actions .btn { padding: .15rem .45rem; font-size: .8rem; }

/* Help button in the portal's top bar: opens the guide page for the current screen. */
.help-btn {
    display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; font-weight: 800; font-size: 1.1rem;
    color: #fff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22);
}
.help-btn:hover { background: rgba(255, 255, 255, .16); text-decoration: none; }
