.ml-wrap {
    --ml-night: #10182d;
    --ml-night-deep: #080d19;
    --ml-blue: #1d2d50;
    --ml-blue-soft: #31466e;
    --ml-gold: #d8b766;
    --ml-gold-light: #f1dc9a;
    --ml-silver: #dce2ec;
    --ml-paper: #f7f2e7;
    --ml-text: #2d2a27;

    max-width: 980px;
    margin: 0 auto 28px;
    overflow: hidden;
    color: var(--ml-text);
    background: #eee8dc;
    border: 1px solid #c9bea9;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(26, 31, 48, .18);
}

.ml-wrap * {
    box-sizing: border-box;
}

.ml-title {
    margin: 22px 20px 4px;
    color: #3b4660;
    text-align: center;
    font-family: Georgia, serif;
}

.ml-sub {
    margin: 0 20px 20px;
    color: #69645d;
    text-align: center;
}

.ml-machine {
    margin: 0 18px;
    overflow: hidden;
    background: var(--ml-night);
    border: 2px solid #080d17;
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px #3c4d6d;
}

.ml-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: linear-gradient(#273a61, #111a30);
    border-bottom: 1px solid #070b14;
}

.ml-plate {
    padding: 5px 9px;
    color: var(--ml-gold-light);
    background: #0c1324;
    border: 1px solid #7f6b3d;
    border-radius: 4px;
    font-weight: 800;
    letter-spacing: .1em;
}

.ml-status {
    color: #cfd8eb;
    font-size: .85rem;
    font-weight: 800;
    text-align: right;
}

.ml-main {
    display: grid;
    grid-template-columns: minmax(320px, 1.1fr) minmax(260px, .9fr);
    gap: 18px;
    padding: 18px;
}

.ml-stage,
.ml-controls {
    min-width: 0;
}

