:root {
    --bg: #0b0c10;
    --card: #14161d;
    --card-soft: #10131b;
    --text: #e8eaf0;
    --muted: #a5a8b3;
    --line: #242733;
    --primary: #131722;
    --primary-line: #2a3042;
    --primary-hover: #1a2030;
    --focus: #6f99e2;
    --error: #ffb4aa;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
    touch-action: manipulation;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    touch-action: manipulation;
}

button,
input,
select {
    font: inherit;
    touch-action: manipulation;
}

button {
    min-height: 46px;
    width: 100%;
    border: 1px solid var(--primary-line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
        var(--primary);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    -webkit-tap-highlight-color: transparent;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

button:hover {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent),
        var(--primary-hover);
    border-color: #4d6ea8;
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    cursor: not-allowed;
}

.textButton {
    min-height: 0;
    width: fit-content;
    justify-self: center;
    border: 0;
    background: transparent;
    color: var(--focus);
    padding: 2px 0;
    font-size: 13px;
    font-weight: 800;
}

.textButton:hover {
    background: transparent;
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.textButton:active {
    transform: none;
}

.compactButton {
    min-height: 34px;
    flex: 0 0 auto;
    width: auto;
    padding: 0 10px;
    white-space: nowrap;
}

.secondaryButton {
    border-color: var(--line);
    background: transparent;
    color: var(--muted);
}

.secondaryButton:hover {
    background: var(--card-soft);
    color: var(--text);
}

input,
select {
    min-height: 46px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f1117;
    color: var(--text);
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(111, 153, 226, 0.18);
}

.checkboxLabel {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkboxLabel input {
    width: auto;
    min-height: 0;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
}

.botField {
    position: fixed;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.botField input {
    width: 1px;
    min-height: 1px;
    padding: 0;
    border: 0;
}

p,
h1 {
    margin: 0;
}

#app {
    min-height: 100vh;
}

.topbar {
    position: fixed;
    z-index: 10;
    top: 0;
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 54px;
    border-bottom: 1px solid var(--line);
    background: rgba(11, 12, 16, 0.94);
    padding: 8px 12px;
    backdrop-filter: blur(14px);
}

.topbarLeft {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbarIdentity {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.topbarIdentity strong {
    overflow: hidden;
    color: var(--text);
    font-size: 16px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbarMeta {
    color: var(--muted);
    font-weight: 700;
}

.topbarEyebrow {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

.topbarActions,
.displayNameForm {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
}

.sessionTopbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.topbarCenter {
    display: flex;
    justify-content: center;
    min-width: max-content;
}

.topbarActions {
    max-width: min(58vw, 520px);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    justify-content: flex-end;
}

.topbarActions::-webkit-scrollbar {
    display: none;
}

.sessionTopbar .topbarActions {
    overflow: visible;
}

.reactionDock {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}

.topbarMenu {
    position: relative;
    flex: 0 0 auto;
}

.topbarMenu summary {
    min-height: 34px;
    border: 1px solid var(--primary-line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
        var(--primary);
    color: var(--text);
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
    display: grid;
    place-items: center;
    list-style: none;
    cursor: pointer;
}

.topbarMenu summary::-webkit-details-marker {
    display: none;
}

.topbarMenuPanel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 12;
    min-width: 180px;
    display: grid;
    gap: 6px;
    border: 1px solid rgba(244, 247, 255, 0.16);
    border-radius: 8px;
    background: rgba(12, 14, 19, 0.96);
    padding: 8px;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.42);
}

.topbarMenu:not([open]) .topbarMenuPanel {
    display: none;
}

.topbarMenuPanel .compactButton {
    width: 100%;
    justify-content: center;
}

.reactionButton {
    position: relative;
    min-height: 34px;
    width: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    padding: 0;
    border-color: rgba(244, 247, 255, 0.18);
    background: rgba(244, 247, 255, 0.08);
    font-size: 17px;
    line-height: 1;
}

.reactionButton[data-count]::after {
    content: attr(data-count);
    position: absolute;
    right: -4px;
    top: -6px;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 1px solid rgba(244, 247, 255, 0.28);
    border-radius: 999px;
    background: rgba(18, 18, 18, 0.88);
    color: rgba(244, 247, 255, 0.86);
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}

.displayNameForm[hidden] {
    display: none;
}

.displayNameForm input {
    min-height: 38px;
}

.screen {
    min-height: 100vh;
    display: grid;
    align-content: center;
    gap: 18px;
    width: min(100%, 460px);
    margin: 0 auto;
    padding: 22px;
}

.homeScreen {
    padding-top: 150px;
}

.brand {
    display: grid;
    gap: 4px;
}

.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.brand h1 {
    color: var(--text);
    font-size: clamp(34px, 12vw, 56px);
    line-height: 1;
    font-weight: 800;
}

.panel {
    display: grid;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    padding: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.panel p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.lobbySection,
.newSession {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(16, 19, 27, 0.55);
    padding: 12px;
}

.sectionHeader {
    display: grid;
    gap: 3px;
}

.sectionHeader h2 {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    line-height: 1.2;
}

.sectionHeader p {
    font-size: 12px;
}

.openSessions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    padding: 0 10px;
}

.sessionButton {
    aspect-ratio: 1;
    min-height: 0;
    position: relative;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 7px;
    width: 100%;
    border: 1px solid rgba(244, 247, 255, 0.18);
    border-radius: 999px;
    background:
        radial-gradient(circle at 50% 44%, rgba(0, 0, 0, 0.72) 0 56%, transparent 57%),
        conic-gradient(from -90deg, rgba(244, 247, 255, 0.58) 0 var(--session-fill, 0%), rgba(244, 247, 255, 0.07) var(--session-fill, 0%) 100%),
        radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.12), transparent 28%),
        linear-gradient(
            145deg,
            rgba(38, 42, 50, 0.96),
            rgba(11, 12, 16, 0.98)
        ),
        #121212;
    padding: 16px 14px 48px;
    text-align: center;
    box-shadow:
        inset 0 0 0 9px rgba(18, 18, 18, 0.78),
        inset 0 0 32px rgba(153, 0, 0, 0.18),
        0 18px 40px rgba(0, 0, 0, 0.32);
}

.sessionButton::before,
.sessionButton::after {
    content: "";
    position: absolute;
    inset: 11px;
    border-radius: inherit;
    pointer-events: none;
}

.sessionButton::before {
    border: 1px solid rgba(244, 247, 255, 0.14);
    background: radial-gradient(circle at 50% 44%, rgba(0, 0, 0, 0.68) 0 58%, transparent 59%);
}

.sessionButton::after {
    inset: auto 18% 18% 18%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(244, 247, 255, 0.52), transparent);
    opacity: 0.8;
}

.waitingSession {
    background:
        radial-gradient(circle at 50% 44%, rgba(0, 0, 0, 0.74) 0 56%, transparent 57%),
        conic-gradient(from -90deg, rgba(124, 211, 144, 0.64) 0 var(--session-fill, 0%), rgba(244, 247, 255, 0.07) var(--session-fill, 0%) 100%),
        radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.13), transparent 28%),
        linear-gradient(
            145deg,
            rgba(25, 39, 31, 0.98),
            rgba(10, 14, 12, 0.98)
        ),
        #121212;
    border-color: rgba(124, 211, 144, 0.34);
}

.runningSession {
    background:
        radial-gradient(circle at 50% 44%, rgba(0, 0, 0, 0.74) 0 56%, transparent 57%),
        conic-gradient(from -90deg, rgba(255, 180, 84, 0.64) 0 var(--session-fill, 0%), rgba(244, 247, 255, 0.07) var(--session-fill, 0%) 100%),
        radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.13), transparent 28%),
        linear-gradient(
            145deg,
            rgba(43, 27, 19, 0.98),
            rgba(14, 12, 11, 0.98)
        ),
        #121212;
    border-color: rgba(255, 180, 84, 0.38);
}

