/* ---------------------------------------------------------
   1. ตัวแปรส่วนกลาง (Global Variables)
   --------------------------------------------------------- */
:root {
    --primary-blue: #5B8DBF;
    --primary-blue-dark: #1E4A6B;
    --accent-gold: #D4AF37;
    --accent-rose: #E8A5BE;
    --accent-glow: rgba(91, 141, 191, 0.3);
    --bg-white: #FFFFFF;
    --bg-soft-blue: #F5F9FD;
    --bg-ultra-light: #FAFBFC;
    --text-dark: #1A2332;
    --text-light: #6B7280;
    --text-muted: #9CA3AF;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(91, 141, 191, 0.15);
    --shadow-premium: 0 20px 50px rgba(26, 35, 50, 0.08);
    --shadow-lg: 0 15px 40px rgba(26, 35, 50, 0.1);
    --shadow-md: 0 10px 25px rgba(26, 35, 50, 0.06);
    --shadow-sm: 0 5px 15px rgba(26, 35, 50, 0.04);
    --shadow-glow: 0 0 30px rgba(91, 141, 191, 0.2);
    --hero-gradient: linear-gradient(180deg, #EBF5FF 0%, #F5FAFF 40%, #FFFFFF 100%);
    --card-gradient: linear-gradient(180deg, #FAFBFC 0%, #FFFFFF 100%);
    --divider-color: rgba(91, 141, 191, 0.1);
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    /* Fluid Typography (Modern Approach) */
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.38vw, 1rem);
    --text-md: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1rem + 0.63vw, 1.25rem);
    --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    --text-3xl: clamp(1.8rem, 1.5rem + 1.5vw, 2.5rem);
    --text-hero: clamp(2.5rem, 1.5rem + 5vw, 4rem);
}

/* ---------------------------------------------------------
   2. ตั้งค่าพื้นฐาน (Base Styles)
   --------------------------------------------------------- */
html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Prompt', sans-serif;
    background: var(--bg-white);
    color: var(--text-dark);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;

    /* Thai Text Readability */
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

/* -------------------------
   Thai Text Readability
   ป้องกันตัวอักษรขาดกลางคำ
   ------------------------- */
p,
li,
span,
td,
th,
label,
.tip-description,
.marker-description p {
    overflow-wrap: break-word;
    word-break: normal;
    line-break: strict;
    /* ช่วย browser ตัด Thai ถูกจุด */
    line-height: 1.8;
}

