/* ============================================================
   Rosi Klick – Fernsehstudio-Optik
   Palette: Studioblau, Creme, Senf, Rost, Petrol, Aubergine
   ============================================================ */

:root {
    --ink:        #0c141d;
    --stage:      #13202c;
    --panel:      #1b2b39;
    --line:       #2c4152;
    --cream:      #f2e9dc;
    --cream-dim:  #a9b8c4;
    --mustard:    #e8b32c;
    --rust:       #c0562b;
    --teal:       #1e7a6e;
    --aubergine:  #56304f;
    --mint:       #4fd1a5;

    --font-display: Impact, Haettenschweiler, "Franklin Gothic Bold",
                    "Arial Narrow", "Arial Black", sans-serif;
    --font-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

    --chrome: 15.5rem;   /* Platz für Kopf- und Fußleiste */
    --radius: 10px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    background: var(--ink);
    color: var(--cream);
    font-family: var(--font-body);
    overflow: hidden;
}

/* Studiolicht */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(120% 85% at 50% -10%, rgba(232, 179, 44, .17), transparent 62%),
        radial-gradient(90% 70% at 50% 45%, var(--stage), var(--ink) 72%);
    pointer-events: none;
    z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* ---------- Kopfleiste ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: .85rem 1.5rem;
    border-bottom: 1px solid var(--line);
    background: rgba(12, 20, 29, .72);
}

.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.brand__mark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background:
        conic-gradient(var(--mustard) 0 25%, var(--rust) 0 50%,
                       var(--teal) 0 75%, var(--aubergine) 0);
    box-shadow: 0 0 0 2px rgba(242, 233, 220, .25);
}

.brand__name {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: .09em;
    text-transform: uppercase;
    line-height: 1;
}

.progress {
    margin: 0;
    font-size: .95rem;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--cream-dim);
}

.tally {
    display: flex;
    align-items: baseline;
    gap: .5rem;
}

.tally__label {
    font-size: .7rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--cream-dim);
}

.tally__value {
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1;
    color: var(--mustard);
    font-variant-numeric: tabular-nums;
    transition: transform .28s cubic-bezier(.2, 1.6, .4, 1);
}

.tally__value.is-bumped { transform: scale(1.35); }

.tally__max {
    font-size: .8rem;
    color: var(--cream-dim);
}

/* ---------- Bühne ---------- */

.stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
}

.board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .9rem;
    max-width: 100%;
    max-height: 100%;
}

.frame {
    position: relative;
    display: block;
    margin: 0;
    line-height: 0;
    max-width: 100%;
    border: 5px solid var(--cream);
    border-radius: var(--radius);
    box-shadow:
        0 26px 60px rgba(0, 0, 0, .62),
        0 0 0 1px rgba(0, 0, 0, .4);
    background: var(--panel);
}

/* Beim Bildwechsel schließt die Scheibe ohne Übergang */
.cover.is-instant .wedge,
.cover.is-instant .wedge__num { transition: none; }

.frame__pic {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100dvh - var(--chrome));
    border-radius: calc(var(--radius) - 5px);
}

.cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: calc(var(--radius) - 5px);
}

/* Die Tortenstücke – das Herzstück */

.wedge {
    cursor: pointer;
    transform-box: view-box;
    transform-origin: center;
    transition: opacity .5s ease, transform .55s cubic-bezier(.3, .8, .3, 1);
}

.wedge:hover { filter: brightness(1.22); }

.wedge.is-open {
    opacity: 0;
    transform: translate(var(--tx, 0), var(--ty, 0)) scale(1.06);
    pointer-events: none;
}

.wedge__num {
    font-family: var(--font-display);
    fill: rgba(242, 233, 220, .5);
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
    user-select: none;
    transition: opacity .4s ease;
}

.wedge__num.is-open { opacity: 0; }

/* Punktestand-Plakette in der Ecke */

.chip {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(28%, -28%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: .5rem .9rem .6rem;
    background: var(--mustard);
    color: var(--ink);
    border-radius: var(--radius);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .5);
    line-height: 1;
    transition: background .3s ease, color .3s ease;
}

.chip__label,
.chip__unit {
    font-size: .58rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    font-weight: 700;
    opacity: .78;
}

.chip__value {
    font-family: var(--font-display);
    font-size: 2.7rem;
    font-variant-numeric: tabular-nums;
    margin: .12rem 0;
}

.chip.is-solved {
    background: var(--mint);
}

/* Erraten-Banner */

.solved {
    position: absolute;
    left: 50%;
    bottom: 1.1rem;
    transform: translateX(-50%);
    display: flex;
    align-items: baseline;
    gap: .55rem;
    padding: .55rem 1.4rem;
    border-radius: 999px;
    background: rgba(12, 20, 29, .88);
    border: 1px solid var(--mint);
    line-height: 1;
    animation: pop .35s cubic-bezier(.2, 1.5, .4, 1);
}

.solved__plus {
    font-family: var(--font-display);
    font-size: 1.9rem;
    color: var(--mint);
}

.solved__word {
    font-size: .82rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--cream);
}

