:root {
    color-scheme: light dark;
    font-family: system-ui, sans-serif;
    line-height: 1.6;
}

body {
    margin: 3rem auto;
    max-width: 60rem;
    padding: 0 1.5rem;
}

header {
    border-bottom: 1px solid currentColor;
    padding-bottom: 1rem;
}

footer {
    border-top: 1px solid currentColor;
    margin-top: 3rem;
    padding-top: 1rem;
}

form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

input, button {
    font: inherit;
    padding: 0.6rem 0.8rem;
    max-width: 100%;
    box-sizing: border-box;
}

input[type="email"] {
    width: 24rem;
}

form[action="/stefan/login"] label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 24rem;
    max-width: 100%;
}

form[action="/stefan/login"] input:not([type="hidden"]) {
    width: 100%;
}

button {
    cursor: pointer;
}

article {
    border-top: 1px solid currentColor;
    margin-top: 2rem;
}

#material-frame {
    width: 100%;
    height: 100vh;
    border: 0;
}

object[type="application/pdf"] {
    display: block;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin-left: calc(50% - 50vw);
    border: 0;
}

img { max-width: 100%; height: auto; }
pre { overflow-x: auto; padding: 1rem; background: light-dark(#f4f4f4, #222); }

nav[aria-label="Freigabeziel"],
.sharing-panel {
    padding: 1rem;
    border: 2px solid currentColor;
    border-radius: 0.5rem;
}

.sharing-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 23rem), 1fr));
    gap: 1rem 2rem;
    margin-bottom: 1rem;
}

.sharing-target,
.sharing-controls {
    min-width: 0;
    overflow-wrap: anywhere;
}

.sharing-target nav {
    border: 0;
    padding: 0;
}

.sharing-target p { margin: 0.5rem 0; }
.sharing-target > p:last-child { margin-bottom: 0; }

.sharing-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.sharing-controls p,
.sharing-actions form { margin: 0; }

.sharing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#viewer-settings-status:empty { display: none; }

.room-invitation { text-align: center; }
.room-invitation canvas { width: min(65vw, 28rem); max-width: 100%; height: auto; }
.room-invitation a { overflow-wrap: anywhere; }
@media (max-width: 40rem) {
    body { margin: 1rem auto; padding: 0 0.75rem; }
}

body.material-viewer,
body.material-content {
    margin: 0;
    max-width: none;
    padding: 0;
}

.material-viewer #material-frame {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
}

#material-status { margin: 1.5rem; }
#material-status:empty { display: none; }

.material-content:has(> article) {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.material-content > article {
    border: 0;
    margin: 0;
    padding: 1.5rem;
    box-sizing: border-box;
    width: max-content;
    max-width: 60rem;
    flex-shrink: 0;
    display: flow-root;
}

.material-content pre {
    margin: 0;
    min-height: 100vh;
    box-sizing: border-box;
}

.material-content article pre {
    min-height: 0;
}

.material-content > img {
    display: block;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
}

.material-content > img { object-fit: contain; }

html.chromakey,
.chromakey body.material-viewer,
.chromakey body.material-content {
    background: #00ff00;
}

.chromakey .material-content article,
.chromakey .material-content pre {
    max-width: 60rem;
    min-height: 0;
    margin: 1.5rem auto;
    box-sizing: border-box;
    background: #fff;
    color: #111;
    color-scheme: light;
}

.chromakey .material-content > article {
    margin: 0;
}

#chromakey-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #111;
}

#chromakey-pdf canvas {
    display: block;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    object-fit: contain;
    flex-shrink: 0;
}

object[type="application/pdf"][hidden] { display: none; }

body.material-dashboard {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 1rem;
    box-sizing: border-box;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    margin: 0;
    padding: 1rem;
    overflow: hidden;
}

.material-dashboard .sharing-panel { margin: 0; }

.material-workspace {
    display: grid;
    grid-template-columns: clamp(14rem, 24vw, 24rem) minmax(0, 1fr);
    gap: 1rem;
    min-height: 0;
}

.material-navigation {
    overflow: auto;
    min-width: 0;
    border: 1px solid light-dark(#ccc, #555);
    border-radius: 0.5rem;
    padding: 0.75rem;
    overflow-wrap: anywhere;
}

.material-navigation p { margin: 0 0 0.75rem; }
.material-navigation ul { list-style: none; margin: 0; padding: 0; }
.material-navigation li + li { margin-top: 0.25rem; }
.material-navigation li a { display: block; padding: 0.35rem 0.5rem; border-radius: 0.25rem; }
.material-navigation a[aria-current] { background: light-dark(#e3edff, #263853); font-weight: bold; }

#material-preview {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    border: 1px solid light-dark(#ccc, #555);
    border-radius: 0.5rem;
}

body.material-preview,
body.material-preview-empty {
    max-width: none;
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

body.material-preview {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.preview-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid light-dark(#ccc, #555);
}

.preview-toolbar h1 { font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
.preview-toolbar form { margin: 0; }
.preview-toolbar a { font-size: 0.875rem; }
.preview-pages { display: flex; align-items: center; gap: 0.5rem; }
.preview-pages button { padding: 0.25rem 0.6rem; }

.preview-stage,
body.material-preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.material-preview-empty p { padding: 1.5rem; text-align: center; }

.preview-stage > article,
.preview-stage > pre {
    flex-shrink: 0;
    width: max-content;
    max-width: 60rem;
    border: 0;
    margin: 0;
    padding: 1.5rem;
    box-sizing: border-box;
    display: flow-root;
    transform-origin: center;
    overflow: visible;
}

.preview-stage pre { overflow: visible; }
.preview-stage > pre { max-width: none; }

.preview-stage > img,
.preview-stage > canvas,
.preview-stage > object {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    border: 0;
    object-fit: contain;
}

.preview-stage > [hidden] { display: none; }

@media (max-width: 48rem) {
    body.material-dashboard { padding: 0.5rem; gap: 0.5rem; }
    .material-workspace { grid-template-columns: minmax(7rem, 30%) minmax(0, 1fr); gap: 0.5rem; }
    .material-navigation { padding: 0.5rem; }
    .material-dashboard .sharing-panel {
        padding: 0.5rem;
        gap: 0.5rem;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .sharing-actions button { padding: 0.35rem 0.5rem; }
}

@media (max-height: 32rem) {
    body.material-dashboard { height: auto; min-height: 100dvh; overflow: auto; }
    .material-workspace { height: 75dvh; min-height: 15rem; }
}