/* แอนิเมชันพื้นฐาน */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes floatSlow {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-8px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(60px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes shimmer {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(91, 141, 191, 0.2);
    }

    50% {
        box-shadow: 0 0 40px rgba(91, 141, 191, 0.4);
    }
}

@keyframes slide-up-stagger {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(91, 141, 191, 0.2);
    }

    50% {
        box-shadow: 0 0 40px rgba(91, 141, 191, 0.4);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@keyframes slide-up-stagger {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rotate-in {
    from {
        opacity: 0;
        transform: rotate(-5deg) scale(0.9);
    }

    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* ---------------------------------------------------------
   3. ตัวครอบแอพ (App Container)
   --------------------------------------------------------- */
.app-container {
    max-width: 100%;
    margin: 0 auto;
    background: var(--bg-white);
    min-height: 100vh;
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow-x: hidden !important;
    overflow-y: visible;
}

/* พื้นหลังตกแต่ง */
.decorative-bg {
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(127, 179, 213, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

/* เส้นคั่นหัวข้อ */
.section-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--divider-color) 20%, var(--divider-color) 80%, transparent);
    margin: 30px 40px;
    border: none;
    animation: slideInRight 0.8s ease-out;
}

@media (max-width: 480px) {
    .app-container {
        max-width: 100%;
        box-shadow: none;
    }
}

/* ส่วนตกแต่งสะพานด้านบนสุด */
.top-bridge-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: url('../images/mon_bridge_minimalist.png') no-repeat center bottom;
    background-size: contain;
    opacity: 0.4;
    z-index: 1;
    pointer-events: none;
    animation: fadeIn 2s ease-out;
}

/* ---------------------------------------------------------
   4. ส่วนหัวของเว็บ (Header & Logo)
   --------------------------------------------------------- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(10px, 2vw, 12px) clamp(16px, 4vw, 32px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1.5px solid var(--glass-border);
    box-shadow: 0 2px 10px rgba(26, 35, 50, 0.04);
}

.app-logo {
    height: 30px;
    object-fit: contain;
    transition: transform 0.3s;
}

.app-logo:hover {
    transform: scale(1.05);
}

.desktop-nav {
    display: flex;
    gap: clamp(15px, 2vw, 25px);
}

.desktop-nav a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    font-size: var(--text-sm);
    transition: color 0.3s, transform 0.2s;
}

.desktop-nav a:hover {
    color: var(--primary-blue);
    transform: translateY(-2px);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: clamp(10px, 2vw, 20px);
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.hero-actions .btn-primary-glow,
.hero-actions .btn-secondary-outline {
    animation: bounceIn 0.8s ease-out 0.8s backwards;
}

.btn-signup {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #4A7BA7 100%);
    color: white;
    border: none;
    padding: clamp(8px, 2vw, 10px) clamp(16px, 3vw, 20px);
    border-radius: 12px;
    font-weight: 700;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: 0 6px 15px rgba(91, 141, 191, 0.2);
    letter-spacing: 0.3px;
}

.btn-signup:hover {
    background: linear-gradient(135deg, #4A7BA7 0%, var(--primary-blue-dark) 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(91, 141, 191, 0.3);
}

.mobile-only {
    display: none;
}

@media (max-width: 1024px) {
    .desktop-nav {
        display: none;
    }

    .mobile-only {
        display: block;
    }
}

/* ---------------------------------------------------------
   5. ส่วนฮีโร่ (Hero Section)
   --------------------------------------------------------- */
.hero-section {
    padding: 120px 24px;
    text-align: center;
    background: var(--hero-gradient);
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero-content {
    max-width: 800px;
    animation: fadeIn 1.2s ease-out;
}

.hero-content>* {
    animation: slide-up-stagger 0.8s ease-out backwards;
}

.hero-content .badge-game {
    animation-delay: 0.1s;
}

.hero-content h1 {
    animation-delay: 0.3s;
}

.hero-content p {
    animation-delay: 0.5s;
}

.hero-actions {
    animation-delay: 0.7s;
}

.hero-content h1 {
    font-size: var(--text-hero);
    margin-bottom: 20px;
    color: var(--text-dark);
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.02em;
    animation: slide-up-stagger 0.8s ease-out backwards 0.3s;
}

.hero-content h1 span {
    color: var(--primary-blue);
    background: linear-gradient(120deg, var(--primary-blue), #A9CCE3);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Badges & Text */
.badge-game {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 18px;
    background: linear-gradient(135deg, rgba(91, 141, 191, 0.08), rgba(232, 165, 190, 0.06));
    color: var(--primary-blue);
    border-radius: 30px;
    font-size: var(--text-sm);
    font-weight: 700;
    margin-bottom: 20px;
    border: 1.5px solid rgba(91, 141, 191, 0.15);
    animation: float 4s ease-in-out infinite, slide-up-stagger 0.8s ease-out backwards 0.1s;
    letter-spacing: 0.5px;
}

.system-status-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(91, 141, 191, 0.15);
    color: var(--primary-blue);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(91, 141, 191, 0.25);
    animation: pulse 2s ease-in-out infinite;
    min-width: 140px;
    text-align: center;
    white-space: nowrap;
}

.status-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0px;
    margin-bottom: 60px;
}

.system-status-badge-bottom {
    display: inline-block;
    padding: 0px 16px;
    background: linear-gradient(135deg, rgba(91, 141, 191, 0.12), rgba(232, 165, 190, 0.08));
    color: var(--primary-blue);
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1.5px solid rgba(91, 141, 191, 0.2);
    animation: pulse 2s ease-in-out infinite;
    text-align: center;
    white-space: nowrap;
    min-width: 180px;
}

.analysis-status-card {
    margin-top: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(91, 141, 191, 0.08), rgba(232, 165, 190, 0.05));
    border: 1.5px solid rgba(91, 141, 191, 0.15);
    border-radius: 16px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    animation: slideInUp 0.5s ease-out;
}

.status-detail {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-detail p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-dark);
    font-weight: 500;
    padding: 6px 0;
}

.tips-card {
    margin-top: 20px;
    margin-bottom: 60px;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), rgba(232, 165, 190, 0.05));
    border: 1.5px solid rgba(212, 175, 55, 0.2);
    border-radius: 16px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    animation: slideInUp 0.5s ease-out;
}

.tips-header-main {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(212, 175, 55, 0.25);
}

.tips-header-main h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--accent-gold);
    font-weight: 700;
}

.tips-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 12px;
    font-size: var(--text-md);
}

.tips-header i {
    font-size: 1.2rem;
}

.tips-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tips-list li {
    margin: 0;
    padding: 8px 0;
    color: var(--text-dark);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.tips-list li:before {
    content: "→";
    color: var(--accent-gold);
    font-weight: 700;
    flex-shrink: 0;
}

.hero-content p {
    color: var(--text-light);
    font-size: var(--text-lg);
    margin-bottom: clamp(20px, 5vw, 40px);
    line-height: 1.7;
    font-weight: 500;
    letter-spacing: 0.2px;
    animation: slide-up-stagger 0.8s ease-out backwards 0.5s;
}

.btn-primary-large {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s, box-shadow 0.3s;
}

/* Premium Buttons */
.btn-primary-glow {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #4A7BA7 100%);
    color: white;
    border: none;
    padding: clamp(12px, 3vw, 16px) clamp(24px, 5vw, 36px);
    border-radius: 16px;
    font-size: var(--text-md);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(91, 141, 191, 0.25);
    transition: all var(--transition-smooth);
    letter-spacing: 0.3px;
}

.btn-primary-glow:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 45px rgba(91, 141, 191, 0.35);
    background: linear-gradient(135deg, #4A7BA7 0%, #1E4A6B 100%);
}

.btn-secondary-outline {
    background: transparent;
    color: var(--primary-blue);
    border: 2.5px solid var(--primary-blue);
    padding: 14px 32px;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-smooth);
    letter-spacing: 0.3px;
}

