:root {
    --page-bg: #fff6dc;
    --panel: #ffffff;
    --panel-soft: #fff9e9;

    --red: #b11d00;
    --red-dark: #7d1400;
    --red-deep: #5e0c00;

    --orange: #f28a00;
    --orange-dark: #b24d00;

    --yellow: #ffd96f;
    --yellow-light: #fff0a8;

    --cream: #fff7df;
    --text: #4a1600;
    --muted: #7a2b00;

    --border: rgba(190, 60, 0, 0.28);
    --shadow: 0 10px 30px rgba(120, 45, 0, 0.14);
}


* {
    box-sizing: border-box;
}


body {
    margin: 0;

    background:
        radial-gradient(
            circle at top left,
            rgba(255, 217, 111, 0.55),
            transparent 28%
        ),
        var(--page-bg);

    color: var(--text);

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    line-height: 1.45;
}



button,
select,
input {
    font: inherit;
}


button {
    cursor: pointer;
}


button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}


/* Lotto-Familie
   --------------------------------------------------------- */

.lotto-family {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;

    gap: 8px;

    margin: 10px 0;
}


.lotto-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 34px;

    padding: 6px 14px;

    border: 2px solid;

    border-radius: 999px;

    color: #333;

    font-size: 0.86rem;
    font-weight: 800;

    line-height: 1;

    text-decoration: none;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}


.lotto-badge:hover {
    transform: translateY(-1px);

    box-shadow:
        0 4px 10px
        rgba(0, 0, 0, 0.14);
}


/* Audio Lotto: weiß mit neutralem Rand */
.lotto-audio,
.lotto-audio:link,
.lotto-audio:visited {
    background: #124d78;
    border-color: #f3b31b;
    color: #fff;
}


/* Fibonacci Lotto: gelb mit orangem Rand */
.lotto-fibo, .lotto-fibo:link, .lotto-fibo:visited {
    background: #ffd51f;
    border-color: #ed7900;

    color: #333;
}


/* Kleroterion Lotto: weiß mit blauem Rand */
.lotto-klero, .lotto-klero:link, .lotto-klero:visited {
    background: #ffffff;
    border-color: #2586c7;

    color: #155b8c;
}



/* =========================================================
   KOPFBEREICH
   ========================================================= */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;
    padding: 18px max(20px, calc((100vw - 1280px) / 2));

    background:
        linear-gradient(
            135deg,
            #fff6c7,
            #ffca4d 58%,
            #f07900
        );

    border-bottom: 3px solid var(--red);

    box-shadow:
        0 8px 30px rgba(120, 45, 0, 0.16);
}


.brand {
    display: flex;
    align-items: center;

    gap: 18px;
}


.brand h1 {
    margin: 0;

    color: var(--red);

    font-family: Georgia, serif;
    font-size: clamp(1.8rem, 4vw, 2.7rem);

    text-shadow:
        1px 1px 0 #fff2b8;
}


.brand-copy {
    padding-left: 18px;

    border-left:
        1px solid rgba(177, 29, 0, 0.28);
}


.brand-copy strong {
    display: block;

    color: var(--red-dark);
}


.brand-copy span {
    color: var(--muted);

    font-size: 0.9rem;
}


.process {
    color: var(--red-dark);

    font-size: 0.88rem;
    font-weight: 700;
    text-align: right;
}


.overline {
    margin: 0 0 4px;

    color: #b82800;

    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}


/* =========================================================
   HAUPTLAYOUT - WIE AUDIO-LOTTO
   ========================================================= */

.page {
    width: min(
        1280px,
        calc(100% - 28px)
    );

    margin:
        20px auto 40px;
}


.layout {
    display: grid;

    grid-template-columns:
        320px
        minmax(0, 1fr);

    gap: 16px;

    align-items: start;
}


.sidebar-klero,
.content {
    display: grid;

    gap: 16px;
}


/* =========================================================
   PANELS
   ========================================================= */

.panel,
.machine-panel {
    overflow: hidden;

    background:
        radial-gradient(
            circle at 0% 0%,
            rgba(255, 255, 255, 0.65),
            transparent 28%
        ),
        linear-gradient(
            145deg,
            #fffaf0,
            #fff0b8
        );

    border:
        1px solid var(--border);

    border-radius: 14px;

    box-shadow:
        var(--shadow);
}