@keyframes pop {
    from { opacity: 0; transform: translate(-50%, 12px) scale(.9); }
    to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.answer {
    margin: 0;
    min-height: 1.9rem;
    visibility: hidden;
    font-family: var(--font-display);
    font-size: 1.6rem;
    line-height: 1.2;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--mustard);
    text-align: center;
}

.answer.is-visible { visibility: visible; }

/* ---------- Bedienleiste ---------- */

.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .8rem 1.2rem;
    padding: .9rem 1.5rem 1.1rem;
    border-top: 1px solid var(--line);
    background: rgba(12, 20, 29, .72);
}

.group {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.group--center { flex: 1 1 auto; justify-content: center; }
.group--right  { justify-content: flex-end; }

.group__label {
    font-size: .65rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--cream-dim);
    margin-right: .2rem;
}

.btn {
    appearance: none;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--cream);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .62rem 1.05rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease,
                transform .1s ease, color .15s ease;
}

.btn:hover:not(:disabled) {
    background: #24384a;
    border-color: #3f5c72;
}

.btn:active:not(:disabled) { transform: translateY(1px); }

.btn:focus-visible {
    outline: 3px solid var(--mustard);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: .32;
    cursor: not-allowed;
}

.btn--key {
    background: rgba(232, 179, 44, .14);
    border-color: rgba(232, 179, 44, .5);
    color: var(--mustard);
}

.btn--key:hover:not(:disabled) {
    background: rgba(232, 179, 44, .24);
    border-color: var(--mustard);
}

.btn--go {
    background: var(--mint);
    border-color: var(--mint);
    color: #06231a;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
    padding: .72rem 2.2rem;
    min-width: 14rem;
}

.btn--go:hover:not(:disabled) {
    background: #6ce0b8;
    border-color: #6ce0b8;
}

.btn--go.is-undo {
    background: transparent;
    border-color: var(--line);
    color: var(--cream-dim);
}

.btn--go.is-undo:hover:not(:disabled) {
    background: var(--panel);
    color: var(--cream);
}

.btn--ghost {
    background: transparent;
    color: var(--cream-dim);
    font-weight: 500;
}

.btn--ghost:hover:not(:disabled) { color: var(--cream); }

.btn--ghost.is-ready {
    color: var(--mustard);
    border-color: rgba(232, 179, 44, .5);
}

/* ---------- Auswertung ---------- */

.result {
    width: min(760px, 100%);
    max-height: 100%;
    overflow-y: auto;
    text-align: center;
    padding: .5rem;
}

.result__eyebrow {
    margin: 0;
    font-size: .72rem;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--cream-dim);
}

.result__score {
    margin: .2rem 0 0;
    font-family: var(--font-display);
    font-size: clamp(4rem, 15vh, 7.5rem);
    line-height: 1;
    color: var(--mustard);
    font-variant-numeric: tabular-nums;
}

.result__slash,
.result__max {
    color: var(--cream-dim);
    font-size: .42em;
}

.result__slash { margin: 0 .12em; }

.result__verdict {
    margin: .3rem 0 1.4rem;
    font-size: 1.05rem;
    letter-spacing: .05em;
    color: var(--cream);
}

.result__list {
    list-style: none;
    margin: 0 0 1.6rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: .45rem;
    text-align: left;
}

.result__row {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .5rem .75rem;
    background: rgba(27, 43, 57, .7);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.result__no {
    font-family: var(--font-display);
    font-size: .95rem;
    color: var(--cream-dim);
    min-width: 1.4rem;
}

.result__title {
    flex: 1 1 auto;
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result__pts {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--mint);
    font-variant-numeric: tabular-nums;
}

.result__row--miss .result__pts { color: #6d7f8d; }

.result__actions {
    display: flex;
    gap: .7rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---------- Leerer Zustand ---------- */

.empty {
    max-width: 34rem;
    text-align: center;
}

.empty h1 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin: 0 0 .7rem;
}

.empty p { color: var(--cream-dim); line-height: 1.65; }

.empty code {
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: .1rem .4rem;
    color: var(--mustard);
}

.empty__hint { font-size: .82rem; opacity: .7; }

/* Während der Auswertung stört die Bedienleiste nur */
body.is-result .controls { display: none; }

/* ---------- Kleinere Bildschirme ---------- */

@media (max-width: 860px) {
    :root { --chrome: 20rem; }

    .topbar {
        flex-wrap: wrap;
        gap: .35rem 1rem;
        justify-content: center;
        padding: .6rem 1rem;
    }

    .stage { padding: 1rem .8rem; }
    .frame { border-width: 3px; }

    .controls {
        flex-direction: column;
        gap: .5rem;
        padding: .6rem .8rem .8rem;
    }

    .group {
        width: 100%;
        justify-content: center;
        flex-wrap: nowrap;
    }

    .group--center { order: -1; }
    .group__label { display: none; }

    .btn {
        padding: .55rem .75rem;
        font-size: .82rem;
    }

    .btn--go {
        width: 100%;
        min-width: 0;
        padding: .68rem 1rem;
    }

    .chip { transform: translate(10%, -10%); padding: .4rem .7rem .45rem; }
    .chip__value { font-size: 1.9rem; }
    .answer { font-size: 1.15rem; min-height: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