.btn-secondary-outline:hover {
    background: rgba(91, 141, 191, 0.08);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(91, 141, 191, 0.15);
}

@media (min-width: 1024px) {
    .hero-content p {
        max-width: 850px;
        margin-left: auto;
        margin-right: auto;
        line-height: 1.7;
    }

    .app-logo {
        height: 45px;
    }
}

/* ---------------------------------------------------------
   Shop & Cosmetic Item Styles
   --------------------------------------------------------- */
/* Shop Modal Tabs */
.shop-tabs .shop-tab {
    transition: all 0.2s;
}

.shop-tabs .shop-tab:hover {
    color: var(--primary-blue);
    background: rgba(91, 141, 191, 0.05);
}

/* Shop Card Hover */
.shop-card:hover,
.inventory-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* --- COSMETIC EFFECTS --- */

/* 1. Frames */
.avatar-frame-silver img {
    border: 3px solid #C0C0C0 !important;
    box-shadow: 0 0 10px rgba(192, 192, 192, 0.4);
    border-radius: 50%;
}

.avatar-frame-gold img {
    border: 3px solid #FFD700 !important;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    border-radius: 50%;
    animation: gold-pulse 2s infinite;
}

@keyframes gold-pulse {
    0% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }

    100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    }
}

.avatar-frame-neon img {
    border: 3px solid #0ff !important;
    box-shadow: 0 0 10px #0ff, 0 0 20px #0ff, 0 0 30px #0ff;
    border-radius: 50%;
    animation: neon-pulse 1.5s infinite alternate;
}

@keyframes neon-pulse {
    from {
        box-shadow: 0 0 10px #0ff, 0 0 20px #0ff;
    }

    to {
        box-shadow: 0 0 20px #f0f, 0 0 30px #f0f;
    }
}

/* 2. Titles (Usage in Leaderboard/Profile) */
.title-explorer::before {
    content: '🧭 ';
}

.title-explorer {
    color: #2E86C1;
    font-weight: bold;
}

.title-master::before {
    content: '👑 ';
}

.title-master {
    background: linear-gradient(45deg, #FFD700, #F4D03F);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
}

.title-beginner::before {
    content: '🌱 ';
}

.title-beginner {
    color: #27AE60;
    font-weight: 600;
}

.title-photographer::before {
    content: '📸 ';
}

.title-photographer {
    color: #8E44AD;
    font-weight: 700;
}

.title-rich::before {
    content: '💰 ';
}

.title-rich {
    background: linear-gradient(45deg, #F1C40F, #B7950B);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    border-bottom: 1px dashed #F1C40F;
}

.title-foodie::before {
    content: '🍜 ';
}

.title-foodie {
    color: #D35400;
    font-weight: 700;
}

/* 3. New Frames */
.avatar-frame-bronze img {
    border: 3px solid #CD7F32 !important;
    box-shadow: 0 0 8px rgba(205, 127, 50, 0.4);
    border-radius: 50%;
}

/* Platinum God Mode (Spectacular) */
.avatar-frame-platinum {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.avatar-frame-platinum::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent, #FFFFFF, #C0C0C0, #FFFFFF, transparent);
    animation: rotate-aura 4s linear infinite;
    z-index: -1;
    opacity: 0.7;
    filter: blur(2px);
}

.avatar-frame-platinum::after {
    content: '👑';
    position: absolute;
    top: -16px;
    right: -10px;
    font-size: 16px;
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
    animation: bounce-crown 2s ease-in-out infinite;
    z-index: 2;
}

.avatar-frame-platinum img {
    border: 3px solid #fff !important;
    box-shadow:
        0 0 10px rgba(255, 255, 255, 0.8),
        inset 0 0 10px rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    position: relative;
    z-index: 1;
}

@keyframes rotate-aura {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes bounce-crown {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Ensure aura doesn't block clicks */
.avatar-frame-platinum::before,
.avatar-frame-platinum::after {
    pointer-events: none;
}



.avatar-frame-nature img {
    border: 3px solid #2ECC71 !important;
    box-shadow: 0 0 12px rgba(46, 204, 113, 0.5);
    border-radius: 50%;
}

.avatar-frame-fire img {
    border: 3px solid #FF5733 !important;
    box-shadow: 0 0 15px rgba(255, 87, 51, 0.8);
    border-radius: 50%;
    animation: fire-pulse 1.5s infinite alternate;
}

@keyframes fire-pulse {
    from {
        box-shadow: 0 0 10px #FF5733, 0 0 20px #C0392B;
    }

    to {
        box-shadow: 0 0 20px #FFC300, 0 0 30px #FF5733;
    }
}

/* --- Small Frame Overrides (Header) --- */
.btn-profile-header .avatar-frame-silver img,
.btn-profile-header .avatar-frame-gold img,
.btn-profile-header .avatar-frame-neon img {
    border-width: 1.5px !important;
    box-shadow: none !important;
    /* Reset default large shadow */
}

.btn-profile-header .avatar-frame-gold img {
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.6) !important;
}

.btn-profile-header .avatar-frame-neon img {
    box-shadow: 0 0 5px #0ff !important;
}

/* Sections */
.section-header {
    text-align: center;
    animation: slideInDown 0.8s ease-out;
}

.section-header h2 {
    font-size: var(--text-3xl);
    margin-bottom: 15px;
    color: var(--text-dark);
    font-weight: 800;
    letter-spacing: -0.01em;
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-blue) 30%, var(--primary-blue) 70%, transparent);
    border-radius: 2px;
    animation: slideInRight 0.8s ease-out 0.3s backwards;
}

.section-header p {
    color: var(--text-light);
    font-size: var(--text-md);
    line-height: 1.6;
}

.section-container {
    padding: 35px 24px;
    position: relative;
    z-index: 1;
}

.section-header-split {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
    gap: 20px;
    animation: slideInDown 0.8s ease-out;
}

.section-header-split h2 {
    font-size: var(--text-2xl);
    color: var(--text-dark);
    margin: 0;
    font-weight: 800;
    flex: 1;
}

.btn-text {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 700;
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-smooth);
    white-space: nowrap;
}