.sessionButton:disabled {
    cursor: wait;
    opacity: 0.7;
}

.sessionName {
    position: relative;
    z-index: 2;
    display: -webkit-box;
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.85);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.sessionStatus {
    position: relative;
    z-index: 2;
    color: rgba(232, 234, 240, 0.82);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.sessionMeta {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 2px;
    color: rgba(232, 234, 240, 0.74);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.82);
}

.sessionHintMeta {
    color: rgba(218, 222, 216, 0.82);
}

.sessionHintMeta.isDisabled {
    color: rgba(165, 168, 164, 0.7);
}

.sessionActions {
    position: absolute;
    right: 0;
    bottom: 22px;
    left: 0;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    z-index: 2;
    padding: 0 6px;
}

.sessionIconButton {
    min-height: 42px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    padding: 0;
    display: grid;
    place-items: center;
    border-color: rgba(244, 247, 255, 0.22);
    appearance: none;
    -webkit-appearance: none;
    background:
        radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.22), transparent 34%),
        rgba(18, 18, 18, 0.72);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 10px 22px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    clip-path: circle(50% at 50% 50%);
}

.sessionIconButton img {
    width: 42px;
    height: 42px;
    object-fit: fill;
    border-radius: inherit;
    clip-path: circle(50% at 50% 50%);
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}

