:root {
    --bg-dark: #05010a;
    --card-dark: #12081d;
    --pill-bg: #1a1025;
    --accent-pink: #d336ff;
    --accent-gold: #ffcc00;
    --grad-primary: linear-gradient(90deg, #ff66cc 0%, #ff9966 100%);
    --grad-card: linear-gradient(135deg, #3d1063 0%, #12081d 100%);
    --text-main: #ffffff;
    --text-dim: #8e8599;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    user-select: none;
}

.container { padding: 20px; padding-bottom: 100px; max-width: 450px; margin: 0 auto; }

.main-title { margin: 10px 0 5px 0; font-size: 22px; font-weight: 700; }
.sub-text { font-size: 13px; color: var(--text-dim); line-height: 1.4; }
.section-label { font-size: 14px; color: var(--text-dim); margin-bottom: 15px; display: block; }

.header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 25px; }
.online-status { display: flex; align-items: center; color: #4cd964; font-size: 13px; font-weight: 500; }
.online-dot { width: 8px; height: 8px; background: #4cd964; border-radius: 50%; margin-right: 6px; box-shadow: 0 0 10px #4cd964; }
.season-badge, .static-badge { font-size: 11px; background: #1a1025; padding: 4px 10px; border-radius: 6px; color: var(--text-dim); }

.top-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 25px; }
.mini-card { background: var(--card-dark); padding: 16px; border-radius: 18px; position: relative; }
.mini-card .tag { position: absolute; top: 12px; right: 12px; font-size: 10px; color: var(--text-dim); font-weight: 600; }
.card-label { display: block; font-size: 13px; color: var(--text-main); margin-bottom: 8px; }
.val { font-size: 20px; font-weight: 700; display: flex;align-items: center; justify-content: flex-start; align-content: center; flex-wrap: nowrap; flex-direction: row; gap: 2px;}
.card-sub-info { font-size: 11px; color: var(--text-dim); margin-top: 15px; width: 100%; }

.lobby-info-row { display: flex; justify-content: space-between; align-items: center; margin: 25px 0 20px 0; }
.online-count { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-dim); }
.round-timer-pill {
    background: linear-gradient(90deg, #5c1860 0%, #201035 100%);
    padding: 8px 18px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.08);
}
#timer-val { font-weight: 700; margin-left: 4px; letter-spacing: 0.5px; }

.main-tournament-card {
    background: var(--grad-card);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.05);
}
.bank-label { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; }
.bank-amount { display: flex; font-size: 36px; font-weight: 800; margin: 10px 0 25px 0; align-items: center;}

.progress-box { margin-top: 20px; }
.progress-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.progress-bar { height: 6px; background: rgba(0,0,0,0.3); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--grad-primary); border-radius: 10px; }

