@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Russo+One&family=Space+Mono:wght@400;700&display=swap');

:root {
    color-scheme: dark;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);

    --gold: #cda15a;
    --gold-soft: rgba(205, 161, 90, 0.16);
    --gold-line: rgba(205, 161, 90, 0.45);
    --gold-glow: rgba(205, 161, 90, 0.35);

    --shadow-ambient: 0 30px 60px -18px rgba(0, 0, 0, 0.65);
    --shadow-contact: 0 10px 24px -10px rgba(0, 0, 0, 0.55);
    --shadow-inner-top: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ================= БАЗА ================= */
body {
    font-family: 'Montserrat', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.4s var(--ease), color 0.4s var(--ease);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, .russo {
    font-family: 'Russo One', sans-serif;
    letter-spacing: 0.02em;
}

.mono {
    font-family: 'Space Mono', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.eyebrow {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.85;
}

#app {
    position: relative;
    z-index: 1;
    animation: appIn 0.6s var(--ease) both;
}

@keyframes appIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

::selection {
    background: var(--gold-glow);
    color: #fff;
}

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 4px;
}

button:not(:disabled) {
    transition: transform 0.15s var(--ease), filter 0.15s var(--ease);
}
button:not(:disabled):active {
    transform: scale(0.97);
}

/* ================= ТЕМНА ТЕМА ================= */
body.theme-dark {
    background:
        radial-gradient(ellipse 90% 55% at 50% -8%, rgba(124, 58, 168, 0.55) 0%, rgba(76, 29, 88, 0.32) 20%, transparent 55%),
        radial-gradient(ellipse 65% 45% at 88% 105%, rgba(139, 17, 45, 0.30) 0%, transparent 60%),
        radial-gradient(ellipse 55% 40% at 4% 100%, rgba(30, 20, 60, 0.35) 0%, transparent 55%),
        linear-gradient(180deg, #0a0712 0%, #060409 45%, #030203 100%);
    color: #e5e5e5;
}

body.theme-dark::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    opacity: 0.035;
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 0;
}