.sessionEmpty {
    grid-column: 1 / -1;
}

.message {
    min-height: 20px;
    color: var(--error);
    font-size: 13px;
    white-space: pre-wrap;
}

.sessionScreen {
    --score-cell-width: 78px;
    --score-cell-height: 20px;
    --score-cell-font-size: 10px;
    --session-top-space: 104px;
    --session-bottom-space: 16px;
    --seat-strip-space: 72px;
    --session-gap-space: 14px;
    --play-area-height: max(260px, calc(100svh - var(--session-top-space) - var(--session-bottom-space) - var(--seat-strip-space) - (2 * var(--session-gap-space))));
    min-height: 100vh;
    display: grid;
    gap: 14px;
    width: min(100%, 1240px);
    margin: 0 auto;
    padding: 104px 16px 16px;
}

.diceBoard {
    position: relative;
    height: var(--play-area-height);
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.07), transparent 28%),
        linear-gradient(145deg, #32363b, #23262a);
    overflow: hidden;
}

.reactionLayer {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
}

.reactionBurst {
    position: absolute;
    left: var(--reaction-start-x, 50%);
    top: var(--reaction-start-y, 0);
    font-size: clamp(28px, 6vw, 58px);
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    line-height: 1;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.34));
    transform: translate(-50%, -50%);
    will-change: top, transform, opacity;
}

.reactionBurst.fromTop {
    --reaction-start-x: 50%;
    --reaction-start-y: -18px;
    --reaction-end-x: 26px;
    --reaction-start-rotate: -8deg;
    --reaction-end-rotate: 12deg;
    --reaction-fall-top: 72%;
    --reaction-duration: 1.65s;
    animation: reactionRain var(--reaction-duration) cubic-bezier(0.18, 0.8, 0.2, 1) forwards;
}

.reactionBurst.fromPlayer {
    animation: reactionPop 1.15s cubic-bezier(0.18, 0.9, 0.2, 1) forwards;
}

@keyframes reactionRain {
    0% {
        opacity: 0;
        top: var(--reaction-start-y, -22px);
        transform: translate(-50%, -120%) scale(0.76) rotate(var(--reaction-start-rotate, -8deg));
    }

    14% {
        opacity: 1;
    }

    72% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        top: var(--reaction-fall-top, 72%);
        transform: translate(calc(-50% + var(--reaction-end-x, 26px)), -50%) scale(1.1) rotate(var(--reaction-end-rotate, 12deg));
    }
}

@keyframes reactionPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.55);
    }

    16% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50% + 22px), calc(-50% - 120px)) scale(1.22) rotate(10deg);
    }
}