.panel-header {
    padding: 12px 14px;

    background:
        linear-gradient(
            #fffdf6,
            #fff3cb
        );

    color: var(--red-dark);

    border-bottom:
        1px solid var(--border);

    font-weight: 900;
}


.panel-body {
    padding: 14px;
}


.panel-body label {
    display: block;

    margin-bottom: 6px;

    color: var(--red-dark);

    font-size: 0.9rem;
    font-weight: 900;
}


select,
input {
    width: 100%;
    min-height: 42px;

    padding: 0 10px;

    background: #fffdf2;
    color: var(--text);

    border:
        1px solid #d86c00;

    border-radius: 8px;
}


.note {
    margin:
        10px 0 0;

    color: var(--muted);

    font-size: 0.86rem;
}


.form-grid {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 10px;
}


.button-stack {
    display: grid;

    gap: 10px;
}


.start-button,
.secondary-button,
.copy-button {
    min-height: 44px;

    padding:
        10px 14px;

    border: 0;
    border-radius: 9px;

    font-weight: 900;
}


.start-button {
    background:
        linear-gradient(
            #e33200,
            #9e1600
        );

    color: #fff8db;

    box-shadow:
        0 4px 0 #641000;
}


.secondary-button {
    background:
        linear-gradient(
            #f39a00,
            #b24d00
        );

    color: #fff8db;

    box-shadow:
        0 4px 0 #7b2f00;
}


.copy-button {
    width: auto;

    background: #fff9d8;
    color: var(--red-dark);

    border:
        1px solid var(--border);
}


/* =========================================================
   STATUS
   ========================================================= */

.status-panel {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 12px;
}


.status-panel > div {
    padding: 14px;

    background: #fff9d8;

    border:
        1px solid var(--border);

    border-radius: 10px;

    box-shadow:
        0 6px 18px rgba(120, 45, 0, 0.08);
}


.status-label {
    display: block;

    margin-bottom: 4px;

    color: var(--muted);

    font-size: 0.73rem;
    font-weight: 800;
    text-transform: uppercase;
}


.status-panel strong {
    color: var(--red-dark);

    font-size: 1.02rem;
}


/* =========================================================
   KLEROTERION / ACTION
   ========================================================= */

.machine-panel {
    padding: 16px;
}


.machine-head,
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;
    margin-bottom: 14px;
}


.machine-head h2,
.section-head h2 {
    margin: 0;

    color: var(--red);

    font-family: Georgia, serif;
}


.legend {
    display: flex;
    flex-wrap: wrap;

    gap: 14px;

    color: var(--muted);

    font-size: 0.86rem;
    font-weight: 800;
}


.legend span {
    display: flex;
    align-items: center;

    gap: 6px;
}


.legend-ball {
    display: inline-block;

    width: 18px;
    height: 18px;

    border-radius: 50%;
}


.legend-ball.keep {
    background:
        radial-gradient(
            circle at 35% 30%,
            #ffffff,
            #fff4c0
        );

    border:
        2px solid #9c6a00;
}


.legend-ball.reject {
    background:
        radial-gradient(
            circle at 35% 30%,
            #d92800,
            #5e0c00
        );

    border:
        2px solid #5b1100;
}


.machine {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        86px;

    gap: 14px;

    align-items: stretch;
}


.round-text {
    min-height: 46px;

    margin-bottom: 10px;
    padding: 10px 13px;

    background: #fff9d8;
    color: #8c2500;

    border:
        1px solid var(--border);

    border-radius: 10px;

    font-weight: 900;
}


.board {
    display: grid;

    grid-template-columns:
        repeat(10, minmax(0, 1fr));

    gap: 7px;

    min-height: 430px;
    padding: 14px;

    background:
        radial-gradient(
            circle at 12% 12%,
            rgba(255, 255, 255, 0.30),
            transparent 24%
        ),
        linear-gradient(
            145deg,
            #fff0a8,
            #ffb12b
        );

    border:
        4px solid #d23a00;

    border-radius: 18px;

    box-shadow:
        inset 0 0 26px rgba(140, 40, 0, 0.22);
}


