:root {
    --bg: #eaf2f8;
    --panel: #ffffff;
    --panel-soft: #f7fbfe;

    --navy-900: #082842;
    --navy-800: #0d3555;
    --navy-700: #124d78;

    --blue: #0075cc;
    --blue-light: #16a3ee;
    --cyan: #1dc8ff;

    --gold: #f3b31b;
    --gold-light: #ffd65b;
    --gold-dark: #a86b00;

    --green: #169b45;
    --red: #cf3b2f;

    --text: #153b5a;
    --muted: #6c8192;
    --line: #cfdde8;

    --scope-bg: #071f32;
    --scope-grid: rgba(125, 177, 210, 0.16);
    --scope-green: #21d4ff;

    --shadow: 0 10px 28px rgba(6, 40, 68, 0.10);
}


/* =========================================================
   BASIS
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;

    background:
        linear-gradient(
            180deg,
            #edf5fa,
            #e5eef5
        );

    color: var(--text);

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    line-height: 1.45;
}



button,
select,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

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

label {
    display: block;

    margin-bottom: 6px;

    font-weight: 700;
}

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

    border: 1px solid #b9cbd9;
    border-radius: 8px;

    background: #ffffff;
    color: var(--text);
}

select,
input {
    padding: 0 10px;
}

button {
    padding: 0 14px;

    font-weight: 700;

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

button:hover:not(:disabled) {
    filter: brightness(1.03);
    transform: translateY(-1px);
}



/* 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;
}


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

.topbar {
    position: relative;

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

    gap: 30px;

    min-height: 220px;

    padding:
        22px max(
            24px,
            calc((100vw - 1440px) / 2)
        );

    overflow: hidden;

    background:
        radial-gradient(
            circle at 66% 35%,
            rgba(0, 117, 204, 0.28),
            transparent 34%
        ),
        linear-gradient(
            100deg,
            #061f36 0%,
            #0a3455 45%,
            #0075cc 100%
        );

    color: #ffffff;

    border-bottom:
        3px solid #0c91e4;
}

.topbar::after {
    content: "";

    position: absolute;

    inset: auto 0 0;

    height: 2px;

    background:
        linear-gradient(
            90deg,
            transparent,
            var(--gold),
            transparent
        );

    opacity: 0.9;
}

.brand {
    position: relative;
    z-index: 2;

    display: flex;
    align-items: center;

    gap: 18px;
}

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

    gap: 4px;

    height: 64px;
}

.brand-mark span {
    display: block;

    width: 6px;

    background:
        linear-gradient(
            var(--gold-light),
            var(--gold)
        );

    border-radius: 999px;

    box-shadow:
        0 0 13px
        rgba(243, 179, 27, 0.35);
}

.brand-mark span:nth-child(1),
.brand-mark span:nth-child(5) {
    height: 20px;
}

.brand-mark span:nth-child(2),
.brand-mark span:nth-child(4) {
    height: 42px;
}

.brand-mark span:nth-child(3) {
    height: 62px;
}

.brand-title h1 {
    margin: 0;

    color: #ffffff;

    font-size:
        clamp(2.4rem, 5vw, 4.2rem);

    line-height: 1;

    letter-spacing: -0.03em;
}

.brand-copy {
    margin-top: 12px;
}

.brand-copy strong {
    display: block;

    color: var(--gold-light);

    font-size: 1.15rem;
}

.brand-copy span {
    display: block;

    margin-top: 4px;

    color: #d7e8f5;
}

.header-radio-wrap {
    position: relative;
    z-index: 1;

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

    flex: 0 0 min(44vw, 610px);

    min-height: 180px;

    overflow: hidden;

    border-radius: 20px;
}

.header-radio-wrap::before {
    content: "";

    position: absolute;

    inset: 0;

    z-index: 2;

    pointer-events: none;

    
}

.header-radio {
    display: block;

    width: 100%;
    height: 180px;

    object-fit: cover;
    object-position: center;

    border-radius: 20px;

    box-shadow:
        0 12px 32px
        rgba(0, 0, 0, 0.28);
}


/* =========================================================
   MAIN
   ========================================================= */

