:root {
    --bg-top: #06101f;
    --bg-bottom: #030914;
    --surface-1: rgba(12, 28, 50, 0.92);
    --surface-2: rgba(17, 38, 65, 0.9);
    --surface-3: rgba(10, 21, 39, 0.78);
    --surface-border: rgba(117, 168, 255, 0.18);
    --surface-border-strong: rgba(255, 183, 72, 0.35);
    --text-main: #eff3ff;
    --text-muted: #9db1d2;
    --text-dim: #7084a7;
    --blue-accent: #3f8cff;
    --blue-bright: #74b4ff;
    --gold-accent: #ffcf63;
    --gold-deep: #da9a2f;
    --green-accent: #73eb7c;
    --red-accent: #ff766f;
    --wood-top: #99643b;
    --wood-mid: #6f4125;
    --wood-bottom: #4f2b17;
    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.3);
    --shadow-strong: 0 30px 80px rgba(0, 0, 0, 0.45);
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --ui-font: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
    --title-font: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia,
        serif;
}

html,
body {
    position: relative;
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    color: var(--text-main);
    margin: 0;
    box-sizing: border-box;
    font-family: var(--ui-font);
    background:
        radial-gradient(circle at top, rgba(48, 102, 188, 0.24), transparent 24%),
        radial-gradient(circle at bottom right, rgba(255, 166, 84, 0.16), transparent 24%),
        linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

* {
    box-sizing: border-box;
}

a {
    color: var(--blue-bright);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

label {
    display: block;
}

input,
button,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    box-sizing: border-box;
}

input,
select,
textarea {
    color: var(--text-main);
    background: rgba(9, 22, 40, 0.88);
    border: 1px solid rgba(123, 162, 222, 0.24);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-dim);
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(116, 180, 255, 0.7);
    box-shadow:
        0 0 0 3px rgba(63, 140, 255, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

button {
    color: var(--text-main);
    background:
        linear-gradient(180deg, rgba(33, 77, 144, 0.95), rgba(17, 48, 95, 0.96));
    border: 1px solid rgba(111, 174, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 0.9rem 1.1rem;
    outline: none;
    cursor: pointer;
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        border-color 180ms ease,
        filter 180ms ease;
    box-shadow: var(--shadow-soft);
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

button:not(:disabled):active {
    transform: translateY(0);
}

button:focus-visible {
    border-color: rgba(255, 207, 99, 0.75);
    box-shadow:
        0 0 0 3px rgba(255, 207, 99, 0.18),
        var(--shadow-soft);
}

#svelte,
body > div {
    min-height: 100vh;
}

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(7, 17, 31, 0.8);
}

::-webkit-scrollbar-thumb {
    background: rgba(86, 120, 179, 0.58);
    border-radius: 999px;
    border: 2px solid rgba(7, 17, 31, 0.8);
}

.grid-stack-item-content.tile-face {
    display: block;
    height: var(--tile-face-height, 82px);
    min-height: var(--tile-face-height, 82px);
    position: relative;
    overflow: hidden;
    border-radius: var(--tile-face-radius, 7px);
    border: 1px solid rgba(122, 86, 34, 0.34);
    background:
        radial-gradient(
            circle at 50% 28%,
            #fffaf0 0%,
            #f7ead0 38%,
            #e4c48c 78%,
            #c99951 100%
        );
    color: #1b232f;
    box-shadow:
        0 8px 11px rgba(0, 0, 0, 0.42),
        inset 0 2px 3px rgba(255, 255, 255, 1),
        inset 3px 0 5px rgba(255, 255, 255, 0.45),
        inset -4px -7px 10px rgba(85, 55, 20, 0.34);
    cursor: grab;
    user-select: none;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.grid-stack-item-content.tile-face::before {
    content: "";
    position: absolute;
    inset: max(4px, calc(var(--tile-face-height, 82px) * 0.07));
    border-radius: calc(var(--tile-face-radius, 7px) - 1px);
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.52),
            rgba(255, 255, 255, 0.14) 38%,
            rgba(110, 72, 24, 0.08) 100%
        );
    pointer-events: none;
}

.grid-stack-item-content.tile-face:active {
    cursor: grabbing;
}

.value-area {
    position: absolute;
    z-index: 1;
    top: max(4px, calc(var(--tile-face-height, 82px) * 0.092));
    left: 50%;
    width: min(
        calc(var(--tile-face-height, 82px) * 0.508),
        calc(100% - max(8px, calc(var(--tile-face-height, 82px) * 0.1)))
    );
    height: min(
        calc(var(--tile-face-height, 82px) * 0.508),
        calc(100% - max(8px, calc(var(--tile-face-height, 82px) * 0.1)))
    );
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.symbol {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--title-font);
    font-size: var(--tile-value-size, 2.25rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.037em;
    text-align: center;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.58),
        0 -1px 1px rgba(0, 0, 0, 0.28);
    filter:
        drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.18))
        drop-shadow(0 1px 0 rgba(255, 255, 255, 0.28));
}

.tile-black .symbol {
    color: #080808;
}

.tile-blue .symbol {
    color: #285de0;
}

.tile-orange .symbol {
    color: #e8882e;
}

.tile-red .symbol {
    color: #d71920;
}

.joker-tile .symbol {
    font-size: var(--tile-joker-size, 2.3rem);
    letter-spacing: 0;
}

.smiley-symbol {
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
}

.staging-tile {
    box-shadow:
        0 0 0 2px rgba(255, 205, 74, 0.9),
        0 0 20px rgba(255, 205, 74, 0.34),
        0 8px 16px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.selected-tile .tile-face {
    box-shadow:
        0 0 0 2px rgba(87, 154, 255, 0.92),
        0 0 18px rgba(87, 154, 255, 0.36),
        0 8px 16px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.grid-stack-item.ui-draggable-dragging .tile-face {
    transform: rotate(-1deg) scale(1.03);
    box-shadow:
        0 22px 32px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
}