.board-number {
    display: flex;
    align-items: center;
    justify-content: center;

    aspect-ratio: 1 / 1;

    background:
        radial-gradient(
            circle at 35% 28%,
            #ffffff,
            #ffe27a 55%,
            #f28a00
        );

    color: #7a1800;

    border:
        2px solid #b52a00;

    border-radius: 50%;

    font-size:
        clamp(0.68rem, 1.2vw, 1rem);

    font-weight: 900;

    box-shadow:
        0 4px 10px rgba(120, 45, 0, 0.22);

    transition:
        transform 0.12s ease,
        opacity 0.12s ease,
        filter 0.12s ease,
        background 0.12s ease;
}


.board-number.current {
    z-index: 2;

    outline:
        3px solid #ffffff;

    transform:
        scale(1.12);
}


.board-number.keep {
    background:
        radial-gradient(
            circle at 35% 28%,
            #ffffff,
            #fff0a0 50%,
            #e32800
        );

    border-color:
        #8d1200;
}


.board-number.out {
    opacity: 0.18;

    filter:
        grayscale(1);

    transform:
        scale(0.88);
}


.tube-wrap {
    display: flex;
    flex-direction: column;
}


.tube-title {
    margin-bottom: 7px;

    color: var(--red-dark);

    font-size: 0.8rem;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
}


.tube {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;

    align-content: center;
    align-items: center;

    gap: 5px;

    min-height: 430px;
    padding: 8px 4px;

    overflow: hidden;

    background:
        linear-gradient(
            90deg,
            #a32000,
            #ffd15f,
            #a32000
        );

    border:
        3px solid #801500;

    border-radius: 28px;

    box-shadow:
        inset 0 0 18px rgba(0, 0, 0, 0.35);
}


.tube-ball {
    width: 22px;
    height: 22px;

    flex:
        0 0 22px;

    border:
        2px solid #5b1100;

    border-radius: 50%;

    animation:
        ballDrop 0.14s ease both;
}


.tube-ball.keep {
    background:
        radial-gradient(
            circle at 35% 30%,
            #ffffff,
            #fff4c0
        );
}


.tube-ball.reject {
    background:
        radial-gradient(
            circle at 35% 30%,
            #d92800,
            #5e0c00
        );
}


@keyframes ballDrop {
    from {
        opacity: 0;

        transform:
            translateY(-12px)
            scale(0.75);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}


/* =========================================================
   ERGEBNISSE
   ========================================================= */

.result-panel {
    padding: 16px;
}


.results {
    display: grid;

    gap: 12px;
}


.result-row {
    padding: 12px;

    background:
        rgba(255, 255, 255, 0.72);

    border:
        1px solid var(--border);

    border-radius: 12px;
}


.result-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 9px;
}


.result-line + .result-line {
    margin-top: 9px;
}


.result-label {
    min-width: 90px;

    color: var(--red-dark);

    font-weight: 900;
}


.result-ball {
    display: grid;
    place-items: center;

    width: 44px;
    height: 44px;

    background:
        radial-gradient(
            circle at 35% 28%,
            #ffffff,
            #ffe27a 45%,
            #e32800
        );

    color: #7a1800;

    border:
        2px solid #8d1200;

    border-radius: 50%;

    font-size: 1rem;
    font-weight: 900;

    box-shadow:
        0 4px 10px rgba(120, 45, 0, 0.18);
}


.result-ball.extra {
    background:
        radial-gradient(
            circle at 35% 28%,
            #ffffff,
            #fff3a8 45%,
            #f28a00
        );
}


.placeholder {
    color: #a67a5c;

    font-style: italic;
}


/* =========================================================
   INFO
   ========================================================= */

.info-box {
    padding:
        13px 15px;

    background: #fff9d8;
    color: var(--muted);

    border:
        1px solid var(--border);

    border-radius: 12px;

    font-size: 0.86rem;
}


code {
    color: var(--red-dark);
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1050px) {

    .layout {
        grid-template-columns:
            1fr;
    }

    .sidebar-klero {
        grid-template-columns:
            1fr 1fr;
    }

    .status-panel {
        grid-template-columns:
            1fr 1fr;
    }
}