.diceLog {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    border-top: 1px solid rgba(232, 234, 240, 0.16);
    background: rgba(2, 3, 8, 0.72);
    color: var(--text);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

.seatColumn {
    order: 1;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 62px;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.diceBoard {
    order: 2;
}

.scoreColumn {
    order: 3;
    min-width: 0;
}

.playerSlot {
    position: relative;
    min-height: 62px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(
            to top,
            rgba(111, 153, 226, 0.1) 0,
            rgba(111, 153, 226, 0.1) var(--roll-fill, 0%),
            transparent var(--roll-fill, 0%)
        ),
        #303030;
    padding: 8px;
    color: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}

button.playerSlot {
    font: inherit;
}

button.playerSlot:hover {
    background:
        linear-gradient(
            to top,
            rgba(111, 153, 226, 0.16) 0,
            rgba(111, 153, 226, 0.16) var(--roll-fill, 0%),
            transparent var(--roll-fill, 0%)
        ),
        #363a40;
}

.emptySlot {
    cursor: default;
}

.playerSlot strong {
    display: none;
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playerSlot span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.playerSlot > span:not(.playerInitials) {
    display: none;
}

.playerInitials {
    color: var(--text);
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
}

.ownSlot {
    border-color: var(--focus);
    background:
        linear-gradient(
            to top,
            rgba(111, 153, 226, 0.36) 0,
            rgba(111, 153, 226, 0.36) var(--roll-fill, 0%),
            transparent var(--roll-fill, 0%)
        ),
        #263042;
}

.readySlot {
    border-color: rgba(46, 204, 113, 0.65);
}

.readyOverlay {
    position: absolute;
    right: 6px;
    bottom: 6px;
    left: 6px;
    display: block;
    border-radius: 7px;
    padding: 4px 5px;
    color: #07110b;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    text-align: center;
}

.readyOverlay.isReady {
    background: rgba(87, 215, 132, 0.92);
}

.readyOverlay.isNotReady {
    background: rgba(255, 119, 107, 0.92);
}

.activeSlot {
    border-color: #e8eaf0;
    box-shadow: inset 0 0 0 1px rgba(232, 234, 240, 0.45);
}

.selectedSlot {
    border-color: rgba(244, 247, 255, 0.95);
    box-shadow:
        inset 0 0 0 1px rgba(244, 247, 255, 0.5),
        0 10px 24px rgba(0, 0, 0, 0.22);
}

.selectedSlot::before {
    content: "Ansicht";
    position: absolute;
    top: 6px;
    right: 6px;
    border-radius: 999px;
    background: rgba(244, 247, 255, 0.88);
    color: #161a20;
    padding: 3px 6px;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
}

.scoreColumn {
    display: grid;
    align-content: stretch;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    height: var(--play-area-height);
    min-width: 0;
}

.scoreBlock {
    height: auto;
    min-height: 0;
    width: max-content;
    max-width: 100%;
    display: grid;
    align-content: start;
    gap: 8px;
    border: 1px solid rgba(232, 234, 240, 0.14);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 90px),
        #2b2f34;
    padding: 8px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

.manualScoreBlock {
    border-color: rgba(255, 190, 102, 0.5);
    background:
        linear-gradient(180deg, rgba(255, 190, 102, 0.12), transparent 110px),
        #302d29;
}

.scoreBlockHeader {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 0 3px 5px;
    border-bottom: 1px solid rgba(232, 234, 240, 0.1);
}

.scoreBlockTitle {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.scoreBlockHeader strong {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scoreHintState {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    color: rgba(218, 222, 216, 0.62);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.15;
}

.scoreBlockResetButton {
    min-height: 30px;
    width: fit-content;
    max-width: 100%;
    padding: 6px 9px;
    border-color: rgba(111, 153, 226, 0.46);
    border-radius: 7px;
    background: rgba(111, 153, 226, 0.12);
    color: #f4f7ff;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.scoreBlock p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.readyHint {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
    white-space: normal;
}

.scoreEyebrow {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.rollButton {
    align-self: end;
    margin-top: auto;
}

.rollButton:not(:disabled) {
    animation: rollButtonPulse 2.2s ease-in-out infinite;
}

.readyButton {
    background: rgba(46, 204, 113, 0.14);
    border-color: rgba(46, 204, 113, 0.45);
}

.readyButton.isReady {
    background: rgba(231, 76, 60, 0.12);
    border-color: rgba(231, 76, 60, 0.38);
}

.startReadyButton.canStart {
    background: rgba(46, 204, 113, 0.22);
    border-color: rgba(46, 204, 113, 0.72);
}

.dieButton {
    position: absolute;
    top: var(--die-y, 50%);
    left: var(--die-x, 50%);
    width: clamp(54px, 8vw, 92px);
    min-height: 0;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, 0.86);
    border-radius: 12px;
    background: transparent;
    padding: 0;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.38));
    transform: rotate(var(--die-rotation, 0deg));
    transition: top 0.12s ease, left 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    user-select: none;
    overflow: hidden;
}

.dieButton:disabled {
    opacity: 0.48;
    filter: grayscale(0.25) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.28));
}

.dieButton:hover {
    background: transparent;
    border-color: rgba(232, 234, 240, 0.52);
}

.dieButton:active {
    transform: rotate(var(--die-rotation, 0deg)) scale(0.96);
}

.heldDie {
    border-color: var(--focus);
    box-shadow: 0 0 0 4px rgba(111, 153, 226, 0.2);
}

.heldTrayDie {
    background: rgba(111, 153, 226, 0.13);
    border-color: #dfe9ff;
    box-shadow:
        0 0 0 4px rgba(111, 153, 226, 0.18),
        0 14px 28px rgba(0, 0, 0, 0.28);
}

.dieImage {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.scoreBlockShell {
    display: grid;
    grid-template-columns: max-content;
    align-items: start;
    height: 100%;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    scrollbar-width: none;
}

.scoreBlockShell::-webkit-scrollbar {
    display: none;
}

.blockmenue {
    display: flex;
    gap: 6px;
    min-height: 0;
}

.blockButton {
    min-height: 0;
    width: 38px;
    padding: 8px 4px;
    border: 1px solid rgba(232, 234, 240, 0.14);
    border-radius: 8px;
    background: #262a30;
    color: rgba(232, 234, 240, 0.72);
    font-size: 8px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0;
    text-transform: uppercase;
    writing-mode: vertical-rl;
    transform: none;
}

.blockButton:hover {
    color: var(--text);
}

.blockButton.isActive {
    background: rgba(111, 153, 226, 0.18);
    border-color: rgba(111, 153, 226, 0.62);
    color: #f4f7ff;
}

.scoreBlockGrid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 4px;
    width: max-content;
    min-width: 0;
    overflow: visible;
}

.scoreBlockNav,
.scoreBlockColumn {
    display: grid;
    align-content: start;
    grid-template-columns: minmax(var(--score-cell-width), max-content);
}

.scoreBlockCell {
    font-size: var(--score-cell-font-size);
    border: 1px solid rgba(232, 234, 240, 0.14);
    border-radius: 6px;
    padding: 2px 3px;
    margin: 1px;
    min-width: 4.5ch;
    max-width: none;
    text-align: center;
    height: var(--score-cell-height);
    min-height: var(--score-cell-height);
    width: auto;
    min-width: var(--score-cell-width);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    white-space: nowrap;
}

.placeholdercell {
    height: 3px;
}

.scoreBlockMenue {
    background: rgba(232, 234, 240, 0.12);
    color: rgba(232, 234, 240, 0.78);
    border-color: rgba(232, 234, 240, 0.08);
    font-weight: 800;
}

.scoreInputCell {
    background: rgba(244, 247, 255, 0.105);
    border-color: rgba(244, 247, 255, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.scorePreviewCell {
    color: #d7d9d3;
    background: rgba(244, 247, 255, 0.105);
    border-color: rgba(244, 247, 255, 0.22);
    font-weight: 900;
    text-shadow: 0 1px 7px rgba(4, 6, 8, 0.48);
}

.scorePreviewZeroCell {
    color: #9faaa8;
    background: rgba(244, 247, 255, 0.055);
    border-color: rgba(244, 247, 255, 0.18);
    font-weight: 800;
    text-shadow: 0 1px 7px rgba(0, 0, 0, 0.46);
}

.scoreStrikeCell {
    background: rgba(117, 52, 61, 0.3);
    border-color: rgba(255, 122, 138, 0.28);
    color: rgba(255, 214, 218, 0.78);
}

.scoreSummaryCell {
    background: transparent;
    border-color: rgba(111, 153, 226, 0.34);
    color: rgba(232, 234, 240, 0.76);
    font-weight: 800;
}

.finalDiceBoard {
    display: grid;
    place-items: center;
    padding: 24px;
}

.finalResults {
    width: min(100%, 520px);
    display: grid;
    gap: 12px;
    text-align: center;
}

.finalResults h2 {
    margin: 0;
    color: var(--text);
    font-size: 28px;
    line-height: 1.1;
}

.finalResultsList {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.finalResultItem {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(232, 234, 240, 0.16);
    border-radius: 8px;
    background: rgba(16, 19, 27, 0.72);
    padding: 10px;
    text-align: left;
}

.finalResultItem small {
    grid-column: 2 / -1;
    color: var(--muted);
    font-size: 11px;
}

.finalRank {
    display: grid;
    place-items: center;
    width: 28px;
    aspect-ratio: 1;
    border-radius: 999px;
    background: rgba(46, 204, 113, 0.2);
    color: #d6ffe4;
    font-weight: 900;
}

@keyframes rollButtonPulse {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        box-shadow: 0 0 0 rgba(111, 153, 226, 0);
    }
    45% {
        transform: translateY(-1px) rotate(-0.7deg);
        box-shadow: 0 0 0 4px rgba(111, 153, 226, 0.12);
    }
    55% {
        transform: translateY(-1px) rotate(0.7deg);
    }
}

.scoreButton:not(:disabled):hover {
    background: rgba(244, 247, 255, 0.18);
    border-color: rgba(244, 247, 255, 0.55);
}

.scoreButton:disabled {
    background: transparent;
    cursor: not-allowed;
    opacity: 0.45;
}

@media (max-width: 719px) {
    .sessionScreen {
        --score-cell-width: 72px;
        --score-cell-height: 18px;
        --score-cell-font-size: 8.5px;
    }

    .scoreBlock {
        max-height: none;
        padding: 6px;
        overflow: visible;
    }

    .scoreBlockHeader {
        position: sticky;
        top: 0;
        z-index: 2;
        background: #2b2f34;
    }

    .scoreBlockResetButton {
        min-height: 28px;
        padding: 5px 7px;
        font-size: 10px;
    }

    .scoreBlockGrid {
        gap: 2px;
    }

    .scoreBlockCell {
        min-width: 4ch;
        padding: 1px 2px;
        margin: 1px;
    }
}

@media (min-width: 720px) {
    .topbar {
        grid-template-columns: minmax(260px, 1fr) auto;
        align-items: center;
        padding: 8px 18px;
    }

    .sessionTopbar {
        grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
    }

    .topbarActions {
        justify-content: end;
        max-width: min(54vw, 560px);
    }

    .screen {
        width: min(100%, 900px);
        grid-template-columns: minmax(220px, 0.8fr) minmax(420px, 1fr);
        align-items: center;
    }

    .brand h1 {
        font-size: 64px;
    }

    .openSessions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .homeScreen {
        display: block;
        padding-top: 96px;
    }

    .playerSlot {
        place-items: initial;
        align-content: end;
        gap: 2px;
        padding: 10px;
    }

    .playerSlot strong,
    .playerSlot > span:not(.playerInitials) {
        display: block;
    }

    .playerInitials {
        display: none;
    }

    .scoreBlockCell {
    }
}

@media (min-width: 900px) and (max-width: 1099px) {
    .sessionScreen {
        --score-cell-width: 74px;
        --score-cell-height: 19px;
        --score-cell-font-size: 9px;
        --session-top-space: 94px;
        --session-bottom-space: 16px;
        --seat-strip-space: 76px;
        --play-area-height: min(520px, max(320px, calc(100svh - var(--session-top-space) - var(--session-bottom-space) - var(--seat-strip-space) - (2 * var(--session-gap-space)))));
        width: min(100%, 980px);
        grid-template-columns: minmax(360px, 1fr) max-content;
        align-items: stretch;
        padding-top: 94px;
        padding-bottom: 16px;
    }

    .seatColumn {
        grid-column: 1 / -1;
        order: initial;
        grid-auto-flow: column;
        grid-auto-columns: minmax(76px, 1fr);
        overflow-x: auto;
    }

    .diceBoard,
    .scoreColumn {
        order: initial;
    }

    .diceBoard {
        min-height: 0;
        height: var(--play-area-height);
    }

    .scoreColumn {
        height: var(--play-area-height);
        grid-template-rows: auto 1fr;
        justify-self: end;
        max-width: min(56vw, 520px);
    }

    .scoreBlockShell {
        height: 100%;
    }

    .scoreBlock {
        max-height: none;
        overflow: visible;
    }
}

@media (min-width: 1100px) {
    .sessionScreen {
        --score-cell-width: 78px;
        --score-cell-height: 20px;
        --score-cell-font-size: 10px;
        --session-top-space: 94px;
        --session-bottom-space: 16px;
        --play-area-height: min(620px, max(420px, calc(100svh - var(--session-top-space) - var(--session-bottom-space))));
        grid-template-columns: minmax(132px, 180px) minmax(420px, 1fr) max-content;
        align-items: stretch;
        min-height: 100vh;
        padding-top: 94px;
        padding-bottom: 16px;
    }

    .diceBoard {
        min-height: 0;
        height: var(--play-area-height);
        max-height: none;
    }

    .seatColumn {
        order: initial;
        display: grid;
        grid-auto-flow: row;
        grid-auto-columns: initial;
        height: var(--play-area-height);
        max-height: none;
        align-self: stretch;
        grid-auto-rows: minmax(0, 1fr);
        overflow: visible;
        padding-bottom: 0;
    }

    .diceBoard,
    .scoreColumn {
        order: initial;
    }

    .scoreColumn {
        height: var(--play-area-height);
        grid-template-rows: auto 1fr;
        justify-self: end;
        max-width: calc(100vw - 260px);
    }

    .scoreBlockShell {
        height: 100%;
    }
}
