/* Native dialogs sit above the player and never enter the page layout. */
dialog.modal:not([open]) { display: none !important; }
dialog.modal[open] {
    display: flex;
    position: fixed;
    inset: 0;
    margin: auto;
    padding: 0;
    width: min(960px, calc(100vw - 40px));
    max-width: none;
    max-height: calc(100dvh - 40px);
    height: fit-content;
    overflow: hidden;
    border: 1px solid #355344;
    border-radius: 18px;
    color: #f5f5f5;
    background: #071b13;
    box-shadow: 0 24px 100px #000b;
}
dialog.modal::backdrop { background: rgb(0 8 5 / 82%); }
dialog.modal .modal-dialog { width: 100%; max-height: inherit; margin: 0; }
dialog.modal .modal-content { width: 100%; max-height: calc(100dvh - 42px); border: 0; border-radius: 0; box-shadow: none; }
dialog.modal .modal-body { min-height: 0; overscroll-behavior: contain; }
body.modal-open { overflow: hidden; }
/* A quiet forest glow replaces the flat black About panel. */
#aboutModal { --modal-link: #85e1ae; }
#aboutModal .modal-dialog { width: 100%; }
#aboutModal .modal-content { display: flex; flex-direction: column; background: radial-gradient(ellipse at 100% 0%, #17412b 0%, transparent 55%), linear-gradient(150deg, #0c2419, #04110c 80%); color: #f5f5f5; border: 0; border-radius: 0; }
#aboutModal .modal-header { flex: 0 0 auto; background: transparent; color: #fff; border: 0; padding: 16px 24px 0; font-family: Roboto, sans-serif; }
#aboutModal .modal-title { font: 500 .9rem Roboto, sans-serif; color: #b5c8bc; }
#aboutModal .btn-close { min-width: 44px; min-height: 44px; }
#aboutModal .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; background: transparent; padding: 0 clamp(20px, 5vw, 58px) 32px; scrollbar-gutter: stable; }
#aboutModal .modal-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 28px; }
#aboutModal .modal-brand img { display: block; width: 48px; height: 48px; }
#aboutModal .virtualforest { color: #fff; font: 2rem 'Irish Grover', cursive; }
#aboutModal .about-welcome { position: relative; isolation: isolate; padding-right: 145px; }
#aboutModal .about-welcome h3 { margin: 0 0 12px; font: 700 clamp(2rem, 4vw, 3.2rem)/1.15 Roboto, sans-serif; letter-spacing: -.04em; }
#aboutModal .about-welcome h3 span { color: #69c58c; }
#aboutModal .about-audience { margin: 0 0 18px; font-size: 1.1rem; font-weight: 600; color: #dcebe1; }
#aboutModal .about-leaves { position: absolute; right: 0; top: -16px; width: 125px; height: 150px; color: #388454; stroke-width: 1.5; pointer-events: none; }
#aboutModal p { line-height: 1.65; }
#aboutModal .about-resources-title, #aboutModal .about-credits > h3 { margin: 30px 0 20px; font: 600 1.35rem/1.3 Roboto, sans-serif; color: #fff; }
#aboutModal .modal-module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 36px; }
#aboutModal .module-item { margin: 0; padding: 0; border: 0; background: transparent; text-align: left; }
#aboutModal .module-item__heading { display: flex; align-items: center; justify-content: flex-start; gap: 12px; }
#aboutModal .module-item__heading img { width: 44px; height: 44px; flex: 0 0 44px; object-fit: contain; }
#aboutModal .module-title { margin: 0; font: inherit; font-size: 1.25rem; line-height: 1.25; color: var(--module-color); text-align: left; }
#aboutModal .module-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0 56px; }
#aboutModal a.module-link { display: inline-block; padding: 8px 0; color: #e2e8e4; font: 400 .95rem/1.4 Roboto, sans-serif; text-decoration-color: #637e6d; text-underline-offset: 4px; }
#aboutModal a.module-link:hover { color: #fff; text-decoration-color: #85e1ae; }
/* The shared links occupy a full row below the seven module resources. */
#aboutModal .modal-module-grid > div:has(.allmodules) { grid-column: 1 / -1; }
#aboutModal .allmodules { padding: 18px 22px; background: #092b1c; border-radius: 10px; }
#aboutModal .allmodules .module-title { color: #98d6ad; font: 600 1.1rem Roboto, sans-serif; }
#aboutModal .allmodules .module-links { margin: 4px 0 0; }
#aboutModal .about-credits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 32px; margin-top: 32px; padding-top: 4px; border-top: 1px solid #253c30; }
#aboutModal .about-credits > h3, #aboutModal .credit-intro, #aboutModal .credit-logos { grid-column: 1 / -1; }
#aboutModal .about-credits > h3 { margin-bottom: 0; }
#aboutModal .credit-intro p { margin: 0; }
#aboutModal .credit-intro span { color: #acb9b0; font-size: .8rem; }
#aboutModal .content-section { margin: 0; min-width: 0; }
#aboutModal .about-credits h4 { color: #9fd4b0; font: 600 1rem/1.5 Roboto, sans-serif; margin: 0 0 12px; }
#aboutModal .credit-list { list-style: none; padding: 0; margin: 0; font-size: .92rem; line-height: 1.65; color: #c3cec6; }
#aboutModal .credit-list li + li { margin-top: 8px; }
#aboutModal .credit-list strong { color: #f3f6f4; }
#aboutModal .credit-logos { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 24px; padding: 20px 0 0; }
#aboutModal .credit-logo { width: auto; max-width: min(180px, 100%); height: auto; max-height: 72px; object-fit: contain; }
#aboutModal .modal-footer { flex: 0 0 auto; background: #06170f; color: #678372; border-color: #253c30; font: 400 .85rem/1.8 Roboto, sans-serif; }
#aboutModal .modal-footer a { display: inline-block; padding: 5px 8px; color: #bad4c3; }
#aboutModal a:focus-visible, #aboutModal button:focus-visible { outline: 3px solid #a5efbe; outline-offset: 4px; border-radius: 3px; }
@media (max-width: 600px) {
    dialog.modal[open] { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 12px; }
    dialog.modal .modal-content { max-height: calc(100dvh - 18px); }
    #aboutModal .modal-module-grid, #aboutModal .about-credits { grid-template-columns: minmax(0, 1fr); }
    #aboutModal .about-welcome { padding-right: 0; }
    #aboutModal .about-leaves { display: none; }
    #aboutModal .modal-brand { margin-bottom: 24px; }
    #aboutModal .virtualforest { font-size: 1.65rem; }
    #aboutModal .modal-header { padding: 8px 12px 0; }
    #aboutModal .modal-title { font-size: .8rem; }
}
