body.labyrinth-page {
    --game-ui-accent: #c3a15f;
    --game-ui-control: #a99064;
    --game-ui-header-background: #11130ff5;
    --game-ui-header-color: #e8d9b7;
    --game-ui-surface: #d7c59fe8;
    --game-ui-surface-text: #2c2116;
    --game-ui-surface-muted: #65563f;
    --game-ui-surface-border: #8a7048;
    --game-ui-field-background: #e3d5b9;
    --game-ui-field-border: #88704d;
    --game-ui-primary-background: #642f26;
    --game-ui-primary-color: #f3e4bd;
    --game-ui-secondary-background: #332d22;
    --game-ui-secondary-color: #ead9b4;
    min-height: 100dvh;
    background:
        radial-gradient(ellipse at 50% 42%, #34402d 0, #172019 31%, transparent 64%),
        radial-gradient(ellipse at 12% 18%, #4b2633 0, transparent 42%),
        radial-gradient(ellipse at 88% 78%, #382031 0, transparent 48%),
        repeating-linear-gradient(112deg, #fff0 0 8px, #d0b98008 9px, #0000 10px 18px),
        linear-gradient(137deg, #080b09, #1b1413 52%, #070a09) fixed;
    font-family: Arial, Helvetica, sans-serif;
}

body.labyrinth-page :is(button, input, select, textarea) { font-family: Arial, Helvetica, sans-serif; }
body.labyrinth-page .game-ui-header.game-ui-header {
    border-bottom: 1px solid #826a3e !important;
    background-color: #171b16;
    box-shadow: inset 0 -1px #d4b46d24, 0 3px 0 #0b0806, 0 10px 26px #0009 !important;
}
body.labyrinth-page .game-ui-header.game-ui-header .game-ui-header-brand {
    color: #ddc58f !important;
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: .055em;
    text-shadow: 0 1px #000, 0 0 12px #b68d3844;
}
body.labyrinth-page .game-ui-header.game-ui-header :is(.game-ui-header-back, .game-ui-header-action) {
    color: #d7c294 !important;
    text-shadow: 0 1px #000;
}
body.labyrinth-page .game-ui-panel {
    border: 1px solid #8d7147;
    border-radius: 9px;
    background:
        radial-gradient(ellipse at 20% 12%, #fff7df52, transparent 46%),
        repeating-linear-gradient(7deg, #5d421808 0 1px, transparent 1px 7px),
        linear-gradient(145deg, #dfcda8ed, #c9b486ed);
    box-shadow: inset 0 0 0 1px #f5e8c160, inset 0 0 28px #5e3d1830, 0 18px 55px #000b;
}
body.labyrinth-page :is(.game-ui-primary, .game-ui-secondary) {
    border: 1px solid #8e7043;
    border-radius: 6px;
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: .025em;
    text-shadow: 0 1px 1px #000;
    box-shadow: inset 0 1px #f2d9982b, inset 0 -5px 12px #0004, 0 2px 5px #0005;
}
body.labyrinth-page .game-ui-primary {
    background: linear-gradient(145deg, #7c4031, #4a211d 62%, #321714) !important;
}
body.labyrinth-page .game-ui-secondary {
    color: #ead9b4 !important;
    background: linear-gradient(145deg, #484131, #27251d 62%, #171912) !important;
}
body.labyrinth-page :is(input, select, textarea) {
    border-color: #826b49;
    border-radius: 5px;
    background: #e8dcc2e8;
    box-shadow: inset 0 2px 7px #5c42192b;
}
body.labyrinth-page :is(.game-ui-recent, .game-leaderboard),
body.labyrinth-page :is(.game-ui-recent, .game-leaderboard) * { color: #fff; }
body.labyrinth-page .game-ui-status.game-ui-status {
    right: max(14px, env(safe-area-inset-right, 0px)) !important;
    left: auto !important;
    transform: translateY(12px) !important;
}
body.labyrinth-page .game-ui-status.game-ui-status.visible { transform: translateY(0) !important; }
body.labyrinth-page.labyrinth-playing { overflow: hidden; overscroll-behavior: none; }
body.labyrinth-page.labyrinth-playing #labyrinth-app {
    position: fixed;
    inset: calc(var(--game-ui-header-height) + env(safe-area-inset-top, 0px)) 0 0;
    height: auto;
    margin: 0;
    overflow: hidden;
    overscroll-behavior: none;
}

.labyrinth-add-player { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: end; gap: 10px; }

.labyrinth-lobby-pawn,
.labyrinth-mini-pawn {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 25px;
    height: 25px;
    border: 1px solid #0008;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 2px 4px #0004;
}
.labyrinth-lobby-pawn::after,
.labyrinth-mini-pawn::after {
    content: '';
    position: absolute;
    top: -7px;
    left: 50%;
    width: 15px;
    height: 15px;
    border: 1px solid #0008;
    border-radius: 50%;
    background: currentColor;
    transform: translateX(-50%);
}
.color-red { color: #c93b32; }
.color-brown { color: #60463e; }
.color-white { color: #f7f4e9; }
.color-blue { color: #3767a1; }

.labyrinth-color-picker { display: grid; gap: 10px; padding: 14px 0; }
.labyrinth-color-options { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 20px; }
.labyrinth-color-option {
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.labyrinth-color-option > span {
    position: relative;
    display: block;
    width: 32px;
    height: 32px;
    border: 1px solid color-mix(in srgb, var(--choice-color) 76%, #000);
    border-radius: 50%;
    background: var(--choice-color);
}
.labyrinth-color-option > span::after {
    content: '';
    position: absolute;
    top: -18px;
    left: 50%;
    width: 19px;
    height: 19px;
    border: 1px solid color-mix(in srgb, var(--choice-color) 76%, #000);
    border-radius: 50%;
    background: var(--choice-color);
    transform: translateX(-50%);
}
.labyrinth-color-option.selected { border-color: var(--choice-color); }
.labyrinth-color-option:focus-visible { outline: 3px solid var(--choice-color); outline-offset: 2px; }
.labyrinth-color-option:disabled { cursor: default; opacity: .35; }

.labyrinth-game {
    --labyrinth-recipe-width: clamp(62px, 11vh, 100px);
    position: relative;
    width: min(1240px, calc(100% - 24px));
    height: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 8px 0 max(6px, env(safe-area-inset-bottom, 0px));
    color: #fff;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) clamp(46px, 8vh, 64px) auto;
    gap: 7px;
    overflow: hidden;
}

.labyrinth-player-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 20px;
    width: min(900px, 100%);
    min-height: 32px;
    margin: 0 auto;
}
.labyrinth-player {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: .78rem;
    white-space: nowrap;
}
.labyrinth-player.is-you strong { text-decoration-line: underline; text-decoration-color: var(--player-color); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.labyrinth-player .labyrinth-mini-pawn { width: 18px; height: 18px; color: var(--player-color); }
.labyrinth-player .labyrinth-mini-pawn::after { top: -5px; width: 11px; height: 11px; }
.labyrinth-opponent-sticks { display: inline-flex; flex: none; align-items: center; gap: 1px; }
.labyrinth-opponent-stick { position: relative; display: block; flex: none; width: 8px; height: 24px; }
.labyrinth-opponent-stick > span {
    position: absolute;
    top: 3px;
    left: 2px;
    width: 4px;
    height: 18px;
    border-radius: 3px;
    background: #090909;
    box-shadow: 0 0 0 1px rgb(255 255 255 / 32%), 0 1px 2px #0008;
    transform: rotate(5deg);
}
.labyrinth-opponent-stick:nth-child(even) > span { transform: rotate(-4deg); }
.labyrinth-opponent-stick.is-spent > span { visibility: hidden; }
.labyrinth-player > span:not(.labyrinth-mini-pawn):not(.labyrinth-reaction) { min-width: 0; }
.labyrinth-player strong,
.labyrinth-player small { display: block; min-width: 0; }
.labyrinth-player small { margin-top: 1px; color: #c9c3b8; font-size: .62rem; }
.labyrinth-reaction { position: absolute; z-index: 30; right: 8px; bottom: calc(100% - 4px); max-width: 190px; padding: 7px 10px; border-radius: 12px 12px 2px 12px; color: #1d2f36; background: #fff; box-shadow: 0 8px 20px #0007; }

.labyrinth-collected-discs {
    display: flex;
    align-items: center;
    min-width: 0;
    padding-top: 5px;
}
.labyrinth-collected-disc {
    position: relative;
    display: grid;
    flex: 0 0 28px;
    width: 28px;
    aspect-ratio: 1;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 1px 3px #0005;
    cursor: pointer;
}
.labyrinth-collected-disc + .labyrinth-collected-disc { margin-left: -10px; }
.labyrinth-collected-disc img { display: block; width: 100%; height: 100%; border-radius: 50%; }
.labyrinth-collected-disc:focus-visible { outline: 2px solid #e0bc69; outline-offset: 2px; }
.labyrinth-opponent-discs { margin-right: -3px; }

.labyrinth-game-sidebar { display: contents; }

.labyrinth-game-messages {
    grid-row: 3;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    width: 100%;
    height: 100%;
    min-height: 0;
}
.labyrinth-game-messages .labyrinth-turn-actions { grid-row: 1; grid-column: 1 / -1; }
.labyrinth-game-messages .labyrinth-hint { grid-row: 1; grid-column: 1; }
.labyrinth-hand-tray {
    --labyrinth-hand-gap: clamp(20px, 2.5vw, 26px);
    grid-row: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    width: 100%;
    padding-bottom: 20px;
    min-height: calc(var(--labyrinth-recipe-width) * 1.59);
}
.labyrinth-own-discs {
    grid-column: 1;
    justify-self: end;
    align-self: center;
    margin-right: var(--labyrinth-hand-gap);
    padding-top: 8px;
}
.labyrinth-own-discs .labyrinth-collected-disc { flex-basis: 38px; width: 38px; }
.labyrinth-own-discs .labyrinth-collected-disc + .labyrinth-collected-disc { margin-left: -14px; }
.labyrinth-sticks { display: flex; grid-column: 3; align-self: center; justify-self: start; align-items: center; gap: 1px; margin-left: var(--labyrinth-hand-gap); }
.labyrinth-stick {
    position: relative;
    width: 18px;
    height: 42px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.labyrinth-stick > span {
    position: absolute;
    top: 7px;
    left: 50%;
    width: 7px;
    height: 28px;
    border-radius: 5px;
    background: #090909;
    box-shadow: 0 0 0 1px rgb(255 255 255 / 32%), 0 1px 2px #0008;
    transform: translateX(-50%) rotate(5deg);
    transition: transform .16s ease, box-shadow .16s ease;
}
.labyrinth-stick:nth-child(even) > span { transform: translateX(-50%) rotate(-4deg); }
.labyrinth-stick.is-selected > span { box-shadow: 0 0 0 2px #f2c867, 0 0 0 3px rgb(255 255 255 / 24%), 0 3px 7px #000b; transform: translate(-50%, -5px) rotate(5deg); }
.labyrinth-stick:nth-child(even).is-selected > span { transform: translate(-50%, -5px) rotate(-4deg); }
.labyrinth-stick:focus-visible { outline: 2px solid #f2c867; outline-offset: -2px; }
.labyrinth-stick:disabled { cursor: default; opacity: .48; }
.labyrinth-stick.is-spent > span { visibility: hidden; }
.labyrinth-flying-stick {
    position: fixed;
    z-index: 270;
    display: block;
    pointer-events: none;
    border-radius: 5px;
    background: #090909;
    box-shadow: 0 0 0 1px rgb(255 255 255 / 50%), 0 3px 8px #000b, 0 0 10px rgb(242 200 103 / 35%);
    transform-origin: center;
}
.labyrinth-recipe {
    position: relative;
    z-index: 22;
    display: block;
    grid-column: 2;
    width: var(--labyrinth-recipe-width);
    aspect-ratio: 300 / 477;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
}
.labyrinth-recipe-surface {
    position: absolute;
    inset: 0;
}
.labyrinth-recipe-background {
    display: block;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 8px 20px #0007;
}
.labyrinth-recipe-ingredient {
    position: absolute;
    z-index: 1;
    left: 30.6667%;
    display: block;
    width: 39%;
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 1px 3px #0005;
    filter: drop-shadow(0 2px 3px #0008);
    cursor: pointer;
}
.labyrinth-recipe-ingredient img { display: block; width: 100%; height: 100%; border-radius: 50%; }
.labyrinth-recipe-ingredient.is-collected { box-shadow: 0 0 0 2px #e5bd4f, 0 0 11px 3px #d6a927c9, 0 2px 4px #0009; }
.labyrinth-recipe-ingredient:focus-visible { outline: 2px solid #f4d77b; outline-offset: 3px; }
.labyrinth-recipe-ingredient.ingredient-1 { top: 11.1111%; }
.labyrinth-recipe-ingredient.ingredient-2 { top: 37.9455%; }
.labyrinth-recipe-ingredient.ingredient-3 { top: 64.1509%; }
.labyrinth-turn-actions { display: flex; flex-wrap: nowrap; justify-content: center; gap: 6px; max-width: 100%; }
.labyrinth-turn-actions:empty { display: none; }
.labyrinth-turn-actions :is(.game-ui-primary, .game-ui-secondary) {
    min-height: 30px;
    padding: 5px 10px;
    border-color: #9f814b;
    color: #f1dfb3 !important;
    background:
        radial-gradient(circle at 50% -60%, #c8a45242, transparent 55%),
        linear-gradient(145deg, #352b22, #151712 66%, #090b09) !important;
    box-shadow: inset 0 0 0 1px #e4c5751c, inset 0 -7px 15px #0007, 0 0 11px #b8953f2b, 0 3px 6px #0008;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: .7rem;
    letter-spacing: .045em;
    line-height: 1.05;
    white-space: nowrap;
}
.labyrinth-turn-actions :is(.game-ui-primary, .game-ui-secondary):hover {
    border-color: #d1ad62;
    box-shadow: inset 0 0 9px #d2ad5340, inset 0 -7px 15px #0007, 0 0 15px #c6a14c42, 0 3px 6px #0008;
}

.labyrinth-board-area {
    position: relative;
    display: grid;
    place-items: center;
    width: min(900px, 100%);
    min-width: 0;
    min-height: 0;
    margin-inline: auto;
    container-type: size;
}
.labyrinth-board-frame {
    --labyrinth-edge-size: 100%;
    position: relative;
    display: grid;
    grid-template: repeat(9, minmax(0, 1fr)) / repeat(9, minmax(0, 1fr));
    width: min(100%, 100cqh, 760px);
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1;
    touch-action: none;
    filter: drop-shadow(0 18px 20px #000a);
}
.labyrinth-board-frame::before {
    content: '';
    position: absolute;
    z-index: 0;
    inset: 8%;
    background: url('/public/img/labyrinth-der-meister/board-background.png') center / 100% 100% no-repeat;
    box-shadow: 0 0 0 0 rgb(222 184 79 / 0%), 0 0 0 0 rgb(188 137 42 / 0%);
    filter: brightness(.62) saturate(.78);
    pointer-events: none;
}
.labyrinth-board-area.is-my-turn .labyrinth-board-frame::before {
    box-shadow: 0 0 24px 9px rgb(222 184 79 / 43%), 0 0 48px 14px rgb(188 137 42 / 18%);
}
.labyrinth-board-area.is-turn-starting .labyrinth-board-frame::before {
    animation: labyrinth-board-glow-in 1100ms ease-out var(--labyrinth-glow-delay, 0ms) both;
}
.labyrinth-board-area.is-turn-ending .labyrinth-board-frame::before {
    animation: labyrinth-board-glow-out 850ms ease-in var(--labyrinth-glow-delay, 0ms) both;
}
@keyframes labyrinth-board-glow-in {
    from { box-shadow: 0 0 0 0 rgb(222 184 79 / 0%), 0 0 0 0 rgb(188 137 42 / 0%); }
    to { box-shadow: 0 0 24px 9px rgb(222 184 79 / 43%), 0 0 48px 14px rgb(188 137 42 / 18%); }
}
@keyframes labyrinth-board-glow-out {
    from { box-shadow: 0 0 24px 9px rgb(222 184 79 / 43%), 0 0 48px 14px rgb(188 137 42 / 18%); }
    to { box-shadow: 0 0 0 0 rgb(222 184 79 / 0%), 0 0 0 0 rgb(188 137 42 / 0%); }
}
.labyrinth-board-frame > span { position: relative; z-index: 3; display: grid; min-width: 0; min-height: 0; place-items: center; }
.labyrinth-grid {
    position: relative;
    z-index: 2;
    grid-row: 2 / 9;
    grid-column: 2 / 9;
    display: grid;
    grid-template: repeat(7, minmax(0, 1fr)) / repeat(7, minmax(0, 1fr));
    width: 100%;
    height: 100%;
    overflow: visible;
}

.labyrinth-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 8%;
    box-shadow: inset 0 0 0 1px rgb(15 9 6 / 24%), 0 2px 5px rgb(0 0 0 / 52%);
}
.labyrinth-cell.is-shift-preview { animation: labyrinth-shift-preview 1.55s ease-in-out infinite; }
@keyframes labyrinth-shift-preview {
    0%, 24%, 100% { transform: translate(0, 0); }
    10% { transform: translate(var(--labyrinth-preview-x, 0), var(--labyrinth-preview-y, 0)); }
}
.labyrinth-tile { position: relative; display: block; width: 100%; height: 100%; }
.labyrinth-tile > img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; -webkit-user-drag: none; }

.labyrinth-treasure {
    position: absolute;
    z-index: 4;
    top: 27%;
    left: 27%;
    width: 46%;
    aspect-ratio: 1;
    border-radius: 50%;
    box-shadow: 0 1px 3px #0005;
}
.labyrinth-treasure img { display: block; width: 100%; height: 100%; border-radius: 50%; }
body.labyrinth-treasures-zoomed .labyrinth-grid .labyrinth-treasure { top: 0; left: 0; width: 100%; }
.labyrinth-treasure.is-target { box-shadow: 0 0 0 2px #dcb656, 0 0 10px #dcb656b8, 0 2px 4px #0008; }
.labyrinth-treasure.is-inspectable {
    z-index: 13;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.labyrinth-treasure.is-inspectable:focus-visible { outline: 2px solid #e0bc69; outline-offset: 2px; }

.labyrinth-treasure-overlay {
    position: fixed;
    z-index: 320;
    inset: 0;
    display: grid;
    box-sizing: border-box;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) max(18px, env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
}
.labyrinth-treasure-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgb(3 6 5 / 82%);
    backdrop-filter: blur(5px);
}
.labyrinth-treasure-dialog {
    position: relative;
    display: grid;
    grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
    align-items: center;
    gap: clamp(18px, 4vw, 34px);
    width: min(610px, 100%);
    max-height: min(620px, calc(100dvh - 36px));
    box-sizing: border-box;
    padding: clamp(22px, 5vw, 42px);
    overflow: auto;
    border: 1px solid #9b7d49;
    border-radius: 10px;
    color: #eadbb9;
    background:
        radial-gradient(circle at 25% 15%, #70572b35, transparent 42%),
        repeating-linear-gradient(112deg, #fff0 0 8px, #c7aa6510 9px, #0000 10px 18px),
        linear-gradient(145deg, #24221a, #10140f 68%, #090b09);
    box-shadow: inset 0 0 0 1px #dec07824, inset 0 0 38px #0009, 0 24px 70px #000e;
}
.labyrinth-treasure-dialog > img {
    display: block;
    width: 100%;
    max-width: 210px;
    justify-self: center;
    border-radius: 50%;
    filter: drop-shadow(0 8px 13px #000b);
}
.labyrinth-treasure-dialog h2 { margin: 5px 34px 12px 0; color: #e2c57f; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.35rem, 4vw, 2rem); }
.labyrinth-treasure-dialog p { margin: 0; line-height: 1.55; }
.labyrinth-treasure-close {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    border: 1px solid #80683f;
    border-radius: 50%;
    color: #e3cb97;
    background: #171912;
    font-size: 1.35rem;
    cursor: pointer;
}
.labyrinth-treasure-close:focus-visible { outline: 2px solid #e0bc69; outline-offset: 2px; }
.labyrinth-flying-treasure {
    position: fixed !important;
    z-index: 310 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    pointer-events: none !important;
    filter: drop-shadow(0 7px 9px #000a);
}

.labyrinth-pawn {
    position: absolute;
    z-index: 14;
    left: 38%;
    bottom: 36%;
    width: 24%;
    aspect-ratio: 1;
    border: 1px solid #0008;
    border-radius: 50%;
    background: currentColor;
    filter: drop-shadow(0 2px 2px #0008);
    pointer-events: none;
}
.labyrinth-moving-pawn {
    position: fixed !important;
    z-index: 19 !important;
    margin: 0 !important;
    pointer-events: none !important;
}
.labyrinth-pawn::after {
    content: '';
    position: absolute;
    top: -45%;
    left: 50%;
    width: 64%;
    aspect-ratio: 1;
    border: 1px solid #0008;
    border-radius: 50%;
    background: currentColor;
    transform: translateX(-50%);
}
.labyrinth-pawn.pawn-slot-1 { left: 22%; bottom: 56%; }
.labyrinth-pawn.pawn-slot-2 { left: 54%; bottom: 56%; }
.labyrinth-pawn.pawn-slot-3 { left: 54%; bottom: 30%; }

.labyrinth-move-target { position: absolute; z-index: 12; inset: 3px; border: 0; border-radius: 10%; padding: 0; background: transparent; cursor: pointer; }
.labyrinth-move-target:focus-visible { outline: 2px solid #c7a45c; outline-offset: -3px; }

.labyrinth-edge-slot {
    position: relative;
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
}
.labyrinth-drop-zone {
    --labyrinth-drop-position: translate(-50%, -50%);
    position: absolute;
    z-index: 3;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: grid;
    place-items: center;
    border: 1px dashed #b6975caa;
    background:
        radial-gradient(circle, #8e73352e 0 16%, transparent 54%),
        repeating-linear-gradient(45deg, #c5aa6710 0 2px, transparent 2px 8px);
    box-shadow: inset 0 0 12px #0009, 0 0 9px #a4813540;
    opacity: 0;
    pointer-events: none;
    transform: var(--labyrinth-drop-position);
    transition: opacity .12s ease, background .12s ease, box-shadow .12s ease, transform .12s ease;
}
.labyrinth-edge-slot.direction-right .labyrinth-drop-zone {
    --labyrinth-drop-position: translateY(-50%);
    right: 0;
    left: auto;
    width: var(--labyrinth-edge-size);
}
.labyrinth-edge-slot.direction-left .labyrinth-drop-zone {
    --labyrinth-drop-position: translateY(-50%);
    left: 0;
    width: var(--labyrinth-edge-size);
}
.labyrinth-edge-slot.direction-down .labyrinth-drop-zone {
    --labyrinth-drop-position: translateX(-50%);
    top: auto;
    bottom: 0;
    height: var(--labyrinth-edge-size);
}
.labyrinth-edge-slot.direction-up .labyrinth-drop-zone {
    --labyrinth-drop-position: translateX(-50%);
    top: 0;
    height: var(--labyrinth-edge-size);
}
.labyrinth-drop-zone::before {
    content: '✦';
    color: #bfa367;
    font-size: clamp(.6rem, 1.9vmin, 1rem);
    line-height: 1;
    text-shadow: 0 0 7px #e0be65aa, 0 1px #000;
}
.labyrinth-board-frame.is-dragging .labyrinth-drop-zone { opacity: 1; pointer-events: auto; }
.labyrinth-drop-zone.drag-over {
    border-color: #e1bf72;
    background: radial-gradient(circle, #d0a94c66, #5e45293b 48%, transparent 72%);
    box-shadow: inset 0 0 15px #d7b4574f, 0 0 15px #d4ad526e;
    transform: var(--labyrinth-drop-position) scale(.94);
}
.labyrinth-edge-slot > .labyrinth-spare { width: 100%; }
.labyrinth-edge-slot:is(.direction-left, .direction-right) > .labyrinth-spare { width: var(--labyrinth-edge-size); }
.labyrinth-edge-slot.direction-right { justify-items: end; }
.labyrinth-edge-slot.direction-left { justify-items: start; }
.labyrinth-edge-slot.direction-down { align-items: end; }
.labyrinth-edge-slot.direction-up { align-items: start; }

.labyrinth-spare-dock { position: absolute; z-index: 20; top: 4%; left: 0; display: grid; width: min(86px, 12%); gap: 6px; color: #f8ead0; font-size: .72rem; text-align: center; transform: translateX(-80%); }
.labyrinth-spare { display: block; width: 100%; aspect-ratio: 1; overflow: hidden; border-radius: 8%; box-shadow: inset 0 0 0 1px rgb(15 9 6 / 24%), 0 6px 15px #000a; cursor: default; user-select: none; touch-action: none; }
.labyrinth-spare[role='button'] { cursor: grab; }
.labyrinth-spare.is-awaiting-shift { animation: labyrinth-spare-wobble 4.8s ease-in-out infinite; }
@keyframes labyrinth-spare-wobble {
    0%, 14%, 100% { transform: rotate(0); }
    3% { transform: rotate(-2deg); }
    6% { transform: rotate(2deg); }
    9% { transform: rotate(-1.25deg); }
    12% { transform: rotate(.75deg); }
}
.labyrinth-spare.dragging { position: relative; z-index: 50; cursor: grabbing; filter: brightness(1.15); animation: none; transform: scale(1.08); }
.labyrinth-spare.is-dropping { position: relative; z-index: 15; pointer-events: none; }
.labyrinth-wrap-copy { position: fixed !important; z-index: 250 !important; margin: 0 !important; pointer-events: none !important; }

.labyrinth-hint { max-width: min(620px, calc(100vw - 120px)); margin: 0; color: #eee2cf; font-size: .78rem; text-align: center; }
.labyrinth-result { position: absolute; z-index: 40; top: 50%; left: 50%; width: min(650px, calc(100% - 24px)); max-height: calc(100% - 24px); margin: 0; padding: 20px; overflow: auto; box-sizing: border-box; border: 1px solid #ffffff25; border-radius: 18px; background: #151e2df5; box-shadow: 0 16px 40px #0007; transform: translate(-50%, -50%); }
.labyrinth-result h2 { margin-top: 0; color: #ffd786; }
.labyrinth-result-players { display: grid; gap: 10px; }
.labyrinth-result-player { padding: 10px; border: 1px solid rgb(225 194 118 / 18%); border-radius: 12px; background: rgb(255 255 255 / 5%); }
.labyrinth-result-player > header { display: flex; align-items: center; gap: 7px; color: #f5ead7; }
.labyrinth-result-player > header .labyrinth-mini-pawn { width: 17px; height: 17px; color: var(--player-color); }
.labyrinth-result-player > header .labyrinth-mini-pawn::after { top: -5px; width: 10px; height: 10px; }
.labyrinth-result-player > header b { margin-left: auto; color: #ffd786; white-space: nowrap; }
.labyrinth-result-player-content { display: grid; grid-template-columns: minmax(0, 1fr) 78px; gap: 12px; align-items: center; margin-top: 7px; }
.labyrinth-result-player h3 { margin: 0; color: #d7c8b1; font-size: .7rem; font-weight: 600; }
.labyrinth-result-discs { flex-wrap: wrap; gap: 3px; padding: 5px 0 2px; }
.labyrinth-result-discs .labyrinth-collected-disc { flex-basis: 28px; width: 28px; }
.labyrinth-result-discs .labyrinth-collected-disc + .labyrinth-collected-disc { margin-left: 0; }
.labyrinth-result-empty { margin: 5px 0; color: #b8ae9d; font-size: .72rem; }
.labyrinth-score-breakdown { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 8px; margin: 5px 0 0; color: #d4c8b4; font-size: .66rem; }
.labyrinth-score-breakdown > div { display: flex; min-width: 0; justify-content: space-between; gap: 4px; }
.labyrinth-score-breakdown dt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.labyrinth-score-breakdown dd { margin: 0; color: #fff3cb; font-weight: 700; }
.labyrinth-score-breakdown .is-total { grid-column: 1 / -1; margin-top: 2px; padding-top: 3px; border-top: 1px solid rgb(255 255 255 / 15%); color: #f1dfb3; font-size: .74rem; }
.labyrinth-score-breakdown .is-total dd { color: #ffd786; }
.labyrinth-result-recipe { display: block; grid-column: auto; width: 78px; min-height: 0; padding: 0; }
.labyrinth-result-recipe .labyrinth-recipe-background { box-shadow: 0 4px 10px #0008; }
.labyrinth-result > .game-ui-primary { margin-top: 14px; }

.labyrinth-rules { position: fixed; z-index: 220; inset: 74px 16px auto; width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 100px); margin: auto; overflow: auto; box-sizing: border-box; padding: 22px; border-radius: 16px; color: #1d2f36; background: #fffdf5; box-shadow: 0 18px 60px #000a; }
.labyrinth-rules > button { position: absolute; top: 8px; right: 8px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eee4ce; font-size: 1.4rem; }
.labyrinth-rules h2 { margin: 0 40px 12px 0; font-family: Georgia, serif; }
.labyrinth-rules li + li { margin-top: 8px; }

@media (max-width: 900px) {
    .labyrinth-spare-dock { left: 8%; transform: none; }
}

@media (max-width: 520px) {
    .labyrinth-game { --labyrinth-recipe-width: clamp(56px, 10vh, 78px); width: min(100% - 10px, 1240px); padding-top: 5px; gap: 5px; }
    .labyrinth-player-list { gap: 5px 12px; }
    .labyrinth-player { gap: 5px; font-size: .72rem; }
    .labyrinth-player small { display: none; }
    .labyrinth-opponent-discs .labyrinth-collected-disc { flex-basis: 22px; width: 22px; }
    .labyrinth-opponent-discs .labyrinth-collected-disc + .labyrinth-collected-disc { margin-left: -8px; }
    .labyrinth-own-discs .labyrinth-collected-disc { flex-basis: 31px; width: 31px; }
    .labyrinth-own-discs .labyrinth-collected-disc + .labyrinth-collected-disc { margin-left: -12px; }
    .labyrinth-turn-actions { width: auto; max-width: 100%; }
    .labyrinth-hint { min-height: 16px; padding-inline: 12px; font-size: .7rem; }
    .labyrinth-treasure-dialog { grid-template-columns: 1fr; gap: 12px; padding: 20px; text-align: center; }
    .labyrinth-treasure-dialog > img { width: min(118px, 48vw); }
    .labyrinth-treasure-dialog h2 { margin: 3px 28px 9px; }
    .labyrinth-result { padding: 14px; }
    .labyrinth-result-player { padding: 8px; }
    .labyrinth-result-player-content { grid-template-columns: minmax(0, 1fr) 62px; gap: 8px; }
    .labyrinth-result-recipe { width: 62px; }
    .labyrinth-score-breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-height: 899px) {
    body.labyrinth-page.labyrinth-playing .game-ui-header.game-ui-header {
        min-height: 0;
        height: 0;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        pointer-events: none;
    }
    body.labyrinth-page.labyrinth-playing .game-ui-header.game-ui-header .game-ui-header-brand { display: none !important; }
    body.labyrinth-page.labyrinth-playing .game-ui-header.game-ui-header .game-ui-header-back,
    body.labyrinth-page.labyrinth-playing .game-ui-header.game-ui-header .game-ui-header-action {
        position: fixed !important;
        z-index: 200;
        top: max(8px, env(safe-area-inset-top, 0px));
        display: grid !important;
        width: 29px !important;
        height: 29px !important;
        place-items: center;
        padding: 0 !important;
        border: 1px solid #927748 !important;
        border-radius: 50% !important;
        color: #d6bd88 !important;
        background: radial-gradient(circle at 42% 32%, #433a28, #161912 70%) !important;
        box-shadow: inset 0 0 0 1px #d0ad5d24, 0 3px 10px #000a !important;
        pointer-events: auto;
    }
    body.labyrinth-page.labyrinth-playing .game-ui-header.game-ui-header .game-ui-header-back { left: max(8px, env(safe-area-inset-left, 0px)); }
    body.labyrinth-page.labyrinth-playing .game-ui-header.game-ui-header .game-ui-header-action { right: max(8px, env(safe-area-inset-right, 0px)); }
    body.labyrinth-page.labyrinth-playing .game-ui-header-back span { display: none; }
    body.labyrinth-page.labyrinth-playing .game-ui-header-back svg { width: 20px; height: 20px; margin-left: -2px; }
    body.labyrinth-page.labyrinth-playing #labyrinth-app { inset: 0; }
    .labyrinth-player-list { box-sizing: border-box; padding-inline: 42px; }
    .labyrinth-hand-tray { min-height: var(--labyrinth-recipe-width); }
    .labyrinth-recipe {
        width: auto;
        height: var(--labyrinth-recipe-width);
        aspect-ratio: 477 / 300;
    }
    .labyrinth-recipe-surface {
        inset: auto;
        top: 50%;
        left: 50%;
        width: var(--labyrinth-recipe-width);
        aspect-ratio: 300 / 477;
        transform: translate(-50%, -50%) rotate(90deg);
    }
    .labyrinth-recipe-ingredient { transform: rotate(-90deg); }
}

@media (orientation: landscape) {
    .labyrinth-game {
        --labyrinth-sidebar-width: clamp(150px, 28vw, 340px);
        grid-template-columns: minmax(0, 1fr) var(--labyrinth-sidebar-width);
        grid-template-rows: auto minmax(0, 1fr);
        column-gap: clamp(8px, 1.6vw, 20px);
        row-gap: 5px;
    }
    .labyrinth-player-list {
        grid-row: 1;
        grid-column: 1 / -1;
    }
    .labyrinth-board-area {
        grid-row: 2;
        grid-column: 1;
        width: 100%;
        height: 100%;
        margin: 0;
    }
    .labyrinth-board-frame { width: min(100%, 100cqh, 900px); }
    .labyrinth-game-sidebar {
        display: grid;
        grid-row: 2;
        grid-column: 2;
        grid-template-rows: auto auto;
        align-content: center;
        gap: clamp(12px, 2vh, 22px);
        min-width: 0;
        min-height: 0;
        overflow: hidden;
    }
    .labyrinth-hand-tray {
        grid-row: 1;
        grid-template-columns: auto auto;
        grid-template-rows: auto auto;
        justify-content: center;
        align-content: center;
        gap: clamp(10px, 2vh, 18px) clamp(16px, 2.2vw, 28px);
        width: 100%;
        min-height: 0;
        padding: 0;
    }
    .labyrinth-own-discs {
        grid-row: 1;
        grid-column: 1 / -1;
        justify-self: center;
        justify-content: center;
        align-self: end;
        flex-wrap: wrap;
        width: min(100%, 290px);
        margin: 0;
        padding: 5px 2px 0;
        row-gap: 4px;
    }
    .labyrinth-own-discs .labyrinth-collected-disc {
        flex-basis: clamp(24px, 4vh, 34px);
        width: clamp(24px, 4vh, 34px);
    }
    .labyrinth-own-discs .labyrinth-collected-disc + .labyrinth-collected-disc { margin-left: -10px; }
    .labyrinth-recipe {
        grid-row: 2;
        grid-column: 1;
        justify-self: end;
        align-self: center;
    }
    .labyrinth-sticks {
        grid-row: 2;
        grid-column: 2;
        justify-self: start;
        align-self: center;
        margin: 0;
    }
    .labyrinth-game-messages {
        grid-row: 2;
        width: 100%;
        height: auto;
        min-height: 42px;
        padding: 0;
    }
    .labyrinth-hint {
        max-width: 100%;
        box-sizing: border-box;
        padding-inline: 6px;
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    .labyrinth-game { --labyrinth-recipe-width: 48px; width: min(100% - 12px, 1240px); padding: 4px 0 0; gap: 4px; }
    .labyrinth-player-list { gap: 4px 14px; }
    .labyrinth-player { gap: 4px; }
    .labyrinth-player small { display: none; }
    .labyrinth-opponent-discs .labyrinth-collected-disc { flex-basis: 20px; width: 20px; }
    .labyrinth-own-discs .labyrinth-collected-disc { flex-basis: 25px; width: 25px; }
    .labyrinth-hint { max-width: min(520px, calc(100vw - 100px)); font-size: .66rem; }
}

@media (prefers-reduced-motion: reduce) {
    .labyrinth-cell.is-shift-preview { animation: none; }
    .labyrinth-spare.is-awaiting-shift { animation: none; }
    .labyrinth-spare,
    .labyrinth-drop-zone,
    .labyrinth-stick > span { transition: none; }
    .labyrinth-board-frame::before { animation: none !important; }
}
