:root{
    --ocean-deep: #05111f;
    --ocean-mid: #0b2442;
    --ocean-surface: #123b63;
    --sky-glow: #38bdf8;
    --seafoam: #67e8f9;
    --gold: #fbbf24;
    --gold-soft: #fde68a;
    --sunset: #fb7185;
    --leaf: #22c55e;
    --danger: #ef4444;
    --ink: #e8f4ff;
    --muted: #c7d7ea;
    --panel: rgba(7, 22, 39, 0.88);
    --panel-strong: rgba(6, 16, 30, 0.96);
    --panel-soft: rgba(14, 38, 66, 0.86);
    --line: rgba(255,255,255,0.14);
    --line-strong: rgba(255,255,255,0.24);
    --shadow-lg: 0 28px 64px rgba(0, 0, 0, 0.42);
    --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.28);
    --shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.2);
}

*{
    box-sizing: border-box;
}

html{
    scroll-behavior: smooth;
}

body{
    margin: 0;
    min-height: 100vh;
    padding: 22px;
    text-align: center;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    background:
        radial-gradient(circle at top center, rgba(103, 232, 249, 0.12), transparent 24%),
        radial-gradient(circle at 15% 12%, rgba(251, 191, 36, 0.18), transparent 16%),
        radial-gradient(circle at 88% 14%, rgba(56, 189, 248, 0.18), transparent 16%),
        linear-gradient(180deg, #0a2c4d 0%, #08213a 28%, #06182c 56%, #04111f 100%);
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after{
    content: "";
    position: fixed;
    inset: auto;
    pointer-events: none;
    z-index: 0;
}

body::before{
    width: 560px;
    height: 560px;
    left: -180px;
    top: -180px;
    background: radial-gradient(circle, rgba(253, 224, 71, 0.14), transparent 64%);
}

body::after{
    width: 700px;
    height: 700px;
    right: -220px;
    bottom: -260px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.18), transparent 66%);
}

.hidden{
    display: none !important;
}

.start-screen,
.game-container{
    position: relative;
    z-index: 1;
    width: min(1320px, 100%);
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 34px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.start-screen{
    min-height: calc(100vh - 44px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 28px;
    padding: 44px 40px 54px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.015)),
        linear-gradient(180deg, rgba(9, 28, 49, 0.94), rgba(4, 13, 24, 0.98));
}

.start-screen::before,
.start-screen::after,
.game-container::before,
.game-container::after{
    content: "";
    position: absolute;
    pointer-events: none;
}

.start-screen::before{
    inset: 0;
    background:
        radial-gradient(circle at 50% -8%, rgba(253, 224, 71, 0.18), transparent 28%),
        radial-gradient(circle at 10% 24%, rgba(103, 232, 249, 0.12), transparent 20%),
        radial-gradient(circle at 90% 24%, rgba(56, 189, 248, 0.12), transparent 20%);
}

.start-screen::after{
    left: -8%;
    right: -8%;
    bottom: -72px;
    height: 180px;
    background:
        radial-gradient(ellipse at 18% 20%, rgba(255,255,255,0.08), transparent 30%),
        radial-gradient(ellipse at 48% 28%, rgba(255,255,255,0.06), transparent 28%),
        radial-gradient(ellipse at 78% 18%, rgba(255,255,255,0.08), transparent 30%),
        linear-gradient(180deg, rgba(22, 163, 224, 0.08), rgba(4, 21, 38, 0));
    filter: blur(10px);
}

.play-type-panel{
    width: 100%;
    max-width: 820px;
    padding: 22px 24px 18px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.12);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
        rgba(7, 24, 41, 0.72);
    box-shadow: var(--shadow-md);
}

.play-type-title{
    margin: 0 0 14px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--gold-soft);
}

.play-type-buttons{
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
}

.play-type-btn{
    padding: 14px 18px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
    color: var(--ink);
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s ease;
}

.play-type-btn:hover{
    transform: translateY(-2px);
    filter: brightness(1.06);
}

.play-type-btn.active{
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1f2937;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.22);
}

.play-type-description{
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.5;
}

h1{
    margin: 0;
    line-height: 1;
    letter-spacing: 2px;
    font-size: clamp(52px, 6.4vw, 88px);
    color: var(--gold-soft);
    text-shadow:
        0 0 10px rgba(251, 191, 36, 0.38),
        0 0 32px rgba(56, 189, 248, 0.18);
}