main {
    width:
        min(
            1440px,
            calc(100% - 28px)
        );

    margin:
        18px auto 36px;
}


/* =========================================================
   INTRO / ABLAUF
   ========================================================= */

.audio-intro {
    display: grid;

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

    gap: 0;

    margin-bottom: 18px;

    overflow: hidden;

    background:
        linear-gradient(
            180deg,
            #ffffff,
            #f4f9fc
        );

    border: 1px solid #d5e2ec;
    border-radius: 14px;

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

.intro-step {
    display: flex;
    align-items: center;

    gap: 13px;

    min-height: 94px;

    padding: 16px 20px;

    border-right:
        1px solid #dce7ef;
}

.intro-icon {
    display: grid;
    place-items: center;

    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    color: var(--gold-dark);

    border: 2px solid var(--gold);
    border-radius: 50%;

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

.intro-step h2 {
    margin: 0 0 3px;

    color: var(--navy-900);

    font-size: 1.05rem;
}

.intro-step p {
    margin: 0;

    color: #355d7b;

    font-size: 0.9rem;
}

.intro-wish {
    display: grid;
    place-items: center;

    min-width: 145px;

    padding: 16px 20px;

    color: var(--gold-dark);

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 1.3rem;
    font-style: italic;
    font-weight: 700;

    background:
        linear-gradient(
            135deg,
            #fff7d8,
            #ffffff
        );
}


/* =========================================================
   LAYOUT
   ========================================================= */

.layout {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.audio-sidebar,
.content {
    display: grid;
    gap: 16px;
    align-content: start;
}

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

.panel {
    overflow: hidden;

    background: var(--panel);

    border: 1px solid #c9d9e5;
    border-radius: 12px;

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

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

    gap: 10px;

    min-height: 50px;

    padding: 0 14px;

    background:
        linear-gradient(
            180deg,
            #f9fcfe,
            #eef5fa
        );

    color: var(--navy-900);

    border-bottom: 1px solid #d5e2ec;

    font-weight: 800;
}

.panel-body {
    padding: 14px;
}


/* =========================================================
   BUTTONS / FORM
   ========================================================= */

.button-stack {
    display: grid;

    gap: 10px;
}

.spacing-top {
    margin-top: 12px;
}

button.primary,
button.blue {
    background:
        linear-gradient(
            180deg,
            #16a3ee,
            #0075cc
        );

    color: #ffffff;

    border-color: #0075cc;

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

button.danger {
    color: #a12a22;
}

.status-box {
    margin-top: 12px;
    padding: 12px;

    background: #f7fafc;

    border: 1px solid #cbd9e4;
    border-radius: 8px;
}

.status-line {
    display: flex;
    align-items: center;

    gap: 8px;

    font-weight: 700;
}

.status-dot {
    width: 12px;
    height: 12px;

    flex: 0 0 12px;

    background: #9dafbc;

    border-radius: 50%;
}

.status-box.active .status-dot {
    background: var(--green);

    box-shadow:
        0 0 0 4px
        rgba(22, 155, 69, 0.12);
}

.level-track,
.progress {
    overflow: hidden;

    height: 10px;

    margin-top: 10px;

    background: #dbe6ee;

    border-radius: 999px;
}

.level-fill,
.progress > div {
    height: 100%;

    width: 0;

    background:
        linear-gradient(
            90deg,
            var(--blue-light),
            var(--gold)
        );

    border-radius: inherit;
}

.note {
    margin-top: 9px;

    color: var(--muted);

    font-size: 0.86rem;
}

.form-grid {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 10px;
}

.field.full {
    grid-column: 1 / -1;
}


/* =========================================================
   INSTRUMENTE
   ========================================================= */

.instrument-grid {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 16px;
}

.instrument {
    background:
        linear-gradient(
            180deg,
            #0d3657,
            #082842
        );

    border-color: #0b6096;

    box-shadow:
        0 12px 28px
        rgba(5, 32, 54, 0.18);
}

.instrument .panel-header {
    background:
        linear-gradient(
            180deg,
            #0e426a,
            #0b3454
        );

    color: #ffffff;

    border-bottom-color:
        rgba(255, 255, 255, 0.10);
}

.badge {
    padding: 4px 10px;

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

    color: #dcecf7;

    border:
        1px solid rgba(255, 255, 255, 0.18);

    border-radius: 999px;

    font-size: 0.78rem;
    font-weight: 400;
}

.instrument-wrap {
    padding: 12px;
}

.instrument-canvas {
    display: block;

    width: 100%;
    height: 250px;

    background: var(--scope-bg);

    border: 1px solid #2a6e9c;
    border-radius: 6px;
}

.instrument-caption {
    display: flex;
    justify-content: space-between;

    gap: 12px;

    margin-top: 7px;

    color: #d9e9f4;

    font-size: 0.83rem;
}


/* =========================================================
   METRIKEN
   ========================================================= */

.metrics {
    display: grid;

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

    gap: 12px;
}

.metric {
    min-height: 116px;

    padding: 16px;

    background:
        linear-gradient(
            180deg,
            #ffffff,
            #f6fafc
        );

    border: 1px solid #cfdee8;
    border-radius: 12px;

    box-shadow: var(--shadow);

    text-align: center;
}

.metric-label {
    color: #607a8e;

    font-size: 0.84rem;
}

.metric-value {
    margin-top: 10px;

    color: var(--navy-900);

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

.metric-value.frequency {
    color: var(--cyan);
}

.metric-value.number {
    color: var(--gold-dark);
}


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

.results-grid {
    display: grid;

    grid-template-columns:
        1.25fr 0.75fr;

    gap: 16px;
}

.lotto-rows {
    display: grid;

    gap: 14px;
}

/* ---------------------------------------------------------
   Glückszahlen – bewusst als eigentlicher Höhepunkt gestaltet
   --------------------------------------------------------- */

.lotto-row {
    position: relative;

    display: grid;
    gap: 8px;

    padding: 14px 16px 15px;

    overflow: hidden;

    background:
        radial-gradient(
            circle at 92% 12%,
            rgba(255, 214, 91, 0.20),
            transparent 27%
        ),
        linear-gradient(
            135deg,
            #ffffff,
            #f7fbfe
        );

    border: 1px solid #cbdce8;
    border-radius: 14px;

    box-shadow:
        0 6px 16px
        rgba(8, 40, 66, 0.07);
}

.lotto-row::before {
    content: "";

    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;

    width: 4px;

    background: #b9cbd9;
}

.lotto-row.active {
    border-color: #7dbde7;

    box-shadow:
        0 8px 22px
        rgba(0, 117, 204, 0.13);
}

.lotto-row.active::before {
    background: var(--blue);
}

.lotto-row.complete {
    border-color: #e8c46b;

    background:
        radial-gradient(
            circle at 92% 12%,
            rgba(255, 214, 91, 0.28),
            transparent 30%
        ),
        linear-gradient(
            135deg,
            #fffef9,
            #fff9e9
        );
}

.lotto-row.complete::before {
    background:
        linear-gradient(
            180deg,
            var(--gold-light),
            var(--gold)
        );
}

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

    gap: 9px;
}

.row-title {
    min-width: 72px;

    color: var(--navy-900);

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

.pool-label {
    min-width: 76px;

    color: #6b8091;

    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    color: #4c2b00;

    background:
        radial-gradient(
            circle at 34% 27%,
            #fffbd0 0%,
            #ffe46b 20%,
            #f9b515 55%,
            #e68100 82%,
            #bd5d00 100%
        );

    border: 2px solid #ffc52b;
    border-radius: 50%;

    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.85),
        inset 0 -3px 5px rgba(139, 65, 0, 0.18),
        0 4px 8px rgba(129, 77, 0, 0.22);

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

    font-variant-numeric: tabular-nums;
}

.number-ball.secondary {
    color: #ffffff;

    background:
        radial-gradient(
            circle at 34% 27%,
            #67c5ff 0%,
            #1c94e2 35%,
            #0075cc 68%,
            #00528e 100%
        );

    border-color: #57baff;

    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.45),
        inset 0 -3px 5px rgba(0, 45, 82, 0.25),
        0 4px 8px rgba(0, 70, 120, 0.22);
}

.number-ball.empty {
    color: #9aabba;

    background: #edf3f7;

    border: 2px dashed #c4d3de;

    box-shadow: none;
}

.lotto-row.complete .row-title {
    color: #8a5100;
}

.actions {
    display: grid;

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

    gap: 8px;

    margin-top: 14px;
}

.log {
    overflow: auto;

    max-height: 360px;
}

table {
    width: 100%;

    border-collapse: collapse;
}

th,
td {
    padding: 9px 10px;

    border-bottom: 1px solid #dde7ee;

    text-align: left;
    font-size: 0.82rem;
}

th {
    position: sticky;
    top: 0;

    background: #f2f7fa;

    color: var(--navy-900);
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
    padding: 14px 4px 0;

    color: #708596;

    font-size: 0.82rem;
    text-align: center;
}


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

@media (max-width: 1100px) {

    .topbar {
        min-height: 190px;
    }

    .header-radio-wrap {
        flex-basis: 42vw;
        min-height: 150px;
    }

    .header-radio {
        height: 150px;
    }

    .audio-intro {
        grid-template-columns:
            1fr 1fr;
    }

    .intro-wish {
        min-height: 78px;
    }

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

    /*
     * Auf kleinen Bildschirmen werden die beiden Desktop-Spalten
     * nur als logische Gruppen behandelt. Ihre Kinder werden dadurch
     * direkte Grid-Elemente von .layout und lassen sich sinnvoll ordnen.
     */
    .audio-sidebar,
    .content {
        display: contents;
    }

    .audio-source-panel { order: 1; }
    .instrument-grid     { order: 2; }
    .game-panel          { order: 3; }
    .metrics             { order: 4; }
    .draw-panel          { order: 5; }
    .results-grid        { order: 6; }
}


@media (max-width: 780px) {

    .topbar {
        min-height: 150px;
    }

    .brand-mark {
        display: none;
    }

    .brand-title h1 {
        font-size: 2.2rem;
    }

    .brand-copy strong {
        font-size: 1rem;
    }

    .header-radio-wrap {
        flex-basis: 42vw;
        min-height: 110px;
    }

    .header-radio {
        height: 110px;
    }

    .instrument-grid,
    .metrics,
    .results-grid {
        grid-template-columns:
            1fr;
    }

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

    .audio-intro {
        grid-template-columns:
            1fr;
    }

    .intro-step {
        border-right: 0;
        border-bottom:
            1px solid #dce7ef;
    }

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


@media (max-width: 520px) {

    .topbar {
        gap: 10px;

        padding:
            14px 10px;

        min-height: 122px;
    }

    .brand-copy span {
        display: none;
    }

    .brand-title h1 {
        font-size: 1.75rem;
    }

    .brand-copy {
        margin-top: 7px;
    }

    .brand-copy strong {
        font-size: 0.85rem;
    }

    .header-radio-wrap {
        flex-basis: 43vw;
        min-height: 100px;
    }

    .header-radio {
        height: 100px;
    }

    main {
        width:
            min(
                100% - 14px,
                1440px
            );

        margin-top: 10px;
    }

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

    .field.full {
        grid-column: auto;
    }

    .instrument-canvas {
        height: 210px;
    }
}


@media (max-width: 520px) {
    .lotto-row {
        padding: 12px;
    }

    .row-title {
        width: 100%;
        min-width: 100%;
    }

    .pool-label {
        width: 100%;
        min-width: 100%;
    }

    .number-ball {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }
}