.btn-main-start {
    width: 100%;
    padding: 20px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(90deg, #f779c1 0%, #fbd786 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(247, 121, 193, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info-card { display: flex; align-items: center; gap: 15px; margin: 25px 0; }
.avatar-sq { 
    width: 64px; height: 64px; border-radius: 18px; 
    background: linear-gradient(135deg, #59f9b7 0%, #66a6ff 100%);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: #fff; font-size: 20px;
}
.username { display: block; font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.user-status { font-size: 12px; color: var(--text-dim); }

.stats-container { background: var(--card-dark); border-radius: 20px; padding: 20px; margin-bottom: 25px; }
.stats-header { display: flex; justify-content: space-between; margin-bottom: 20px; font-size: 14px; font-weight: 600; }
.stats-period { color: var(--text-dim); font-size: 11px; background: rgba(255,255,255,0.05); padding: 2px 8px; border-radius: 5px; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.stat-item { display: flex; flex-direction: column; gap: 8px; }
.stat-label { font-size: 11px; color: var(--text-dim); }
.stat-value { font-size: 16px; font-weight: 700; }
.highlight-p { color: var(--accent-pink); }
.highlight-y { color: var(--accent-gold); }

.ach-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; }
.ach-card { min-width: 140px; background: var(--card-dark); padding: 15px; border-radius: 15px; border: 1px solid rgba(255,255,255,0.03); }
.ach-title { display: block; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.ach-desc { font-size: 10px; color: var(--text-dim); line-height: 1.3; }

.p-text { color: #ff66cc; }
.y-text { color: #ffcc00; }
.b-text { color: #66ccff; }

.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: 80px;
    background: rgba(10, 5, 15, 0.9); backdrop-filter: blur(10px);
    display: flex; justify-content: space-around; align-items: center;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.nav-item { display: flex; flex-direction: column; align-items: center; color: var(--text-dim); font-size: 12px; cursor: pointer; transition: 0.3s; }
.nav-dot { width: 14px; height: 14px; background: #6c2a8f; border-radius: 50%; margin-bottom: 6px; }
.nav-item.active { color: #fff; }
.nav-item.active .nav-dot { background: var(--accent-pink); box-shadow: 0 0 10px var(--accent-pink); }

.icon-star-inline { width: 16px; height: 16px; vertical-align: middle; }
.icon-star-large { width: 28px; height: 28px; vertical-align: middle; margin-left: 4px; }
.icon-users { width: 18px; height: 18px; }

.page { display: none; }
.page.active { display: block; animation: slideUp 0.3s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.nav-icon { width: 24px; height: 24px; margin-bottom: 4px; fill: currentColor; }

.training-card {
    background: var(--card-dark);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.t-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.t-title {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
}

.t-badge {
    font-size: 11px;
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 50px;
    text-transform: none;
}

.t-desc {
    font-size: 13px;
    color: var(--text-dim);
    margin: 0 0 16px 0;
}

.t-footer {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 12px;
}

.white { color: #fff; font-weight: 600; }
.pink { color: var(--accent-pink); font-weight: 600; }

.t-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin: 12px 0;
    overflow: hidden;
}

.t-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6c2a8f 0%, #ff9966 100%);
}

.t-hint {
    font-size: 12px;
    color: #a855f7;
    line-height: 1.4;
    margin-top: 12px;
}

.t-stats-grid {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

.t-stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.t-stat-label {
    font-size: 12px;
    color: var(--text-dim);
}

.t-stat-val {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}



.entry-selector-container {
    position: relative;
    background: #0d0615;
    border-radius: 50px;
    padding: 4px;
    display: flex;
    justify-content: space-between;
    border: 1px solid rgba(255,255,255,0.05);
    z-index: 1;
}

.entry-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    width: calc(33.33% - 4px);
    background: linear-gradient(90deg, #e652d5 0%, #f7996c 100%);
    border-radius: 50px;
    box-shadow: 0 0 15px rgba(230, 82, 213, 0.3);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.entry-option {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    align-content: center;
    flex-wrap: nowrap;
    flex-direction: row;
    gap: 2px;
}

.entry-option:not(.active) {
    color: var(--text-dim);
}

#bank-val {
    font-variant-numeric: tabular-nums;
    transition: transform 0.1s ease;
}

.btn-main-start:disabled {
    opacity: 0.4;              
    filter: grayscale(0.6);    
    cursor: not-allowed;      
    pointer-events: none;     
    box-shadow: none;          
    transform: scale(1) !important; 
}

.entry-selector-container:has(+ .lobby-info-row + .main-tournament-card + .btn-main-start:disabled) {
    opacity: 0.5;
    pointer-events: none;
}

.highlight-b { 
    color: #66ccff; 
    font-weight: 700; 
}

.t-stats-grid {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.action-buttons-container {
    display: flex;
    gap: 12px; 
    margin-top: 24px; 
    align-items: center;
}

.btn-chat {
    width: 54px; 
    height: 54px; 
    border-radius: 50%;
    background: #0d0615; 
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0; 
}

.btn-chat:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.1);
}

.icon-chat {
    width: 24px;
    height: 24px;
}

.btn-main-start {
    flex: 1; 
    margin-top: 0 !important;
    height: 54px;
}

.game-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, #1a0b2e 0%, #05010a 100%);
    z-index: 9999; display: none; flex-direction: column;
    align-items: center; justify-content: center;
    backdrop-filter: blur(10px);
}

.game-screen { display: none; flex-direction: column; align-items: center; text-align: center; }
.game-screen.active { display: flex; animation: fadeIn 0.5s ease; }

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

.light-indicator {
    width: 100px; height: 100px; border-radius: 50%; margin-bottom: 40px;
    border: 4px solid rgba(255,255,255,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-container-circle { position: relative; width: 220px; height: 220px; margin-bottom: 40px; }
.progress-svg circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.progress-svg .bg { stroke: rgba(255, 255, 255, 0.03); }
.progress-svg .bar {
    stroke: #d336ff; stroke-dasharray: 283; stroke-dashoffset: 283;
    filter: drop-shadow(0 0 8px #d336ff);
    transition: stroke-dashoffset 0.1s linear;
}

.progress-text {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 42px; font-weight: 800; color: #fff; letter-spacing: -1px;
}

.main-game-btn {
    width: 140px; height: 140px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.2);
    background: linear-gradient(145deg, #2a0e4a, #12081d);
    color: #fff; font-weight: 700; font-size: 14px; cursor: pointer;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    text-transform: uppercase; letter-spacing: 1px;
    transition: transform 0.1s, box-shadow 0.1s;
}

.main-game-btn:active { transform: scale(0.9); box-shadow: 0 5px 15px rgba(0,0,0,0.5); }

.result-card {
    background: rgba(255,255,255,0.03); padding: 30px; border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.08); width: 75%;
}

.rules-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px 30px;
    border-radius: 32px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    width: 75%;
}
.rules-header { color: var(--text-dim); font-size: 12px; letter-spacing: 3px; margin-bottom: 10px; }
.rules-main-title { color: #fff; font-size: 28px; font-weight: 800; margin-bottom: 20px; }
.rules-divider { width: 50px; height: 3px; background: var(--accent-pink); margin: 0 auto 25px; border-radius: 2px; }
.rules-item { color: #ccc; font-size: 16px; margin: 15px 0; text-align: left; display: flex; align-items: center; gap: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.green { background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.dot.red { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.dot.pink { background: var(--accent-pink); box-shadow: 0 0 10px var(--accent-pink); }
.rules-footer { margin-top: 30px; font-size: 13px; color: var(--text-dim); font-style: italic; }

.countdown-wrapper { display: flex; flex-direction: column; align-items: center; }
.countdown-number { 
    font-size: 160px; font-weight: 900; color: #fff; 
    text-shadow: 0 0 30px rgba(255,255,255,0.3);
    line-height: 1;
}
.countdown-label { letter-spacing: 5px; color: var(--accent-pink); font-weight: bold; margin-top: 20px; }

.pulse-anim { animation: pulseNumber 0.5s ease-out; }
@keyframes pulseNumber {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.game-screen {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
}

.game-screen.active {
    display: flex;
}

.dalgona-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.dalgona-hint {
    font-size: 12px;
    color: #aaa;
    margin-top: 10px;
    text-transform: uppercase;
}

.cracks-overlay {
    position: absolute;
    width: 100%; height: 100%;
    background-size: cover;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.2s;
}

@keyframes crack{
    to{
        stroke-dashoffset:0;
    }
}


.cracks-active { opacity: 1; transform: scale(1.1); }

.progress-label { font-size: 10px; color: var(--text-dim); letter-spacing: 2px; }
.progress-text { font-size: 32px; font-weight: 900; color: var(--accent-pink); }

#shape-path {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1); 
    stroke-width: 20;
    stroke-linecap: round;
    pointer-events: stroke;
    cursor: crosshair;
}

#trace-path {
    fill: none;
    stroke: var(--accent-pink);
    stroke-width: 6;
    stroke-linecap: round;
    pointer-events: none;
}
.round-timer{
    position:absolute;
    top:40px;
    font-size:42px;
    font-weight:900;
    color:#fff;
    text-shadow:0 0 20px rgba(255,255,255,0.4);
    letter-spacing:2px;
}
.timer{
font-size:42px;
font-weight:900;
margin-bottom:20px;
text-align:center;
}

.candy{
width:300px;
height:300px;
border-radius:50%;
background:radial-gradient(circle,#e7a85c,#b66a1a);
position:relative;
box-shadow:
inset 0 0 30px rgba(0,0,0,.5),
0 15px 40px rgba(0,0,0,.7);
touch-action:none;
}

.candy svg{
position:absolute;
inset:0;
width:100%;
height:100%;
}

#shape{
stroke:rgba(0,0,0,.25);
stroke-width:16;
fill:none;
}

#line{
stroke:#ff2f6d;
stroke-width:7;
fill:none;
stroke-linecap:round;
stroke-linejoin:round;
}

.percent{
margin-top:20px;
font-size:28px;
font-weight:800;
text-align:center;
}

.candy.break{
animation:breakCookie .5s forwards;
}

@keyframes breakCookie{
0%{transform:scale(1)}
50%{transform:scale(.9) rotate(3deg)}
100%{transform:scale(.7) rotate(7deg);opacity:.6}
}

#game-fiveclicks{
    position:absolute;
    inset:0;
}

#fiveclicks-container{
    position:fixed;
    inset:0;
}

.spawn{
position:absolute;
width:260px;
height:260px;
transform:translate(-50%,-50%);
}

.grey{
position:absolute;
inset:0;
border-radius:50%;
background:rgba(255,255,255,.08);
backdrop-filter:blur(2px);
}

.btn{
position:absolute;
left:50%;
top:50%;
transform:translate(-50%,-50%);
width:120px;
height:120px;
border-radius:50%;
background:#eee;
display:flex;
align-items:center;
justify-content:center;
box-shadow:0 0 20px rgba(0,0,0,.6);
z-index:3;
}

.redZone{
position:absolute;
left:50%;
top:50%;
transform:translate(-50%,-50%);
width:184px;
height:184px;
border-radius:50%;
background:rgba(255,68,68,.46);
border:2px solid rgb(164,0,0);
z-index:1;
}

.flash{
position:fixed;
inset:0;
background:#43ff64;
opacity:0;
pointer-events:none;
}

.flash.show{ animation:flash .45s forwards }

@keyframes flash{ to{opacity:1} }

.fade{ animation:fade .5s forwards }
@keyframes fade{ to{opacity:0; transform:scale(.7)} }

#fiveclicks-round{
position:fixed;
bottom:40px;
width:100%;
text-align:center;
color:white;
font-size:24px;
}

.redZone.win{
animation:expand .55s cubic-bezier(.2,.8,.2,1) forwards;
background:#38ff6a;
border-color:#38ff6a;
}

@keyframes expand{
to{
width:200vmax;
height:200vmax;
border-width:0;
}
}

.btn svg{
width:55px;
height:55px;
pointer-events:none;
}

.btn{
display:flex;
align-items:center;
justify-content:center;
}

#loader{
    position:fixed;
    inset:0;
    background:
        radial-gradient(circle at 50% 30%, #1a0830 0%, #05010a 70%);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:99999;
    opacity:1;
    transition:opacity .5s ease, visibility .5s ease;
}

#loader.hide{
    opacity:0;
    visibility:hidden;
}

.loader-box{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:22px;
    animation:loaderFade .6s ease;
}

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

.spinner{
    width:70px;
    height:70px;
    border-radius:50%;
    border:4px solid transparent;
    border-top:4px solid #ff2f6d;
    border-right:4px solid #d336ff;
    border-bottom:4px solid #7c3aed;
    animation:spin 1s linear infinite;
    filter:
        drop-shadow(0 0 6px #ff2f6d)
        drop-shadow(0 0 12px #d336ff);
}

@keyframes spin{
    to{ transform:rotate(360deg); }
}

.loader-text{
    font-size:15px;
    letter-spacing:2px;
    font-weight:700;
    color:#ff2f6d;
    text-transform:uppercase;
    text-shadow:
        0 0 8px rgba(255,47,109,.8),
        0 0 18px rgba(211,54,255,.6);
    animation:pulseText 1.5s infinite alternate;
}

@keyframes pulseText{
    from{opacity:.6; transform:scale(.96)}
    to{opacity:1; transform:scale(1)}
}

.loader-shapes{
    display:flex;
    gap:12px;
}

.shape{
    width:14px;
    height:14px;
    opacity:.8;
    animation:blink 1.2s infinite alternate;
}

.shape:nth-child(2){ animation-delay:.2s }
.shape:nth-child(3){ animation-delay:.4s }

.shape.circle{
    border-radius:50%;
    background:#ff2f6d;
    box-shadow:0 0 10px #ff2f6d;
}

.shape.triangle{
    width:0;
    height:0;
    border-left:8px solid transparent;
    border-right:8px solid transparent;
    border-bottom:14px solid #d336ff;
    filter:drop-shadow(0 0 8px #d336ff);
}

.shape.square{
    background:#7c3aed;
    box-shadow:0 0 10px #7c3aed;
}

@keyframes blink{
    from{ transform:translateY(0); opacity:.4 }
    to{ transform:translateY(-6px); opacity:1 }
}