/* GunBound.Fun Premium Stylesheet */

:root {
    --primary-dark: #0f4b7a;
    --secondary: #FDBB30;
    --error: #FF4444;
    --surface-alt: #FFFDE7; /* Pale yellow */
    --text-main: #2b2b2b;
    --text-muted: #6b6b6b;
    
    /* Using a rounded, playful font typical of modern retro-gaming styles */
    --font-base: 'Open Sans', sans-serif;
    --font-heading: 'Fredoka One', 'Arial Black', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-base);
    color: var(--text-main);
    background-color: #7EC0EE;
    min-height: 100vh;
}

/* Background image */
.sky-background {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background-image: url('assets/bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    animation: drift 60s linear infinite;
}

@keyframes drift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Accessibility Focus */
:focus-visible {
    outline: 4px dashed #FF6600 !important;
    outline-offset: 4px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header & Navbar */
.logo-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
    position: relative;
    z-index: 10;
}

.logo-container {
    max-width: 350px;
    height: 140px;
    display: flex;
    align-items: flex-end;
}

.logo {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.4));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.logo:hover {
    transform: scale(1.05) rotate(-2deg);
}

.navbar {
    display: flex;
    background: linear-gradient(to bottom, #1d6fa5, #0a3d66);
    border: 3px solid #ffcc00;
    border-radius: 30px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4), inset 0 2px 5px rgba(255,255,255,0.4);
    padding: 8px 25px;
    margin-bottom: 20px;
    position: relative;
    z-index: 20;
}

.nav-link {
    text-decoration: none;
    color: #FFF;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    padding: 10px 20px;
    text-transform: uppercase;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.7);
    transition: all 0.25s ease;
    border-radius: 20px;
}

.nav-link:hover {
    color: #ffeb3b;
    background: rgba(255,255,255,0.15);
    transform: translateY(-3px);
    text-shadow: 2px 2px 0px rgba(0,0,0,0.7), 0 0 10px rgba(255,235,59,0.4);
}

/* ===== LAYOUT ===== */
.main-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
}

.sidebar-left, .sidebar-right {
    width: 240px;
    flex-shrink: 0;
    max-width: 100%;
    overflow: visible;
}

.content-center {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

/* On screens too narrow for 3-column, stack them */
@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
        align-items: center;
    }
    .sidebar-left, .sidebar-right, .content-center {
        width: 100%;
        max-width: 500px;
        flex: none;
    }
}