.btn-text:hover {
    gap: 12px;
    color: var(--primary-blue-dark);
}

/* Ranking Grid - Modern Auto-fit */
.ranking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
    gap: clamp(16px, 3vw, 24px);
    animation: fadeIn 1.2s ease-out;
}

.ranking-grid .rank-card-premium {
    animation: slide-up-stagger 0.8s ease-out backwards;
}

.ranking-grid .rank-card-premium:nth-child(1) {
    animation-delay: 0.2s;
}

.ranking-grid .rank-card-premium:nth-child(2) {
    animation-delay: 0.4s;
}

.rank-card-premium {
    background: var(--card-gradient);
    border: 1.5px solid var(--glass-border);
    padding: 25px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-lg);
    position: relative;
    transition: all var(--transition-smooth);
    height: 100%;
    box-sizing: border-box;
}

.rank-card-premium.current-player {
    border: 2px solid var(--primary-blue);
    background: linear-gradient(135deg, rgba(91, 141, 191, 0.15) 0%, rgba(255, 255, 255, 0.95) 100%);
    box-shadow: 0 10px 30px rgba(91, 141, 191, 0.2);
    z-index: 2;
}

.rank-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 30px 0;
    opacity: 0.6;
}

.rank-separator::before,
.rank-separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--glass-border), transparent);
}

@media (max-width: 480px) {
    .rank-card-premium {
        padding: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .rank-img {
        width: 45px;
        height: 45px;
        border-radius: 12px;
    }

    .player-name {
        font-size: var(--text-md);
    }

    .rank-badge {
        font-size: var(--text-xs);
        padding: 4px 8px;
    }
}

.rank-card-premium:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(26, 35, 50, 0.12);
    border-color: rgba(91, 141, 191, 0.2);
}

.rank-card-premium.gold {
    border: 1.5px solid rgba(212, 175, 55, 0.25);
    background: linear-gradient(135deg, #FFFBF0 0%, #FFFEF5 100%);
}

.rank-medal {
    position: absolute;
    top: -15px;
    left: 20px;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #E5BA23 100%);
    color: #3E2E1A;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3);
    font-size: 1.2rem;
    animation: float 3s ease-in-out infinite;
}

.rank-img {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(91, 141, 191, 0.1);
    transition: all var(--transition-smooth);
}

.rank-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.player-name {
    font-weight: 800;
    font-size: var(--text-lg);
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.player-stats {
    font-size: var(--text-sm);
    color: var(--text-light);
}

.rank-badge {
    background: linear-gradient(135deg, rgba(91, 141, 191, 0.08), rgba(91, 141, 191, 0.05));
    padding: 8px 14px;
    border-radius: 12px;
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--primary-blue);
    border: 1px solid rgba(91, 141, 191, 0.12);
    letter-spacing: 0.3px;
}

/* Preview Wrapper & Container */
.preview-wrapper {
    position: relative;
    margin: 40px auto;
    width: 100%;
    max-width: 400px;
    height: 250px;
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
    border: 2px dashed var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
    animation: slideInUp 0.8s ease-out 0.6s both;
    transition: all var(--transition-smooth);
    visibility: visible;
    opacity: 1;
}

.preview-wrapper:hover {
    border-color: var(--primary-blue);
    box-shadow: inset 0 2px 8px rgba(91, 141, 191, 0.08);
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #94A3B8;
}

.preview-placeholder i {
    font-size: 3rem;
}

#preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.btn-verify-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary-blue-dark) 0%, var(--text-dark) 100%);
    color: white;
    padding: 14px 32px;
    border-radius: 30px;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 12px 30px rgba(26, 35, 50, 0.3);
    cursor: pointer;
    display: none;
    /* Shown via JS */
    align-items: center;
    gap: 10px;
    z-index: 10;
    transition: all var(--transition-smooth);
    white-space: nowrap;
    animation: slideInUp 0.5s ease-out;
    pointer-events: auto;
}

