/* Team-Canvas (team-canvas.js): Pixelart-Büro mit den Team-Figuren.
   Keine Schatten, Verläufe oder Rundungen, Linien als Hairlines. Farben aus der Hell/Dunkel-Palette des Themes. */
.ap-team {
    --ap-team-ink: light-dark(var(--light-color, #121212), var(--dark-color, #FAFAFA));
    --ap-team-bg: light-dark(var(--light-bg, #FAFAFA), var(--dark-bg, #121212));
    position: relative;
    width: 100%;
    color: var(--ap-team-ink);
}
.ap-team__stage {
    position: relative;
    width: min(100%, calc((100vh - 1rem) * 16 / 9));
    width: min(100%, calc((100svh - 1rem) * 16 / 9));
    margin-inline: auto;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--ap-team-bg);
}
/* JS (fit) setzt Breite und Randversatz, sodass die Stage die volle Viewport-Breite hat und aus dem Container ausbricht */
.ap-team--fit .ap-team__stage {
    width: var(--ap-team-w);
    margin-inline: var(--ap-team-x);
}
/* Optional: Klasse "limit-canvas-height" an der Avada-Zeile um den Canvas begrenzt deren Höhe auf 85vh, unten bündig (oben wird abgeschnitten).
   Nicht im Handy-Querformat (Viewport-Höhe bis 500px), dort bleibt die volle Höhe. */
@media (min-height: 501px) {
    .limit-canvas-height {
        max-height: 85vh !important;
        overflow: hidden !important;
        align-items: end !important;
    }
}
/* Vollbild-Schaltfläche: nur auf Touch-Geräten, unten rechts im Canvas */
.ap-team__full {
    display: none;
    position: absolute;
    right: .5rem;
    bottom: .5rem;
    z-index: 2;
    box-sizing: border-box;
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ap-team-ink);
    border-radius: 0;
    background: var(--ap-team-bg);
    color: var(--ap-team-ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
@media (hover: none), (pointer: coarse) { .ap-team__full { display: flex; } }
.ap-team__full:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.ap-team__full[aria-pressed="false"] .ap-team__ico-out, .ap-team__full[aria-pressed="true"] .ap-team__ico-in { display: none; }
/* Vollbild (echtes Fullscreen-API oder Pseudo-Vollbild per fixed): Stage passt ganz in den Bildschirm, 16:9, schwarze Balken */
.ap-team--full {
    --ap-team-ink: #FAFAFA;
    --ap-team-bg: #121212;
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: auto;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #121212;
}
.ap-team--full .ap-team__stage {
    width: min(100vw, calc(100vh * 16 / 9));
    width: min(100vw, calc(100dvh * 16 / 9));
    margin: 0;
}
.ap-team--full .ap-team__hint { margin: 0; padding: .75rem 1rem; }
.ap-team--loading .ap-team__stage::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(90deg, transparent 0 7px, var(--ap-team-ink) 7px 8px);
    opacity: .15;
}
.ap-team__canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    touch-action: pan-y;        /* senkrecht scrollen bleibt, waagerecht wischen wechselt den Raum */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.ap-team__label {
    position: absolute;
    transform: translateX(-50%);
    padding: .2rem .6rem;
    border: 1px solid var(--ap-team-ink);
    background: var(--ap-team-bg);
    color: var(--ap-team-ink);
    font-size: .875rem;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
}
.ap-team__label[hidden] { display: none; }
/* Raumwechsel per Maus/Touch passiert im Canvas (Pfeile am Rand). Die Schaltflächen sind für Tastatur und Screenreader da und erscheinen bei Fokus. */
.ap-team__nav:not(:focus-within) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.ap-team__nav { display: flex; gap: .75rem; margin-top: .75rem; }
.ap-team__nav[hidden] { display: none; }
.ap-team__btn {
    padding: .3rem .8rem;
    border: 1px solid var(--ap-team-ink);
    border-radius: 0;
    background: transparent;
    color: var(--ap-team-ink);
    font: inherit;
    font-size: .875rem;
    cursor: pointer;
}
.ap-team__btn:disabled { opacity: .3; cursor: default; }
/* Hinweis auf Querformat: nur im Pseudo-Vollbild (iPhone-Safari, kein echtes Fullscreen-API, keine Querformat-Sperre) und im Hochformat */
.ap-team__hint {
    display: none;
    align-items: center;
    gap: .75rem;
    margin: 0 0 .75rem;
    font-size: .875rem;
    line-height: 1.4;
}
.ap-team__hint svg { flex: none; }
@media (orientation: portrait) {
    .ap-team--pseudo .ap-team__hint { display: flex; }
}
.ap-team__btn:focus-visible, .ap-team__who:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
/* Tastatur und Screenreader: eine Schaltfläche je Person, optisch ausgeblendet bis zum Fokus */
.ap-team__list { list-style: none; margin: 0; padding: 0; }
.ap-team__list li { margin: 0; }
.ap-team__who:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
.ap-team__who { margin-top: .5rem; padding: .3rem .8rem; border: 1px solid var(--ap-team-ink); border-radius: 0; background: transparent; color: inherit; font: inherit; }
.ap-team__live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.ap-team--error .ap-team__stage { min-height: 6rem; }

/* Charakterblatt (Popup). Farben aus der ap35-Palette, folgt Hell/Dunkel wie die Seite: Gold als Akzent auf hellem, Gelb auf dunklem Grund.
   Schrift Pixelify Sans (OFL), lokal gehostet, siehe team-canvas/fonts/OFL.txt. Keine Schatten, Verläufe oder Rundungen, Linien als Hairlines. */
@font-face { font-family: "Pixelify Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("team-canvas/fonts/pixelify-sans-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Pixelify Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("team-canvas/fonts/pixelify-sans-latin-700.woff2") format("woff2"); }
.ap-sheet {
    --ap-sheet-bg: light-dark(var(--light-bg, #FAFAFA), var(--dark-bg, #121212));
    --ap-sheet-ink: light-dark(var(--light-color, #121212), var(--dark-color, #FAFAFA));
    --ap-sheet-accent: light-dark(var(--light-hover-color, #A69866), var(--dark-hover-color, #FEFC7B));
    --ap-sheet-dim: light-dark(var(--awb-color3, #626262), var(--awb-color4, #9E9E9E));
    --ap-sheet-line: light-dark(var(--awb-color2, #E5E5E5), var(--awb-color7, #626262));
    --ap-px: 2;                                  /* Portraitbreite = 60 x --ap-px Pixel (120 am Handy, 180 sonst; das Bild hat doppelte Dichte) */
    box-sizing: border-box;
    width: min(30rem, calc(100vw - 1.5rem));
    max-height: calc(100vh - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
    margin: auto;
    padding: 1.1rem 1.25rem 1.25rem;
    overflow: auto;
    border: 1px solid var(--ap-sheet-ink);
    border-radius: 0;
    background: var(--ap-sheet-bg);
    color: var(--ap-sheet-ink);
    font-family: "Pixelify Sans", ui-monospace, "Courier New", monospace;
    font-size: 1rem;
    line-height: 1.3;
    box-shadow: none;
}
.ap-sheet:focus { outline: none; }
/* Das Theme trennt p, li, dd automatisch (hyphens: auto, style.css) und setzt Ränder auf p: im Blatt nicht */
.ap-sheet p, .ap-sheet dd, .ap-sheet dt { hyphens: manual; -webkit-hyphens: manual; }
.ap-sheet::backdrop { background: light-dark(rgb(250 250 250 / .8), rgb(18 18 18 / .8)); }
@media (min-width: 34rem) { .ap-sheet { --ap-px: 3; padding: 1.4rem 1.6rem 1.5rem; } }
.ap-sheet__head {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    padding-bottom: .7rem;
    border-bottom: 1px solid var(--ap-sheet-ink);
    color: var(--ap-sheet-accent);
    font-size: .8125rem;
    font-weight: 700;
    letter-spacing: .12em;
}
.ap-sheet__title { flex: 1; }
.ap-sheet__close {
    align-self: center;
    width: 1.75rem;
    height: 1.75rem;
    margin: -.25rem -.35rem -.25rem 0;
    padding: 0;
    border: 1px solid var(--ap-sheet-ink);
    border-radius: 0;
    background: transparent;
    color: var(--ap-sheet-ink);
    font: inherit;
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: 0;
    cursor: pointer;
    transition: background-color .3s ease, color .3s ease;
}
@media (hover: hover) { .ap-sheet__close:hover { background: var(--ap-sheet-ink); color: var(--ap-sheet-bg); } }
.ap-sheet__close:focus-visible { outline: 2px solid var(--ap-sheet-accent); outline-offset: 2px; }
.ap-sheet__body { display: flex; gap: 1.25rem; margin-top: 1.25rem; }
.ap-sheet__pic { flex: none; }
.ap-sheet__frame { border: 1px solid var(--ap-sheet-accent); background: var(--ap-sheet-line); }
.ap-sheet__frame[hidden] { display: none; }
.ap-sheet__img {
    display: block;
    width: calc(60px * var(--ap-px));
    height: auto;
}
.ap-sheet__stats { flex: 1; min-width: 0; margin: 0; }
.ap-sheet__row { margin: 0 0 1rem; }
.ap-sheet__row:last-child { margin-bottom: 0; }
.ap-sheet__row[hidden] { display: none; }
.ap-sheet__stats dt { margin: 0 0 .15rem; color: var(--ap-sheet-dim); font-size: .75rem; letter-spacing: .08em; }
.ap-sheet__stats dd { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.ap-sheet__stats dd.ap-sheet__tag { font-size: 1.5rem; font-weight: 700; letter-spacing: .04em; }
.ap-sheet__ability { margin: 1.25rem 0 0 !important; padding: .9rem 1rem; border: 1px solid var(--ap-sheet-dim); font-size: 1rem; line-height: 1.5; }
.ap-sheet__ability[hidden] { display: none; }
.ap-sheet__abl { color: var(--ap-sheet-accent); font-weight: 700; letter-spacing: .04em; }
.ap-sheet__foot { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; color: var(--ap-sheet-dim); font-size: .8125rem; letter-spacing: .04em; }
.ap-sheet__foot span:empty { display: none; }
.ap-sheet__example { margin-inline: auto; color: var(--ap-sheet-accent); }

/* ---- Modus "smooth" (Illustration, team.json "style": "smooth"): geglättet statt Pixel ---- */
.ap-team--smooth .ap-team__canvas { image-rendering: auto; }

/* Schlichtes Charakterblatt (team.json "sheetStyle": "clean") im Stil der Illustration: Schrift des Themes, keine Spielbogen-Optik.
   Gleiche Struktur wie .ap-sheet (siehe oben), Farben aus der Palette, Hairlines, keine Schatten, Verläufe oder Rundungen. */
.ap-sheet--clean {
    --ap-px: 1;
    width: min(34rem, calc(100vw - 1.5rem));
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.45;
}
.ap-sheet--clean .ap-sheet__head {
    align-items: center;
    padding-bottom: .8rem;
    border-bottom-color: var(--ap-sheet-line);
    color: var(--ap-sheet-dim);
    font-size: .8125rem;
    font-weight: 500;
    letter-spacing: .02em;
}
.ap-sheet--clean .ap-sheet__title { color: var(--ap-sheet-ink); font-weight: 700; }
.ap-sheet--clean .ap-sheet__body { gap: 1.5rem; margin-top: 1.5rem; }
.ap-sheet--clean .ap-sheet__frame { border: 1px solid var(--ap-sheet-line); background: var(--ap-sheet-line); }
.ap-sheet--clean .ap-sheet__img { width: 9.5rem; height: auto; }
.ap-sheet--clean .ap-sheet__stats dt { margin: 0 0 .1rem; font-size: .75rem; letter-spacing: .02em; color: var(--ap-sheet-dim); }
.ap-sheet--clean .ap-sheet__stats dd { font-size: 1.125rem; }
.ap-sheet--clean .ap-sheet__stats dd.ap-sheet__tag { font-size: 1.75rem; font-weight: 700; letter-spacing: 0; line-height: 1.15; }
.ap-sheet--clean .ap-sheet__ability { margin-top: 1.5rem !important; padding: 1rem 1.1rem; border-color: var(--ap-sheet-line); font-size: 1rem; line-height: 1.5; }
.ap-sheet--clean .ap-sheet__abl { color: var(--ap-sheet-accent); font-weight: 700; letter-spacing: 0; }
.ap-sheet--clean .ap-sheet__foot { color: var(--ap-sheet-dim); font-size: .8125rem; letter-spacing: 0; }
@media (min-width: 34rem) { .ap-sheet--clean { --ap-px: 1; padding: 1.5rem 1.75rem 1.6rem; } .ap-sheet--clean .ap-sheet__img { width: 11rem; } }