.ml-sky {
    position: relative;
    overflow: hidden;
    padding: 20px 16px 16px;
    text-align: center;
    background:
        radial-gradient(circle at 50% 32%, rgba(104, 126, 176, .28), transparent 33%),
        linear-gradient(#111a32, #080d19);
    border: 1px solid #34425e;
    border-radius: 9px;
}

.ml-stars {
    position: absolute;
    inset: 0;
    opacity: .8;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 12% 18%, #fff 0 1px, transparent 1.5px),
        radial-gradient(circle at 24% 72%, #fff 0 1px, transparent 1.5px),
        radial-gradient(circle at 37% 12%, #f4e4ae 0 1px, transparent 1.5px),
        radial-gradient(circle at 63% 18%, #fff 0 1px, transparent 1.5px),
        radial-gradient(circle at 82% 31%, #fff 0 1px, transparent 1.5px),
        radial-gradient(circle at 91% 73%, #f4e4ae 0 1px, transparent 1.5px),
        radial-gradient(circle at 69% 82%, #fff 0 1px, transparent 1.5px),
        radial-gradient(circle at 8% 51%, #fff 0 1px, transparent 1.5px);
}

.ml-moon-shell {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto 6px;
    filter: drop-shadow(0 0 20px rgba(230, 232, 220, .28));
}

.ml-moon-shell canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.ml-phase-name {
    position: relative;
    color: var(--ml-gold-light);
    font: 700 1.25rem/1.2 Georgia, serif;
}

.ml-moon-sign {
    position: relative;
    margin-top: 4px;
    color: #d8e0ef;
    font-weight: 700;
}

.ml-facts {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
}

.ml-facts > div {
    padding: 9px 7px;
    background: rgba(6, 10, 20, .62);
    border: 1px solid #354461;
    border-radius: 6px;
}

.ml-facts span,
.ml-facts strong {
    display: block;
}

.ml-facts span {
    margin-bottom: 2px;
    color: #8fa0bf;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.ml-facts strong {
    color: #f0eadc;
    font-size: .88rem;
}

.ml-meaning {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.ml-meaning article {
    padding: 12px 14px;
    color: #ddd8ce;
    background: #151e32;
    border: 1px solid #34425c;
    border-radius: 7px;
}

.ml-meaning h3 {
    margin: 0 0 5px;
    color: var(--ml-gold-light);
    font: 700 1rem/1.25 Georgia, serif;
}

.ml-meaning p {
    margin: 0;
    color: #c9cfdb;
    font-size: .88rem;
    line-height: 1.55;
}

.ml-controls {
    padding: 14px;
    color: #e4e8ef;
    background: #111a2c;
    border: 1px solid #34425d;
    border-radius: 8px;
}

.ml-row {
    margin-bottom: 14px;
}

.ml-controls label {
    display: block;
    margin-bottom: 5px;
    color: var(--ml-gold-light);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.ml-controls select,
.ml-controls input {
    width: 100%;
    padding: 9px;
    color: #222733;
    background: #f3f0e8;
    border: 1px solid #7b8497;
    border-radius: 5px;
}

.ml-mini-button {
    margin-top: 6px;
    padding: 5px 8px;
    color: #bfc8da;
    background: transparent;
    border: 1px solid #52617c;
    border-radius: 4px;
    cursor: pointer;
    font-size: .74rem;
}

.ml-custom {
    margin-bottom: 13px;
    padding: 10px;
    background: #0c1424;
    border: 1px solid #35435d;
    border-radius: 6px;
}

.ml-custom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ml-personal {
    margin: 13px 0;
    padding: 11px;
    color: #cbd2df;
    background: #18243b;
    border-left: 3px solid var(--ml-gold);
    border-radius: 4px;
}

.ml-personal span {
    display: block;
    margin-bottom: 4px;
    color: var(--ml-gold-light);
    font-weight: 800;
}

.ml-personal p {
    margin: 0;
    font-size: .82rem;
    line-height: 1.45;
}

.ml-button,
.ml-new-button {
    width: 100%;
    padding: 12px 14px;
    color: #201b10;
    background: linear-gradient(#ead18a, #b99545);
    border: 2px solid #715b2d;
    border-radius: 6px;
    font-weight: 900;
    letter-spacing: .06em;
    cursor: pointer;
}

.ml-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.ml-codepanel {
    margin-top: 12px;
    padding: 9px;
    color: #d9e4ff;
    background: #070c16;
    border: 1px solid #485777;
    border-radius: 5px;
    text-align: center;
    font: 700 .82rem/1.4 monospace;
    word-break: break-word;
}

.ml-small {
    margin-top: 9px;
    color: #aeb8ca;
    font-size: .76rem;
    line-height: 1.45;
}

.ml-small code {
    color: var(--ml-gold-light);
}

.ml-result {
    margin: 16px 18px;
    padding: 17px;
    text-align: center;
    background: #fffaf0;
    border: 1px solid #c9b785;
    border-radius: 9px;
}

.ml-result-label {
    margin-bottom: 11px;
    color: #5c4b2a;
    font-weight: 800;
    letter-spacing: .08em;
}

.ml-number-groups {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px;
}

.ml-number-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
}

.ml-number-group.extra {
    margin-left: 10px;
    padding-left: 14px;
    border-left: 2px solid #d4c69f;
}

.ml-ball {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: #25314a;
    background: linear-gradient(#fff, #e5eaf4);
    border: 2px solid #687b9d;
    border-radius: 50%;
    box-shadow: 0 2px 5px #0002;
    font-weight: 900;
}

.ml-number-group.extra .ml-ball {
    color: #4c3915;
    background: linear-gradient(#fff8dc, #f0dfa9);
    border-color: #b58b39;
}

/* ------------------------------------------------------------
   Ergebnisanimation
   Die Zahlen erscheinen nacheinander und leuchten kurz auf.
   ------------------------------------------------------------ */

.ml-ball-reveal {
    opacity: 0;
    transform: scale(.72);
    animation: ml-ball-appear 700ms ease-out var(--ml-ball-delay, 0ms) forwards;
}

@keyframes ml-ball-appear {
    0% {
        opacity: 0;
        transform: scale(.72);
        filter: brightness(1);
        box-shadow: 0 2px 5px #0002;
    }

    38% {
        opacity: 1;
        transform: scale(1.14);
        filter: brightness(1.45);
        box-shadow:
            0 0 10px rgba(241, 220, 154, .95),
            0 0 24px rgba(216, 183, 102, .72);
    }

    68% {
        opacity: 1;
        transform: scale(.98);
        filter: brightness(1.12);
    }

    100% {
        opacity: 1;
        transform: scale(1);
        filter: brightness(1);
        box-shadow: 0 2px 5px #0002;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ml-ball-reveal {
        opacity: 1;
        transform: none;
        animation: none;
    }
}

.ml-result-moment {
    margin-top: 10px;
    color: #746a5a;
    font-size: .8rem;
}

.ml-new-button {
    max-width: 280px;
    margin-top: 14px;
}

.ml-footer {
    padding: 12px 18px 16px;
    color: #6c665c;
    text-align: center;
    font-size: .85rem;
}

@media (max-width: 700px) {
    .ml-main {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .ml-machine {
        margin: 0 10px;
    }

    .ml-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .ml-status {
        text-align: left;
    }

    .ml-moon-shell {
        width: min(220px, 72vw);
        height: auto;
        aspect-ratio: 1;
    }

    .ml-result {
        margin: 14px 10px;
    }
}

@media (max-width: 420px) {
    .ml-facts {
        grid-template-columns: 1fr;
    }

    .ml-custom-grid {
        grid-template-columns: 1fr 1fr;
    }
}
