:root {
    font-family:
            -apple-system,
            BlinkMacSystemFont,
            "Segoe UI",
            sans-serif;

    color-scheme: light dark;

    --page-background: #000000;
    --page-foreground: #ffffff;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;

    background: var(--page-background);
    color: var(--page-foreground);
}

body {
    min-height: 100vh;

    transition:
            background-color 180ms ease,
            color 180ms ease;
}


body.menu-is-open {
    overflow: hidden;
}

.entity-page {
    min-height: 100vh;
}

.entity-page {
    background: var(--page-background);
    color: var(--page-foreground);
}

.entity {
    min-height: 100vh;
    padding: 2rem;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.entity h1 {
    margin: 0 0 2rem;
    font-size: clamp(1.5rem, 5vw, 3rem);
    font-weight: 500;
}

.entity-text {
    width: min(100%, 42rem);

    font-size: clamp(1.25rem, 4vw, 2rem);
    line-height: 1.45;
    text-align: center;
}


html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}


.static-page {
    min-height: 100svh;

    padding:
            calc(env(safe-area-inset-top) + 5rem)
            1.5rem
            calc(env(safe-area-inset-bottom) + 3rem);
}

.static-page__content {
    width: min(100%, 46rem);
    margin-inline: auto;
}

.static-page h1 {
    margin: 0 0 2rem;

    font-size: clamp(2.75rem, 8vw, 4.5rem);
    line-height: 1;
}

.static-page p {
    margin: 0 0 1.5rem;

    font-size: clamp(1.15rem, 3.8vw, 1.4rem);
    line-height: 1.5;
}


.entity-page {
    width: 100%;
    height: 100svh;
    overflow: hidden;
}

/* Full ancestor sheets remain mounted beneath the current level. */
.entity-viewer { position: relative; width: 100%; height: 100%; isolation: isolate; }
.viewer-ancestors { position: absolute; inset: 0; pointer-events: none; }
.viewer-panel:has(.entity[data-background]) { background: transparent; }
.entity[data-background] { background: var(--panel-background, var(--page-background)); }
.viewer-current { position: relative; z-index: 1; width: 100%; height: 100%; }
/* Material sheet edges only: no inset, layout box or gesture target. */
.viewer-depth-cue {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1;
    pointer-events: none;
    opacity: .4;
    background: var(--depth-color);
}
.viewer-depth-cue--parent { top: 0; box-shadow: 0 3px 8px var(--depth-color); }
.viewer-depth-cue--child { bottom: 0; box-shadow: 0 -3px 8px var(--depth-color); }