@media (max-width: 760px) {

    .topbar {
        flex-direction:
            column;

        align-items:
            flex-start;
    }

    .brand-copy {
        display: none;
    }

    .process {
        text-align: left;
    }

    .sidebar-klero {
        grid-template-columns:
            1fr;
    }

    .machine-head,
    .section-head {
        align-items:
            flex-start;

        flex-direction:
            column;
    }

    .machine {
        grid-template-columns:
            1fr;
    }

    .tube-wrap {
        order: -1;
    }

    .tube {
        flex-direction:
            row;

        flex-wrap:
            wrap;

        align-content:
            flex-start;

        justify-content:
            flex-start;

        min-height:
            76px;
    }

    .board {
        grid-template-columns:
            repeat(7, minmax(0, 1fr));

        min-height:
            auto;
    }
}


@media (max-width: 480px) {

    .page {
        width:
            min(100% - 18px, 1280px);
    }

    .topbar {
        padding:
            16px 12px;
    }

    .status-panel,
    .form-grid {
        grid-template-columns:
            1fr;
    }

    .board {
        gap:
            5px;

        padding:
            10px;
    }

    .result-ball {
        width:
            40px;

        height:
            40px;
    }
}


/* =========================================================
   KURZE EINLEITUNG
   ========================================================= */

.intro-panel {
    margin-bottom: 16px;
    padding: 15px 18px;

    background: #fff9d8;

    border: 1px solid var(--border);
    border-radius: 12px;

    box-shadow:
        0 6px 18px rgba(120, 45, 0, 0.08);
}

.intro-panel h2 {
    margin: 0 0 7px;

    color: var(--red);

    font-family: Georgia, serif;
    font-size: 1.25rem;
}

.intro-panel p {
    margin: 0;

    color: var(--muted);

    font-size: 0.99rem;
}

.intro-panel p + p {
    margin-top: 7px;
}


/* =========================================================
   HISTORISCHE KOPFZEILE UND INFOTEXT
   ========================================================= */

.process.quote {
    display: grid;

    gap: 2px;

    max-width: 360px;

    text-align: right;
}

.quote-greek {
    color: var(--red-dark);

    font-family: Georgia, serif;
    font-size: 1.05rem;
    font-style: italic;
    font-weight: 700;
}

.quote-de {
    color: var(--muted);

    font-size: 0.82rem;
}

.history-box strong {
    display: block;

    margin-bottom: 5px;

    color: var(--red-dark);
}

.history-box p {
    margin: 0;
}


/* Die Kugelröhre bleibt immer so hoch wie das Kleroterion.
   Neue Kugeln dürfen unten aus dem sichtbaren Bereich verschwinden. */
.tube-wrap {
    min-height: 0;
}

.tube {
    height: 430px;
    min-height: 430px;
    max-height: 430px;

    overflow: hidden;
}


/* Mobile Ansicht: ebenfalls feste, kurze Röhre. */
@media (max-width: 760px) {

    .process.quote {
        max-width: none;

        text-align: left;
    }

    .tube {
        height: 76px;
        min-height: 76px;
        max-height: 76px;

        overflow: hidden;
    }
}


/* =========================================================
   VERSION 1.4 – BILD RECHTS OBEN IM HEADER
   ========================================================= */

.topbar {
    display: block;

    padding: 0;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;

    width: min(
        1280px,
        calc(100% - 40px)
    );

    margin: 0 auto;

    padding: 14px 0;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 18px;

    flex: 0 0 auto;
}

.header-greek {
    display: block;

    width: 172px;
    height: 172px;

    object-fit: cover;

    border: 3px solid rgba(255, 247, 223, 0.90);
    border-radius: 18px;

    box-shadow:
        0 7px 18px rgba(104, 40, 0, 0.22);
}


/* =========================================================
   RESPONSIVE HEADER
   ========================================================= */

@media (max-width: 900px) {

    .topbar-inner {
        align-items: flex-start;
    }

    .brand {
        align-items: flex-start;
    }

    .brand-copy {
        display: none;
    }

    .header-greek {
        width: 140px;
        height: 140px;

        border-radius: 15px;
    }
}


@media (max-width: 620px) {

    .topbar-inner {
        width: min(
            100% - 24px,
            1280px
        );

        gap: 12px;

        padding: 12px 0;
    }

    .header-right {
        gap: 10px;
    }

    .process.quote {
        display: none;
    }

    .header-greek {
        width: 130px;
        height: 130px;

        border-width: 2px;
        border-radius: 12px;
    }

    .brand h1 {
        font-size: clamp(
            1.55rem,
            8vw,
            2.1rem
        );
    }
}