#mode-title{
    margin: 0;
    padding: 11px 30px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #a5f3fc;
    font-size: clamp(24px, 3vw, 38px);
    font-weight: 700;
    letter-spacing: 8px;
    text-shadow: 0 0 12px rgba(103, 232, 249, 0.3);
}

.mode-buttons{
    width: 100%;
    max-width: 1180px;
    display: grid;
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    gap: 28px;
}

.mode-buttons > div{
    position: relative;
    padding: 24px 22px 22px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.12);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)),
        rgba(9, 28, 48, 0.66);
    box-shadow: var(--shadow-md);
}

.mode-buttons > div::before{
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    top: 12px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
}

.mode-buttons p{
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.5;
}

.mode-buttons button{
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 1px;
    color: white;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.28);
    transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

.mode-buttons button:hover{
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
    filter: brightness(1.06);
}

.mode-buttons button:active{
    transform: scale(0.98);
}

.btn-easy{
    background: linear-gradient(135deg, #22c55e, #15803d);
}

.btn-hard{
    background: linear-gradient(135deg, #fb7185, #e11d48);
}

.btn-insane{
    background: linear-gradient(135deg, #7c3aed, #4338ca);
}

.btn-impossible{
    background: linear-gradient(135deg, #111827, #7f1d1d);
}

.leaderboard{
    width: 100%;
    max-width: 1020px;
    margin-top: 6px;
    padding: 28px 28px 24px;
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,0.12);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.02)),
        rgba(5, 19, 34, 0.74);
    box-shadow: var(--shadow-md);
}

.leaderboard h2{
    margin: 0 0 18px;
    font-size: clamp(34px, 3.6vw, 56px);
    letter-spacing: 2px;
    color: var(--gold-soft);
    text-shadow: 0 0 14px rgba(251, 191, 36, 0.2);
}

.leaderboard table{
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--line-strong);
    background: rgba(3, 13, 24, 0.92);
}

.leaderboard th,
.leaderboard td{
    padding: 16px 14px;
    text-align: center;
    font-size: 19px;
}

.leaderboard th{
    background: linear-gradient(180deg, rgba(11, 59, 99, 0.95), rgba(8, 35, 58, 0.95));
    color: var(--gold-soft);
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.leaderboard td{
    color: var(--ink);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.leaderboard tbody tr:nth-child(even){
    background: rgba(255,255,255,0.03);
}

.leaderboard tbody tr:hover{
    background: rgba(103, 232, 249, 0.08);
}

.leaderboard tbody tr:last-child td{
    border-bottom: none;
}

.game-container{
    padding: 34px 28px 38px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.01)),
        linear-gradient(180deg, rgba(7, 25, 44, 0.95), rgba(3, 12, 22, 0.98));
}

.game-container::before{
    width: 320px;
    height: 320px;
    top: -120px;
    right: -110px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.16), transparent 68%);
}

.game-container::after{
    width: 260px;
    height: 260px;
    left: -70px;
    bottom: -90px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.16), transparent 68%);
}

.game-container h1{
    margin-bottom: 24px;
}

.top-bar{
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
}

#score,
.top-bar button{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: var(--shadow-sm);
}

#score{
    margin: 0;
    min-width: 176px;
    padding: 10px 18px;
    font-size: 28px;
    font-weight: 700;
    background: rgba(255,255,255,0.06);
}

#score{
    color: #86efac;
    text-shadow: 0 0 12px rgba(34, 197, 94, 0.24);
}

.top-bar button{
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.top-bar button:hover{
    transform: translateY(-2px);
    filter: brightness(1.07);
}

.top-bar button:active{
    transform: scale(0.98);
}

#soundBtn{
    background: linear-gradient(135deg, #334155, #1e293b);
}

.sound-controls{
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    box-shadow: var(--shadow-sm);
}

#volumeSlider{
    width: 110px;
    accent-color: #38bdf8;
    cursor: pointer;
}

#hintBtn{
    background: linear-gradient(135deg, #22c55e, #15803d);
}

#restartBtn{
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

#homeBtn,
.end-screen button{
    background: linear-gradient(135deg, #38bdf8, #2563eb);
}

#hintBtn:disabled{
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.15);
}

#reshuffleBtn{
    background: linear-gradient(180deg, #1f4f6b 0%, #16394d 100%);
    color: #f3f4f6;
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 4px 10px rgba(0,0,0,0.22);
}