/* ===== PANELS ===== */
.panel-3d {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-bottom: 3px solid #b3b3b3;
    border-right: 3px solid #b3b3b3;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    padding: 20px;
    position: relative;
    overflow: visible;
    animation: fade-in-up 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-3d-inset {
    background: #2b4555;
    border-radius: 24px;
    padding: 20px;
    border-top: 4px solid #1a2a34;
    border-left: 4px solid #1a2a34;
    border-bottom: 4px solid #5a8099;
    border-right: 4px solid #5a8099;
    box-shadow: 0 6px 14px rgba(0,0,0,0.25), inset 0 4px 8px rgba(0,0,0,0.5);
}

/* ===== SIDEBAR LEFT: LOGIN ===== */
.login-box {
    background: linear-gradient(to bottom, #FFFDE7, #FFF59D);
    border-color: #FFF #FFF #D4C366 #D4C366;
    padding: 25px 20px;
    overflow: visible; /* To allow button pop out */
}

.input-group {
    display: flex;
    align-items: center;
    background: #FFF;
    border: 2px solid #ccc;
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 8px 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.input-group:focus-within {
    border-color: #FDBB30;
    box-shadow: 0 0 10px rgba(253, 187, 48, 0.5);
    transform: translateY(-2px);
}

.premium-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-base);
    font-size: 1rem;
    color: #333;
    width: 100%;
}
.premium-input:focus {
    background: rgba(253, 187, 48, 0.05);
}

.input-icon {
    font-size: 1.2rem;
    color: #888;
    margin-right: 10px;
}
.user-icon::before { content: "👤"; }
.lock-icon::before { content: "🔒"; }

.input-group input {
    border: none; outline: none; flex: 1;
    font-size: 0.95rem; font-family: var(--font-base);
}

.login-actions {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 10px;
}

.link-muted {
    color: #555; text-decoration: none;
    transition: color 0.2s, transform 0.2s;
}
.link-muted:hover { 
    color: #1A95D9; 
    text-decoration: underline; 
}

/* ===== 3D BUTTON SYSTEM =====
   NOTE: CSS class names cannot start with a digit.
   We use [class~="3d-btn"] as a selector AND .btn-3d for new code.
   Both selectors target the same elements for backwards compatibility. */

[class~="3d-btn"], .btn-3d {
    display: inline-block;
    border: none;
    background: transparent;
    padding: 6px 0 0 0; /* room for the raised btn-inner */
    margin-bottom: 6px; /* compensate for the shift */
    cursor: pointer;
    outline-offset: 4px;
    transition: filter 250ms, transform 250ms;
    user-select: none;
    touch-action: manipulation;
    border-radius: 14px;
}

[class~="3d-btn"]:hover, .btn-3d:hover {
    filter: brightness(1.15) drop-shadow(0 0 10px rgba(255, 255, 255, 0.4));
    transform: scale(1.03);
}

[class~="3d-btn"]:active, .btn-3d:active {
    transform: scale(0.98);
}

.btn-inner {
    display: block;
    box-sizing: border-box;
    border-radius: 14px;
    transform: translateY(-4px);
    transition: transform 200ms cubic-bezier(.3, .7, .4, 1);
}

[class~="3d-btn"]:hover .btn-inner, .btn-3d:hover .btn-inner {
    transform: translateY(-6px);
}

[class~="3d-btn"]:active .btn-inner, .btn-3d:active .btn-inner {
    transform: translateY(-1px);
    transition: transform 34ms;
}

.btn-login {
    position: absolute;
    right: -25px;
    top: 50%;
    margin-top: -30px;
    background: #6a9ba8;
    border-radius: 50%;
    width: 60px; height: 60px;
    box-shadow: 0 4px 0 #4a6c75;
    padding: 0; /* override 3d-btn padding for circular button */
    margin-bottom: 0;
    z-index: 5;
}
.btn-login .btn-inner {
    background: linear-gradient(to bottom, #86c4d4, #578a96);
    border-radius: 50%;
    width: 60px; height: 60px;
    border: 3px solid #FFF;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.5rem; font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    transform: translateY(-4px);
}

/* ===== MASCOT ===== */
.mascot-placeholder {
    margin: 30px 0;
    text-align: center;
    pointer-events: none; /* Prevent mascot from blocking button clicks */
}
.mascot-img {
    max-width: 100%; 
    max-height: 250px;
    width: auto;
    filter: drop-shadow(0 15px 15px rgba(0,0,0,0.5));
}
.floating {
    animation: float 4s ease-in-out infinite;
}
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* ===== BASE BUTTON STYLES ===== */
.btn {
    text-decoration: none;
    display: inline-block;
    border-radius: 12px;
}
.btn .btn-inner {
    padding: 10px 20px;
    color: #FFF;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    text-transform: uppercase;
    text-decoration: none;
    border: 2px solid rgba(255,255,255,0.3);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
.btn-small { border-radius: 8px; }
.btn-small .btn-inner {
    padding: 5px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.3);
}

/* Large Action Buttons */
.btn-large {
    display: block;
    width: 100%; margin-bottom: 15px;
    border-radius: 14px;
    text-decoration: none;
}
.btn-large .btn-inner {
    padding: 15px 10px;
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    color: #FFF;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    text-transform: uppercase;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Button Color Variants */
.btn-primary {
    background: #4a821e; /* Bottom shadow color */
}
.btn-primary .btn-inner {
    background: linear-gradient(to bottom, #a8e563, #6fba2c);
}

.btn-secondary {
    background: #c97a14;
}
.btn-secondary .btn-inner {
    background: linear-gradient(to bottom, #ffdb7a, #fca020);
}

.btn-title {
    display: block;
    font-size: 1.8rem;
    font-family: var(--font-heading);
    color: #FFF;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.6);
    letter-spacing: 1px;
}
.btn-subtitle {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    color: #FFF;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.5);
    margin-top: 2px;
}

/* ===== CENTER COLUMN ===== */
.tv-screen {
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    border: 3px solid #111;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    aspect-ratio: 16/9;
}

.banner-img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.scanlines {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    z-index: 2;
}

.feeds-container {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 20px;
    margin-top: 25px;
}

@media (max-width: 700px) {
    .feeds-container {
        grid-template-columns: 1fr;
    }
}

.feed-box { padding: 0; }

.feed-header {
    margin: 0; padding: 12px 20px;
    color: white; font-family: var(--font-heading);
    display: flex; justify-content: space-between; align-items: center;
    border-radius: 14px 14px 0 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.purple-header { 
    background: linear-gradient(to bottom, #c288d6, #8e4ba6); 
    border-bottom: 3px solid #6c3282;
}
.teal-header { 
    background: linear-gradient(to bottom, #86d4d0, #4ca6a0); 
    border-bottom: 3px solid #37807b;
}

.news-list { list-style: none; padding: 15px 20px; margin: 0; }
.news-list li {
    display: flex; align-items: center; padding: 10px 0;
    border-bottom: 1px dashed #ccc; font-size: 0.95rem; font-weight: 600;
}
.news-list li:last-child { border-bottom: none; }

.news-tag {
    background: #8e4ba6; color: white; padding: 3px 8px;
    border-radius: 6px; margin-right: 12px; font-weight: bold;
    font-size: 0.8rem; box-shadow: 0 2px 0 #6c3282;
}
.news-list a { color: var(--text-main); text-decoration: none; flex: 1; transition: color 0.2s;}
.news-list a:hover { color: #8e4ba6; }
.news-date { color: var(--text-muted); font-size: 0.85rem; }
.pu-content { padding: 15px; text-align: center; }

/* ===== RIGHT COLUMN ===== */
.ranking-board { 
    padding: 0; 
    border: 4px solid #FDBB30;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    width: 100%; /* Never exceed sidebar width */
}

.orange-header {
    background: linear-gradient(to bottom, #ffab40, #ff6d00);
    margin: 0; padding: 15px 20px; color: white;
    font-family: var(--font-heading); display: flex; justify-content: space-between;
    border-bottom: 3px solid #cc5500; font-size: 1.3rem;
}
.text-light { font-family: var(--font-base); font-size: 0.9rem; font-weight: normal; margin-left: 10px;}

.ranking-list { padding: 10px 20px; background: #FFF; }
.ranking-item {
    display: flex; align-items: center; padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.ranking-item:last-child { border-bottom: none; }

.rank-num {
    font-family: var(--font-heading); font-size: 1.8rem; width: 40px;
    text-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}
.rank-1 { color: #FF4500; }
.rank-2 { color: #FF8C00; }
.rank-3 { color: #DAA520; }

.player-info strong { display: block; font-size: 1.1rem; color: #222;}
.guild-name { font-size: 0.85rem; color: #888; font-weight: 600;}

/* Right sidebar action buttons */
.action-links {
    margin-top: 15px;
}

.btn-blue-gradient {
    width: 100%; margin-bottom: 15px; border-radius: 14px;
    background: #184976; /* Bottom shadow color */
}
.btn-blue-gradient .btn-inner {
    padding: 15px 10px;
    border-radius: 14px;
    background: linear-gradient(to bottom, #499eeb, #2768a8);
    color: white; font-family: var(--font-heading); font-size: 1.2rem;
    letter-spacing: 1px; text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.4);
}

/* ============================================
   RESPONSIVE DESIGN — TABLET (max-width: 900px)
   ============================================ */
@media (max-width: 900px) {
    .container {
        padding: 15px;
    }

    /* Logo + Navbar: stack vertically */
    .logo-area {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        margin-bottom: 20px;
    }

    .logo-container {
        height: 100px;
        max-width: 280px;
    }

    /* Navbar: allow wrapping */
    .navbar {
        flex-wrap: wrap;
        justify-content: center;
        padding: 6px 15px;
        gap: 2px;
    }

    .nav-link {
        font-size: 0.95rem;
        padding: 8px 14px;
    }

    /* Layout: stack columns */
    .main-layout {
        flex-direction: column;
        align-items: center;
    }

    .sidebar-left, .sidebar-right, .content-center {
        width: 100%;
        max-width: 500px;
        flex: none;
    }

    /* Feeds: keep side-by-side on tablet */
    .feeds-container {
        grid-template-columns: 1.5fr 1fr;
        gap: 15px;
    }

    /* Slightly smaller button text */
    .btn-title {
        font-size: 1.5rem;
    }

    .btn-large .btn-inner {
        font-size: 1.1rem;
        padding: 12px 10px;
    }
}

/* ===================================================
   RESPONSIVE DESIGN — SMALL TABLET (max-width: 700px)
   =================================================== */
@media (max-width: 700px) {
    .container {
        padding: 10px;
    }

    .logo-container {
        height: 80px;
        max-width: 240px;
    }

    /* Navbar: smaller links */
    .navbar {
        padding: 5px 10px;
        border-radius: 20px;
        gap: 0;
    }

    .nav-link {
        font-size: 0.85rem;
        padding: 7px 10px;
    }

    /* Feeds: stack */
    .feeds-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Panels: less padding */
    .panel-3d {
        border-radius: 12px;
        padding: 15px;
    }

    .panel-3d-inset {
        border-radius: 16px;
        padding: 12px;
    }

    /* Ranking */
    .orange-header {
        font-size: 1.1rem;
        padding: 12px 15px;
    }

    .rank-num {
        font-size: 1.5rem;
        width: 35px;
    }

    .ranking-list {
        padding: 8px 15px;
    }

    /* Feed headers */
    .feed-header {
        font-size: 1rem;
        padding: 10px 15px;
    }

    /* Button sizing */
    .btn-blue-gradient .btn-inner {
        font-size: 1rem;
        padding: 12px 8px;
    }
}

/* ============================================
   RESPONSIVE DESIGN — MOBILE (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    /* Logo: compact */
    .logo-area {
        gap: 10px;
        margin-bottom: 15px;
    }

    .logo-container {
        height: 65px;
        max-width: 200px;
    }

    /* Navbar: horizontal scroll on very small screens */
    .navbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        border-radius: 16px;
        padding: 4px 8px;
        gap: 0;
    }
    .navbar::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        font-size: 0.75rem;
        padding: 6px 8px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Layout: full width, tighter gaps */
    .main-layout {
        gap: 12px;
    }

    .sidebar-left, .sidebar-right, .content-center {
        max-width: 100%;
    }

    /* Login box */
    .login-box {
        padding: 18px 14px;
    }

    .input-group {
        padding: 6px 10px;
        margin-bottom: 10px;
    }

    .login-actions {
        font-size: 0.78rem;
        flex-direction: column;
        gap: 6px;
        align-items: center;
    }

    /* Mascot: smaller */
    .mascot-img {
        max-height: 160px;
    }

    .mascot-placeholder {
        margin: 15px 0;
    }

    /* Buttons: mobile-friendly sizes */
    .btn-title {
        font-size: 1.3rem;
    }

    .btn-subtitle {
        font-size: 0.8rem;
    }

    .btn-large .btn-inner {
        padding: 10px 8px;
        font-size: 1rem;
    }

    .btn .btn-inner {
        padding: 8px 14px;
        font-size: 0.95rem;
    }

    /* Panels */
    .panel-3d {
        border-radius: 10px;
        padding: 12px;
        box-shadow: 0 8px 16px rgba(0,0,0,0.25);
    }

    .panel-3d-inset {
        border-radius: 12px;
        padding: 10px;
        border-width: 3px;
    }

    /* TV Banner */
    .tv-screen {
        border-radius: 10px;
        border-width: 2px;
    }

    /* Feed items */
    .news-list {
        padding: 10px 12px;
    }

    .news-list li {
        font-size: 0.85rem;
        padding: 8px 0;
    }

    .news-tag {
        font-size: 0.7rem;
        padding: 2px 6px;
        margin-right: 8px;
    }

    /* Ranking */
    .ranking-board {
        border-width: 3px;
    }

    .orange-header {
        font-size: 1rem;
        padding: 10px 12px;
    }

    .rank-num {
        font-size: 1.3rem;
        width: 30px;
    }

    .ranking-item {
        padding: 8px 0;
    }

    .ranking-list {
        padding: 6px 12px;
    }

    .player-info strong {
        font-size: 0.95rem;
    }

    .guild-name {
        font-size: 0.75rem;
    }

    /* Blue gradient buttons */
    .btn-blue-gradient .btn-inner {
        font-size: 0.95rem;
        padding: 10px 8px;
        letter-spacing: 0.5px;
    }

    /* Action links spacing */
    .action-links {
        margin-top: 10px;
    }

    /* Disable pulse animation on mobile for performance */
    [class~="3d-btn"], .btn-3d {
        animation: none;
    }

    /* Ensure touch targets are at least 44px tall */
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ============================================
   RESPONSIVE DESIGN — VERY SMALL (max-width: 360px)
   ============================================ */
@media (max-width: 360px) {
    .container {
        padding: 5px;
    }

    .logo-container {
        height: 50px;
        max-width: 160px;
    }

    .nav-link {
        font-size: 0.7rem;
        padding: 5px 6px;
    }

    .btn-title {
        font-size: 1.1rem;
    }

    .btn-large .btn-inner {
        padding: 8px 6px;
        font-size: 0.9rem;
    }

    .login-box {
        padding: 14px 10px;
    }

    .orange-header,
    .purple-header,
    .teal-header {
        font-size: 0.9rem;
        padding: 8px 10px;
    }
}