.btn-verify-overlay:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-verify-overlay:not(:disabled):hover {
    background: linear-gradient(135deg, var(--text-dark) 0%, var(--primary-blue-dark) 100%);
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 15px 40px rgba(26, 35, 50, 0.4);
    pointer-events: auto;
}

.btn-verify-overlay i {
    font-size: 1.2rem;
}

/* Toast Notification System */
.toast-container {
    font-size: 16px;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(150px);
    background: linear-gradient(135deg, rgba(26, 35, 50, 0.267), rgba(26, 35, 50, 0.9));
    color: white;
    padding: 16px 28px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    box-shadow: 0 15px 40px rgba(7, 39, 167, 0.25);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s;
    opacity: 0;
    pointer-events: none;
    border: 0px solid rgba(91, 141, 191, 0.15);
    backdrop-filter: blur(10px);
}

.toast-container.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #4A7BA7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    animation: bounce 0.6s ease-out;
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Fix mobile overflow */
.app-container {
    max-width: 100%;
    margin: 0 auto;
    background: var(--bg-white);
    min-height: 100vh;
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow-x: hidden !important;
    /* Force hide overflow */
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: var(--text-3xl);
        font-weight: 800;
        line-height: 1.15;
    }

    .hero-actions {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        padding: 0 10px;
    }

    .btn-primary-glow,
    .btn-secondary-outline {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
    }

    .section-container {
        padding: clamp(24px, 5vw, 40px) 16px;
    }

    .ranking-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .section-header h2 {
        font-size: var(--text-2xl);
    }
}

/* Responsive Video Embed Container (16:9) */
.video-section {
    width: 100%;
    max-width: 1000px;
    /* Limit max width for ultra-wide screens */
    margin: 0 auto;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio (9 / 16 = 0.5625) */
    height: 0;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* How to Play */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: clamp(20px, 4vw, 30px);
    animation: fadeIn 1.2s ease-out;
}

.steps-grid .step-card {
    animation: slide-up-stagger 0.8s ease-out backwards;
}

.steps-grid .step-card:nth-child(1) {
    animation-delay: 0.2s;
}

.steps-grid .step-card:nth-child(2) {
    animation-delay: 0.4s;
}

.steps-grid .step-card:nth-child(3) {
    animation-delay: 0.6s;
}

@media (max-width: 768px) {
    .steps-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    }
}

.step-card {
    background: var(--bg-ultra-light);
    padding: 40px 30px;
    border-radius: 24px;
    text-align: center;
    position: relative;
    transition: all var(--transition-smooth);
    border: 1px solid rgba(91, 141, 191, 0.08);
    backdrop-filter: blur(5px);
}

.step-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(91, 141, 191, 0.05), transparent);
    border-radius: 24px;
    pointer-events: none;
}

.step-card:hover {
    transform: translateY(-12px);
    box-shadow: var(--shadow-lg);
    background: var(--bg-white);
    border-color: rgba(91, 141, 191, 0.15);
}

.step-number {
    position: absolute;
    top: -14px;
    left: 30px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #4A7BA7 100%);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(91, 141, 191, 0.25);
}

.step-icon {
    font-size: 3rem;
    color: var(--primary-blue);
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    animation: float 3s ease-in-out infinite;
}

.step-card h3 {
    font-size: var(--text-xl);
    margin-bottom: 15px;
    color: var(--text-dark);
    font-weight: 800;
    letter-spacing: -0.01em;
    position: relative;
    z-index: 1;
}

.step-card p {
    font-size: var(--text-sm);
    color: var(--text-light);
    line-height: 1.5;
}

/* Info Cards */
.info-card {
    background: var(--bg-white);
    padding: 40px;
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
    border: 1.5px solid var(--glass-border);
    transition: all var(--transition-smooth);
    animation: slide-up-stagger 1s ease-out;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.info-card:hover {
    box-shadow: var(--shadow-premium);
    border-color: rgba(91, 141, 191, 0.25);
}

.info-card p {
    line-height: 1.8;
    color: var(--text-light);
    margin: 0;
}

.glass-morphism {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(91, 141, 191, 0.12);
}

/* Team Grid */
.team-grid {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: clamp(20px, 4vw, 30px);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.team-member {
    display: flex;
    justify-content: center;
}

/* ยกเลิกการบังคับคนที่ 3 ให้อยู่ตรงกลาง เพื่อให้กริดไหลลื่น */
.team-member:nth-child(3) {
    grid-column: auto;
    justify-self: center;
    max-width: 100%;
}


.member-card {
    background: var(--card-gradient);
    border: 1.5px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    transition: all var(--transition-smooth);
    box-shadow: var(--shadow-md);
    width: 100%;
}

.member-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(91, 141, 191, 0.2);
}

.member-img {
    width: 180px;
    height: 140px;
    border-radius: 8px;
    object-fit: cover;
    object-position: center top;
    margin-bottom: 15px;
    box-shadow: 0 6px 18px rgba(91, 141, 191, 0.15);
}

/* Rank Image Container for Frames */
.rank-img-container {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 60px;
    margin-right: 15px;
    flex-shrink: 0;
}

.rank-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Override existing .rank-img if needed or just ensure it fits in container */
.rank-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
}