/* ================= СВІТЛА ТЕМА ================= */
body.theme-light {
    background:
        radial-gradient(ellipse 70% 45% at 50% -10%, rgba(138, 102, 44, 0.08) 0%, transparent 55%),
        linear-gradient(135deg, #f0f4f8 0%, #d9e2ec 100%);
    color: #102a43;
    color-scheme: light;
    --gold: #8a662c;
    --gold-soft: rgba(138, 102, 44, 0.12);
    --gold-line: rgba(138, 102, 44, 0.4);
    --gold-glow: rgba(138, 102, 44, 0.25);
}

.theme-light .glass-panel {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 20px 45px -22px rgba(16, 42, 67, 0.25), var(--shadow-inner-top);
    border-color: rgba(16, 42, 67, 0.1);
    color: #102a43;
}

.theme-light .slot-card {
    background: linear-gradient(150deg, #ffffff 0%, #f0f4f8 100%);
    border-color: rgba(16, 42, 67, 0.1);
    color: #102a43;
    box-shadow: 0 10px 24px -14px rgba(16, 42, 67, 0.25);
}

.theme-light .bg-black\/40, .theme-light .bg-black\/50, .theme-light .bg-black\/60 {
    background-color: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
    color: #102a43;
}

.theme-light .bg-zinc-900, .theme-light .bg-zinc-800 {
    background-color: #f0f4f8;
    color: #102a43;
    border-color: #bcccdc;
}

.theme-light .text-zinc-400, .theme-light .text-zinc-300, .theme-light .text-zinc-500, .theme-light .text-white {
    color: #334e68;
}

.theme-light select option {
    background: #ffffff;
    color: #102a43;
}

/* ================= СІРА ТЕМА ================= */
body.theme-gray {
    background:
        radial-gradient(ellipse 70% 45% at 50% -10%, rgba(212, 180, 131, 0.07) 0%, transparent 55%),
        linear-gradient(135deg, #3e4c59 0%, #243b53 100%);
    color: #f0f4f8;
    --gold: #d4b483;
    --gold-soft: rgba(212, 180, 131, 0.14);
    --gold-line: rgba(212, 180, 131, 0.4);
    --gold-glow: rgba(212, 180, 131, 0.3);
}

.theme-gray .glass-panel {
    background: rgba(72, 101, 129, 0.8);
    box-shadow: var(--shadow-ambient), var(--shadow-inner-top);
    border-color: rgba(255, 255, 255, 0.1);
}

.theme-gray .slot-card {
    background: linear-gradient(150deg, #627d98 0%, #486581 100%);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.35);
    color: #fff;
}

.theme-gray .bg-black\/40, .theme-gray .bg-black\/50, .theme-gray .bg-black\/60 {
    background-color: rgba(36, 59, 83, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.theme-gray .bg-zinc-900, .theme-gray .bg-zinc-800 {
    background-color: #3e4c59;
    border-color: #627d98;
}

.theme-gray select option {
    background: #3e4c59;
    color: #f0f4f8;
}

/* ================= СПІЛЬНІ СТИЛІ ================= */
.glass-panel {
    background: rgba(20, 18, 26, 0.6);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: var(--shadow-ambient), var(--shadow-contact), var(--shadow-inner-top);
}

.corner-frame {
    position: relative;
}
.corner-frame::before,
.corner-frame::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2px solid var(--gold-line);
    pointer-events: none;
    z-index: 2;
}
.corner-frame::before { top: 14px; left: 14px; border-right: none; border-bottom: none; }
.corner-frame::after  { bottom: 14px; right: 14px; border-left: none; border-top: none; }

.brand-gradient-bg {
    background: linear-gradient(135deg, #8b2fc9 0%, #9d174d 55%, #be123c 100%);
    transition: filter 0.2s var(--ease);
}
.brand-gradient-bg:hover {
    filter: brightness(1.12) saturate(1.08);
}

.brand-gradient-text {
    background: linear-gradient(90deg, #be123c 0%, #8b2fc9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.slot-card {
    background: linear-gradient(155deg, rgba(42, 38, 50, 0.85) 0%, rgba(18, 16, 22, 0.92) 100%);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.55), var(--shadow-inner-top);
}

.slot-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 20px 38px -14px rgba(0, 0, 0, 0.65), var(--shadow-inner-top);
}

/* СТИЛЬ ДЛЯ МЕРТВИХ */
.dead {
    opacity: 0.4;
    filter: grayscale(85%);
    border: 2px dashed #ef4444 !important;
    background: rgba(127, 29, 29, 0.18) !important;
}

/* Спецефекти карток */
.target-kill {
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.55), inset 0 0 20px rgba(239, 68, 68, 0.08);
    border: 2px solid #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.target-heal {
    box-shadow: 0 0 26px rgba(16, 185, 129, 0.55), inset 0 0 20px rgba(16, 185, 129, 0.08);
    border: 2px solid #10b981 !important;
    background: rgba(16, 185, 129, 0.13) !important;
}

.target-sheriff-found {
    box-shadow: 0 0 26px rgba(59, 130, 246, 0.55);
    border: 2px solid #3b82f6 !important;
    background: rgba(30, 58, 138, 0.3) !important;
}

.target-mafia-found {
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.85);
    border: 2px solid #222 !important;
    background: rgba(0, 0, 0, 0.82) !important;
    color: #888;
}

.target-lola {
    box-shadow: 0 0 22px rgba(203, 213, 225, 0.55);
    border: 2px solid silver !important;
    background: rgba(192, 192, 192, 0.1) !important;
}

.target-kamikaze {
    box-shadow: 0 0 22px rgba(234, 88, 12, 0.55);
    border: 2px solid #ea580c !important;
    background: rgba(234, 88, 12, 0.1) !important;
}

.target-oracle {
    box-shadow: 0 0 22px rgba(168, 85, 247, 0.55);
    border: 2px solid #a855f7 !important;
    background: rgba(168, 85, 247, 0.1) !important;
}

.target-checked-false {
    opacity: 0.4;
    filter: blur(0.5px);
}

.mafia-wakes-up {
    box-shadow: 0 0 22px rgba(220, 38, 38, 0.5);
    border: 2px solid rgba(220, 38, 38, 0.85) !important;
    background: rgba(220, 38, 38, 0.1);
    animation: pulseAlert 1.8s ease-in-out infinite;
}

.day-speaker {
    box-shadow: 0 0 28px var(--gold-glow);
    border: 2px solid var(--gold) !important;
    background: var(--gold-soft) !important;
}

@keyframes pulseAlert {
    0%, 100% { box-shadow: 0 0 16px rgba(220, 38, 38, 0.4); }
    50%      { box-shadow: 0 0 30px rgba(220, 38, 38, 0.75); }
}

.foul-box {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.2s var(--ease);
    background: radial-gradient(circle at 35% 30%, #3f3f46, #27272a 80%);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.foul-box:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

.foul-filled {
    background: radial-gradient(circle at 35% 30%, #f87171, #b91c1c 85%);
    border-color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.7), inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.foul-warning {
    background: radial-gradient(circle at 35% 30%, #fde047, #ca8a04 85%);
    border-color: #eab308;
    box-shadow: 0 0 12px rgba(234, 179, 8, 0.7), inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.roulette-cell {
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    background: radial-gradient(circle at 32% 28%, #3f3f46 0%, #18181b 75%);
    border-radius: 16px;
    cursor: pointer;
    border: 2px solid #52525b;
    transition: 0.2s var(--ease);
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.08), inset 0 -6px 10px rgba(0, 0, 0, 0.55);
}

.roulette-cell:hover {
    border-color: var(--gold);
    transform: scale(1.06);
}

.roulette-safe {
    background: radial-gradient(circle at 32% 28%, #22c55e 0%, #14532d 85%);
    border-color: #22c55e;
    color: #fff;
    pointer-events: none;
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.5);
    animation: revealPop 0.35s var(--ease) both;
}

.roulette-bullet {
    background: radial-gradient(circle at 32% 28%, #ef4444 0%, #7f1d1d 85%);
    border-color: #ef4444;
    color: #fff;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
    pointer-events: none;
    box-shadow: 0 0 26px rgba(239, 68, 68, 0.85);
}

@keyframes revealPop {
    0%   { transform: scale(0.7); opacity: 0; }
    70%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}

.pulse-danger {
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0%   { color: #ef4444; text-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }
    50%  { color: #f87171; text-shadow: 0 0 22px rgba(239, 68, 68, 0.85); }
    100% { color: #ef4444; text-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gold-line);
    border-radius: 10px;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}
