:root {
    --paper: #f7f0dc;
    --paper-dark: #e9dfc3;
    --ink: #182219;
    --green: #174f36;
    --green-light: #2e7652;
    --red: #c84b3f;
    --gold: #e4b94f;
    --nav-height: 58px;
}

body[data-kniffel-room] {
    --game-ui-accent: var(--gold);
    --game-ui-header-background: #0b2b1ef2;
    --game-ui-primary-background: var(--red);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100dvh;
    margin: 0;
    color: var(--ink);
    background: radial-gradient(circle at 18% 10%, #ffffff12 0 8%, transparent 8.3%), linear-gradient(145deg, #123d2b, #216044) fixed;
    background-attachment: fixed;
    font-family: Arial, Helvetica, sans-serif;
}

body.kn-playing {
    height: 100dvh;
    overflow: hidden;
}

button, input, select {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.kn-nav {
    position: relative;
    z-index: 20;
    height: var(--nav-height);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 0 max(16px, env(safe-area-inset-left));
    color: #fff8e8;
    background: #0b2b1e;
    box-shadow: 0 2px 14px #071d154d;
}

.kn-nav a {
    color: inherit;
    text-decoration: none;
}

.kn-nav > a:first-child {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .9rem;
}

.kn-nav svg {
    width: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.kn-wordmark {
    font-family: Georgia, serif;
    font-weight: 900;
    letter-spacing: .12em;
}

.kn-help-toggle {
    justify-self: end;
    width: 25px;
    height: 25px;
    border: 1px solid #c9decf;
    border-radius: 50%;
    padding: 0;
    color: #e7f1e9;
    background: transparent;
    font-family: Georgia, serif;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.kn-help-toggle:hover, .kn-help-toggle:focus-visible, .kn-help-toggle[aria-expanded="true"] {
    border-color: var(--gold);
    color: var(--gold);
    outline: none;
}

#kn-app {
    min-height: calc(100dvh - var(--nav-height));
}

.kn-landing {
    min-height: calc(100dvh - var(--nav-height));
    display: grid;
    place-items: center;
    padding: 28px 18px;
    background: transparent;
}

.kn-panel {
    width: min(460px, 100%);
    padding: clamp(24px, 6vw, 42px);
    border: 1px solid #d8ceb0;
    border-radius: 4px;
    background: var(--paper);
    box-shadow: 16px 20px 0 #09251966;
    transform: rotate(-.35deg);
}

.kn-panel h1 {
    margin: 0 0 10px;
    font-family: Georgia, serif;
    font-size: 3rem;
    line-height: .9;
    letter-spacing: -.06em;
    text-transform: uppercase;
}

.kn-panel h2 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.kn-panel p {
    color: #5e665d;
    line-height: 1.5;
}

.kn-kicker {
    display: block;
    margin-bottom: 13px;
    color: var(--red);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.kn-form {
    display: grid;
    gap: 13px;
    margin-top: 24px;
}

.kn-form label {
    display: grid;
    gap: 6px;
    color: #39443b;
    font-size: .82rem;
    font-weight: 700;
}

.kn-player-setup, .kn-player-links {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 12px;
    border: 1px solid #d6cfb9;
    border-radius: 9px;
    background: #fffaf0;
}

.kn-player-setup legend, .kn-player-links > strong {
    padding: 0 3px;
    color: #39443b;
    font-size: .78rem;
    font-weight: 900;
}

.kn-player-inputs {
    display: grid;
    gap: 8px;
}

.kn-form input, .kn-form select {
    min-width: 0;
    min-height: 44px;
    border: 1px solid #b8b39f;
    border-radius: 3px;
    padding: 0 11px;
    color: var(--ink);
    background: #fffdf5;
}

.kn-primary, .kn-secondary, .kn-link-button, .kn-roll-button {
    min-height: 44px;
    border: 0;
    border-radius: 3px;
    padding: 0 16px;
    font-weight: 800;
    cursor: pointer;
}

.kn-primary, .kn-roll-button {
    color: white;
    background: var(--red);
    box-shadow: 0 5px 0 #8f3028;
}

.kn-primary:active, .kn-roll-button:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #8f3028;
}

.kn-secondary {
    color: #fff;
    background: var(--green-light);
}

.kn-icon-button {
    width: 44px;
    min-width: 44px;
    padding: 10px;
    display: grid;
    place-items: center;
}

.kn-icon-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.kn-player-setup .kn-icon-button {
    justify-self: start;
}

.kn-recent-session .kn-icon-button {
    margin-left: auto;
}

.kn-link-button {
    min-height: 34px;
    color: #687069;
    background: transparent;
}

button:disabled {
    cursor: default;
    opacity: .55;
}

.kn-players, .kn-recent-list {
    display: grid;
    gap: 8px;
    margin: 20px 0;
    padding: 0;
    list-style: none;
}

.kn-players li, .kn-recent-session {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid #d8d0b8;
    background: #fffaf0;
}

.kn-players small, .kn-recent-session small {
    margin-left: auto;
    color: #73786f;
}

.kn-avatar {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--green);
    font-weight: 900;
}

.kn-share, .kn-bot-controls {
    display: flex;
    gap: 8px;
    align-items: end;
}

.kn-share input, .kn-bot-controls label {
    flex: 1;
}

.kn-player-shares {
    display: grid;
    gap: 8px;
}

.kn-player-share {
    align-items: center;
}

.kn-player-share-info {
    min-width: 0;
    display: flex;
    flex: 1;
    align-items: center;
    gap: 10px;
    background: white;
    height: 100%;
    border-radius: 3px;
    border: 1px solid #b8b39f;
    padding: 0 11px;
}

.kn-player-share-info > span:last-child {
    min-width: 0;
    display: grid;
    gap: 1px;
}

.kn-player-share-info strong, .kn-player-share-info small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kn-player-share-info small {
    color: #73786f;
    font-size: .72rem;
}

.kn-delete {
    margin-left: auto;
    border: 0;
    color: #7e413b;
    background: transparent;
    font-size: 1.35rem;
    cursor: pointer;
}

.kn-recent {
    margin-top: 28px;
    padding-top: 20px;
}

.kn-recent-session > div {
    flex: 1;
    min-width: 0;
}

.kn-recent-session small {
    display: block;
    margin-top: 3px;
}

.kn-resume-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.kn-resume-buttons button {
    border: 0;
    border-radius: 20px;
    padding: 5px 9px;
    color: #fff;
    background: var(--green-light);
    cursor: pointer;
}

.kn-playing #kn-app {
    height: calc(100dvh - var(--nav-height));
    min-height: 0;
}

.kn-game {
    position: relative;
    height: 100%;
    overflow: hidden;
    padding: 8px 12px 44px;
    background: linear-gradient(120deg, #164b34, #0e3424);
}

.kn-layout {
    width: min(900px, 100%);
    height: 100%;
    min-height: 0;
    margin: auto;
}

.kn-table {
    position: relative;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    justify-items: center;
    gap: 7px;
}

.kn-sheet-launchers {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.kn-player-area {
    position: relative;
    z-index: 10;
    width: 100%;
}

.kn-sheet-launcher {
    position: relative;
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ffffff38;
    border-radius: 999px;
    padding: 0 11px;
    color: #e6f0e8;
    background: #09291dbd;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.kn-sheet-launcher.turn {
    color: #182219;
    background: var(--gold);
}

.kn-sheet-launcher u {
    text-underline-offset: 3px;
}

.kn-sheet-launcher b {
    min-width: 22px;
    text-align: right;
}

.kn-reaction-bubble {
    display: flex;
    align-items: baseline;
    gap: 5px;
    max-width: min(100%, 430px);
    padding: 4px 7px;
    border-radius: 12px;
    color: #172118;
    background: #fff8df;
    box-shadow: 0 4px 12px #0005;
    font-size: .78rem;
    font-weight: 700;
    pointer-events: none;
    overflow-wrap: anywhere;
}

.kn-reaction-feed {
    position: absolute;
    z-index: 1;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.kn-sheet-launchers.has-short-reactions + .kn-reaction-feed {
    top: calc(100% + 41px);
}

.kn-reaction-short {
    position: absolute;
    z-index: 2;
    top: calc(100% + 6px);
    left: 50%;
    max-width: min(170px, 70vw);
    border-radius: 999px;
    white-space: nowrap;
    transform: translateX(-50%);
}

.kn-reaction-bubble strong {
    flex: 0 0 auto;
}

.kn-reaction-bubble span {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.kn-help-tooltips {
    position: absolute;
    z-index: 18;
    inset: 0;
    display: none;
    pointer-events: none;
}

.kn-help-open .kn-help-tooltips {
    display: block;
}

.kn-help-tooltip {
    position: absolute;
    max-width: min(235px, 48%);
    margin: 0;
    padding: 7px 9px;
    border: 1px solid #f1d777;
    border-radius: 9px;
    color: #203025;
    background: #fff8dff2;
    box-shadow: 0 6px 16px #061b1370;
    font-size: .72rem;
    line-height: 1.25;
}

.kn-help-tooltip strong {
    display: block;
    margin-bottom: 2px;
    color: #875c11;
}

.kn-help-players { top: 39px; left: 50%; transform: translateX(-50%); }
.kn-help-dice { top: 40%; left: 4%; }
.kn-help-held { top: 48%; right: 2%; }
.kn-help-arrange { bottom: 42px; left: 4%; }
.kn-help-dice-style {
    position: fixed;
    left: max(3px, env(safe-area-inset-left, 0px));
    bottom: max(46px, calc(env(safe-area-inset-bottom, 0px) + 46px));
}
.kn-help-controls { bottom: 42px; left: 50%; transform: translateX(-50%); }
.kn-help-corner {
    position: fixed;
    right: max(3px, env(safe-area-inset-right, 0px));
    bottom: max(46px, calc(env(safe-area-inset-bottom, 0px) + 46px));
    max-width: min(245px, 62vw);
}

.kn-arena {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 8px;
}

.kn-stage-head {
    min-height: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #c8ddce;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.kn-dice-stage {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border: 3px solid #ffffff05;
    border-radius: 5px;
    background: radial-gradient(circle at 40% 36%, #397d5b, #1e573c 65%, #17462f);
    box-shadow: inset 0 0 52px #0b271b99, 0 12px 24px #061b135c;
    isolation: isolate;
}

.kn-stage-tools {
    position: absolute;
    z-index: 8;
    bottom: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.kn-straighten-dice {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #ffffff52;
    border-radius: 999px;
    padding: 5px 9px;
    color: #e6f0e8;
    background: #09291dbd;
    font-size: .68rem;
    font-weight: 800;
    cursor: pointer;
}

.kn-straighten-dice:active,
.kn-dice-style-toggle:active {
    outline: none;
    border-color: var(--gold);
    color: #172118;
    background: var(--gold);
}

.kn-straighten-dice svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.kn-dice-style-toggle svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.kn-dice-style-toggle circle {
    fill: currentColor;
    stroke: none;
}

.kn-dice-style-toggle text {
    fill: currentColor;
    stroke: none;
    font-family: inherit;
    font-size: 11px;
    font-weight: 400;
}

.kn-dice-style-toggle {
    right: auto;
    left: max(3px, env(safe-area-inset-left, 0px));
}

.kn-turn-label {
    position: absolute;
    z-index: 7;
    top: 7px;
    left: 50%;
    margin: 0;
    padding: 4px 10px;
    border-radius: 999px;
    color: #dce9df;
    background: #0a2a1e80;
    font-family: inherit;
    font-size: clamp(.72rem, 1.5vw, .88rem);
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    transform: translateX(-50%);
    pointer-events: none;
}

.kn-score-announcement {
    position: absolute;
    z-index: 9;
    top: 42px;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: calc(100% - 32px);
    padding: 8px 13px;
    border: 1px solid #ead58b;
    border-radius: 999px;
    color: #26352b;
    background: #fff8dfed;
    box-shadow: 0 7px 20px #061b1370;
    font-size: clamp(.72rem, 1.7vw, .9rem);
    opacity: 0;
    white-space: nowrap;
    transform: translate(-50%, -8px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}

.kn-score-announcement[hidden] {
    display: none;
}

.kn-score-announcement.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.kn-score-announcement span {
    overflow: hidden;
    color: #667169;
    text-overflow: ellipsis;
}

.kn-score-announcement b {
    color: #147246;
}

.kn-win-overlay {
    position: absolute;
    z-index: 120;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #061b13ba;
    backdrop-filter: blur(5px);
}

.kn-win-card {
    width: min(460px, 100%);
    padding: clamp(28px, 6vw, 48px);
    border: 2px solid #f4dc82;
    border-radius: 18px;
    color: #fff8df;
    background: radial-gradient(circle at 50% 0%, #467f5b, #123a29 66%);
    box-shadow: 0 26px 80px #000b, 0 0 45px #e4b94f55;
    text-align: center;
    animation: kn-win-appear .32s ease-out both;
}

.kn-win-card > span {
    display: block;
    margin-bottom: 10px;
    font-size: clamp(3.8rem, 13vw, 6.4rem);
    line-height: 1;
}

.kn-win-card h1 {
    margin: 0;
    color: #fff6bb;
    font-family: Georgia, serif;
    font-size: clamp(2rem, 8vw, 3.6rem);
    line-height: 1.03;
}

.kn-win-card p {
    margin: 14px 0 25px;
    color: #d5e5d8;
}

.kn-win-scores {
    width: min(100%, 330px);
    display: grid;
    gap: 3px;
    margin: -5px auto 22px;
    padding: 0;
    list-style: none;
    text-align: left;
}

.kn-win-scores li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 8px;
    border-radius: 6px;
    color: #e6eee7;
    background: #061b1359;
    font-size: clamp(.86rem, 3vw, 1rem);
}

.kn-win-scores li.winner {
    color: #3a2c08;
    background: var(--gold);
}

.kn-win-scores b {
    white-space: nowrap;
}

.kn-win-actions {
    display: grid;
    gap: 9px;
    justify-items: center;
}

.kn-win-card .kn-primary {
    min-width: 190px;
}

#confetti-canvas {
    position: fixed;
    z-index: 999999;
    inset: 0;
    pointer-events: none;
}

@keyframes kn-win-appear {
    from { opacity: 0; transform: translateY(18px) scale(.92); }
    to { opacity: 1; transform: none; }
}

.kn-loose-field {
    position: absolute;
    inset: 0 25% 0 0;
    border-right: 1px solid #ffffff24;
}

#kn-dice-box, #kn-dice-targets {
    position: absolute;
    inset: 0;
}

#kn-dice-box canvas {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

#kn-dice-targets {
    z-index: 4;
    pointer-events: none;
}

.kn-held-field {
    position: absolute;
    z-index: 5;
    inset: 0 0 0 75%;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 12px;
    padding: 18px 12px;
    background: #0b302338;
}

.kn-held-title {
    color: #bcd1c1;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-align: center;
    text-transform: uppercase;
}

.kn-held-canvas {
    position: relative;
    min-width: 0;
    min-height: 0;
}

#kn-held-dice-box, #kn-held-targets {
    position: absolute;
    inset: 0;
}

#kn-held-dice-box canvas {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

#kn-held-targets {
    z-index: 2;
    pointer-events: none;
}

.kn-held-error {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #dceade;
    font-size: .75rem;
    text-align: center;
}

.kn-die-target {
    position: absolute;
    width: 72px;
    height: 72px;
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 0;
    background: transparent;
    transform: translate(-50%, -50%);
    cursor: pointer;
    pointer-events: auto;
    transition: border-color .15s ease, background .15s ease;
}

.kn-die-target span {
    position: absolute;
    left: 50%;
    bottom: -4px;
    padding: 4px 7px;
    border-radius: 999px;
    color: #fff;
    background: #102e22d9;
    font-size: .64rem;
    font-weight: 800;
    opacity: 0;
    transform: translate(-50%, 55%);
    transition: opacity .15s ease;
}

.kn-die-target:not(:disabled):hover, .kn-die-target:not(:disabled):focus-visible {
    border-color: #ffffffa8;
    outline: none;
    background: #ffffff12;
}

.kn-die-target:not(:disabled):hover span, .kn-die-target:not(:disabled):focus-visible span {
    opacity: 1;
}

.kn-die-target:disabled {
    pointer-events: none;
}

.kn-dice-error {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 25px;
    color: #fff;
    text-align: center;
}

.kn-dice-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.kn-sheet-toggle {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 3px;
    padding: 0 12px;
    color: #172118;
    background: #d4c492;
    box-shadow: 0 5px 0 #978440;
    font-weight: 800;
    cursor: pointer;
}

.kn-sheet-toggle:hover, .kn-sheet-toggle:focus-visible {
    outline: none;
    background: #e4d39b;
}

.kn-sheet-toggle:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #978440;
}

.kn-sheet-toggle svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.kn-roll-count {
    min-height: 20px;
    margin: 0;
    color: #dceade;
    text-align: right;
    font-size: .84rem;
}

.kn-roll-button {
    grid-column: 2;
    min-width: 190px;
}

.kn-sheet-toggle {
    justify-self: start;
}

.kn-table > .kn-primary {
    margin-top: 6px;
}

.kn-scorecard {
    overflow: hidden;
    border: 1px solid #d9ceb0;
    border-radius: 3px;
    background: var(--paper);
    box-shadow: 9px 12px 0 #071f1666;
}

.kn-scorecard.turn {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
}

.kn-scorecard.yours > header h2 {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.kn-scorecard > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 2px solid #3e493f;
}

.kn-scorecard > header h2 {
    margin: 0;
    font-family: Georgia, serif;
    font-size: 1.35rem;
}

.kn-scorecard > header > strong {
    font-size: 1.3rem;
}

.kn-score-section h3 {
    margin: 0;
    padding: 0 14px;
    color: #f8f1df;
    background: var(--green);
    font-size: .7rem;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.kn-score-row {
    width: 100%;
    min-height: 47px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid #d9d0b8;
    padding: 6px 18px;
    color: var(--ink);
    text-align: left;
    background: transparent;
}

.kn-score-row span {
    display: grid;
    gap: 1px;
}

.kn-score-row small {
    color: #788078;
    font-size: .68rem;
}

.kn-score-row b {
    min-width: 35px;
    font-size: 1rem;
    text-align: right;
}

.kn-score-row.available {
    cursor: pointer;
    background: #fffaf0;
}

.kn-score-row.available:hover, .kn-score-row.available:focus-visible {
    color: #fff;
    outline: none;
    background: var(--green-light);
}

.kn-score-row.available:hover small, .kn-score-row.available:focus-visible small {
    color: #dce9df;
}

.kn-score-row.yours.available b {
    color: #147246;
}

.kn-score-row.available:hover b, .kn-score-row.available:focus-visible b {
    color: #fff4b5;
}

.kn-score-row.used {
    opacity: 1;
    background: #ece3cc;
}

.kn-subtotal, .kn-total {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    font-size: .83rem;
    font-weight: 800;
}

.kn-total {
    color: #fff;
    background: var(--red);
    font-size: 1rem;
}

.kn-sheet-open {
    overflow: hidden;
}

.kn-sheet-overlay {
    position: fixed;
    z-index: 180;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
}

.kn-sheet-overlay[hidden] {
    display: none;
}

.kn-sheet-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #061b13c7;
    backdrop-filter: blur(5px);
    cursor: default;
}

.kn-sheet-dialog {
    position: relative;
    z-index: 1;
    width: min(480px, 100%);
    max-height: calc(100dvh - 44px);
    overflow: auto;
    border-radius: 5px;
    box-shadow: 0 26px 70px #0009;
}

.kn-sheet-dialog .kn-scorecard {
    box-shadow: none;
}

/* Die Übersicht verwendet bewusst den bestehenden Wertungsbogen: nur die rechte Punktespalte wird wiederholt. */
.kn-score-overview > header {
    padding-right: 58px;
}

.kn-score-overview .kn-score-section-title {
    color: #f8f1df;
    background: var(--green);
}

.kn-score-overview .kn-score-row, .kn-score-overview .kn-subtotal, .kn-score-overview .kn-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    width: 100%;
    box-sizing: border-box;
    padding-right: 18px;
    padding-left: 18px;
    padding-top: 0;
    padding-bottom: 0;
}

.kn-score-overview .kn-score-row > span:first-child,
.kn-score-overview .kn-subtotal > span:first-child,
.kn-score-overview .kn-total > span:first-child {
    flex: 1 1 0;
    min-width: 0;
}

.kn-score-overview .kn-score-values {
    display: flex;
    flex: 0 0 var(--kn-score-values-width);
    width: var(--kn-score-values-width);
    align-items: center;
}

.kn-score-overview .kn-score-value {
    box-sizing: border-box;
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    padding: 0;
    text-align: center;
}

.kn-score-overview .kn-score-row {
    gap: 0;
}

.kn-score-overview .kn-score-value {
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-left: 1px solid #d9d0b8;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    background: transparent;
}

.kn-score-overview .kn-score-value.yours {
    color: #172118;
    background: #d3d3d382;
}

.kn-score-overview .kn-score-value.used {
    background: #ece3cc;
}

.kn-score-overview .kn-score-value.used.yours {
    background: #9b9b9b;
    color: white;
}

.kn-score-overview .kn-score-value.available {
    color: #147246;
    cursor: pointer;
    background: #fffaf0;
}

.kn-score-overview .kn-score-value.available.yours {
    background: #14724640;
}

.kn-score-overview .kn-score-value.available:hover, .kn-score-overview .kn-score-value.available:focus-visible, .kn-score-overview .kn-score-value.pending.yours {
    outline: none;
    color: #fff4b5;
    background: var(--green-light);
}

.kn-score-overview .kn-score-value.winner {
    color: #000 !important;
    background: #fff900bf !important;
}

.kn-score-row.available.pending {
    background: #174f3685;
}

.kn-score-row.available.pending *:not(.used) {
    color: white !important;
}

.kn-score-overview .kn-score-confirm {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-right: 7px;
    color: #147246;
    font-size: .62rem;
    font-weight: 900;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.kn-score-overview .kn-score-confirm i {
    font-style: normal;
    font-size: .9rem;
}

.kn-score-overview .kn-subtotal, .kn-score-overview .kn-total {
    gap: 0;
}

.kn-score-overview .kn-score-player-heads .kn-score-value {
    padding-inline: 1px;
    overflow: visible;
    white-space: nowrap;
    letter-spacing: -.04em;
    font-size: var(--kn-player-name-size, 12px);
}

.kn-score-overview .kn-subtotal > span:first-child, .kn-score-overview .kn-total > span:first-child {
    display: grid;
    gap: 1px;
}

.kn-score-overview .kn-subtotal small, .kn-score-overview .kn-total small {
    color: #788078;
    font-size: .68rem;
}

.kn-score-overview .kn-subtotal .kn-score-value, .kn-score-overview .kn-total .kn-score-value {
    font-size: 16px;
}

.kn-score-overview .kn-total .kn-score-value {
    color: inherit;
    border-color: #ffffff44;
}

.kn-score-overview .kn-total .kn-score-value.yours {
    color: #172118;
    background: #f8df76;
}

.kn-score-overview .kn-score-section-title .kn-score-value,
.kn-score-overview .kn-score-section-title .kn-score-value.yours,
.kn-score-overview .kn-total .kn-score-value,
.kn-score-overview .kn-total .kn-score-value.yours {
    color: #fff;
    background: transparent;
    border-color: #ffffff44;
}

.kn-sheet-close {
    position: absolute;
    z-index: 2;
    top: 9px;
    right: 9px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: var(--red);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.kn-corner-control {
    position: fixed;
    z-index: 190;
    bottom: max(3px, env(safe-area-inset-bottom, 0px));
    width: 38px;
    height: 38px;
    border: 0;
    padding: 9px;
    color: #b9c8b8;
    background: transparent;
    cursor: pointer;
}

.kn-corner-control svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.kn-corner-control.active {
    color: var(--gold);
}

.kn-corner-control:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 1px;
}

.kn-fullscreen-toggle {
    right: max(3px, env(safe-area-inset-right, 0px));
}

.kn-sound-toggle {
    right: max(44px, calc(env(safe-area-inset-right, 0px) + 44px));
}

.kn-reaction-toggle {
    right: max(85px, calc(env(safe-area-inset-right, 0px) + 85px));
    display: none;
}

.kn-playing .kn-reaction-toggle {
    display: block;
}

.kn-reaction-panel {
    position: fixed;
    z-index: 200;
    right: max(85px, calc(env(safe-area-inset-right, 0px) + 85px));
    bottom: max(45px, calc(env(safe-area-inset-bottom, 0px) + 45px));
    display: flex;
    width: min(390px, calc(100vw - 20px));
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
    padding: 10px;
    border: 1px solid #ffffff35;
    border-radius: 12px;
    background: #09291df2;
    box-shadow: 0 10px 30px #0008;
}

.kn-reaction-panel header {
    display: flex;
    min-height: 28px;
    align-items: center;
    justify-content: space-between;
    color: #e7f0e9;
    font-size: .82rem;
}

.kn-reaction-panel header button {
    min-width: 28px;
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    line-height: 1;
}

.kn-reaction-emojis {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.kn-chat-history {
    display: flex;
    max-height: min(34dvh, 240px);
    min-height: 72px;
    flex-direction: column;
    gap: 7px;
    overflow-y: auto;
    padding: 2px 1px;
}

.kn-chat-message {
    align-self: flex-start;
    max-width: 82%;
    padding: 5px 8px;
    border-radius: 11px 11px 11px 3px;
    color: #122219;
    background: #eef5ea;
    box-shadow: 0 2px 6px #0004;
    overflow-wrap: anywhere;
}

.kn-chat-message.yours {
    align-self: flex-end;
    border-radius: 11px 11px 3px 11px;
    color: #102318;
    background: var(--gold);
}

.kn-chat-message small {
    display: block;
    margin-bottom: 1px;
    opacity: .7;
    font-size: .66rem;
    font-weight: 700;
}

.kn-chat-message p, .kn-chat-empty {
    margin: 0;
    white-space: pre-wrap;
}

.kn-chat-empty {
    margin: auto;
    color: #dce9df;
    font-size: .78rem;
}

.kn-reaction-panel button {
    min-width: 35px;
    height: 35px;
    border: 0;
    border-radius: 7px;
    color: #fff;
    background: #ffffff10;
    cursor: pointer;
}

.kn-reaction-panel button:hover, .kn-reaction-panel button:focus-visible {
    outline: 2px solid var(--gold);
    background: #ffffff25;
}

.kn-reaction-panel form {
    display: flex;
    gap: 6px;
}

.kn-reaction-panel input {
    min-width: 0;
    width: 100%;
    flex: 1;
    min-height: 36px;
    border: 1px solid #ffffff45;
    border-radius: 7px;
    padding: 0 9px;
    color: #fff;
    background: #123f2d;
}

.kn-reaction-panel form button {
    padding-inline: 10px;
    background: var(--green-light);
}

#kn-status {
    position: fixed;
    z-index: 50;
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
    max-width: calc(100% - 32px);
    padding: 10px 15px;
    border-radius: 4px;
    color: #fff;
    background: #1b1d1bcc;
    box-shadow: 0 8px 28px #0005;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 15px);
    transition: .2s ease;
}

#kn-status.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 1050px) {
    .kn-game {
        padding-inline: 14px;
    }

    .kn-score-row {
        padding-inline: 11px;
    }
}

@media (max-width: 800px) {
    .kn-nav > a:first-child span {
        display: none;
    }

    .kn-game {
        padding: 6px 8px 42px;
    }

    .kn-dice-stage {
        height: 100%;
        min-height: 0;
        border-width: 5px;
    }

    .kn-loose-field {
        right: 29%;
    }

    .kn-held-field {
        left: 71%;
        padding: 14px 7px;
    }

    .kn-die-target {
        width: 62px;
        height: 62px;
    }

    .kn-scorecard {
        box-shadow: 5px 7px 0 #071f1666;
    }

    .kn-score-row {
        padding-inline: 14px;
    }

    .kn-sheet-overlay {
        padding: 10px;
    }

    .kn-sheet-dialog {
        max-height: calc(100dvh - 20px);
    }

    .kn-reaction-panel {
        right: 0;
        bottom: max(42px, calc(env(safe-area-inset-bottom, 0px) + 42px));
        left: 0;
        width: 100%;
        max-width: none;
        padding: 11px max(10px, env(safe-area-inset-right, 0px)) 11px max(10px, env(safe-area-inset-left, 0px));
        border-right: 0;
        border-left: 0;
        border-radius: 12px 12px 0 0;
    }
}

@media (max-width: 450px) {
    .kn-score-overview .kn-score-confirm-label {
        display: none;
    }

    .kn-score-overview .kn-score-confirm {
        margin-right: 4px;
    }
}

@media (max-height: 500px) {
    :root {
        --nav-height: 46px;
    }

    .kn-nav {
        padding-inline: 10px;
    }

    .kn-game {
        padding: 3px 8px 39px;
    }

    .kn-table {
        gap: 3px;
    }

    .kn-sheet-launchers {
        gap: 4px;
    }

    .kn-sheet-launcher {
        min-height: 27px;
        padding-inline: 8px;
        font-size: .72rem;
    }

    .kn-stage-head {
        min-height: 14px;
        font-size: .64rem;
    }

    .kn-turn-label {
        top: 4px;
        padding: 3px 8px;
        font-size: .68rem;
    }

    .kn-score-announcement {
        top: 30px;
        gap: 6px;
        padding: 5px 9px;
        font-size: .68rem;
    }

    .kn-roll-count {
        min-height: 15px;
        font-size: .72rem;
    }

    .kn-roll-button, .kn-sheet-toggle, .kn-table > .kn-primary {
        min-height: 34px;
    }

    .kn-held-field {
        gap: 4px;
        padding: 7px 5px;
    }

    .kn-held-title {
        display: none;
    }

    .kn-die-target {
        width: 52px;
        height: 52px;
    }
}