/* Specific Frame Adjustments are handled gracefully */

.member-name-only {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--primary-blue);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.member-info {
    display: flex;
    flex-direction: column;
}

.member-name {
    font-size: var(--text-md);
    font-weight: 800;
    color: var(--text-dark);
    margin: 10px 0 5px;
    letter-spacing: -0.01em;
}


.member-role {
    font-size: var(--text-xs);
    color: var(--text-light);
    margin: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .team-grid {
        max-width: 800px;
    }

    .member-img {
        width: 160px;
        height: 120px;
    }

    .member-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .team-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        max-width: 100%;
        padding: 0 15px;
    }

    .member-card {
        max-width: 100%;
        padding: 15px;
    }

    .member-img {
        width: 140px;
        height: 110px;
    }
}


.team-member img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(91, 141, 191, 0.15);
}

.team-member p {
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

/* Footer */
.app-footer {
    padding: 80px 24px 50px;
    background: linear-gradient(135deg, var(--bg-soft-blue) 0%, var(--bg-ultra-light) 100%);
    text-align: center;
    border-top: 1.5px solid var(--glass-border);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    animation: slideInDown 0.8s ease-out;
}

.footer-links a {
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.95rem;
    transition: all var(--transition-smooth);
    font-weight: 600;
    position: relative;
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-blue);
    transition: width var(--transition-smooth);
}

.footer-links a:hover {
    color: var(--primary-blue);
}

.footer-links a:hover::after {
    width: 100%;
}

.app-footer p {
    font-size: 0.85rem;
    color: var(--text-muted);
    animation: slideInUp 0.8s ease-out 0.3s backwards;
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-white);
    z-index: 1000;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    padding: 30px;
}

.side-menu.active {
    transform: translateX(0);
}

.menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 52, 54, 0.2);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.menu-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    border-bottom: 1px solid var(--bg-soft-blue);
}

.btn-signup-full {
    width: 100%;
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    margin-top: 30px;
    cursor: pointer;
}

.status-message {
    margin-top: 15px;
    font-size: 0.9rem;
    color: var(--primary-blue);
}

/* =========================================================================
   AUTH MODAL & GLASSMORPHISM
   ========================================================================= */

.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auth-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.auth-modal {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 2.5rem;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.auth-modal-overlay.active .auth-modal {
    transform: scale(1);
}

.auth-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.auth-close-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h2 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
}

/* Form Styles */
.auth-form-group {
    margin-bottom: 1.2rem;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: 0.3s;
    outline: none;
    font-family: 'Prompt', sans-serif;
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.auth-input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.btn-auth-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 1rem;
    box-shadow: 0 5px 15px rgba(0, 114, 255, 0.3);
}

.btn-auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 114, 255, 0.4);
}

/* Social Login */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.auth-divider span {
    padding: 0 10px;
}

.social-login-btns {
    display: flex;
    gap: 10px;
}

.btn-social {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
    color: white;
}

.btn-google {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
}

.btn-facebook {
    background: #1877f2;
    color: white;
}

.btn-social:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Toggle Login/Register */
.auth-toggle-text {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.auth-toggle-text a {
    color: #00c6ff;
    text-decoration: none;
    font-weight: 600;
    margin-left: 5px;
    cursor: pointer;
    transition: 0.2s;
}

.auth-toggle-text a:hover {
    color: #3399ff;
    text-decoration: underline;
}

/* User Profile Menu */
.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(91, 141, 191, 0.15) !important;
    border: 1px solid rgba(91, 141, 191, 0.3) !important;
    padding: 6px 15px !important;
    border-radius: 50px !important;
    color: var(--primary-blue) !important;
    cursor: pointer;
    transition: 0.3s;
    font-family: 'Prompt', sans-serif;
}

.user-profile-btn:hover {
    background: rgba(91, 141, 191, 0.25) !important;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #00c6ff;
    display: block;
}

.user-name-display {
    font-weight: 500;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ---------------------------------------------------------
   X. Premium Tips Card Styles (Added via Redesign)
   --------------------------------------------------------- */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: clamp(16px, 3vw, 25px);
    padding: clamp(8px, 2vw, 15px);
}

.tip-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.tip-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(91, 141, 191, 0.2);
    border-color: rgba(91, 141, 191, 0.4);
    z-index: 10;
}

.tip-featured-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 247, 237, 0.95));
    border: 2px solid #fbbf24;
    box-shadow: 0 15px 35px rgba(251, 191, 36, 0.15);
}

.tip-featured-card:hover {
    box-shadow: 0 25px 50px rgba(251, 191, 36, 0.25);
}

.tip-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.tip-card:hover .tip-image {
    transform: scale(1.1);
}

