.wuerfel-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
    gap: 2rem;
    align-items: stretch;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.eyebrow {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(240, 158, 11, 0.15);
    color: #f6bb55;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-note {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
}

.hero-note h2,
.dice-controls h2,
.legend-box h3 {
    color: #F09E0B;
}

.wuerfel-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem;
    align-items: stretch;
}

.dice-stage,
.dice-controls {
    background: linear-gradient(180deg, rgba(44, 63, 74, 0.96) 0%, rgba(26, 37, 47, 0.98) 100%);
    border: 1px solid #475569;
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
}

.dice-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dice-stage-toolbar {
    display: flex;
    justify-content: flex-end;
}

.fullscreen-button {
    padding: 0.7rem 1rem;
    border: 1px solid rgba(240, 158, 11, 0.45);
    border-radius: 999px;
    background: rgba(240, 158, 11, 0.08);
    color: #f8d08a;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.fullscreen-button:hover {
    background: rgba(240, 158, 11, 0.16);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(240, 158, 11, 0.14);
}

.fullscreen-toolbar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.fullscreen-control-field {
    flex: 1 1 240px;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    color: #ffffff;
    font-weight: 600;
}

.fullscreen-control-field span {
    color: #cbd5e1;
}

.fullscreen-control-field select {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 12px;
    border: 1px solid #475569;
    background: rgba(15, 23, 42, 0.55);
    color: #ffffff;
    font-size: 1rem;
}

.fullscreen-size-control {
    width: 100%;
    display: grid;
    gap: 0.75rem;
    padding: 1rem 1.2rem;
    border-radius: 14px;
    border: 1px solid rgba(240, 158, 11, 0.24);
    background: rgba(15, 23, 42, 0.45);
}

.fullscreen-size-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: #e2e8f0;
    font-weight: 600;
}

.fullscreen-size-slider {
    width: 100%;
    accent-color: #F09E0B;
    cursor: pointer;
}

.fullscreen-toolbar.hidden {
    display: none;
}

.results-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.result-card {
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid #475569;
    border-radius: 14px;
    padding: 1rem 1.1rem;
}

.result-card--highlight {
    background: linear-gradient(180deg, rgba(240, 158, 11, 0.18), rgba(240, 158, 11, 0.08));
    border-color: rgba(240, 158, 11, 0.4);
}

.result-label {
    display: block;
    margin-bottom: 0.35rem;
    color: #94a3b8;
    font-size: 0.85rem;
}

.result-card strong {
    color: #ffffff;
    font-size: 1.3rem;
}

#totalDisplay {
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1;
    color: #f8d08a;
    font-family: 'Bebas Nueva', 'Poppins', sans-serif;
}

.dice-grid {
    display: grid;
    justify-content: center;
    grid-template-columns: repeat(var(--dice-columns, 1), minmax(110px, var(--dice-column-max, 1fr)));
    gap: 1.1rem;
    align-items: stretch;
}

.die {
    position: relative;
    min-height: 150px;
    perspective: 1000px;
}

.die-inner {
    --die-color-primary: #e2e8f0;
    --die-color-secondary: #cbd5e1;
    --die-color-edge: #94a3b8;
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), color-mix(in srgb, var(--die-color-primary) 72%, white) 34%, color-mix(in srgb, var(--die-color-secondary) 88%, white) 72%, var(--die-color-edge) 100%),
        var(--die-color-primary);
    border: 1px solid color-mix(in srgb, var(--die-color-edge) 35%, white);
    box-shadow:
        0 24px 30px rgba(15, 23, 42, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.75),
        inset 0 -10px 16px color-mix(in srgb, var(--die-color-edge) 20%, transparent);
    display: grid;
    place-items: center;
    transform-style: preserve-3d;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    overflow: hidden;
}

.die-inner::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--die-color-edge) 24%, white);
    pointer-events: none;
}

.die:hover .die-inner {
    transform: translateY(-4px) rotateX(6deg) rotateY(-6deg);
}

.die.is-rolling .die-inner {
    animation: diceSpin 0.85s cubic-bezier(0.2, 0.75, 0.25, 1);
}

.die.is-empty .die-inner {
    --die-color-primary: #f8fafc;
    --die-color-secondary: #e2e8f0;
    --die-color-edge: #94a3b8;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(226, 232, 240, 0.94)),
        #e2e8f0;
}

.die-face {
    width: 74%;
    height: 74%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    align-items: center;
    justify-items: center;
    gap: 0.2rem;
}