#reshuffleBtn:hover{
    transform: translateY(-1px);
    filter: brightness(1.08);
    box-shadow: 0 6px 14px rgba(0,0,0,0.28);
}

#reshuffleBtn:active{
    transform: translateY(0);
}

#reshuffleBtn:disabled{
    background: #4b5563;
    color: rgba(255,255,255,0.65);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.8;
}

#pauseBtn{
    background: linear-gradient(135deg, #6366f1, #4338ca);
}

#endRunBtn{
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.board-wrapper{
    position: relative;
    display: inline-block;
    overflow: visible;
    padding: 18px;
    margin-top: 4px;
    border-radius: 26px;
    border: 1px solid rgba(255,255,255,0.08);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015)),
        rgba(4, 16, 28, 0.72);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), var(--shadow-md);
}

.board{
    display: grid;
    gap: 1px;
    justify-content: center;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 16px;
    overflow: hidden;
}

.matched{
    animation: revealUnderImage 0.55s ease forwards;
    pointer-events: none;
}

@keyframes revealUnderImage{
    0%{
        opacity: 1;
        transform: scale(1);
        filter: brightness(1);
    }
    60%{
        opacity: 0.35;
        transform: scale(0.92);
        filter: brightness(1.08);
    }
    100%{
        opacity: 0;
        transform: scale(0.78);
        filter: brightness(1.12);
    }
}

#board{
    position: relative;
    z-index: 1;
}

#lineCanvas{
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    pointer-events: none;
}

.cell{
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255,255,255,0.16);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02)),
        rgba(14, 44, 72, 0.82);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 16px rgba(0,0,0,0.18);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    will-change: transform, opacity;
}

.cell img{
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    padding: 0;
    transform: scale(1.08);
}

.cell:hover{
    transform: translateY(-2px) scale(1.04);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 12px 20px rgba(0,0,0,0.24);
}

.selected{
    border-color: #ffe45c !important;
    background:
        linear-gradient(180deg, rgba(255, 230, 92, 0.58), rgba(255,255,255,0.12)),
        rgba(58, 78, 108, 0.98);
    box-shadow:
        0 0 0 4px rgba(255, 228, 92, 0.75),
        0 0 14px rgba(255, 228, 92, 0.75),
        0 0 30px rgba(255, 196, 0, 0.65),
        0 12px 22px rgba(0,0,0,0.28);
    transform: scale(1.05);
    z-index: 3;
}

.hint{
    border-color: #ef4444 !important;
    background:
        linear-gradient(180deg, rgba(239, 68, 68, 0.30), rgba(255,255,255,0.06)),
        rgba(88, 22, 22, 0.92);
    box-shadow:
        0 0 0 3px rgba(239, 68, 68, 0.38),
        0 0 18px rgba(239, 68, 68, 0.55),
        0 0 34px rgba(185, 28, 28, 0.42);
    animation: hintPulseRed 1.1s ease-in-out infinite;
}

@keyframes hintPulseRed{
    0%, 100%{
        transform: scale(1);
        box-shadow:
            0 0 0 3px rgba(239, 68, 68, 0.30),
            0 0 14px rgba(239, 68, 68, 0.42),
            0 0 24px rgba(185, 28, 28, 0.28);
    }
    50%{
        transform: scale(1.08);
        box-shadow:
            0 0 0 4px rgba(239, 68, 68, 0.48),
            0 0 22px rgba(239, 68, 68, 0.72),
            0 0 38px rgba(185, 28, 28, 0.50);
    }
}

.removed{
    visibility: hidden;
}

.wrong{
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.14), 0 0 18px rgba(239, 68, 68, 0.28);
    animation: wrongShake 0.3s ease;
}

@keyframes wrongShake{
    0%{ transform: translateX(0); }
    25%{ transform: translateX(-4px); }
    50%{ transform: translateX(4px); }
    75%{ transform: translateX(-4px); }
    100%{ transform: translateX(0); }
}

.pause-overlay{
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background:
        radial-gradient(circle at center,
            rgba(255, 255, 255, 0.08) 0%,
            rgba(24, 52, 88, 0.14) 18%,
            rgba(4, 18, 34, 0.78) 42%,
            rgba(2, 8, 18, 0.96) 100%);
    backdrop-filter: blur(10px);
    animation: pauseFadeIn 0.25s ease;
}