.viewer-panel {
    position: absolute;
    inset: 0;
    isolation: isolate;
    background: var(--page-background, #000000);
    color: var(--page-foreground, #ffffff);
}

.swipe-track {
    display: flex;

    width: 100%;
    height: 100%;

    overflow-x: auto;
    overflow-y: hidden;

    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;

    scrollbar-width: none;
}

/* Native horizontal panning remains available; only integrated touch input claims vertical motion. */
.entity-viewer[data-touch-levels] .viewer-current > .swipe-track { touch-action: pan-x pinch-zoom; }
.entity-viewer[data-touch-active] .viewer-current,
.entity-viewer[data-touch-active] .viewer-current * {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
.entity-viewer[data-touch-active] .viewer-current img { -webkit-user-drag: none; }

/* Contain the absolute selected panel without changing Part-frame positioning. */
.swipe-frame--panel { position: relative; }

.swipe-track::-webkit-scrollbar {
    display: none;
}

.swipe-frame {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;

    scroll-snap-align: start;
    scroll-snap-stop: always;
}


.work-progress {
    position: absolute;

    top: max(
            0.75rem,
            env(safe-area-inset-top)
    );

    left: 0.75rem;
    right: 0.75rem;

    display: flex;
    gap: 0.25rem;

    pointer-events: none;
}

.work-progress__item {
    flex: 1;

    height: 3px;

    border-radius: 100px;

    background: rgb(255 255 255 / 30%);
}

.work-progress__item.is-active {
    background: rgb(255 255 255 / 90%);
}


.swipe-arrow {
    display: flex;
    position: absolute;
    width: 44px;
    height: 44px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 1.5rem;
    line-height: 1;
    text-decoration: none;
    opacity: .45;
    cursor: pointer;
}
.swipe-arrow:hover { opacity: .65; }
.swipe-arrow:disabled { opacity: .2; cursor: default; }
.swipe-arrow:focus-visible { outline: 2px solid currentColor; outline-offset: -4px; }
.swipe-arrow--previous, .swipe-arrow--next {
    top: 50%;
    transform: translateY(-50%);
}
.swipe-arrow--previous { left: max(.5rem, env(safe-area-inset-left)); }
.swipe-arrow--next { right: max(.5rem, env(safe-area-inset-right)); }

@media (max-width: 600px) {
    .swipe-arrow--previous {
        left: env(safe-area-inset-left);
    }

    .swipe-arrow--next {
        right: env(safe-area-inset-right);
    }

    .swipe-arrow--previous {
        text-indent: -.35rem;
    }

    .swipe-arrow--next {
        text-indent: .35rem;
    }
}

.viewer-level-controls {
    position: absolute;
    z-index: 30;
    bottom: max(1rem, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: .25rem;
}
.viewer-level-controls[hidden] { display: none; }
.swipe-arrow--vertical {
    position: static;
    font-size: 1.75rem;
    opacity: .7;
}

/* Shared circular controls; menu/actions at the top, Share/Responses at the bottom. */
.menu-toggle, .action-trigger, .responses-trigger, .share-trigger {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgb(0 0 0 / 35%);
    color: #fff;
    display: flex;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.menu-toggle { right: 1rem; z-index: 3000; flex-direction: column; gap: .35rem; }
.action-trigger, .responses-trigger {
    bottom: auto;
    left: auto;
    min-width: 0;
    align-items: center;
    font: inherit;
    line-height: 1;
}
.action-trigger { right: 4.25rem; z-index: 50; font-size: 2rem; }
.responses-trigger {
    top: auto;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 30;
    font-size: 1rem;
    font-weight: 600;
}
.responses-trigger { width: auto; min-width: 2.75rem; max-width: calc(100vw - 2rem); height: auto; min-height: 2.75rem; padding: .6rem .8rem; border-radius: 1.4rem; flex-wrap: wrap; line-height: 1.3; }
.responses-trigger__separator { opacity: .55; white-space: pre; }
.responses-trigger__current { font-weight: 750; }
.responses-trigger[hidden] { display: none; }

.menu-toggle span {
    display: block;

    width: 1.4rem;
    height: 2px;

    margin-inline: auto;

    background: currentColor;
}


.main-navigation {
    position: fixed;

    inset: 0;

    background: rgb(15 15 15 / 96%);

    color: white;
}

.main-navigation[hidden] {
    display: none;
}

.main-navigation__content {
    min-height: 100%;

    display: flex;
    flex-direction: column;

    padding:
            max(5rem, env(safe-area-inset-top))
            2rem
            2rem;

    gap: 1rem;
}

.main-navigation a {
    color: inherit;
    text-decoration: none;

    font-size: 1.25rem;
}

.main-navigation__group {
    margin-top: 1.75rem;

    display: flex;
    flex-direction: column;

    gap: 0.75rem;
}

.main-navigation__label {
    font-size: 0.75rem;

    text-transform: uppercase;
    letter-spacing: 0.12em;

    opacity: 0.5;
}

.main-navigation__legal {
    margin-top: auto;

    display: flex;
    flex-direction: column;

    gap: 0.6rem;
}

.main-navigation__legal a {
    font-size: 0.9rem;

    opacity: 0.7;
}

.menu-close {
    position: absolute;
    z-index: 4100;

    top: max(
            1rem,
            env(safe-area-inset-top)
    );
    right: 1rem;

    width: 2.75rem;
    height: 2.75rem;

    border: 0;
    border-radius: 50%;

    background: rgb(255 255 255 / 10%);
    color: #fff;

    font-size: 1.75rem;
    line-height: 1;

    cursor: pointer;
}


.main-navigation {
    z-index: 4000;
}


.action-dialog {
    width: min(44rem, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    max-height: calc(100svh - 2rem);
    box-sizing: border-box;
    padding: 1.5rem;
    border: 1px solid rgb(255 255 255 / 15%);
    border-radius: 1rem;
    background: #181818;
    color: #fff;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 100;
}

.action-dialog::backdrop {
    background: rgb(0 0 0 / 60%);
    backdrop-filter: blur(3px);
}

.action-dialog__close {
    position: absolute;

    top: 0.75rem;
    right: 0.75rem;

    border: 0;
    background: none;
    color: inherit;

    font-size: 1.75rem;
    cursor: pointer;
}

.action-dialog__choices {
    display: grid;
    gap: 0.75rem;
}

.action-choice {
    display: grid;
    gap: 0.25rem;

    width: 100%;
    padding: 1rem;

    border: 1px solid rgb(255 255 255 / 15%);
    border-radius: 0.75rem;

    background: transparent;
    color: inherit;

    text-align: left;
    font: inherit;

    cursor: pointer;
}

.action-choice:hover {
    background: rgb(255 255 255 / 7%);
}

.action-choice span {
    opacity: 0.6;
    font-size: 0.9rem;
}

.action-dialog__back {
    margin-bottom: 1rem;

    padding: 0;
    border: 0;

    background: none;
    color: inherit;

    font: inherit;
    cursor: pointer;

    opacity: 0.7;
}


.entity-page {
    position: relative;
    isolation: isolate;
}

.swipe-track {
    position: relative;
    z-index: 1;
}

.work-progress {
    z-index: 20;
}

.swipe-arrow {
    z-index: 30;
}

.action-dialog__step {
    width: 100%;
    min-width: 0;
}

.action-dialog__intro {
    margin: -0.5rem 0 1.5rem;

    color: rgb(255 255 255 / 60%);

    font-size: 0.95rem;
    line-height: 1.4;
}

.login-form {
    display: grid;
    gap: 1rem;

    width: 100%;
    min-width: 0;
}

.login-form__field {
    display: grid;
    gap: 0.5rem;

    min-width: 0;
}

.login-form__field span {
    font-size: 0.9rem;
    color: rgb(255 255 255 / 65%);
}

.login-form input[type="email"] {
    display: block;

    width: 100%;
    min-width: 0;
    box-sizing: border-box;

    padding: 0.9rem 1rem;

    border: 1px solid rgb(255 255 255 / 20%);
    border-radius: 0.7rem;

    background: #101010;
    color: #fff;

    font: inherit;
    font-size: 1rem;

    outline: none;
}

.login-form input[type="email"]:focus {
    border-color: rgb(255 255 255 / 55%);
}

.login-form__submit {
    width: 100%;

    padding: 0.9rem 1rem;

    border: 0;
    border-radius: 0.7rem;

    background: #fff;
    color: #111;

    font: inherit;
    font-weight: 600;

    cursor: pointer;
}


[hidden] {
    display: none !important;
}

.entity-image {
    min-height: 0;
}


/* Grid/fieldset intrinsic minimums must not expand the editing dialog. */
.part-form,
.part-form :where(fieldset, .part-form__field, .part-form__colors, label, [data-ordinary-panel], .sound-json-editor) {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-inline-size: 0;
}
.part-form fieldset { margin-inline: 0; }
.part-form :where(label, small, [role=status], summary) { white-space: normal; overflow-wrap: anywhere; }
.part-form :where(input, select, textarea, button, audio, video) { box-sizing: border-box; max-width: 100%; min-width: 0; }
.part-form input:is([type=range], [type=number]),
.part-form label:not(.part-form__upload) > input[type=file] { width: 100%; }
.part-form input[type=range] { margin-inline: 0; }
.part-form button { white-space: normal; overflow-wrap: anywhere; }

.part-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
}

.part-form__field {
    display: grid;
    gap: .6rem;
}

.part-form__label {
    font-size: .95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .72);
}

.part-form textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 9rem;
    padding: 1rem;

    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: .8rem;

    background: rgba(255, 255, 255, .06);
    color: #fff;

    font: inherit;
    line-height: 1.5;

    resize: vertical;
}

/* Only advanced Sound JSON fields allow horizontal manual resizing. */
textarea[data-sound-json],
textarea[data-sound-definitions] {
    box-sizing: border-box;
    resize: both;
    max-width: 100%;
}

.part-form textarea:focus {
    outline: 2px solid rgba(255, 255, 255, .5);
    outline-offset: 2px;
}


/* Upload */

.part-form__upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: fit-content;
    padding: .7rem 1rem;

    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;

    background: rgba(255, 255, 255, .08);

    cursor: pointer;
}

.part-form__upload:hover {
    background: rgba(255, 255, 255, .13);
}

.part-form__upload input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}


/* Image preview */

.part-form__image-preview {
    position: relative;

    overflow: hidden;

    width: 100%;
    max-height: min(50svh, 32rem);

    border-radius: 1rem;

    background:
            linear-gradient(
                    135deg,
                    rgba(255, 255, 255, .06),
                    rgba(255, 255, 255, .02)
            );
}

.part-form__image-preview img {
    display: block;

    width: 100%;
    height: 100%;
    max-height: min(50svh, 32rem);

    object-fit: contain;
}

.part-form__image-remove {
    position: absolute;
    right: .75rem;
    bottom: .75rem;

    padding: .55rem .8rem;

    border: 0;
    border-radius: 999px;

    background: rgba(0, 0, 0, .68);
    color: #fff;

    font: inherit;
    font-size: .85rem;

    cursor: pointer;

    backdrop-filter: blur(8px);
}


.part-form__alignment { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.part-form__alignment select { font: inherit; color: inherit; background: #181818; border: 1px solid #555; border-radius: .4rem; padding: .35rem .5rem; }

/* Colors */

.part-form__colors {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
}

.part-form__colors .part-form__field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;

    padding: .8rem 1rem;

    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: .8rem;
}

@media (max-width: 40rem) {
    .part-form__colors { grid-template-columns: minmax(0, 1fr); }
}

.part-form input[type="color"] {
    width: 3rem;
    height: 2rem;

    padding: 0;
    border: 0;
    background: none;

    cursor: pointer;
}


/* Destructive action */

.part-form__delete {
    justify-self: start;

    padding: 0;

    border: 0;
    background: none;

    color: #ff8f8f;

    font: inherit;
    font-size: .9rem;

    cursor: pointer;
}

.entity {
    min-width: 0;

    /*
     * Wichtig:
     * kein horizontales Padding hier.
     * Sonst kann das Bild nie bis an die Displaykante.
     */
}


/*
 * Image
 *
 * Full bleed whenever the aspect ratio permits it.
 */
.entity-image {
    min-width: 0;
}


/*
 * Text gets its own readable measure.
 * Its padding must not constrain the image.
 */
.entity-content {
    width: min(100%, 46rem);
    margin-inline: auto;

    padding-inline: 1.5rem;
}


/*
 * Optional spacing when image + text coexist.
 */
.entity-image + .entity-content {
    margin-top: 1.5rem;
}

.entity-image {
    overflow: hidden;
}


.entity {
    position: relative;
    width: 100%;
    height: 100svh;
}

.entity {
    overflow: hidden;
}

.entity-image {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
}

.entity-image img {
    display: block;

    width: 100%;
    height: 100%;

    max-width: none;
    max-height: none;

    object-fit: contain;
}


.entity-content {
    position: absolute;
    z-index: 1;

    left: 0;
    right: 0;
    bottom: 0;

    box-sizing: border-box;

    padding: 1.25rem 1.5rem;

    background: var(--panel-background, var(--page-background));
    color: var(--page-foreground);
}

/* The existing centered, fixed-measure text block is the local stage.
   Alignment only moves text inside it; content never determines its width. */
.entity-text { white-space: break-spaces; overflow-wrap: anywhere; min-width: 0; }
.entity-text[data-text-align="left"] { text-align: left; }
.entity-text[data-text-align="right"] { text-align: right; }

.entity-text,
.entity-content h1 {
    width: min(100%, 46rem);
    margin-inline: auto;
}


.entity {
    position: relative;
    width: 100%;
    height: 100svh;
}

/* Nur Text: weiterhin vertikal mittig */
.entity:not(.entity--has-image) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.entity:not(.entity--has-image) .entity-content {
    position: static;

    width: min(100%, 46rem);
    padding: max(72px, calc(env(safe-area-inset-bottom) + 56px)) 1.5rem;

    background: transparent;
}

/* Bild + Text: Farbfläche unten */
.entity--has-image .entity-content {
    position: absolute;
    z-index: 1;

    left: 0;
    right: 0;
    bottom: 0;

    box-sizing: border-box;
    width: 100%;

    padding: 1.25rem 1.5rem;

    background: var(--panel-background, var(--page-background));
    color: var(--page-foreground);
}

.entity--has-image .entity-content h1,
.entity--has-image .entity-text {
    width: min(100%, 46rem);
    margin-inline: auto;
}

.action-choice[hidden] { display: none; }

/* Compact content fragments beneath the original Space / Work heading. */
.main-navigation { overflow-y: auto; }
.main-navigation__content,
.main-navigation__group { min-width: 0; max-width: 100%; }
.main-navigation .main-navigation__label { font-size: .75rem; }
.main-navigation__work,
.main-navigation__label { overflow-wrap: anywhere; }
.content-navigation { min-width: 0; max-width: 42rem; align-self: stretch; }
.content-navigation__list { list-style: none; padding: 0; margin: 0; min-width: 0; }
.content-navigation__list li { margin: 0; padding: 0; list-style: none; }
.content-navigation__list li,
.content-navigation__list li > div { min-width: 0; max-width: 100%; }
.content-navigation__row { display: flex; align-items: center; padding-left: calc(var(--depth, 0) * 5px); }
.content-navigation__link { display: flex; align-items: center; gap: .4rem; min-width: 0; max-width: 100%; padding: .35rem .2rem; border-radius: .2rem; flex: 1 1 0%; }
.main-navigation .content-navigation__link { font-size: .875rem; line-height: 1.35; color: rgb(255 255 255 / 78%); }
.content-navigation__link[aria-current="page"] { background: none; color: #fff; font-weight: 700; }
.content-navigation__fragment { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.content-navigation__excerpt { display: inline; white-space: nowrap; }
.content-navigation__link > .content-navigation__excerpt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.content-navigation__format { font-size: inherit; font-weight: 400; color: rgb(255 255 255 / 55%); }
.content-navigation__link img { width: 1.5rem; height: 1.5rem; object-fit: cover; flex: 0 0 1.5rem; }
.content-navigation__expand { width: 1.25rem; height: 2rem; padding: 0; flex: 0 0 1.25rem; color: inherit; background: transparent; border: 0; cursor: pointer; font-size: 1.25rem; }
.content-navigation__expand[aria-expanded="true"] { transform: rotate(90deg); }
.content-navigation__message { font-size: .8rem; opacity: .65; margin: .5rem 0; overflow-wrap: anywhere; }
.content-navigation :focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }

.content-navigation__spacer {
    width: 1.25rem;
    flex: 0 0 1.25rem;
}

.action-trigger .interference-icon {
    display: block;
    width: 2.3rem;
    height: 2.3rem;
    pointer-events: none;
}

/* Quick Navigation occupies the existing dialog; only its lists scroll. */
.action-dialog--navigation { overflow: hidden; }
.action-dialog--navigation .action-dialog__close { z-index: 1; }
.action-dialog--navigation [data-action-responses] { display: flex; flex-direction: column; max-height: calc(100svh - 5rem); }
.action-dialog--navigation h2 { flex: 0 0 auto; margin: 0 2rem 1.25rem 0; font-size: 1.75rem; }
.quick-navigation__sections { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.quick-navigation__section + .quick-navigation__section { border-top: 1px solid rgb(255 255 255 / 10%); margin-top: 1rem; padding-top: 1rem; }
.quick-navigation__section h3 { margin: 0 0 .5rem; font-size: .7rem; font-weight: 500; letter-spacing: .1em; color: rgb(255 255 255 / 48%); }
.quick-navigation__row { display: flex; align-items: center; gap: .55rem; min-width: 0; padding: .6rem 0; color: rgb(255 255 255 / 78%); text-decoration: none; font-size: .9rem; line-height: 1.35; }
.quick-navigation__row[aria-current="page"] { font-weight: 700; color: #fff; }
.quick-navigation__preview { display: flex; align-items: center; gap: .4rem; min-width: 0; flex: 1 1 0%; }
.quick-navigation__preview img { width: 1.5rem; height: 1.5rem; object-fit: cover; flex: 0 0 1.5rem; }
.quick-navigation__arrow { width: 1rem; height: 1rem; flex: 0 0 1rem; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .45; }
.quick-navigation__message { margin: .5rem 0; font-size: .85rem; color: rgb(255 255 255 / 55%); }
.quick-navigation__row:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }

.quick-navigation__row--arrow-right .quick-navigation__preview {
    flex: 0 1 auto;
}

.main-navigation__content .navigation-manage,
.main-navigation__content .navigation-admin a {
    font-size: .85rem;
    color: #aaa;
    display: block;
    margin-top: .5rem;
}
.navigation-admin { margin: 1.5rem 0; }

.navigation-space > summary {
    cursor: pointer;
    padding: .35rem 0;
}
.navigation-space > summary::marker { color: #aaa; }
.main-navigation .navigation-space > summary a {
    display: inline;
    font: inherit;
    color: inherit;
}
.navigation-space__body { min-width: 0; padding-left: .5rem; }
.navigation-space > summary:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }
.main-navigation button.navigation-manage {
    background: none;
    border: 0;
    padding: .25rem 0;
    font: inherit;
    cursor: pointer;
}
.main-navigation__group.navigation-space { display: block; margin-top: .35rem; }
.navigation-space[open] > .navigation-space__body { display: flex; flex-direction: column; gap: .75rem; padding-top: .5rem; }
.navigation-space > summary .main-navigation__label { opacity: 1; }

.share-trigger {
    top: auto;
    left: max(1rem, env(safe-area-inset-left));
    bottom: max(1rem, env(safe-area-inset-bottom));
    align-items: center;
    z-index: 30;
}
.share-trigger svg { width: 1.4rem; height: 1.4rem; }
.share-trigger[hidden], .share-preview[hidden] { display: none; }
.share-trigger:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.share-dialog { width: min(26rem, calc(100vw - 2rem)); }
.share-dialog h2 { margin: 0 2rem 1rem 0; font-size: 1.5rem; }
.share-preview { display: block; width: auto; height: min(48svh, 30rem); max-width: 100%; aspect-ratio: 9 / 16; object-fit: contain; margin: 0 auto 1rem; }
.share-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.share-actions button { color: inherit; background: transparent; border: 1px solid #666; border-radius: .4rem; padding: .6rem 1rem; font: inherit; cursor: pointer; }
.share-actions button:disabled { opacity: .45; cursor: default; }
.share-dialog [role=status] { font-size: .85rem; margin-bottom: 0; }

/* Separate image and text regions; only the full-text dialog scrolls. */
.entity-content__preview { max-height: 100%; overflow: hidden; flex: 0 1 auto; width: 100%; }
.entity-content__body { display: flow-root; }
.entity .entity-content {
    height: var(--text-region-height, auto);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 0;
    padding-top: max(72px, calc(env(safe-area-inset-bottom) + 56px));
    padding-bottom: max(72px, calc(env(safe-area-inset-bottom) + 56px));
    background: transparent;
}
.entity--has-image .entity-content {
    height: var(--text-region-height, auto);
    top: var(--composition-text-top, auto);
    bottom: auto;
    padding-block: 24px;
}
.entity--has-image .entity-read-more { margin-bottom: 48px; }
.entity--has-image:has(.entity-content) .entity-image {
    top: var(--composition-top, 0);
    bottom: auto;
    height: var(--composition-image-height, 100%);
}
.entity-read-more { flex: none; color: inherit; background: transparent; border: 0; text-decoration: underline; font: inherit; font-size: .85rem; cursor: pointer; }
.entity-read-more[hidden] { display: none; }
.entity-content h1, .read-more-body h1 { white-space: break-spaces; overflow-wrap: anywhere; }
.read-more-dialog { overscroll-behavior: contain; }
.read-more-header { position: sticky; top: -1.5rem; z-index: 1; padding: .5rem 0; background: #181818; }
.read-more-header .action-dialog__close { position: static; display: block; margin-left: auto; }

/* Thoughts are prose in the existing modal, outside the viewer stack. */
.thoughts-trigger {
    position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: 5rem;
    z-index: 20; color: #ccc; background: rgba(0,0,0,.5); border: 0;
    border-radius: 1rem; padding: .4rem .7rem; font: inherit; font-size: .8rem; cursor: pointer;
}
.thought-entry { padding: 1rem 0; border-top: 1px solid #333; }
.thought-entry__author { color: #aaa; font-size: .8rem; }
.thought-entry__text { white-space: break-spaces; overflow-wrap: anywhere; line-height: 1.6; }
.thought-status { color: #bbb; }

/* Video is a full panel, never cropped or auto-playing. */
.entity--video { background: #000; }
.entity-video { width: 100%; height: 100%; object-fit: contain; display: block; }
[data-video-editor] video { width: 100%; max-height: 40svh; object-fit: contain; background: #000; }
[data-video-progress] { font-size: .9rem; color: #aaa; }
.share-dialog video { width: 100%; max-height: 55svh; object-fit: contain; background: #000; }

[data-ordinary-panel]:not([hidden]) { display: grid; gap: 1rem; }

/* Supplemental Sound is page-local and separate from native video controls. */
.sound-control { position:fixed; top:calc(4rem + env(safe-area-inset-top)); right:1rem; z-index:30; max-width:16rem; font-size:.75rem; }
.sound-control button { color:#fff; background:rgba(0,0,0,.65); border:0; border-radius:2rem; padding:.5rem .75rem; cursor:pointer; }
.sound-control span { display:block; background:rgba(0,0,0,.65); }
[data-audio-editor] audio { width:100%; max-width:100%; }

/* One-time Sound awareness; existing control visibility stays coordinator-owned. */
.sound-control button svg { display: block; }
.sound-awareness h2 { margin-top: 0; font-size: 1.75rem; }
.sound-awareness__choices { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.sound-awareness__choices button { padding: .75rem 1rem; font: inherit; cursor: pointer; }

/* Textarea-local controls wrap; no horizontal scrolling is needed. */
.sound-json-toolbar { box-sizing:border-box; width:100%; max-width:100%; min-width:0; display:flex; flex-wrap:wrap; gap:.2rem; padding:.2rem 0; }
.sound-json-toolbar button, .sound-json-menu button { min-height:44px; min-width:0; max-width:100%; box-sizing:border-box; white-space:normal; overflow-wrap:anywhere; padding:.4rem .65rem; font:inherit; font-size:.85rem; cursor:pointer; }
.sound-json-menu { box-sizing:border-box; width:100%; max-width:100%; min-width:0; max-height:12rem; overflow-y:auto; }
.sound-json-menu:not([hidden]) { display:flex; flex-wrap:wrap; gap:.2rem; }

/* The JSON label and controls are siblings, not an inline label container. */
/* Definitions/management fieldsets also need to shrink with their controls. */
fieldset[data-audio-editor] { min-inline-size: 0; }
.sound-json-editor { box-sizing: border-box; width: 100%; max-width: 100%; min-width: 0; }
.sound-json-editor > label { display: block; margin-bottom: .4rem; }
.sound-json-editor > textarea { display: block; width: 100%; }
.sound-json-editor > small { display: block; width: 100%; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

.viewer-depth-cue {
    display: none;
}