/*
 * Nur das, was der Generator zusätzlich zu css/basis.css braucht:
 * zweispaltiges Layout, Formularzeilen, Handy-Rahmen für die Vorschau,
 * Emoji-Popover, Theme-Swatches, Link- und QR-Kasten.
 *
 * Farben stehen auch hier nur als Theme-Variablen aus basis.css.
 */

/* --------------------------------------------------------------- Layout */

.generator {
    width: 100%;
    max-width: 74rem;
    margin-inline: auto;
    justify-content: flex-start;
    align-items: stretch;
}

.gen-kopf {
    width: 100%;
    max-width: 74rem;
    margin-inline: auto;
    text-align: center;
}

.gen-kopf h1 {
    font-size: clamp(1.6rem, 6vw, 2.2rem);
    line-height: 1.15;
}

.gen-raster {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    width: 100%;
}

.gen-formular,
.gen-vorschau {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

/* Ab hier ist Platz für Formular und Vorschau nebeneinander. */
@media (min-width: 900px) {
    .gen-raster {
        grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
        align-items: start;
    }

    .gen-vorschau {
        position: sticky;
        top: 1rem;
    }
}

/* Die Karten des Generators sind breiter und linksbündig. */
.gen-karte {
    max-width: none;
    padding: 1.1rem 1rem;
    text-align: left;
}

.gen-karte > * + * {
    margin-top: 0.8rem;
}

.gen-titel {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.25;
}

.gen-karte p.leise {
    color: var(--fg-leise);
}

/* ------------------------------------------------------------- Formular */

.feld-fuss {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    min-height: 1rem;
}

.feld-hinweis,
.feld-zaehler {
    color: var(--fg-leise);
    font-size: 0.78rem;
    line-height: 1.3;
}

.feld-zaehler {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

.feld .fehler-text:empty {
    display: none;
}

textarea.eingabe {
    min-height: 3.5rem;
    line-height: 1.4;
    resize: vertical;
}

.knopf-schmal {
    width: 100%;
    min-height: 2.75rem;
    font-size: 0.95rem;
}

.knopf-breit {
    width: 100%;
}

.knopf-hinzu {
    align-self: flex-start;
    text-decoration: none;
    font-weight: 700;
}

.knopf-hinzu[disabled] {
    opacity: 0.4;
    cursor: default;
}

/* Eine Zeile aus Emoji-Knopf, Textfeld und Entfernen-Knopf. */
.zeile {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.zeile > .eingabe {
    flex: 1 1 auto;
    min-width: 0;
}

.weg-knopf {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    border: 2px solid var(--karte-rand);
    background: var(--karte);
    color: var(--fg-leise);
    font-size: 1rem;
    line-height: 1;
}

.weg-knopf:hover {
    color: var(--akzent);
    border-color: var(--akzent);
}

.kategorien {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.kategorie {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.7rem;
    border: 2px solid var(--karte-rand);
    border-radius: var(--radius-klein);
}

.optionen {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-left: 1rem;
    border-left: 2px dashed var(--karte-rand);
}

.zeile-option .eingabe {
    min-height: 2.75rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.95rem;
}

.termine {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.zeile-termin .eingabe {
    font-size: 0.95rem;
}

/* Schalter und Radios ---------------------------------------------------- */

.schalter,
.radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
}

.schalter label,
.radio label {
    font-size: 0.95rem;
    line-height: 1.3;
    cursor: pointer;
}

.schalter-box,
.radio-box {
    flex: 0 0 auto;
    width: 1.4rem;
    height: 1.4rem;
    accent-color: var(--akzent);
    cursor: pointer;
}

.radio-reihe {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 1.2rem;
}

/* Aufklappbarer Zwischenschritt ------------------------------------------ */

.gen-details {
    border: 2px solid var(--karte-rand);
    border-radius: var(--radius-klein);
    padding: 0.2rem 0.7rem;
}

.gen-details > summary {
    padding: 0.7rem 0.2rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--fg-leise);
    cursor: pointer;
    list-style-position: inside;
}

.gen-details-inhalt {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-bottom: 0.7rem;
}

/* Theme-Swatches --------------------------------------------------------- */

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

.swatch {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.9rem;
    padding: 0.4rem 0.8rem 0.4rem 0.45rem;
    border: 2px solid var(--karte-rand);
    border-radius: 999px;
    background: var(--karte);
    color: var(--fg);
    font-size: 0.9rem;
    font-weight: 700;
}

.swatch[aria-pressed='true'] {
    border-color: var(--akzent);
    box-shadow: 0 0 0 2px var(--akzent) inset;
}

/* Der Punkt trägt sein eigenes data-theme und holt sich die Farben des
   jeweiligen Themes aus basis.css — im JavaScript steht kein Farbwert. */
.swatch-punkt {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1px solid var(--karte-rand);
    background-image: linear-gradient(135deg, var(--akzent) 0%, var(--akzent-2) 100%);
}

/* Hinweis „wiederhergestellt“ -------------------------------------------- */

.gemerkt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    max-width: none;
    text-align: left;
    font-size: 0.9rem;
}

/* ---------------------------------------------------------- Emoji-Wahl */

.emoji-knopf {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.9rem;
    height: 2.9rem;
    border: 2px solid var(--karte-rand);
    border-radius: var(--radius-klein);
    background: var(--karte);
    font-size: 1.35rem;
    line-height: 1;
}

.emoji-knopf.ist-leer {
    color: var(--fg-leise);
    font-size: 1.1rem;
}

.emoji-knopf:hover {
    border-color: var(--akzent);
}

.emoji-popover {
    position: fixed;
    z-index: 60;
    width: min(20rem, calc(100vw - 1rem));
    max-height: min(22rem, 70vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.6rem;
    background: var(--karte);
    border: 1px solid var(--karte-rand);
    border-radius: var(--radius-klein);
    box-shadow: var(--schatten);
}

.emoji-gruppe {
    margin: 0.5rem 0 0.25rem;
    color: var(--fg-leise);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.emoji-raster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(2.5rem, 1fr));
    gap: 0.15rem;
}

.emoji-wahl {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    min-height: 2.5rem;
    border-radius: var(--radius-klein);
    font-size: 1.35rem;
    line-height: 1;
}

.emoji-wahl:hover,
.emoji-wahl[aria-pressed='true'] {
    background: var(--bg);
}

.emoji-keins {
    width: 100%;
    min-height: 2.6rem;
    border-radius: var(--radius-klein);
    color: var(--fg-leise);
    font-size: 0.9rem;
    font-weight: 700;
}

.emoji-keins:hover {
    background: var(--bg);
    color: var(--akzent);
}

/* ------------------------------------------------------------- Vorschau */

/* Die Bühne bekommt --skala und ihre Höhe per CSSOM aus app.js; der Rahmen
   selbst bleibt 360x720 groß und wird nur skaliert. */
.vorschau-buehne {
    --skala: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.vorschau-handy {
    flex: 0 0 auto;
    padding: 0.85rem 0.75rem;
    border-radius: 2.6rem;
    background: #1c1a24;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.06) inset,
        0 1rem 2.4rem rgba(0, 0, 0, 0.28);
    transform: scale(var(--skala));
    transform-origin: top center;
}

.vorschau-schirm {
    position: relative;
    width: 360px;
    height: 720px;
    border-radius: 1.9rem;
    overflow: hidden;
    background: var(--bg);
}

.vorschau-notch {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 2;
    width: 7rem;
    height: 1.3rem;
    transform: translateX(-50%);
    border-bottom-left-radius: 0.9rem;
    border-bottom-right-radius: 0.9rem;
    background: #1c1a24;
    pointer-events: none;
}

.vorschau-inhalt {
    display: block;
    width: 360px;
    height: 720px;
    border: 0;
    background: var(--bg);
}

/* --------------------------------------------------------- Link und QR */

.gen-aktion {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.link-kasten {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem;
    background: var(--karte);
    border: 1px solid var(--karte-rand);
    border-radius: var(--radius);
    box-shadow: var(--schatten);
    text-align: left;
}

.link-kasten[hidden] {
    display: none;
}

.link-feld {
    font-size: 0.85rem;
    font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    text-overflow: ellipsis;
}

.qr-kasten {
    display: flex;
    justify-content: center;
    padding: 0.6rem;
}

.qr {
    width: 100%;
    max-width: 260px;
    height: auto;
    border-radius: 0.6rem;
}

.qr-grund {
    fill: var(--karte);
}

.qr-modul {
    fill: var(--fg);
}