.pause-overlay-text{
    position: relative;
    display: inline-block;
    margin: 0 auto;
    padding: 0 10px;
    line-height: 1;
    text-align: center;
    background: linear-gradient(
        180deg,
        #ffffff 0%,
        #f8fcff 24%,
        #dcebff 58%,
        #ffffff 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: clamp(52px, 6vw, 84px);
    font-weight: 900;
    letter-spacing: 8px;
    text-transform: uppercase;
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.18),
        0 0 22px rgba(191, 219, 254, 0.30),
        0 0 42px rgba(125, 211, 252, 0.18),
        0 8px 20px rgba(0, 0, 0, 0.52);
    animation: pauseFloat 2.8s ease-in-out infinite;
}

.pause-overlay-text::before{
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 320px;
    height: 320px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255, 255, 255, 0.16) 0%,
        rgba(219, 234, 254, 0.14) 24%,
        rgba(191, 219, 254, 0.09) 46%,
        rgba(147, 197, 253, 0.00) 74%);
    filter: blur(16px);
    z-index: -2;
}

.pause-overlay-text::after{
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 150%;
    height: 32%;
    transform: translate(-50%, -50%) rotate(-8deg);
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.08) 20%,
        rgba(255,255,255,0.42) 50%,
        rgba(255,255,255,0.08) 80%,
        rgba(255,255,255,0) 100%
    );
    filter: blur(10px);
    opacity: 0.85;
    z-index: -1;
    pointer-events: none;
}

@keyframes pauseFadeIn{
    from{
        opacity: 0;
    }
    to{
        opacity: 1;
    }
}

@keyframes pauseFloat{
    0%, 100%{
        transform: translateY(0);
    }
    50%{
        transform: translateY(-5px);
    }
}

.board-wrapper.paused #board,
.board-wrapper.paused #lineCanvas{
    opacity: 0.16;
    filter: blur(5px) brightness(0.52) saturate(0.8);
}

.end-screen{
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding: 28px;
    text-align: center;
    color: white;
    background:
        radial-gradient(circle at top, rgba(253,224,71,0.12), transparent 22%),
        linear-gradient(180deg, rgba(10, 37, 63, 0.96), rgba(3, 12, 22, 0.98));
}

.end-screen h2{
    margin: 0;
    font-size: clamp(44px, 6vw, 76px);
    color: var(--gold-soft);
    text-shadow: 0 0 18px rgba(251, 191, 36, 0.28);
}

.bonus-message{
    margin: 0;
    font-size: clamp(26px, 3vw, 36px);
    font-weight: 700;
    color: #dbeafe;
    text-shadow: 0 0 10px rgba(103, 232, 249, 0.2);
}

#modeBonusMessage{
    color: #c4b5fd;
    text-shadow: 0 0 10px rgba(196, 181, 253, 0.22);
}

.total-score-message{
    margin: 6px 0 0;
    font-size: clamp(30px, 3.4vw, 42px);
    font-weight: 800;
    color: #86efac;
    text-shadow: 0 0 12px rgba(34, 197, 94, 0.28);
}

.leaderboard-rank-message{
    margin: 2px 0 0;
    font-size: clamp(22px, 2.6vw, 30px);
    font-weight: 700;
    color: #facc15;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.28);
}

.end-screen button{
    margin-top: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: 18px;
    color: white;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, filter 0.2s ease;
}