.tip-image-container {
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.tip-content {
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tip-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.tip-category {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.tip-featured {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: white;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(251, 191, 36, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tip-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 12px 0;
    line-height: 1.3;
}

.tip-description {
    color: var(--text-light);
    line-height: 1.7;
    font-size: 0.95rem;
    margin-bottom: 20px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tip-meta {
    display: flex;
    gap: 15px;
    margin: 0 0 20px 0;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
}

.tip-price,
.tip-rating {
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dark);
    background: rgba(0, 0, 0, 0.03);
    padding: 6px 12px;
    border-radius: 8px;
}

.tip-rating {
    color: #d97706;
    background: #fef3c7;
}

.tip-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: auto;
}

.btn-tip {
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
}

.btn-tip-web {
    background: white;
    color: var(--primary-blue);
    border: 2px solid rgba(91, 141, 191, 0.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.btn-tip-web:hover {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(91, 141, 191, 0.25);
}

/* Category Filters */
.category-filter {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.filter-btn {
    padding: 12px 24px;
    border-radius: 50px;
    border: none;
    background: white;
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn:hover {
    background: #f8fafc;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    color: var(--primary-blue);
}

.filter-btn.active {
    background: var(--primary-blue) !important;
    color: white !important;
    box-shadow: 0 8px 20px rgba(91, 141, 191, 0.3);
    transform: translateY(-2px);
}

/* ---------------------------------------------------------
   6. ส่วน Tips & Tricks (Tips Card Styles - NEW)
   --------------------------------------------------------- */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: clamp(16px, 3vw, 24px);
}

.tip-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(91, 141, 191, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tip-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(91, 141, 191, 0.15);
    border-color: rgba(91, 141, 191, 0.3);
}

.tip-featured-card {
    border: 2px solid #fbbf24;
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.2);
    position: relative;
}

.tip-featured-card::before {
    content: "แนะนำ";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #fbbf24;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tip-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.tip-card:hover .tip-image {
    transform: scale(1.05);
}

.tip-image-container {
    overflow: hidden;
    position: relative;
    height: 200px;
}

.tip-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tip-category {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f1f5f9;
    color: var(--text-light);
}

/* Category Badges via JS class or inline, but providing defaults */
.tip-category.cat-restaurant {
    background: #fee2e2;
    color: #ef4444;
}

.tip-category.cat-accommodation {
    background: #dbeafe;
    color: #3b82f6;
}

.tip-category.cat-cafe {
    background: #ede9fe;
    color: #8b5cf6;
}

.tip-category.cat-service {
    background: #d1fae5;
    color: #10b981;
}

.tip-category.cat-photo-spot {
    background: #fce7f3;
    color: #ec4899;
}

.tip-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.4;
}

.tip-description {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 3;
}

.tip-meta {
    display: flex;
    gap: 15px;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
    font-size: 0.85rem;
    color: var(--text-light);
}

.tip-meta i {
    color: var(--primary-blue);
    margin-right: 5px;
}

.tip-price {
    font-weight: 600;
    color: var(--text-dark);
}

.tip-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 20px;
}

.btn-tip {
    padding: 10px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: rgba(91, 141, 191, 0.1);
    color: var(--primary-blue);
    display: block;
}

.btn-tip:hover {
    background: var(--primary-blue);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(91, 141, 191, 0.2);
}

.no-tips {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
    grid-column: 1 / -1;
    background: white;
    border-radius: 16px;
    border: 2px dashed #cbd5e1;
}

/* Specific overrides for buttons if needed */
#submit-tip-btn {
    transition: all 0.3s;
}

#submit-tip-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4) !important;
}

/* --- Custom Horizontal Scrollbar --- */
/* --- Custom Horizontal Scrollbar (Hidden) --- */
.custom-scrollbar {
    overflow-x: auto;
    /* padding-bottom: 10px; Removed padding as scrollbar is hidden */
    scrollbar-width: none !important;
    /* Firefox */
    -ms-overflow-style: none !important;
    /* IE and Edge */
}

.custom-scrollbar::-webkit-scrollbar {
    display: none !important;
    /* Chrome, Safari, Opera */
}

/* Leaderboard Avatar Wrapper */
.leaderboard-avatar-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    /* Match original player-avatar size */
    height: 50px;
}

.leaderboard-avatar-wrapper img.player-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    border-radius: 50%;
}

/* Ensure Platinum Frame fits in Leaderboard */
.leaderboard-avatar-wrapper.avatar-frame-platinum {
    overflow: visible;
    /* Allow crown/glow to extend */
}

/* ---------------------------------------------------------
   GLOBAL MOBILE RESPONSIVENESS OVERHAUL
   --------------------------------------------------------- */
