*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

html,body{
    background:#0b0b0b;
    color:#ccc;
    font-family:'Segoe UI',Arial,sans-serif;
    font-size:14px;
    min-height:100vh;
    overflow-x:hidden;
}

/* PROFILE / ACHIEVEMENTS */
.site-footer{
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    gap:10px;
    padding:24px 12px 28px;
    color:#666;
    font-size:12px;
    letter-spacing:1px;
}

.site-footer-title{
    color:#aaa;
    font-size:13px;
    font-weight:800;
    letter-spacing:1.5px;
    text-transform:uppercase;
}

.site-footer-links{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    flex-wrap:wrap;
}

.site-footer a{
    color:#9a9a9a;
    width:44px;
    height:44px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid #242424;
    border-radius:8px;
    background:#101010;
    transition:color .16s,border-color .16s,background .16s;
}

.site-footer a:hover{
    color:#e05050;
    border-color:#5a1a1a;
    background:#170808;
    text-decoration:none;
}

.site-footer svg{
    width:24px;
    height:24px;
    fill:currentColor;
}

.site-footer .donation-link{
    width:auto;
    min-width:190px;
    gap:9px;
    padding:0 14px;
    color:#f0b0b0;
}

.site-footer .donation-link span{
    font-size:12px;
    font-weight:800;
    letter-spacing:.8px;
    white-space:nowrap;
}

.site-footer .donation-link svg{
    color:#e05050;
    flex:0 0 auto;
}

.nav-brand{
    display:flex;
    align-items:center;
    gap:12px;
    min-width:0;
}

.online-badge{
    min-height:24px;
    display:flex;
    align-items:center;
    gap:6px;
    border:1px solid #1f3a24;
    border-radius:999px;
    background:#081109;
    color:#8fd89a;
    padding:0 9px;
    font-size:10px;
    font-weight:800;
    letter-spacing:.7px;
    white-space:nowrap;
}

.online-dot{
    width:7px;
    height:7px;
    border-radius:50%;
    background:#4dff75;
    box-shadow:0 0 10px rgba(77,255,117,.85);
    flex:0 0 auto;
}

.profile-page{
    width:min(1120px,calc(100% - 28px));
    margin:26px auto 10px;
}

.profile-actions{
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:12px;
}

.profile-actions a,
.profile-back-btn{
    min-height:34px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid #2a1616;
    border-radius:7px;
    background:#101010;
    color:#aaa;
    padding:0 12px;
    font-size:10px;
    letter-spacing:1px;
    cursor:pointer;
    font-weight:700;
}

.profile-actions a:hover,
.profile-back-btn:hover{
    color:#fff;
    border-color:#5a1a1a;
    background:#170808;
    text-decoration:none;
}

.profile-hero{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
    padding:20px;
    background:#101010;
    border:1px solid #242424;
    border-radius:8px;
}

.profile-main{
    display:flex;
    align-items:center;
    gap:16px;
    min-width:0;
}

.profile-avatar{
    width:82px;
    height:82px;
    border-radius:8px;
    border:1px solid #3a1919;
    object-fit:cover;
    background:#150808;
    flex:0 0 auto;
}

.profile-avatar-fallback{
    display:flex;
    align-items:center;
    justify-content:center;
    color:#e05050;
    font-size:30px;
    font-weight:800;
}

.profile-title-block{
    min-width:0;
}

.profile-kicker{
    color:#777;
    font-size:11px;
    letter-spacing:2px;
    margin-bottom:5px;
}

.profile-title-block h1{
    color:#fff;
    font-size:30px;
    line-height:1.1;
    overflow-wrap:anywhere;
    margin-bottom:10px;
}

.profile-level-row{
    width:min(360px,70vw);
    display:flex;
    justify-content:space-between;
    gap:12px;
    color:#aaa;
    font-size:12px;
    margin-bottom:7px;
}

.profile-xp{
    width:min(360px,70vw);
    height:8px;
    background:#080808;
    border:1px solid #2a1616;
    border-radius:999px;
    overflow:hidden;
}

.profile-xp div{
    height:100%;
    background:linear-gradient(90deg,#7a0000,#e05050);
}

.profile-rank{
    min-width:126px;
    padding:14px 16px;
    border:1px solid #2a1616;
    border-radius:8px;
    text-align:center;
    background:#0b0b0b;
}

.profile-rank span{
    display:block;
    color:#777;
    font-size:10px;
    letter-spacing:1px;
    margin-bottom:5px;
}

.profile-rank strong{
    color:#fff;
    font-size:30px;
}

.profile-stats{
    display:grid;
    grid-template-columns:repeat(6,1fr);
    gap:10px;
    margin:14px 0;
}

.profile-stat{
    min-height:82px;
    padding:13px;
    border:1px solid #242424;
    border-radius:8px;
    background:#101010;
}

.profile-stat span{
    display:block;
    color:#777;
    font-size:11px;
    line-height:1.25;
    margin-bottom:10px;
}

.profile-stat strong{
    display:block;
    color:#fff;
    font-size:18px;
    line-height:1.15;
    overflow-wrap:anywhere;
}

.profile-section-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    margin:18px 0 10px;
}

.profile-section-head h2{
    color:#fff;
    font-size:20px;
    letter-spacing:1px;
}

.profile-section-head span{
    color:#888;
    font-size:12px;
}

.profile-achievements-grid{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:10px;
}

.profile-achievement{
    display:flex;
    gap:12px;
    min-height:96px;
    padding:14px;
    border:1px solid #262626;
    border-radius:8px;
    background:#101010;
}

.profile-achievement.is-locked{
    opacity:.45;
    filter:grayscale(1);
}

.profile-achievement-icon{
    width:38px;
    height:38px;
    border-radius:8px;
    display:flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
    background:#1a0808;
    border:1px solid #4a1818;
    color:#fff;
    font-size:18px;
}