.end-screen button:hover{
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.win-flash{
    animation: winFlash 0.6s ease-in-out 2;
}

@keyframes winFlash{
    0%{ background-color: rgba(4, 17, 31, 0.96); }
    50%{ background-color: rgba(255, 255, 255, 0.12); }
    100%{ background-color: rgba(4, 17, 31, 0.96); }
}

.win-pop{
    animation: winPop 0.6s ease;
}

@keyframes winPop{
    0%{
        transform: scale(0.72);
        opacity: 0;
    }
    50%{
        transform: scale(1.12);
        opacity: 1;
    }
    100%{
        transform: scale(1);
    }
}

@media (max-width: 1120px){
    .mode-buttons{
        grid-template-columns: repeat(2, minmax(240px, 1fr));
    }
}

@media (max-width: 860px){
    body{
        padding: 14px;
    }

    .start-screen,
    .game-container{
        border-radius: 24px;
    }

    .start-screen{
        min-height: calc(100vh - 28px);
        padding: 28px 18px 34px;
    }

    .game-container{
        padding: 24px 14px 26px;
    }

    .play-type-buttons{
        grid-template-columns: 1fr;
    }

    .mode-buttons{
        grid-template-columns: 1fr;
        max-width: 520px;
    }

    .leaderboard{
        padding: 20px 14px 16px;
    }

    .leaderboard th,
    .leaderboard td{
        padding: 12px 8px;
        font-size: 16px;
    }

    #score,
    .top-bar button{
        width: 100%;
        max-width: 320px;
    }

    .top-bar{
        gap: 10px;
    }

    .board-wrapper{
        width: 100%;
        padding: 12px;
        overflow-x: auto;
    }
}

@media (max-width: 700px){
    .game-layout{
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 700px){
    .top-bar{
        gap: 10px;
    }

    .top-bar button{
        width: calc(50% - 8px);
    }
}

@media (max-width: 700px){
    .time-column{
        min-width: 112px;
    }

    .time-track{
        width: 66px;
        height: 320px;
        padding-top: 34px;
    }

    .time-column-title{
        font-size: 17px;
        letter-spacing: 2px;
        padding: 8px 16px;
    }

    .wanted-stamp{
        font-size: 5px;
        letter-spacing: 0.45px;
    }

    .wanted-portrait{
        inset: 22px 4px 12px;
        background-size:
            100% 100%,
            132% auto;
    }

    .time-bar-value{
        min-width: 84px;
        font-size: 16px;
    }
}

.game-layout{
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 24px;
    margin-top: 20px;
}

.time-column{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 140px;
}

.time-column-title{
    position: relative;
    padding: 10px 22px;
    border: 2px solid #5a3317;
    border-radius: 10px;
    background:
        linear-gradient(180deg, #f8eed0 0%, #edd9a6 52%, #d8b56c 100%);
    color: #5b3417;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 3px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.35);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.28),
        0 8px 18px rgba(0,0,0,0.28);
}

.time-column-title::before,
.time-column-title::after{
    content: "";
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7a4920;
    transform: translateY(-50%);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.18);
}

.time-column-title::before{ left: 9px; }
.time-column-title::after{ right: 9px; }

.time-track{
    position: relative;
    width: 72px;
    height: 420px;
    padding: 34px 6px 8px;
    border-radius: 16px;
    border: 2px solid #4d2913;
    background:
        linear-gradient(180deg, #e2bb73 0%, #b97834 100%);
    box-shadow:
        inset 0 0 0 2px rgba(255,255,255,0.10),
        inset 0 18px 24px rgba(255,255,255,0.06),
        0 18px 30px rgba(0,0,0,0.34);
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.time-track::before{
    content: "";
}

.time-track::after{
    content: "";
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background:
        radial-gradient(circle at 16% 14%, rgba(102, 60, 22, 0.12), transparent 12%),
        radial-gradient(circle at 76% 22%, rgba(102, 60, 22, 0.10), transparent 11%),
        radial-gradient(circle at 34% 48%, rgba(102, 60, 22, 0.08), transparent 14%),
        radial-gradient(circle at 66% 74%, rgba(102, 60, 22, 0.10), transparent 13%),
        repeating-linear-gradient(
            180deg,
            rgba(96, 58, 23, 0.028) 0px,
            rgba(96, 58, 23, 0.028) 2px,
            rgba(255,255,255,0.014) 3px,
            rgba(255,255,255,0.014) 7px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(96, 58, 23, 0.018) 0px,
            rgba(96, 58, 23, 0.018) 2px,
            rgba(255,255,255,0.010) 3px,
            rgba(255,255,255,0.010) 8px
        );
    mix-blend-mode: multiply;
}

.wanted-stamp{
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%) rotate(-1deg);
    z-index: 7;
    width: calc(100% - 8px);
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
    border: 1px solid rgba(118, 31, 18, 0.72);
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #d94737 0%, #a6281f 100%);
    color: #ffe4c4;
    font-size: 6px;
    font-weight: 900;
    letter-spacing: 0.55px;
    line-height: 1;
    text-align: center;
    text-shadow: 0 1px 0 rgba(0,0,0,0.18);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.10),
        0 2px 6px rgba(0,0,0,0.18);
    white-space: nowrap;
    overflow: hidden;
}

.time-bar{
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 3;
    overflow: visible;
    border-radius: 10px 10px 12px 12px;
    border: 2px solid rgba(76, 38, 19, 0.58);
    background:
        linear-gradient(180deg,
            #fff4d5 0%,
            #f1d28f 20%,
            #d99649 52%,
            #8d4320 100%);
    box-shadow:
        inset 0 16px 22px rgba(255,255,255,0.18),
        inset 0 -18px 24px rgba(66, 22, 8, 0.30),
        0 4px 10px rgba(0,0,0,0.18);
    transition: height 0.35s linear;
}

.time-bar::before{
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(circle at 20% 16%, rgba(97, 57, 25, 0.12), transparent 12%),
        radial-gradient(circle at 78% 28%, rgba(97, 57, 25, 0.10), transparent 12%),
        radial-gradient(circle at 42% 70%, rgba(97, 57, 25, 0.08), transparent 15%),
        repeating-linear-gradient(
            180deg,
            rgba(98, 58, 24, 0.03) 0px,
            rgba(98, 58, 24, 0.03) 2px,
            rgba(255,255,255,0.018) 3px,
            rgba(255,255,255,0.018) 7px
        );
    mix-blend-mode: multiply;
    pointer-events: none;
}

.wanted-portrait{
    position: absolute;
    inset: 24px 4px 14px;
    z-index: 2;
    border: 1px solid rgba(93, 54, 24, 0.38);
    border-radius: 4px;
    background-image:
        linear-gradient(180deg,
            rgba(255,255,255,0.05) 0%,
            rgba(255,255,255,0.00) 34%,
            rgba(68, 30, 12, 0.12) 100%),
        url("image/wanted-portrait.png");
    background-size:
        100% 100%,
        138% auto;
    background-position:
        center,
        center 24%;
    background-repeat: no-repeat;
    opacity: 0.52;
    filter: grayscale(1) sepia(0.95) contrast(1.08) brightness(0.92);
    mix-blend-mode: multiply;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.04),
        0 0 0 1px rgba(66, 34, 14, 0.12);
    pointer-events: none;
}

.wanted-portrait::before{
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(180deg,
            rgba(255,255,255,0.10) 0%,
            rgba(255,255,255,0.00) 26%,
            rgba(43, 20, 8, 0.10) 100%);
    pointer-events: none;
}

.burn-edge{
    position: absolute;
    top: -13px;
    left: -6px;
    right: -6px;
    height: 24px;
    z-index: 5;
    pointer-events: none;
    background:
        radial-gradient(circle at 4% 70%, rgba(23, 10, 6, 0.96) 0 18%, transparent 19%),
        radial-gradient(circle at 17% 26%, rgba(92, 27, 8, 0.90) 0 18%, transparent 19%),
        radial-gradient(circle at 30% 76%, rgba(30, 12, 8, 0.96) 0 20%, transparent 21%),
        radial-gradient(circle at 44% 22%, rgba(122, 34, 8, 0.84) 0 17%, transparent 18%),
        radial-gradient(circle at 58% 72%, rgba(26, 10, 7, 0.96) 0 19%, transparent 20%),
        radial-gradient(circle at 73% 28%, rgba(108, 29, 8, 0.88) 0 18%, transparent 19%),
        radial-gradient(circle at 88% 68%, rgba(26, 10, 6, 0.96) 0 18%, transparent 19%),
        radial-gradient(circle at 98% 38%, rgba(96, 28, 8, 0.88) 0 16%, transparent 17%);
    filter: blur(1px);
}

.ash{
    position: absolute;
    bottom: 2px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 236, 210, 0.92);
    box-shadow:
        0 0 6px rgba(255, 170, 120, 0.35),
        0 0 10px rgba(255, 120, 80, 0.18);
    opacity: 0;
    transform: translate3d(0,0,0) scale(0.7);
}

.ash-1{ left: 6%;  --drift: -10px; --rise: -32px; animation-delay: 0s; }
.ash-2{ left: 18%; --drift:  6px; --rise: -40px; animation-delay: .6s; }
.ash-3{ left: 31%; --drift: -5px; --rise: -36px; animation-delay: 1.1s; }
.ash-4{ left: 45%; --drift:  9px; --rise: -44px; animation-delay: .3s; }
.ash-5{ left: 58%; --drift: -8px; --rise: -34px; animation-delay: .9s; }
.ash-6{ left: 70%; --drift:  7px; --rise: -42px; animation-delay: 1.4s; }
.ash-7{ left: 82%; --drift: -6px; --rise: -38px; animation-delay: .5s; }
.ash-8{ left: 92%; --drift:  4px; --rise: -30px; animation-delay: 1.0s; }

.time-bar.warning .wanted-portrait{
    opacity: 0.40;
    filter: grayscale(1) sepia(1) contrast(1.08) brightness(0.86);
}

.time-bar.danger .wanted-portrait{
    opacity: 0.22;
    filter: grayscale(1) sepia(1) contrast(1.12) brightness(0.76);
}

.time-bar.warning .ash{
    opacity: 0.35;
    animation: ashRise 2.8s linear infinite;
}

.time-bar.danger .ash{
    opacity: 0.82;
    animation: ashRise 1.8s linear infinite;
}

.time-bar.warning{
    background:
        linear-gradient(180deg,
            #ffe1a5 0%,
            #f3a649 22%,
            #cb5a1f 60%,
            #5a170a 100%);
    box-shadow:
        inset 0 14px 18px rgba(255,255,255,0.14),
        inset 0 -18px 24px rgba(69, 12, 5, 0.36),
        0 0 18px rgba(245, 158, 11, 0.22);
}

.time-bar.danger{
    background:
        linear-gradient(180deg,
            #ffd3af 0%,
            #ff8440 20%,
            #d22121 56%,
            #220404 100%);
    box-shadow:
        inset 0 12px 16px rgba(255,255,255,0.09),
        inset 0 -20px 24px rgba(20, 0, 0, 0.48),
        0 0 26px rgba(239, 68, 68, 0.42);
    animation:
        wantedBurnPulse 0.95s ease-in-out infinite,
        wantedDangerShake 1.2s ease-in-out infinite;
}

.time-bar-value{
    position: relative;
    min-width: 86px;
    padding: 8px 10px;
    border: 2px solid rgba(88, 48, 18, 0.95);
    border-radius: 8px;
    background:
        linear-gradient(180deg, #f6e7bf 0%, #debf79 100%);
    color: #5b3417;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.25);
    box-shadow: 0 6px 14px rgba(0,0,0,0.22);
    transform: rotate(-2deg);
}

.time-bar-value::before{
    content: "DEADLINE";
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 8px;
    border: 1px solid rgba(118, 31, 18, 0.6);
    border-radius: 999px;
    background: #b53524;
    color: #ffe5c5;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1.1px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.22);
}

@keyframes wantedBurnPulse{
    0%, 100%{
        box-shadow:
            inset 0 12px 16px rgba(255,255,255,0.09),
            inset 0 -20px 24px rgba(20, 0, 0, 0.48),
            0 0 22px rgba(239, 68, 68, 0.32);
    }
    50%{
        box-shadow:
            inset 0 12px 16px rgba(255,255,255,0.12),
            inset 0 -20px 24px rgba(20, 0, 0, 0.54),
            0 0 34px rgba(239, 68, 68, 0.56);
    }
}

@keyframes wantedDangerShake{
    0%, 100%{
        transform: translateX(0);
    }
    25%{
        transform: translateX(-1px);
    }
    50%{
        transform: translateX(1px);
    }
    75%{
        transform: translateX(-1px);
    }
}

@keyframes ashRise{
    0%{
        transform: translate3d(0, 0, 0) scale(0.7);
        opacity: 0;
    }
    12%{
        opacity: 0.95;
    }
    100%{
        transform: translate3d(var(--drift), var(--rise), 0) scale(1.45);
        opacity: 0;
    }
}

.toast-container{
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast{
    min-width: 260px;
    max-width: 360px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.14);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    box-shadow: 0 16px 36px rgba(0,0,0,0.32);
    backdrop-filter: blur(10px);
    pointer-events: auto;
    animation: toastIn 0.22s ease forwards;
}

.toast-info{
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(30, 64, 175, 0.95));
}

.toast-success{
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(21, 128, 61, 0.95));
}

.toast-warning{
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(217, 119, 6, 0.95));
}

.toast-error{
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(185, 28, 28, 0.95));
}

.toast.hide{
    animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn{
    from{
        opacity: 0;
        transform: translateY(-10px) scale(0.96);
    }
    to{
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut{
    from{
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to{
        opacity: 0;
        transform: translateY(-8px) scale(0.96);
    }
}

@media (max-width: 700px){
    .toast-container{
        left: 14px;
        right: 14px;
        top: 14px;
    }

    .toast{
        min-width: unset;
        max-width: unset;
        width: 100%;
    }
}