@media (max-width: 768px) {

    /* 1. Global Typography Scaling - Removed fixed pixel overrides to let fluid vars work natively */

    /* 2. Layout & Container Fixes */
    .app-container,
    .container {
        padding-left: clamp(10px, 3vw, 20px) !important;
        padding-right: clamp(10px, 3vw, 20px) !important;
        overflow-x: hidden;
    }

    /* GLOBAL FIX: Ensure padding doesn't overflow width */
    * {
        box-sizing: border-box;
    }

    /* 3. Button Optimization for Touch */
    button,
    .btn,
    .btn-primary-glow,
    .btn-secondary-outline,
    .save-btn,
    .tab-btn {
        padding: clamp(10px, 2.5vw, 14px) clamp(16px, 4vw, 24px) !important;
        font-size: var(--text-sm) !important;
        min-height: 44px;
        /* Touch target size */
    }

    /* 4. Hero Section Adjustments */
    .hero-section {
        padding: clamp(60px, 10vw, 100px) clamp(15px, 4vw, 24px) !important;
        min-height: auto;
    }

    .hero-content h1 {
        font-size: 2.2rem !important;
        margin-bottom: 15px;
    }

    .hero-content p {
        font-size: 0.95rem !important;
        margin-bottom: 30px;
    }

    .hero-actions {
        display: flex;
        /* Verify flex is set */
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        /* Prevent overflow */
        gap: 15px;
        align-items: center;
        /* Center buttons */
    }

    .hero-actions button,
    .hero-actions .btn-primary-glow,
    .hero-actions .btn-secondary-outline,
    .hero-actions .btn {
        width: 100% !important;
        max-width: 100% !important;
        /* Ensure no overflow */
        justify-content: center;
        box-sizing: border-box !important;
        /* Crucial for padding to be included in width */
        margin: 0 !important;
        /* Reset margins */
    }

    /* 5. Card & Grid Adjustments */
    .card,
    .profile-card,
    .shop-card,
    .history-card {
        padding: 15px !important;
        border-radius: 16px !important;
    }

    /* 6. Utility Spacing */
    .mt-large {
        margin-top: 30px !important;
    }

    .mb-large {
        margin-bottom: 30px !important;
    }

    /* 7. Modal Full Width on Mobile */
    .modal-content {
        width: 95% !important;
        margin: 10px auto;
        padding: 20px !important;
    }

    /* 8. Specific Fixes for Index/Landing */
    .step-card h3 {
        font-size: 1.1rem !important;
    }

    .tips-grid {
        grid-template-columns: 1fr !important;
    }

    .tip-card {
        max-width: 100%;
    }
}

/* =========================================================================
   NEW MODERN FOOTER (Glassmorphism)
   ========================================================================= */

.site-footer {
    position: relative;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.95) 0%, #0f172a 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: white;
    padding: 80px 20px 40px;
    margin-top: 100px;
    overflow: hidden;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 60px;
    position: relative;
    z-index: 2;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.footer-brand h3 {
    background: linear-gradient(90deg, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 2rem;
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.footer-brand p {
    color: #94a3b8;
    line-height: 1.7;
    font-size: 1rem;
    max-width: 100%;
    margin: 0;
}

.footer-social-new {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.social-btn {
    width: 45px;
    height: 45px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 1.2rem;
}

.social-btn:hover {
    background: var(--primary-blue);
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(91, 141, 191, 0.3);
    border-color: transparent;
}

.footer-links-group h4 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 25px;
    font-weight: 700;
}

.footer-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.footer-links-list a {
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.footer-links-list a:hover {
    color: white;
    transform: translateX(5px);
}

.footer-links-list a i {
    font-size: 0.8rem;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.footer-links-list a:hover i {
    opacity: 1;
    color: var(--primary-blue);
}

.footer-bottom {
    margin-top: 80px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
    z-index: 2;
}

.footer-bottom-links {
    display: flex;
    gap: 20px;
}

.footer-bottom-links a {
    color: #64748b;
    text-decoration: none;
    transition: 0.3s;
}

.footer-bottom-links a:hover {
    color: var(--primary-blue);
}

/* Decorative Blobs */
.footer-blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(91, 141, 191, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    filter: blur(80px);
}

.blob-1 {
    top: -200px;
    left: -200px;
}

.blob-2 {
    bottom: -100px;
    right: -100px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.08) 0%, transparent 70%);
}

@media (max-width: 900px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .footer-brand {
        align-items: center;
    }

    .footer-brand p {
        max-width: 100%;
    }

    .footer-links-list {
        align-items: center;
    }
}

@media (max-width: 600px) {
    .footer-bottom {
        flex-direction: column;
        gap: 15px;
    }
}

/* ---------------------------------------------------------
   Performance (from performance.css)
   --------------------------------------------------------- */
[data-aos] {
  will-change: opacity, transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

.app-header {
  will-change: backdrop-filter, box-shadow;
  transform: translateZ(0);
}

.app-header.scrolled {
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 12px rgba(26, 35, 50, 0.08);
}

.hero-section {
  will-change: background-position;
}

.hero-content {
  will-change: transform;
  transform: translateZ(0);
}

.rank-card-premium {
  will-change: transform, box-shadow;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.rank-card-premium:hover {
  will-change: auto;
}

.step-card,
.info-card {
  will-change: opacity, transform;
  transform: translateZ(0);
}

.section-container {
  contain: layout style paint;
}

.ranking-grid {
  contain: layout style;
}

.member-img,
.rank-img {
  content-visibility: auto;
  contain: layout style paint;
}

body {
  font-display: swap;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.app-container {
  contain: strict;
}

@media (prefers-reduced-motion: reduce) {
  [data-aos],
  .hero-content,
  .rank-card-premium,
  .step-card,
  .info-card {
    will-change: auto !important;
    animation: none !important;
    transition: none !important;
  }
}