.profile-achievement h3{
    color:#fff;
    font-size:14px;
    margin-bottom:4px;
}

.profile-achievement p{
    color:#8a8a8a;
    font-size:12px;
    line-height:1.35;
    margin-bottom:7px;
}

.profile-achievement span{
    color:#e05050;
    font-size:11px;
    font-weight:700;
}

.achievement-toast-host{
    position:fixed;
    left:14px;
    top:66px;
    z-index:2000;
    pointer-events:none;
}

.achievement-toast{
    width:330px;
    max-width:calc(100vw - 28px);
    display:flex;
    gap:12px;
    padding:14px;
    border:1px solid #6a2020;
    border-radius:8px;
    background:rgba(14,14,14,.96);
    box-shadow:0 16px 38px rgba(0,0,0,.45),0 0 24px rgba(180,0,0,.18);
    transform:translateX(calc(-100% - 24px));
    opacity:0;
    transition:transform .24s ease,opacity .24s ease;
}

.achievement-toast.is-visible{
    transform:translateX(0);
    opacity:1;
}

.achievement-toast-icon{
    width:42px;
    height:42px;
    border-radius:8px;
    display:flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
    background:#1a0808;
    border:1px solid #6a2020;
    color:#fff;
    font-size:20px;
}

.achievement-toast-kicker{
    color:#e05050;
    font-size:10px;
    letter-spacing:2px;
    margin-bottom:3px;
}

.achievement-toast-title{
    color:#fff;
    font-size:15px;
    font-weight:800;
    line-height:1.2;
}

.achievement-toast-desc{
    color:#aaa;
    font-size:12px;
    line-height:1.35;
    margin-top:3px;
}

.achievement-toast-xp{
    color:#e05050;
    font-size:11px;
    font-weight:800;
    margin-top:7px;
}

.lb-profile-btn{
    display:inline;
    max-width:100%;
    border:0;
    background:transparent;
    color:inherit;
    font:inherit;
    text-align:left;
    cursor:pointer;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.lb-profile-btn:hover{
    color:#e05050;
    text-decoration:underline;
}

.lb-profile-btn.is-me{
    color:#e05050;
}

.profile-modal{
    position:fixed;
    inset:0;
    z-index:3000;
    display:none;
    align-items:center;
    justify-content:center;
    padding:18px;
}

.profile-modal.is-open{
    display:flex;
}

.profile-modal-backdrop{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,.68);
}

.profile-modal-card{
    position:relative;
    width:min(560px,100%);
    max-height:min(760px,calc(100dvh - 36px));
    overflow:auto;
    border:1px solid #342020;
    border-radius:8px;
    background:#101010;
    box-shadow:0 18px 60px rgba(0,0,0,.55);
    padding:18px;
}

.profile-modal-close{
    position:absolute;
    top:10px;
    right:10px;
    width:34px;
    height:34px;
    border:1px solid #3a1818;
    border-radius:7px;
    background:#160808;
    color:#ddd;
    font-size:22px;
    line-height:1;
    cursor:pointer;
}

.profile-modal-close:hover{
    color:#fff;
    border-color:#e05050;
}

.profile-modal-loading{
    color:#999;
    padding:36px 8px;
    text-align:center;
}

.profile-modal-head{
    display:flex;
    gap:14px;
    align-items:center;
    padding-right:40px;
    margin-bottom:14px;
}

.profile-modal-avatar{
    width:70px;
    height:70px;
    border-radius:8px;
    border:1px solid #3a1919;
    object-fit:cover;
    background:#150808;
    flex:0 0 auto;
}

.profile-modal-avatar-fallback{
    display:flex;
    align-items:center;
    justify-content:center;
    color:#e05050;
    font-size:26px;
    font-weight:800;
}

.profile-modal-kicker{
    color:#777;
    font-size:10px;
    letter-spacing:2px;
    margin-bottom:4px;
}

.profile-modal-head h2{
    color:#fff;
    font-size:24px;
    line-height:1.15;
    overflow-wrap:anywhere;
}

.profile-modal-level{
    color:#e05050;
    font-size:12px;
    margin-top:5px;
}

.profile-modal-stats{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:8px;
    margin:12px 0 16px;
}

.profile-modal-stats div{
    min-height:64px;
    border:1px solid #242424;
    border-radius:8px;
    background:#0b0b0b;
    padding:10px;
}

.profile-modal-stats span{
    display:block;
    color:#777;
    font-size:10px;
    margin-bottom:7px;
}

.profile-modal-stats strong{
    display:block;
    color:#fff;
    font-size:14px;
    overflow-wrap:anywhere;
}

.profile-modal-ach-head{
    color:#ddd;
    font-size:13px;
    font-weight:800;
    margin-bottom:9px;
}

.profile-modal-achievements{
    display:grid;
    gap:8px;
}

.profile-modal-achievement{
    display:flex;
    gap:10px;
    align-items:flex-start;
    border:1px solid #242424;
    border-radius:8px;
    background:#0b0b0b;
    padding:10px;
}

.profile-modal-achievement > span{
    width:32px;
    height:32px;
    border-radius:7px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#1a0808;
    border:1px solid #4a1818;
    flex:0 0 auto;
}

.profile-modal-achievement strong{
    display:block;
    color:#fff;
    font-size:13px;
    margin-bottom:3px;
}

.profile-modal-achievement small{
    display:block;
    color:#888;
    font-size:12px;
    line-height:1.35;
}

.profile-modal-empty{
    color:#888;
    border:1px solid #242424;
    border-radius:8px;
    padding:12px;
    background:#0b0b0b;
}