.pip {
    width: 42%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #475569 0, #1e293b 50%, #020617 100%);
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.15), 0 2px 4px rgba(15, 23, 42, 0.2);
}

.die-value {
    position: absolute;
    right: 0.8rem;
    bottom: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    color: #f8fafc;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.die.is-empty .die-value {
    background: rgba(71, 85, 105, 0.88);
    color: #e2e8f0;
}

.roll-summary {
    padding: 1rem 1.15rem;
    border-radius: 12px;
    border: 1px solid rgba(240, 158, 11, 0.35);
    background: rgba(240, 158, 11, 0.08);
    color: #f8d08a;
    text-align: center;
    font-weight: 500;
}

.control-intro {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.control-field {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
    color: #ffffff;
    font-weight: 600;
}

.control-field span {
    color: #cbd5e1;
}

.control-field select {
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 12px;
    border: 1px solid #475569;
    background: rgba(15, 23, 42, 0.55);
    color: #ffffff;
    font-size: 1rem;
}

.button-group {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.button-group button,
.fullscreen-toolbar button {
    flex: 1 1 180px;
    padding: 0.95rem 1.25rem;
    border-radius: 10px;
    font-size: 0.96rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
    border: none;
}

.btn-primary {
    background: #F09E0B;
    color: #1a252f;
}

.btn-primary:hover {
    background: #e89f0b;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(240, 158, 11, 0.24);
}

.btn-ghost {
    background: transparent;
    color: #f8d08a;
    border: 1px solid rgba(240, 158, 11, 0.45);
}

.btn-ghost:hover {
    background: rgba(240, 158, 11, 0.08);
    transform: translateY(-2px);
}

.legend-box {
    margin-top: 1.5rem;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid #475569;
    color: #cbd5e1;
}

.dice-stage:fullscreen {
    --fullscreen-dice-scale: 1;
    width: 100%;
    max-width: none;
    min-height: 100vh;
    border-radius: 0;
    padding: 2rem;
    overflow-y: auto;
    background:
        radial-gradient(circle at top, rgba(240, 158, 11, 0.14), rgba(26, 37, 47, 0.94) 30%, rgba(15, 23, 42, 0.98) 100%),
        #111827;
}

.dice-stage:fullscreen .dice-stage-toolbar,
.dice-stage:fullscreen .results-panel,
.dice-stage:fullscreen .dice-grid,
.dice-stage:fullscreen .roll-summary,
.dice-stage:fullscreen .fullscreen-toolbar {
    width: min(1200px, 100%);
    margin-left: auto;
    margin-right: auto;
}

.dice-stage:fullscreen .fullscreen-toolbar {
    display: flex;
}

.dice-stage:fullscreen .roll-summary {
    font-size: 2rem;
    line-height: 1.35;
}

.dice-stage:fullscreen .dice-grid {
    justify-content: center;
    grid-template-columns: repeat(var(--dice-columns, 1), minmax(calc(180px * var(--fullscreen-dice-scale)), var(--dice-column-max-fullscreen-scaled, var(--dice-column-max-fullscreen, 1fr))));
    gap: calc(1.1rem * var(--fullscreen-dice-scale));
}

.dice-stage:fullscreen .die {
    min-height: calc(220px * var(--fullscreen-dice-scale));
}

.dice-stage:fullscreen .pip {
    width: 42%;
}

.dice-stage:fullscreen .die-value {
    right: calc(0.8rem * var(--fullscreen-dice-scale));
    bottom: calc(0.8rem * var(--fullscreen-dice-scale));
    padding: calc(0.25rem * var(--fullscreen-dice-scale)) calc(0.6rem * var(--fullscreen-dice-scale));
    font-size: calc(0.85rem * var(--fullscreen-dice-scale));
}

@keyframes diceSpin {
    0% {
        transform: rotateX(0deg) rotateY(0deg) scale(1);
    }
    35% {
        transform: rotateX(180deg) rotateY(160deg) scale(1.04);
    }
    68% {
        transform: rotateX(315deg) rotateY(290deg) scale(0.98);
    }
    100% {
        transform: rotateX(360deg) rotateY(360deg) scale(1);
    }
}

@media (max-width: 980px) {
    .wuerfel-hero,
    .wuerfel-layout {
        grid-template-columns: 1fr;
    }

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

}

@media (max-width: 640px) {
    .dice-stage,
    .dice-controls {
        padding: 1.25rem;
    }

    .die {
        min-height: 130px;
    }

    .button-group button,
    .fullscreen-toolbar button {
        flex-basis: 100%;
    }
}