:root {
    --fh-canvas: #fff8ec;
    --fh-wood: #f2c58f;
    --fh-teal: #126a70;
    --fh-aqua: #35afc2;
    --fh-coral: #dc5663;
    --fh-sun: #e9b63f;
    --fh-leaf: #319466;
    --fh-ink: #263238;
    --fh-line: #e8dccb;
}

html { scroll-behavior: smooth; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
*, *::before, *::after { box-sizing: border-box; }
button, a, input, textarea, summary { outline-offset: 3px; }
:focus-visible { outline: 3px solid rgba(18, 106, 112, .42); }

.fh-skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 100;
    transform: translateY(-150%);
    border-radius: 6px;
    background: #fff;
    color: var(--fh-teal);
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 800;
}
.fh-skip-link:focus { transform: translateY(0); }
.fh-input-invalid { border-color: var(--fh-coral) !important; background: #fff1f2 !important; }

/* Dynamic level range controls and AJAX cards. */
.level-tabs-collapse { --level-tabs-collapsed-height: 100px; }
.level-tabs-panel { overflow: hidden; transition: max-height .2s ease; }
.level-tabs-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.level-range-tab,
.level-tabs-toggle {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--fh-line);
    border-radius: 6px;
    background: #fff;
    color: #475569;
    padding: 8px 13px;
    font-size: 12px;
    font-weight: 800;
}
.level-range-tab:hover { border-color: var(--fh-teal); color: var(--fh-teal); }
.level-range-tab.active { border-color: var(--fh-teal); background: var(--fh-teal); color: #fff; }
.level-tabs-toggle { margin-top: 10px; color: var(--fh-teal); }
.level-tabs-collapse.is-expanded .level-tabs-toggle i { transform: rotate(180deg); }

.fh-level-card { min-width: 0; }
.fh-level-card-link { display: block; height: 100%; border: 1px solid var(--fh-line); background: #fff; color: inherit; text-decoration: none; }
.fh-level-card-link:hover { border-color: var(--fh-teal); }
.fh-level-thumb { position: relative; aspect-ratio: 1; overflow: hidden; background: #f7f3ec; }
.fh-level-thumb img { width: 100%; height: 100%; object-fit: contain; }
.fh-level-number { position: absolute; bottom: 8px; left: 8px; border-radius: 4px; background: var(--fh-ink); color: #fff; padding: 4px 8px; font-size: 11px; font-weight: 800; }
.fh-level-card-body { padding: 12px; }
.fh-level-card-body h2 { color: var(--fh-ink); font-size: 14px; font-weight: 800; }
.fh-level-guide-types { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 7px; color: #64748b; font-size: 11px; font-weight: 700; }
.fh-level-guide-types span { display: inline-flex; align-items: center; gap: 4px; }
.fh-level-guide-types span:first-child i { color: var(--fh-coral); }
.fh-level-thumb-missing img { display: none; }
.fh-level-thumb-missing::after { position: absolute; inset: 0; display: grid; place-items: center; color: #94a3b8; content: "Preview unavailable"; font-size: 11px; font-weight: 700; }
#levels-grid { position: relative; }
#levels-grid.fh-is-loading { min-height: 220px; opacity: .55; pointer-events: none; }
#levels-grid.fh-is-loading::after { position: absolute; inset: 0; display: grid; place-items: center; color: var(--fh-teal); content: "Loading walkthroughs…"; font-size: 13px; font-weight: 800; }
.fh-empty-state { grid-column: 1 / -1; border: 1px solid var(--fh-line); background: #fff; padding: 42px 20px; text-align: center; }
.fh-empty-state > i { color: var(--fh-teal); font-size: 26px; }
.fh-empty-state h2 { margin-top: 12px; color: var(--fh-ink); font-size: 18px; font-weight: 800; }
.fh-empty-state p { margin-top: 5px; color: #64748b; font-size: 13px; }

.fh-pagination .pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.fh-pagination .pagination li > a,
.fh-pagination .pagination li > span { display: grid; min-width: 40px; min-height: 40px; place-items: center; border: 1px solid var(--fh-line); border-radius: 5px; background: #fff; color: #475569; padding: 6px 10px; font-size: 12px; font-weight: 800; }
.fh-pagination .pagination .active > span { border-color: var(--fh-teal); background: var(--fh-teal); color: #fff; }
.fh-pagination .pagination .disabled > span { background: #f8fafc; color: #94a3b8; }

/* FAQ and editorial copy. */
.fh-faq-list details { border-bottom: 1px solid var(--fh-line); }
.fh-faq-list summary { display: flex; min-height: 58px; cursor: pointer; list-style: none; align-items: center; justify-content: space-between; gap: 18px; color: var(--fh-ink); font-size: 15px; font-weight: 800; }
.fh-faq-list summary::-webkit-details-marker { display: none; }
.fh-faq-list summary i { color: var(--fh-teal); transition: transform .18s ease; }
.fh-faq-list details[open] summary i { transform: rotate(45deg); }
.fh-faq-list details p { max-width: 760px; padding: 0 36px 18px 0; color: #64748b; font-size: 14px; line-height: 1.65; }

.fh-prose { min-width: 0; color: #475569; font-size: 15px; line-height: 1.75; }
.fh-prose > section + section { margin-top: 34px; padding-top: 30px; border-top: 1px solid var(--fh-line); }
.fh-prose h2 { margin-bottom: 12px; color: var(--fh-ink); font-size: 22px; font-weight: 900; letter-spacing: -.02em; line-height: 1.25; }
.fh-prose p + p { margin-top: 12px; }
.fh-prose ul { margin-top: 12px; padding-left: 20px; list-style: disc; }
.fh-prose li + li { margin-top: 7px; }
.fh-prose a { color: var(--fh-teal); font-weight: 800; text-decoration: underline; }
.fh-legal-content section { scroll-margin-top: 96px; }
.fh-legal-nav a { display: block; border-top: 1px solid var(--fh-line); color: #475569; padding: 9px 0; font-size: 12px; font-weight: 700; }
.fh-legal-nav a:hover { color: var(--fh-teal); }

/* Walkthrough state controls. */
.video-tab,
.guide-mode-tab {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--fh-line);
    border-radius: 6px;
    background: #fff;
    color: #475569;
    padding: 9px 13px;
    font-size: 12px;
    font-weight: 800;
}
.fh-video-tab-idle:hover,
.guide-mode-tab:hover { border-color: var(--fh-teal); color: var(--fh-teal); }
.fh-video-tab-active,
.guide-mode-tab.is-active { border-color: var(--fh-teal); background: var(--fh-teal); color: #fff; }
.guide-mode-tabs { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--fh-line); padding-bottom: 14px; }

/* Comments and uploads need stable selectors for dynamically inserted content. */
.fh-field { position: relative; }
.fh-field label,
.fh-field-label { display: block; margin-bottom: 6px; color: var(--fh-ink); font-size: 12px; font-weight: 800; }
.fh-field label span { color: var(--fh-coral); }
.fh-field small,
.fh-field-label small { color: #64748b; font-weight: 600; }
.fh-field input[type="text"],
.fh-field textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: var(--fh-ink); padding: 11px 12px; font-size: 14px; }
.fh-field textarea { min-height: 100px; resize: vertical; }
.fh-field input:focus,
.fh-field textarea:focus { border-color: var(--fh-teal); box-shadow: 0 0 0 2px rgba(18, 106, 112, .15); outline: 0; }
.fh-char-count { margin-top: 4px; color: #64748b; text-align: right; font-size: 11px; }
.char-count.is-over-limit { color: var(--fh-coral); font-weight: 800; }
.fh-upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fh-upload-button { display: inline-flex !important; min-height: 40px; cursor: pointer; align-items: center; gap: 8px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: var(--fh-teal) !important; padding: 8px 12px; font-size: 12px; font-weight: 800; }
.fh-upload-button:hover { border-color: var(--fh-teal); }
.image-file-name { color: #64748b; font-size: 12px; }
.image-preview { margin-top: 10px; }
.image-preview img { display: block; max-width: 180px; max-height: 150px; border: 1px solid var(--fh-line); object-fit: contain; }
.image-preview button { margin-top: 6px; color: var(--fh-coral); font-size: 11px; font-weight: 800; }
.comment-error,
.fh-success-message { margin-top: 12px; border-left: 4px solid var(--fh-coral); background: #fff1f2; color: #9f1239; padding: 10px 12px; font-size: 12px; font-weight: 700; }
.fh-success-message { border-color: var(--fh-leaf); background: #ecfdf5; color: #166534; }

.fh-comment-item { border: 1px solid var(--fh-line); background: #fff; padding: 16px; }
.comments-stack > .fh-comment-item + .fh-comment-item { margin-top: 16px; }
.fh-comment-meta { display: flex; align-items: center; gap: 10px; }
.fh-avatar { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--fh-teal); color: #fff; font-size: 13px; font-weight: 900; }
.fh-avatar-small { width: 30px; height: 30px; background: #64748b; font-size: 11px; }
.fh-comment-meta strong { display: block; color: var(--fh-ink); font-size: 13px; }
.fh-comment-meta strong em { color: #64748b; font-style: normal; font-weight: 600; }
.fh-comment-meta time { display: flex; align-items: center; gap: 5px; margin-top: 2px; color: #94a3b8; font-size: 10px; }
.fh-comment-text { margin-top: 13px; color: #475569; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.fh-comment-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fh-comment-actions button { display: inline-flex; min-height: 34px; align-items: center; gap: 5px; border: 1px solid var(--fh-line); border-radius: 5px; background: #fff; color: #64748b; padding: 5px 9px; font-size: 11px; font-weight: 800; }
.fh-comment-actions button:hover,
.fh-comment-actions .fh-vote-active { border-color: var(--fh-teal); color: var(--fh-teal); }
.fh-comment-image { display: inline-block; margin-top: 12px; }
.fh-comment-image img { max-width: 240px; max-height: 210px; border: 1px solid var(--fh-line); object-fit: contain; }
.replies-list { margin: 15px 0 0 26px; border-left: 3px solid #b8d9d6; padding-left: 13px; }
.fh-reply-item { padding: 13px 0; }
.fh-reply-item + .fh-reply-item { border-top: 1px solid var(--fh-line); }
.reply-form-container { margin-top: 14px; border-top: 1px solid var(--fh-line); background: var(--fh-canvas); padding: 14px; }
.reply-form-container > p { margin-bottom: 12px; color: #64748b; font-size: 11px; }
.reply-form .fh-field + .fh-field { margin-top: 12px; }
.reply-form .fh-upload-row { margin-top: 12px; }
.fh-inline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fh-inline-actions button { min-height: 38px; border: 1px solid var(--fh-teal); border-radius: 5px; background: var(--fh-teal); color: #fff; padding: 7px 12px; font-size: 11px; font-weight: 800; }
.fh-inline-actions .cancel-reply-btn { border-color: #cbd5e1; background: #fff; color: #475569; }
.fh-toast { position: fixed; right: 18px; bottom: 18px; z-index: 90; border-radius: 6px; background: var(--fh-ink); color: #fff; padding: 11px 15px; font-size: 12px; font-weight: 800; }

.image-lightbox { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; background: rgba(15, 23, 42, .88); padding: 20px; }
.image-lightbox.active { display: flex; }
.image-lightbox-content { position: relative; max-width: 92vw; max-height: 90vh; }
.image-lightbox-content img { display: block; max-width: 92vw; max-height: 90vh; background: #fff; object-fit: contain; }
.image-lightbox-close { position: absolute; top: -16px; right: -16px; display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: #fff; color: var(--fh-ink); font-size: 24px; line-height: 1; }

/* Redirect state page. */
.jump-state { display: inline-flex; align-items: center; gap: 7px; border-radius: 5px; padding: 7px 10px; font-size: 11px; font-weight: 800; }
.jump-state.is-success { background: #ecfdf5; color: #166534; }
.jump-state.is-error { background: #fff1f2; color: #9f1239; }
.jump-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 8px; color: #fff; font-size: 20px; }
.jump-icon.is-success { background: var(--fh-leaf); }
.jump-icon.is-error { background: var(--fh-coral); }
.jump-progress { height: 5px; overflow: hidden; background: #e2e8f0; }
.jump-progress-bar { width: 100%; height: 100%; background: var(--fh-teal); transform-origin: left; }
@keyframes jumpProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 639px) {
    .level-tabs-collapse { --level-tabs-collapsed-height: 96px; }
    .level-range-tab { flex: 1 0 calc(33.333% - 8px); }
    .fh-prose { font-size: 14px; }
    .fh-prose h2 { font-size: 20px; }
    .replies-list { margin-left: 10px; padding-left: 10px; }
    .image-lightbox-close { top: -12px; right: -8px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
