:root[data-theme="soft"],
[data-theme-choice="soft"] {
    color-scheme: dark;
    --font: 'Instrument Sans', 'Segoe UI', sans-serif;
    --title-font: var(--font);
    --page-fill: radial-gradient(ellipse at 89% 18%, #b68b4ca8, transparent 46%),
        radial-gradient(ellipse at 100% 75%, #ac6b417d, transparent 52%),
        radial-gradient(ellipse at 8% 16%, #3e8985a6, transparent 56%),
        radial-gradient(ellipse at 32% 100%, #69845b61, transparent 55%),
        linear-gradient(128deg, #254e45, #2a4940 53%, #434838);
    --glass: radial-gradient(ellipse at 94% 4%, #b58b482d, transparent 60%),
        radial-gradient(ellipse at 2% 92%, #398d8226, transparent 56%),
        linear-gradient(151deg, #3b5446ef, #25372fee 70%, #304941ef);
    --glass-strong: #293c36;
    --glass-border: #a8bca345;
    --surface: #b3d5ba13;
    --field-fill: #202e2b;
    --field-border: #6a8a7d;
    --hover-fill: #3b5145;
    --stroke: #6c8175;
    --text: #ecf2e4;
    --text-muted: #c0ccc1;
    --aqua-deep: #d6e8dd;
    --green-deep: #dee9bf;
    --pink: #c8a9bd;
    --shadow: -10px 12px 31px #0c181849, 14px 31px 50px #101c16a1,
        inset 0 1px #dfedba2a, inset -8px -10px 24px #111d192a;
    --control-shadow: 2px 4px 12px #101b1880;
    --shadow-inset: inset 0 1px #e1ebca21;
    --hover-shadow: 3px 7px 18px #101b188a;
    --title-shadow: none;
    --radius: 24px;
    --radius-sm: 13px;
    --card-radius: 36px;
    --control-radius: 19px;
    --tile-radius: 8px;
    --panel-blur: blur(24px) saturate(.92);
    --button-fill: linear-gradient(145deg, #48563f, #394f45 53%, #344b54);
    --button-primary: linear-gradient(145deg, #5d7358, #3a5c50 67%, #395d69);
    --primary-shadow: none;
    --button-secondary: linear-gradient(145deg, #515d39, #364d3f);
    --button-pass: #354642;
    --voice-active: #486b5b;
    --voice-danger: #924c58;
    --chat-own: #36565b;
    --player-border: #798e7959;
    --player-highlight: #4f5d3e;
    --muted-surface: #36443c;
    --status-surface: #263831;
    --board-fill: #26382e;
    --tile-fill: #3b5041;
    --focus: #bae0d4;
    --danger-ink: #ffa0a5;
    --danger-cell: #dc727b65;
    --move-ink: #a5dfc2;
    --move-cell: #70b69964;
    --action-area: #82a3be4c;
    --action-ink: #c1d3ec;
    --action-fill: #799db875;
    --selected-ink: #ebdfa2;
    --self-ink: #efe1ac;
    --success-ink: #afd9b2;
    --arrest-ink: #efce93;
    --vote-ink: #d9c8f2;
    --vote-cell: #a38db968;
    --modal-backdrop: #101c1ab8;
    --toast-success: #345037;
    --toast-error: #613a43;
    --toast-warning: #5b5034;
    --toast-info: #324c57;
}

:root[data-theme="soft"] {
    /* Keep the gradient on the fixed body that follows the app viewport. */
    background-color: #254e45;
}

:root[data-theme="soft"] body::after {
    width: clamp(13rem, 29vw, 30rem);
    height: clamp(18rem, calc(var(--app-height) * .66), 40rem);
    border-radius: 0;
    filter: blur(clamp(12px, 1.4vw, 22px));
}

:root[data-theme="soft"] body::before {
    inset: -5px;
    width: auto;
    height: auto;
    border-radius: 0;
    background: url('assets/soft-water.jpg') center / cover;
    filter: grayscale(.72) blur(3px);
    mix-blend-mode: screen;
    opacity: .53;
}

:where(:root[data-theme="soft"]) :is(.center-panel, .login-container, .menu-container) {
    position: relative;
    isolation: isolate;
}
:root[data-theme="soft"] :is(.center-panel, .login-container, .menu-container)::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: url('assets/soft-water.jpg') center / cover;
    filter: grayscale(.8) blur(3px);
    mix-blend-mode: screen;
    opacity: .3;
    pointer-events: none;
}

:root[data-theme="soft"] body::after {
    inset: auto clamp(-6rem, -5vw, -2.5rem) -23% auto;
    background: radial-gradient(ellipse 18% 17% at 44% 27%, #483022 50%, transparent 100%),
        radial-gradient(ellipse 44% 42% at 56% 67%, #533b28 36%, transparent 100%);
    transform: rotate(13deg);
    opacity: .65;
}

:root[data-theme="terminal"],
[data-theme-choice="terminal"] {
    color-scheme: dark;
    --font: 'IBM Plex Mono', Consolas, monospace;
    --title-font: var(--font);
    --page-fill: repeating-linear-gradient(0deg, #0c180c 0 1px, #000 1px 5px);
    --page-glow-alt: none;
    --glass: #030803;
    --glass-strong: #050d05;
    --glass-border: #237b26;
    --surface: #091409;
    --field-fill: #020602;
    --field-border: #2c752d;
    --hover-fill: #142914;
    --stroke: #245925;
    --text: #72f979;
    --text-muted: #68c86c;
    --aqua-deep: #30ef36;
    --green-deep: #8cff91;
    --red: #ff9191;
    --pink: #b2f2b4;
    --shadow: none;
    --control-shadow: none;
    --shadow-inset: none;
    --hover-shadow: inset 0 0 0 1px #63ff6599;
    --title-shadow: none;
    --radius: 0px;
    --radius-sm: 0px;
    --card-radius: 0px;
    --control-radius: 0px;
    --tile-radius: 0px;
    --panel-blur: none;
    --button-fill: #071107;
    --button-primary: #32e738;
    --button-primary-text: #021003;
    --primary-border: #32e738;
    --primary-shadow: none;
    --button-secondary: #142714;
    --button-pass: #0c1b0c;
    --voice-active: #96d8a8;
    --voice-danger: #ffafa5;
    --chat-own: #102910;
    --player-border: #275b29;
    --player-highlight: #163618;
    --muted-surface: #1b271b;
    --status-surface: #0a160a;
    --board-fill: #060d06;
    --tile-fill: #152416;
    --focus: #8cff91;
    --danger-ink: #ff9e91;
    --danger-cell: #ef74685c;
    --success-ink: #9df5ad;
    --move-ink: #b8ff7d;
    --move-cell: #91e25555;
    --action-area: #ffe88b2b;
    --action-ink: #ffe38b;
    --action-fill: #f0bf5355;
    --arrest-ink: #ffd88d;
    --selected-ink: #ffdf70;
    --board-mark-text: #06180f;
    --self-ink: #a9f3f2;
    --vote-ink: #a7e2f6;
    --vote-cell: #73c4df55;
    --modal-backdrop: #000c;
    --toast-success: #123415;
    --toast-error: #421e23;
    --toast-warning: #3c301c;
    --toast-info: #163633;
}

:root[data-theme="retro"],
[data-theme-choice="retro"] {
    color-scheme: dark;
    --font: 'Space Mono', Consolas, monospace;
    --title-font: 'Workbench', 'Space Mono', monospace;
    --page-fill: linear-gradient(180deg, #140928, #422360 57%, #301543 58%, #140928);
    --page-glow-alt: none;
    --glass: linear-gradient(180deg, #25143aef, #211330f7);
    --glass-strong: #29173e;
    --glass-border: #bd77c2;
    --surface: #39224e;
    --field-fill: #1a0f2b;
    --field-border: #9460aa;
    --hover-fill: #523267;
    --stroke: #825292;
    --text: #fff1f8;
    --text-muted: #dfbcd9;
    --aqua-deep: #ffceab;
    --green-deep: #a5f5dc;
    --red: #ff9ab8;
    --pink: #f99ce5;
    --shadow: 4px 4px #110a21, 6px 6px #f377b65c, inset 0 2px #ff9fe84d;
    --control-shadow: 2px 3px #130a22;
    --shadow-inset: inset 0 2px #f4abff48, inset 0 -2px #0d061d72;
    --hover-shadow: 3px 4px #6c3383, 0 0 12px #f980dc47;
    --title-shadow: 2px 2px #8a318d, 4px 4px #591e69;
    --radius: 0;
    --radius-sm: 0;
    --card-radius: 0;
    --control-radius: 0;
    --tile-radius: 0;
    --panel-blur: none;
    --button-fill: linear-gradient(#513065 50%, #39224e 50%);
    --button-primary: linear-gradient(#ffd09b 48%, #ffad85 49%, #ee87b0);
    --button-primary-text: #261032;
    --primary-border: #ffc8a9;
    --primary-shadow: none;
    --button-secondary: #244357;
    --button-pass: #281d40;
    --voice-active: #8ee4d3;
    --voice-danger: #ff9bbd;
    --chat-own: #3f285c;
    --player-border: #6c538e;
    --player-highlight: #4c2a68;
    --muted-surface: #332c43;
    --status-surface: #211735;
    --board-fill: #171027;
    --tile-fill: #4b305e;
    --focus: #8bf7fa;
    --danger-ink: #ff9ab2;
    --danger-cell: #f2648b59;
    --success-ink: #9ff1c6;
    --move-ink: #92fff6;
    --move-cell: #49e3e966;
    --action-area: #ec91f045;
    --action-ink: #ff9ae6;
    --action-fill: #e389da70;
    --arrest-ink: #ffe298;
    --selected-ink: #ffc47a;
    --board-mark-text: #200e30;
    --self-ink: #ffaceb;
    --vote-ink: #d8b6ff;
    --vote-cell: #bf8ff05c;
    --modal-backdrop: #100923bf;
    --toast-success: #1f3f3a;
    --toast-error: #532845;
    --toast-warning: #47324a;
    --toast-info: #26395a;
}

:root[data-theme="frutiger"] {
    --theme-art: url('assets/frutiger-lake.webp');
}

:root[data-theme="retro"] {
    --theme-art: url('assets/retrowave-city.webp');
}

:root:is([data-theme="frutiger"], [data-theme="retro"]) body::before {
    inset: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    background: var(--theme-art) var(--art-position, center) / cover no-repeat;
    opacity: 1;
    filter: none;
}

:root[data-theme="terminal"] {
    background-color: #000;
    --terminal-wordmark:
        " __ __    _    _____  ___    _     ____  _   _  _____  _____  _____\A "
        "|  V  |  / \\  |  ___||_ _|  / \\   / ___|| | | ||  ___|/ ____|/ ____|\A "
        "|     | / _ \\ | |_    | |  / _ \\ | |    | |_| || |__  \\___ \\ \\___ \\\A "
        "| |V| |/ ___ \\|  _|   | | / ___ \\| |___ |  _  ||  __|  ____) | ____) |\A "
        "|_| |_|\\_/ \\_/|_|    |___|\\_/ \\_/ \\____||_| |_||_____||_____/ |_____/";
}

:root[data-theme="terminal"] body::before,
:root[data-theme="terminal"] body::after { content: none; }

:root[data-theme="terminal"] :is(.login-title, .menu-title) {
    display: grid;
    gap: 8px;
    padding-bottom: 8px;
    border-block-end: 1px solid var(--stroke);
}
:root[data-theme="terminal"] :is(.login-title, .menu-title) > span { display: none; }
:root[data-theme="terminal"] :is(.login-title, .menu-title)::before {
    content: '$ ./mafiachess ▉' / '';
    padding: 4px 8px;
    border-block: 1px solid var(--glass-border);
    background: var(--surface);
    font: 600 .75rem var(--font);
    text-align: left;
}
:root[data-theme="terminal"] :is(.login-title, .menu-title)::after {
    content: var(--terminal-wordmark) / '';
    font: 700 clamp(5px, 1.85vw, 11px) / 1.06 var(--font);
    white-space: pre;
}
:root[data-theme="terminal"] .main-menu .menu-container { gap: 10px; }
:root[data-theme="terminal"] .main-menu .menu-buttons .menu-btn { padding-inline: 6px; }
:root[data-theme="terminal"] .btns-panel { border-color: var(--stroke); }

@media (max-width: 650px) {
    :root[data-theme="frutiger"] { --art-position: 13% center; }
    :root[data-theme="retro"] { --art-position: 79% center; }
}