a{color:#5a9aff;text-decoration:none}
a:hover{text-decoration:underline}

/* NAV */
.navbar{
    background:#0e0e0e;
    border-bottom:1px solid #1c1c1c;
    height:46px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 18px;
    flex-shrink:0;
}

.nav-logo{
    font-size:16px;
    font-weight:700;
    color:#fff;
    letter-spacing:3px;
}

.accent{color:#cc2222}

.nav-right{
    display:flex;
    align-items:center;
    gap:10px;
}

.nav-user{
    display:flex;
    align-items:center;
    gap:8px;
}

.nav-avatar{
    width:30px;
    height:30px;
    border-radius:50%;
    border:1px solid #2a4a2a;
    object-fit:cover;
}

.nav-avatar-ph{
    width:30px;
    height:30px;
    border-radius:50%;
    background:#1a2a1a;
    border:1px solid #2a4a2a;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:12px;
    color:#5a8a5a;
    font-weight:700;
}

.nav-name{
    font-size:12px;
    color:#999;
}

.nav-btn{
    font-size:10px;
    color:#dd3333;
    border:1px solid #5a1a1a;
    border-radius:4px;
    padding:4px 10px;
    letter-spacing:1px;
}

.nav-btn:hover{
    background:#1a0000;
    text-decoration:none;
}

/* AUTH */
.auth-wrap{
    min-height:calc(100vh - 46px);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
}

.auth-card{
    background:#111;
    border:1px solid #222;
    border-radius:12px;
    width:320px;
    max-width:100%;
    padding:28px;
}

.auth-logo{
    font-size:22px;
    font-weight:700;
    color:#fff;
    text-align:center;
    letter-spacing:4px;
    margin-bottom:4px;
}

.auth-sub{
    font-size:10px;
    color:#555;
    text-align:center;
    letter-spacing:2px;
    margin-bottom:6px;
}

.welcome-desc{
    font-size:13px;
    color:#666;
    text-align:center;
    line-height:1.7;
}

.auth-tabs{
    display:flex;
    border-bottom:1px solid #1e1e1e;
    margin-bottom:18px;
    margin-top:8px;
}

.auth-tab{
    flex:1;
    text-align:center;
    font-size:11px;
    padding:8px 0;
    color:#555;
    letter-spacing:1px;
    border-bottom:2px solid transparent;
}

.auth-tab.active{
    color:#e05050;
    border-bottom-color:#e05050;
}

.auth-error{
    background:#1a0000;
    border:1px solid #5a0000;
    border-radius:5px;
    padding:8px 10px;
    font-size:12px;
    color:#f55;
    margin-bottom:14px;
}

.field{
    margin-bottom:12px;
}

.field label{
    display:block;
    font-size:10px;
    color:#555;
    margin-bottom:5px;
    letter-spacing:1px;
}

.field input{
    width:100%;
    background:#0d0d0d;
    border:1px solid #2a2a2a;
    border-radius:5px;
    padding:9px 11px;
    font-size:13px;
    color:#ddd;
    outline:none;
    transition:border-color .2s;
}

.field input:focus{
    border-color:#555;
}

.auth-main-btn{
    width:100%;
    display:block;
    min-height:46px;
    background:#7a0000;
    border:none;
    border-radius:6px;
    padding:11px;
    font-size:12px;
    color:#fff;
    letter-spacing:2px;
    cursor:pointer;
    font-weight:700;
    transition:background .2s;
    touch-action:manipulation;
    position:relative;
    z-index:5;
    -webkit-tap-highlight-color:transparent;
}

.auth-main-btn:hover{
    background:#9a0000;
}

.auth-remember{
    display:flex;
    align-items:center;
    gap:9px;
    margin:2px 0 14px;
    color:#777;
    font-size:12px;
    cursor:pointer;
    user-select:none;
}

.auth-remember input{
    position:absolute;
    opacity:0;
    pointer-events:none;
}

.auth-remember-box{
    width:18px;
    height:18px;
    border:1px solid #3a1414;
    border-radius:5px;
    background:#0b0b0b;
    box-shadow:0 0 0 1px rgba(255,255,255,.02) inset;
    position:relative;
    flex-shrink:0;
    transition:background .15s,border-color .15s,box-shadow .15s;
}

.auth-remember-box::after{
    content:'';
    position:absolute;
    left:5px;
    top:2px;
    width:5px;
    height:9px;
    border:solid #fff;
    border-width:0 2px 2px 0;
    opacity:0;
    transform:rotate(45deg) scale(.75);
    transition:opacity .15s,transform .15s;
}

.auth-remember input:checked + .auth-remember-box{
    background:#7a0000;
    border-color:#dd4444;
    box-shadow:0 0 12px rgba(204,34,34,.25);
}

.auth-remember input:checked + .auth-remember-box::after{
    opacity:1;
    transform:rotate(45deg) scale(1);
}

.auth-remember-text{
    line-height:1.25;
}

.auth-sec-btn{
    display:block;
    width:100%;
    background:transparent;
    border:1px solid #2a2a2a;
    border-radius:6px;
    padding:10px;
    font-size:12px;
    color:#888;
    letter-spacing:2px;
    cursor:pointer;
    text-align:center;
    transition:border-color .2s;
}

.auth-sec-btn:hover{
    border-color:#444;
    text-decoration:none;
    color:#aaa;
}

.auth-divider{
    display:flex;
    align-items:center;
    gap:10px;
    margin:14px 0;
}

.auth-divider::before,
.auth-divider::after{
    content:'';
    flex:1;
    height:1px;
    background:#1e1e1e;
}

.auth-divider span{
    font-size:10px;
    color:#333;
    white-space:nowrap;
}

.auth-hint{
    font-size:11px;
    color:#444;
    line-height:1.5;
}

/* TABS */
.generator-tabs{
    display:flex;
    justify-content:center;
    gap:14px;
    padding:10px 0 4px;
    flex-shrink:0;
}

.generator-tab{
    display:inline-block;
    padding:9px 30px;
    font-size:11px;
    font-weight:700;
    letter-spacing:2px;
    color:#888;
    background:#0d0d0d;
    border:1px solid #3a1414;
    border-radius:8px;
    transition:all .2s ease;
    cursor:pointer;
}

.generator-tab:hover{
    color:#fff;
    background:#160606;
    border-color:#cc2222;
    text-decoration:none;
    transform:translateY(-1px);
    box-shadow:0 0 14px rgba(204,34,34,.35);
}

.generator-tab.active{
    color:#fff;
    background:linear-gradient(135deg,#7a0000,#a80000);
    border-color:#dd4444;
    box-shadow:0 0 16px rgba(204,34,34,.4),inset 0 0 8px rgba(255,255,255,.06);
}

/* PAGE */
.generator-page{
    height:calc(100vh - 46px);
    display:flex;
    flex-direction:column;
    overflow:hidden;
}

.game-page{
    flex:1;
    min-height:0;
    display:flex;
    flex-direction:column;
    padding:6px 8px 4px;
    overflow:hidden;
    backdrop-filter:blur(10px);
}

.game-header{
    text-align:center;
    flex-shrink:0;
    margin-bottom:6px;
}

.timer-lbl{
    font-size:9px;
    color:#444;
    letter-spacing:3px;
}

.timer-display{
    font-size:28px;
    font-family:'Courier New',monospace;
    color:#fff;
    letter-spacing:5px;
    line-height:1.1;
}

/* DESKTOP LAYOUT */
.game-layout{
    display:grid;
    grid-template-columns:minmax(220px,.9fr) minmax(560px,1.4fr) minmax(220px,.9fr);
    gap:40px;
    flex:1;
    min-height:0;
    align-items:stretch;
}

.left-col,
.right-col{
    display:flex;
    flex-direction:column;
    gap:8px;
    min-height:0;
    overflow:hidden;
}

.left-col{padding-right:20px}
.right-col{padding-left:20px}

.center-col{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    min-height:0;
    position:relative;
}

/* INSTRUCTION */
.game-instruction{
    width:100%;
    margin:0 0 12px 0;
    padding:10px 14px;
    text-align:center;
    color:#f2f2f2;
    font-family:Arial,sans-serif;
    font-size:14px;
    line-height:1.25;
    background:rgba(0,0,0,.45);
    border:1px solid rgba(255,255,255,.08);
    border-radius:12px;
    text-shadow:0 2px 6px #000;
}

.bbn-instruction,
.fg-instruction{
    position:static!important;
    inset:auto!important;
    grid-column:auto!important;
    pointer-events:none;
}

/* GAME SQUARE */
.game-stage-square{
    width:min(90vw,78vh,1500px);
    max-width:1500px;
    aspect-ratio:1 / 1;
    position:relative;
    overflow:hidden;
    padding:12px;
    background:linear-gradient(135deg,#0d0d0d,#080808);
    border:1px solid #222;
    border-radius:20px;
    box-shadow:0 0 0 1px rgba(255,255,255,.02) inset;
}

.game-stage-content{
    width:100%;
    height:100%;
    position:relative;
    z-index:1;
    display:grid;
    grid-template-columns:22% 1fr 24%;
    gap:10px;
}

.stage-side,
.stage-main{
    min-height:0;
    display:flex;
}

.game-stage-square .sw-panel,
.game-stage-square .cord-panel,
.game-stage-square .wire-panel{
    width:100%;
    height:100%;
    display:flex;
    flex-direction:column;
    min-height:0;
    padding:10px;
}

/* PANEL */
.panel{
    background:#0e0e0e;
    border:1px solid #1e1e1e;
    border-radius:8px;
    padding:8px;
}

.panel-title{
    font-size:9px;
    color:#555;
    letter-spacing:2px;
    margin-bottom:7px;
    text-align:center;
}

/* LEADERBOARD */
.lb-panel{
    background:#0e0e0e;
    border:1px solid #1e1e1e;
    border-radius:8px;
    padding:10px;
    flex:1;
    overflow:hidden;
    display:flex;
    flex-direction:column;
    margin-right:4px;
}

.lb-header{
    display:flex;
    justify-content:space-between;
    font-size:9px;
    color:#555;
    letter-spacing:2px;
    padding-bottom:5px;
    border-bottom:1px solid #1a1a1a;
    margin-bottom:5px;
    flex-shrink:0;
}

.lb-list{
    overflow-y:auto;
    flex:1;
    scrollbar-width:thin;
    scrollbar-color:#222 transparent;
}

.lb-loading,
.lb-empty{
    font-size:10px;
    color:#2a2a2a;
    text-align:center;
    padding:8px 0;
}

.lb-row{
    display:flex;
    align-items:center;
    gap:8px;
    padding:6px 2px;
    border-bottom:1px solid #111;
}

.lb-row.lb-me{
    background:#140a0a;
    border-radius:3px;
    padding:6px 4px;
}

.lb-num{
    width:20px;
    font-size:14px;
    color:#444;
    font-family:'Courier New',monospace;
    flex-shrink:0;
    text-align:right;
}

.lb-num.gold{color:#d4a017}
.lb-num.silver{color:#8a8a8a}
.lb-num.bronze{color:#a0522d}

.lb-av{
    width:22px;
    height:22px;
    border-radius:50%;
    background:#1a2a1a;
    border:1px solid #253525;
    flex-shrink:0;
    overflow:hidden;
    display:flex;
    align-items:center;
    justify-content:center;
}

.lb-av img{
    width:100%;
    height:100%;
    object-fit:cover;
}

.lb-av-txt{
    font-size:10px;
    color:#5a8a5a;
    font-weight:700;
}

.lb-name{
    flex:1;
    font-size:15px;
    color:#ccc;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    font-weight:600;
}

.lb-time{
    font-size:14px;
    color:#66aaff;
    font-family:'Courier New',monospace;
    flex-shrink:0;
    font-weight:700;
}

.lb-my-row{
    flex-shrink:0;
    margin-top:5px;
    padding-top:4px;
    border-top:1px solid #1a1a1a;
}

.lb-my-inner{
    display:flex;
    align-items:center;
    gap:8px;
    background:#1a0808;
    border-radius:3px;
    padding:6px 4px;
}

.lb-my-lbl{
    font-size:9px;
    color:#3a3a3a;
    text-align:center;
    margin-top:2px;
}

/* PERSONAL */
.personal-panel{
    flex:1;
    overflow:hidden;
    display:flex;
    flex-direction:column;
}

.right-personal-panel{
    min-height:180px;
    margin-left:4px;
}

.pp-user{
    font-size:15px;
    color:#8ce88c;
    text-align:center;
    padding:2px 0 6px;
    letter-spacing:1px;
    font-weight:700;
}

.pp-best{
    font-size:20px;
    font-family:'Courier New',monospace;
    color:#d4a017;
    text-align:center;
    padding:2px 0 6px;
    margin-bottom:4px;
    font-weight:700;
}

.pp-list{
    display:flex;
    flex-direction:column;
    gap:2px;
    overflow-y:auto;
    scrollbar-width:thin;
    scrollbar-color:#222 transparent;
}

.pp-row{
    display:grid;
    grid-template-columns:auto 1fr auto;
    gap:10px;
    align-items:center;
    padding:6px 2px;
    border-bottom:1px solid #0f0f0f;
    font-size:14px;
}

.pp-row span:first-child{color:#555}
.pp-row span:nth-child(2){
    color:#ccc;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    font-weight:600;
}
.pp-row span:last-child{
    color:#66aaff;
    font-family:'Courier New',monospace;
    font-weight:700;
}

.pp-empty,
.pp-login-hint{
    font-size:10px;
    color:#444;
    text-align:center;
    padding:8px 0;
}

/* BITE BY NIGHT */
.switches-grid{
    display:flex;
    flex-direction:column;
    gap:5px;
    width:100%;
    max-width:100%;
    min-width:0;
}

.sw-item{
    display:flex;
    align-items:center;
    gap:7px;
    width:100%;
    max-width:100%;
    min-width:0;
    cursor:pointer;
    padding:3px 4px;
    border-radius:4px;
    transition:background .15s;
}

.sw-item:hover{background:#141414}

.sw-led{
    width:13px;
    height:13px;
    border-radius:50%;
    background:#4a0000;
    border:1px solid #2a0000;
    flex-shrink:0;
    transition:all .2s;
}

.sw-item.on .sw-led{
    background:#22aa22;
    border-color:#157015;
    box-shadow:0 0 6px rgba(34,170,34,.5);
}

.sw-body{
    flex:1;
    min-width:0;
    background:#0a0a0a;
    border:1px solid #1e1e1e;
    border-radius:3px;
    padding:3px 6px;
    display:flex;
    align-items:center;
    justify-content:space-between;
}

.sw-track{
    width:26px;
    height:14px;
    flex:0 0 auto;
    background:#060606;
    border:1px solid #252525;
    border-radius:7px;
    position:relative;
}

.sw-knob{
    width:10px;
    height:10px;
    border-radius:50%;
    background:#2a2a2a;
    border:1px solid #3a3a3a;
    position:absolute;
    top:1px;
    left:1px;
    transition:left .15s,background .15s;
}

.sw-item.on .sw-knob{
    left:13px;
    background:#157015;
    border-color:#1f9a1f;
}

.sw-lbl{
    font-size:9px;
    color:#444;
    font-family:'Courier New',monospace;
    flex:0 0 auto;
}

.sw-item.on .sw-lbl{color:#22aa22}

.sw-hint{
    font-size:11px;
    color:#555;
    text-align:center;
    margin-top:6px;
    font-family:'Courier New',monospace;
}

.wire-panel{
    flex:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    position:relative;
}

.wire-panel .panel-title{
    align-self:flex-start;
}

#wireCanvas{
    width:100%;
    height:100%;
    min-height:0;
    flex:1;
    display:block;
    position:relative;
    z-index:5;
    background:#050505;
    border:1px solid #171717;
    border-radius:10px;
    touch-action:none;
    cursor:grab;
}

.wire-panel::before{
    content:'';
    position:absolute;
    inset:10px;
    border-radius:10px;
    pointer-events:none;
    background:radial-gradient(circle at center,rgba(255,255,255,.03),transparent 70%);
    z-index:1;
}

.wire-hint{
    font-size:10px;
    color:#333;
    letter-spacing:1px;
    margin-top:6px;
    text-align:center;
}

.cord-panel{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:6px;
}

.cord-machine{
    display:flex;
    flex-direction:column;
    align-items:center;
}

.cord-engine-top{
    width:60px;
    height:30px;
    background:#141414;
    border:1px solid #252525;
    border-radius:5px 5px 0 0;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
}

.cord-engine-slot{
    width:40px;
    height:5px;
    background:#0a0a0a;
    border:1px solid #1e1e1e;
    border-radius:3px;
}

.cord-drum-wrap{
    display:flex;
    align-items:center;
    justify-content:center;
}

.cord-drum{
    width:30px;
    height:16px;
    background:#1e1e1e;
    border:1px solid #333;
    border-radius:50%;
    transition:transform .3s;
}

.cord-track-wrap{
    width:60px;
    background:#0d0d0d;
    border:1px solid #1e1e1e;
    border-top:none;
    border-radius:0 0 6px 6px;
    height:120px;
    position:relative;
}

.cord-track{
    width:100%;
    height:100%;
    position:relative;
}

.cord-rope{
    position:absolute;
    left:50%;
    top:0;
    transform:translateX(-50%);
    width:4px;
    background:linear-gradient(#444,#222);
    border-radius:2px;
    height:0;
    transition:height .05s;
}

.cord-handle{
    position:absolute;
    left:50%;
    top:0;
    transform:translateX(-50%);
    cursor:grab;
    user-select:none;
    touch-action:none;
}

.cord-handle-body{
    width:40px;
    height:22px;
    background:linear-gradient(135deg,#9a0000,#cc2222,#9a0000);
    border:1px solid #dd4444;
    border-radius:11px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:2px;
    box-shadow:0 2px 6px rgba(0,0,0,.5);
}

.cord-handle-grip{
    width:22px;
    height:2px;
    background:rgba(255,255,255,.2);
    border-radius:1px;
}

.cord-progress-wrap{
    width:90px;
    height:8px;
    background:#060606;
    border:1px solid #1a1a1a;
    border-radius:4px;
    overflow:hidden;
}

.cord-progress-bar{
    height:100%;
    width:0;
    background:linear-gradient(90deg,#6a0000,#cc2222);
    border-radius:4px;
    transition:width .3s;
}

.cord-count{
    font-size:12px;
    color:#555;
    font-family:'Courier New',monospace;
    letter-spacing:1px;
}

.cord-hint{
    font-size:9px;
    color:#333;
    text-align:center;
    letter-spacing:1px;
}

/* STAGES */
.panel.stage-dim{
    opacity:.3;
    filter:grayscale(.5);
    pointer-events:none;
    transition:opacity .5s,filter .5s;
}

.panel.stage-active{
    opacity:1;
    filter:none;
    pointer-events:auto;
    transition:opacity .5s,filter .5s;
}

.panel.stage-done{
    opacity:.55;
    filter:grayscale(.3);
    pointer-events:none;
    transition:opacity .5s,filter .5s;
}

/* START */
.start-bar{
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:20;
    background:rgba(5,5,5,.45);
    backdrop-filter:blur(10px);
    -webkit-backdrop-filter:blur(10px);
}

.start-text{
    font-size:16px;
    color:#f2f2f2;
    letter-spacing:4px;
    cursor:pointer;
    animation:blink 1.6s infinite;
    display:inline-block;
    text-shadow:0 0 14px rgba(255,255,255,.28);
}

@keyframes blink{
    0%,100%{opacity:.28}
    50%{opacity:1}
}

/* FINISH */
.finish-overlay{
    position:absolute;
    inset:0;
    display:none;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:12px;
    padding:24px 24px 20px;
    overflow:hidden;
    z-index:30;
    background:rgba(3,8,3,.42);
    backdrop-filter:blur(10px);
    -webkit-backdrop-filter:blur(10px);
}

.game-stage-square.is-finished .finish-overlay{
    display:flex;
}

.finish-glow{
    position:absolute;
    inset:0;
    background:radial-gradient(ellipse at center,rgba(34,170,34,.16) 0%,transparent 70%);
    pointer-events:none;
}

.finish-title{
    font-size:20px;
    font-weight:700;
    color:#6fff6f;
    letter-spacing:3px;
    text-align:center;
    position:relative;
    z-index:1;
}

.finish-time{
    font-size:40px;
    font-family:'Courier New',monospace;
    color:#f5fff3;
    letter-spacing:4px;
    text-align:center;
    text-shadow:0 0 12px rgba(34,170,34,.35);
    position:relative;
    z-index:1;
}

.finish-rank{
    font-size:12px;
    color:#b4f0b4;
    letter-spacing:2px;
    position:relative;
    z-index:1;
}

.restart-btn{
    background:#22aa22;
    border:1px solid #4fe44f;
    border-radius:8px;
    padding:11px 28px;
    font-size:12px;
    color:#fff;
    letter-spacing:2px;
    cursor:pointer;
    font-weight:700;
    transition:background .2s,transform .2s;
    z-index:1;
    margin-top:6px;
}

.restart-btn:hover{
    background:#2fbe2f;
    transform:translateY(-1px);
}

/* FORSAKEN */
.fg-game{
    width:100%;
    height:100%;
    position:relative;
    background:rgba(0,0,0,.72);
    border-radius:14px;
    padding:10px;
    overflow:hidden;
    display:grid;
    grid-template-columns:minmax(0,1fr) 42px;
    grid-template-rows:auto minmax(0,1fr) auto;
    gap:8px;
}

.fg-info{
    grid-column:1 / 3;
    display:flex;
    justify-content:space-between;
    color:#fff;
    font-size:18px;
    font-family:Arial,sans-serif;
    text-shadow:0 2px 5px #000;
}

.fg-board-wrap{
    position:relative;
    width:100%;
    max-width:100%;
    aspect-ratio:1 / 1;
    align-self:center;
    justify-self:center;
    background:#060606;
    border:4px solid #e6e6e6;
    overflow:hidden;
}

#fgSvg{
    position:absolute;
    inset:0;
    z-index:2;
    width:100%;
    height:100%;
    pointer-events:none;
}

.fg-board{
    position:absolute;
    inset:0;
    z-index:3;
    display:grid;
    grid-template-columns:repeat(6,1fr);
    grid-template-rows:repeat(6,1fr);
}

.fg-cell{
    position:relative;
    border-right:2px solid #171717;
    border-bottom:2px solid #171717;
    background:transparent;
    cursor:pointer;
    user-select:none;
    touch-action:none;
}

.fg-dot{
    position:absolute;
    z-index:10;
    width:62%;
    height:62%;
    left:19%;
    top:19%;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
}

.fg-dot span{
    color:#fff;
    font-size:20px;
    font-weight:900;
    font-family:Arial,sans-serif;
    text-shadow:0 2px 6px #000;
}

.fg-side-bar{
    background:#070707;
    border:4px solid #e6e6e6;
    position:relative;
    overflow:hidden;
}

#fgProgressFill{
    position:absolute;
    left:0;
    bottom:0;
    width:100%;
    height:0%;
    background:linear-gradient(to top,#e05050,#ff9a9a);
    transition:height .25s ease;
}

.fg-layer{
    grid-column:1 / 3;
    color:#ddd;
    text-align:center;
    font-size:15px;
}

.fg-start-overlay{
    position:absolute;
    inset:0;
    z-index:50;
    background:rgba(0,0,0,.55);
    backdrop-filter:blur(9px);
    -webkit-backdrop-filter:blur(9px);
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    cursor:pointer;
}

.fg-start-title{
    color:#fff;
    font-size:38px;
    font-weight:900;
    letter-spacing:4px;
}

.fg-start-sub{
    color:#ddd;
    margin-top:10px;
    font-size:16px;
    letter-spacing:2px;
}

/* MOBILE */
@media (max-width:980px){
    html,body{
        min-height:100%;
        overflow-x:hidden;
        overflow-y:auto!important;
    }

    .navbar{
        height:auto;
        min-height:46px;
        padding:8px 12px;
        flex-wrap:wrap;
        gap:8px;
    }

    .auth-wrap{
        min-height:calc(100dvh - 46px);
        align-items:flex-start;
        padding:18px 12px 28px;
    }

    .auth-card{
        width:100%;
        max-width:360px;
        padding:22px 18px;
    }

    .auth-main-btn{
        min-height:46px;
        font-size:12px;
    }

    .nav-name{
        max-width:130px;
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
    }

    .generator-tabs{
        flex-wrap:wrap;
        padding:8px;
        gap:8px;
    }

    .generator-tab{
        flex:1 1 140px;
        text-align:center;
        padding:9px 12px;
    }

    .generator-page{
        height:auto!important;
        min-height:100vh!important;
        overflow:visible!important;
    }

    .game-page{
        height:auto!important;
        min-height:auto!important;
        overflow:visible!important;
        padding:8px!important;
    }

    .game-header{
        margin-bottom:10px;
    }

    .timer-display{
        font-size:20px!important;
        letter-spacing:3px!important;
    }

    .game-layout{
        display:flex!important;
        flex-direction:column!important;
        gap:16px!important;
        width:100%!important;
    }

    .center-col{
        order:1!important;
        width:100%!important;
        align-items:stretch!important;
        justify-content:flex-start!important;
        overflow:visible!important;
    }

    .right-col{
        order:2!important;
        width:100%!important;
        padding:0!important;
        overflow:visible!important;
    }

    .left-col{
        order:3!important;
        width:100%!important;
        padding:0!important;
        overflow:visible!important;
    }

    .game-instruction{
        margin-bottom:10px!important;
        font-size:12px!important;
        line-height:1.2!important;
    }

    .game-stage-square{
        width:100%!important;
        max-width:100%!important;
        height:auto!important;
        min-height:auto!important;
        aspect-ratio:auto!important;
        overflow:visible!important;
        padding:8px!important;
    }

    .game-stage-content{
        display:flex!important;
        flex-direction:column!important;
        height:auto!important;
        gap:10px!important;
    }

    .stage-main{
        order:1!important;
        width:100%!important;
    }

    .stage-side{
        width:100%!important;
    }

    .stage-side:first-child{
        order:2!important;
    }

    .stage-side:last-child{
        order:3!important;
    }

    .wire-panel,
    .sw-panel,
    .cord-panel{
        height:auto!important;
        min-height:220px!important;
        width:100%!important;
        max-width:100%!important;
        min-width:0!important;
    }

    #wireCanvas{
        width:100%!important;
        height:260px!important;
        min-height:260px!important;
        flex:none!important;
    }

    .switches-grid{
        display:grid!important;
        grid-template-columns:repeat(5,1fr)!important;
        gap:7px!important;
        width:100%!important;
        max-width:100%!important;
        min-width:0!important;
    }

    .sw-item{
        min-height:70px;
    }

    .cord-machine{
        min-height:220px;
    }

    .cord-track-wrap{
        height:155px;
    }

    .lb-panel,
    .personal-panel,
    .right-personal-panel{
        width:100%!important;
        max-height:none!important;
        min-height:auto!important;
        overflow:visible!important;
        margin:0!important;
    }

    .lb-list,
    .pp-list{
        max-height:none!important;
        overflow:visible!important;
    }

    .fg-game{
        width:100%!important;
        height:auto!important;
        min-height:auto!important;
        grid-template-columns:minmax(0,1fr) 32px!important;
        grid-template-rows:auto auto auto!important;
        padding:8px!important;
        gap:8px!important;
        overflow:hidden!important;
    }

    .fg-info{
        grid-column:1 / 3!important;
        font-size:13px!important;
    }

    .fg-board-wrap{
        width:min(100%,82vw)!important;
        max-width:100%!important;
        aspect-ratio:1 / 1!important;
        justify-self:center!important;
        align-self:center!important;
    }

    .fg-side-bar{
        width:32px!important;
        height:auto!important;
    }

    .fg-layer{
        grid-column:1 / 3!important;
    }

    .fg-dot{
        width:68%;
        height:68%;
        left:16%;
        top:16%;
    }

    .fg-dot span{
        font-size:13px!important;
    }

    .fg-start-title{
        font-size:32px;
    }

    .fg-start-sub{
        font-size:14px;
    }
}

@media (max-width:520px){
    .game-page{
        padding:6px!important;
    }

    .timer-display{
        font-size:18px!important;
    }

    .game-instruction{
        font-size:10px!important;
        padding:8px!important;
    }

    .fg-game{
        grid-template-columns:minmax(0,1fr) 26px!important;
        padding:7px!important;
    }

    .fg-board-wrap{
        width:min(100%,78vw)!important;
        border-width:3px!important;
    }

    .fg-info{
        font-size:11px!important;
    }

    .fg-dot span{
        font-size:11px!important;
    }

    .fg-start-title{
        font-size:26px;
        letter-spacing:2px;
    }

    .fg-start-sub{
        font-size:12px;
    }

    #wireCanvas{
        height:220px!important;
        min-height:220px!important;
    }

    .wire-panel,
    .sw-panel,
    .cord-panel{
        min-height:190px!important;
        padding:10px!important;
    }

    .switches-grid{
        gap:5px!important;
    }

    .sw-item{
        min-height:58px;
        gap:6px!important;
        padding:7px 8px!important;
    }

    .sw-led{
        width:15px!important;
        height:15px!important;
        flex-basis:15px!important;
    }

    .sw-body{
        padding:7px 8px!important;
    }

    .sw-track{
        width:34px!important;
        height:18px!important;
        flex-basis:34px!important;
    }

    .sw-knob{
        width:12px!important;
        height:12px!important;
        top:2px!important;
        left:2px!important;
    }

    .sw-item.on .sw-knob{
        left:18px!important;
    }

    .sw-lbl{
        font-size:10px;
        min-width:24px!important;
    }

    .cord-track-wrap{
        height:135px;
    }

    .finish-title{
        font-size:16px;
    }

    .finish-time{
        font-size:26px;
    }

    .lb-name,
    .lb-time,
    .pp-row{
        font-size:12px;
    }
}
@media (max-width:980px){
    .sw-panel {
        min-height: 280px !important;
        overflow-x: hidden !important;
        align-items: stretch !important;
    }

    .switches-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .sw-item {
        min-height: 46px !important;
        padding: 8px 10px !important;
        background: #101010;
        border: 1px solid #202020;
        border-radius: 8px;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .sw-led {
        width: 18px !important;
        height: 18px !important;
        flex: 0 0 18px !important;
    }

    .sw-body {
        padding: 8px 10px !important;
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .sw-track {
        width: 42px !important;
        height: 22px !important;
        flex: 0 0 42px !important;
    }

    .sw-knob {
        width: 16px !important;
        height: 16px !important;
        top: 2px !important;
        left: 2px !important;
    }

    .sw-item.on .sw-knob {
        left: 21px !important;
    }

    .sw-lbl {
        font-size: 13px !important;
        min-width: 30px !important;
        text-align: right !important;
    }

    .cord-track,
    .cord-handle,
    .cord-panel {
        touch-action: none !important;
        overscroll-behavior: contain !important;
    }
}

@media (max-width:520px){
    .sw-panel{
        min-height:240px!important;
        padding:8px!important;
    }

    .switches-grid{
        gap:7px!important;
    }

    .sw-item{
        min-height:42px!important;
        gap:6px!important;
        padding:7px 8px!important;
    }

    .sw-led{
        width:15px!important;
        height:15px!important;
        flex:0 0 15px!important;
    }

    .sw-body{
        padding:7px 8px!important;
        min-width:0!important;
    }

    .sw-track{
        width:34px!important;
        height:18px!important;
        flex:0 0 34px!important;
    }

    .sw-knob{
        width:12px!important;
        height:12px!important;
        top:2px!important;
        left:2px!important;
    }

    .sw-item.on .sw-knob{
        left:18px!important;
    }

    .sw-lbl{
        min-width:24px!important;
        font-size:10px!important;
    }
}

@media (max-width:980px){
    .nav-right{
        gap:6px;
    }

    .nav-brand{
        gap:7px;
    }

    .online-badge{
        min-height:22px;
        padding:0 7px;
        gap:5px;
        font-size:9px;
        letter-spacing:.3px;
    }

    .online-dot{
        width:6px;
        height:6px;
    }

    .nav-name{
        display:none;
    }

    .nav-btn{
        padding:5px 7px;
        font-size:9px;
        letter-spacing:.5px;
    }

    .profile-page{
        width:calc(100% - 20px);
        margin-top:14px;
    }

    .profile-actions{
        display:grid;
        grid-template-columns:1fr 1fr;
        gap:8px;
    }

    .profile-back-btn{
        grid-column:1 / -1;
    }

    .profile-actions a,
    .profile-back-btn{
        width:100%;
        min-height:38px;
    }

    .profile-hero{
        align-items:stretch;
        flex-direction:column;
        padding:14px;
    }

    .profile-main{
        align-items:flex-start;
    }

    .profile-avatar{
        width:62px;
        height:62px;
    }

    .profile-title-block h1{
        font-size:24px;
    }

    .profile-level-row,
    .profile-xp{
        width:100%;
    }

    .profile-rank{
        width:100%;
    }

    .profile-stats{
        grid-template-columns:repeat(2,1fr);
    }

    .profile-achievements-grid{
        grid-template-columns:1fr;
    }

    .achievement-toast-host{
        left:10px;
        top:58px;
    }

    .achievement-toast{
        width:calc(100vw - 20px);
    }

    .profile-modal{
        padding:10px;
        align-items:flex-end;
    }

    .profile-modal-card{
        width:100%;
        max-height:calc(100dvh - 20px);
        padding:15px;
    }

    .profile-modal-head{
        align-items:flex-start;
    }

    .profile-modal-avatar{
        width:58px;
        height:58px;
    }

    .profile-modal-head h2{
        font-size:21px;
    }

    .profile-modal-stats{
        grid-template-columns:repeat(2,1fr);
    }
}

@media (min-width:981px) and (max-width:1180px){
    .profile-stats{
        grid-template-columns:repeat(3,1fr);
    }

    .profile-achievements-grid{
        grid-template-columns:repeat(2,1fr);
    }
}
