/* =====================================================
   HOMEPAGE — Cinematic Official Game Style
   Legends War 2 Classic
   ===================================================== */

/* ========== VARIABLES ========== */
:root {
    --hp-bg: #050301;
    --hp-bg-soft: #090503;
    --hp-surface: rgba(14, 8, 5, 0.86);
    --hp-surface-2: rgba(29, 17, 8, 0.82);
    --hp-edge: rgba(129, 82, 35, 0.42);
    --hp-edge-bright: rgba(230, 171, 82, 0.62);
    --hp-gold: #c89142;
    --hp-gold-bright: #ffe1a1;
    --hp-gold-soft: #b77a32;
    --hp-gold-dim: #6d471f;
    --hp-text: #f3e5c8;
    --hp-text-soft: #cdb98e;
    --hp-muted: #8d7756;
    --hp-red: #ab2416;
    --hp-red-bright: #f04c32;
    --hp-blue: #4a8dff;
    --hp-container: 1240px;
    --hp-radius: 18px;
    --hp-topbar-height: 64px;
}

/* ========== BASE ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--hp-bg);
    scroll-behavior: smooth;
}

body.hp-body-root {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% 0%, rgba(138, 72, 20, 0.16), transparent 34rem),
        var(--hp-bg);
    color: var(--hp-text);
    font-family: "Prompt", "Kanit", Tahoma, "Segoe UI", sans-serif;
    text-rendering: geometricPrecision;
}

body.hp-body-root a,
body.hp-body-root button {
    -webkit-tap-highlight-color: transparent;
}

.homepage-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--hp-bg);
    /* `clip` not `hidden`: overflow-x:hidden promotes overflow-y to auto,
       making this shell a second vertical scroll container. See .main-container. */
    overflow-x: clip;
}

.hp-container {
    max-width: var(--hp-container);
    width: 100%;
    margin: 0 auto;
}

/* ========== TOPBAR ========== */
.hp-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background:
        linear-gradient(180deg, rgba(5, 3, 1, 0.94), rgba(5, 3, 1, 0.68));
    border-bottom: 1px solid rgba(213, 152, 74, 0.22);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.hp-topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 210, 120, 0.48), transparent);
    pointer-events: none;
}

.hp-topbar-inner {
    max-width: var(--hp-container);
    height: var(--hp-topbar-height);
    margin: 0 auto;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.hp-topbar-brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    min-width: 0;
}

.hp-topbar-logo {
    height: 34px;
    width: auto;
    opacity: 0.98;
    filter:
        drop-shadow(0 2px 8px rgba(0, 0, 0, 0.8))
        drop-shadow(0 0 10px rgba(255, 176, 74, 0.18));
}

.hp-topbar-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.hp-topbar-links a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 8px 15px;
    color: #d8bd7c;
    border: 1px solid transparent;
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.15px;
    white-space: nowrap;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.hp-topbar-links a:hover {
    color: var(--hp-gold-bright);
    background: rgba(255, 205, 122, 0.08);
    border-color: rgba(224, 174, 96, 0.28);
    transform: translateY(-1px);
}

.hp-topbar-links a.is-primary {
    color: #fff7df;
    border-color: rgba(255, 170, 89, 0.58);
    background:
        linear-gradient(180deg, rgba(255, 122, 58, 0.2), transparent),
        linear-gradient(135deg, #b72d1b 0%, #6f160c 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 6px 18px rgba(125, 22, 10, 0.38);
}

.hp-topbar-links a.is-primary:hover {
    background:
        linear-gradient(180deg, rgba(255, 160, 76, 0.26), transparent),
        linear-gradient(135deg, #d63c25 0%, #812010 100%);
    border-color: rgba(255, 198, 111, 0.75);
}

/* ========== LANGUAGE SWITCHER (dropdown: flag + full name) ========== */
.hp-lang-dropdown {
    margin-left: 6px;
}

.hp-lang-flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
    flex: 0 0 auto;
    display: block;
}

.hp-lang-toggle {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(224, 174, 96, 0.32);
    border-radius: 999px;
    background: rgba(20, 12, 5, 0.55);
    color: #e7cf97;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 6px 12px;
    min-height: 32px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.hp-lang-toggle:hover,
.hp-lang-toggle[aria-expanded="true"] {
    color: var(--hp-gold-bright);
    border-color: rgba(240, 205, 136, 0.6);
    background: rgba(255, 205, 122, 0.12);
}

.hp-lang-caret {
    font-size: 10px;
    opacity: 0.75;
}

.hp-lang-menu {
    min-width: 184px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(224, 174, 96, 0.35);
    background: rgba(18, 11, 5, 0.98);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 300;
}

.hp-lang-item {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    background: transparent;
    color: #e7cf97;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease;
}

.hp-lang-item:hover,
.hp-lang-item:focus {
    color: var(--hp-gold-bright);
    background: rgba(255, 205, 122, 0.12);
}

.hp-lang-item.is-active {
    color: #1a0f06;
    background: linear-gradient(180deg, #ffe1a1, #c89142);
}

.hp-lang-check {
    margin-left: auto;
    font-size: 12px;
}

/* ========== HERO — PARALLAX ========== */
.hp-hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-align: center;
    isolation: isolate;
}

.hp-hero-bg {
    position: absolute;
    top: -12%;
    left: 0;
    right: 0;
    bottom: -12%;
    z-index: 0;
    background-image:
        radial-gradient(ellipse at 52% 34%, rgba(255, 239, 183, 0.22) 0%, rgba(255, 239, 183, 0.06) 18%, transparent 34%),
        radial-gradient(ellipse at 18% 58%, rgba(34, 123, 255, 0.28) 0%, transparent 27%),
        radial-gradient(ellipse at 84% 58%, rgba(153, 42, 255, 0.24) 0%, transparent 28%),
        linear-gradient(90deg, rgba(0, 0, 0, 0.42) 0%, transparent 22%, transparent 78%, rgba(0, 0, 0, 0.46) 100%),
        url('/assets/images/homepage/background-hero-v2.webp');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    will-change: transform;
}

.hp-hero-aura {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(circle at 50% 43%, rgba(255, 231, 172, 0.18), transparent 15rem),
        radial-gradient(circle at 50% 80%, rgba(185, 71, 20, 0.22), transparent 24rem),
        linear-gradient(90deg, rgba(2, 1, 0, 0.66), transparent 27%, transparent 73%, rgba(2, 1, 0, 0.72));
    mix-blend-mode: screen;
    opacity: 0.78;
    pointer-events: none;
}

.hp-hero-lines {
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 25%),
        repeating-linear-gradient(
            -60deg,
            rgba(255, 255, 255, 0.018),
            rgba(255, 255, 255, 0.018) 1px,
            transparent 1px,
            transparent 12px
        );
    opacity: 0.55;
    pointer-events: none;
}

.hp-hero-vignette {
    position: absolute;
    inset: 0;
    z-index: 3;
    background:
        linear-gradient(180deg, rgba(5, 3, 1, 0.76) 0%, rgba(5, 3, 1, 0.1) 21%, rgba(5, 3, 1, 0.16) 72%, rgba(5, 3, 1, 0.96) 100%),
        radial-gradient(ellipse at 50% 45%, transparent 0%, transparent 38%, rgba(0, 0, 0, 0.68) 100%);
    pointer-events: none;
}

.hp-hero-content {
    position: relative;
    z-index: 4;
    width: min(100%, 900px);
    margin-top: clamp(68px, 13vh, 132px);
    padding: 0 24px 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: hp-hero-enter 0.75s ease both;
}

.hp-logo {
    width: min(100%, 440px);
    height: auto;
    filter:
        drop-shadow(0 8px 30px rgba(0, 0, 0, 0.95))
        drop-shadow(0 0 18px rgba(255, 180, 80, 0.18));
}

@keyframes hp-hero-enter {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hp-hero-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 18px;
    color: #f6dca4;
    border: 1px solid rgba(232, 180, 92, 0.4);
    border-radius: 999px;
    background: rgba(9, 4, 1, 0.45);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 8px 24px rgba(0, 0, 0, 0.35);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hp-hero-title {
    margin: 0;
    color: #fff4d2;
    font-size: clamp(32px, 5.3vw, 76px);
    line-height: 0.98;
    font-weight: 700;
    letter-spacing: -1.2px;
    text-shadow:
        0 5px 18px rgba(0, 0, 0, 0.95),
        0 0 30px rgba(203, 114, 34, 0.4);
}

.hp-hero-title span {
    display: inline-block;
    color: var(--hp-gold-bright);
    font-size: 0.78em;
    letter-spacing: 0.5px;
}

.hp-hero-tagline {
    max-width: 700px;
    margin: 0;
    padding: 0 10px;
    color: #ead7aa;
    font-size: clamp(14px, 1.6vw, 18px);
    font-weight: 400;
    line-height: 1.8;
    letter-spacing: 0.25px;
    text-shadow: 0 3px 14px rgba(0, 0, 0, 0.95);

    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
}

.hp-hero-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 8px;
}

.hp-action-btn {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 156px;
    min-height: 116px;
    padding: 18px 16px 15px;
    color: #fff0cf;
    border: 1px solid rgba(222, 165, 78, 0.62);
    border-radius: 10px;
    text-decoration: none;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -14px 30px rgba(0, 0, 0, 0.22),
        0 14px 34px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.hp-action-btn::before {
    content: "";
    position: absolute;
    inset: 5px;
    z-index: -1;
    border: 1px solid rgba(255, 228, 166, 0.18);
    border-radius: 7px;
    pointer-events: none;
}

.hp-action-btn::after {
    content: "";
    position: absolute;
    left: -40%;
    top: -80%;
    width: 42%;
    height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
    transform: rotate(18deg) translateX(-30%);
    transition: transform 0.38s ease;
    pointer-events: none;
}

.hp-action-btn:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 222, 145, 0.9);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        inset 0 -14px 30px rgba(0, 0, 0, 0.26),
        0 20px 42px rgba(0, 0, 0, 0.66),
        0 0 24px rgba(211, 126, 37, 0.2);
    filter: brightness(1.08);
}

.hp-action-btn:hover::after {
    transform: rotate(18deg) translateX(430%);
}

.hp-action-btn i {
    font-size: 28px;
    margin-bottom: 2px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
}

.hp-action-th {
    color: #fff8de;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.hp-action-en {
    color: rgba(255, 230, 184, 0.62);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.hp-action-register {
    background:
        linear-gradient(180deg, rgba(255, 227, 158, 0.12), transparent 42%),
        linear-gradient(145deg, rgba(72, 45, 23, 0.96), rgba(24, 12, 5, 0.98));
}

.hp-action-topup {
    background:
        linear-gradient(180deg, rgba(255, 241, 171, 0.2), transparent 44%),
        linear-gradient(145deg, rgba(177, 112, 24, 0.98), rgba(82, 45, 7, 0.98));
}

.hp-action-download {
    background:
        linear-gradient(180deg, rgba(255, 162, 103, 0.18), transparent 44%),
        linear-gradient(145deg, rgba(136, 34, 18, 0.98), rgba(57, 13, 6, 0.98));
    border-color: rgba(242, 105, 72, 0.66);
}

.hp-hero-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 2px;
}

.hp-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    color: rgba(238, 215, 173, 0.78);
    background: rgba(5, 2, 1, 0.42);
    border: 1px solid rgba(223, 161, 77, 0.22);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.15px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hp-hero-meta i {
    color: var(--hp-gold-bright);
}

.hp-hero-scroll {
    position: absolute;
    left: 50%;
    bottom: 26px;
    z-index: 5;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    color: rgba(255, 218, 144, 0.68);
    background: rgba(7, 3, 1, 0.38);
    border: 1px solid rgba(220, 166, 85, 0.28);
    border-radius: 50%;
    cursor: pointer;
    transform: translateX(-50%);
    animation: hp-bounce 2.2s ease-in-out infinite;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hp-hero-scroll:hover {
    color: var(--hp-gold-bright);
    border-color: rgba(255, 216, 142, 0.5);
}

@keyframes hp-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.58; }
    50% { transform: translateX(-50%) translateY(8px); opacity: 1; }
}

/* ========== STICKY NAV ========== */
.hp-nav {
    position: sticky;
    top: 0;
    z-index: 190;
    display: flex;
    justify-content: center;
    background: rgba(9, 5, 2, 0.88);
    border-top: 1px solid rgba(224, 166, 89, 0.14);
    border-bottom: 1px solid rgba(224, 166, 89, 0.18);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(13px);
    -webkit-backdrop-filter: blur(13px);
    transition: box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.hp-nav.is-sticky {
    background: rgba(9, 5, 2, 0.95);
    border-bottom-color: rgba(224, 166, 89, 0.42);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.72);
}

.hp-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 34px;
    color: var(--hp-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.35px;
    transition: color 0.2s ease, background 0.2s ease;
}

.hp-nav a::after {
    content: "";
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--hp-gold-bright), transparent);
    transform: scaleX(0);
    transition: transform 0.22s ease;
}

.hp-nav a:hover,
.hp-nav a.active {
    color: var(--hp-gold-bright);
    background: linear-gradient(180deg, transparent, rgba(209, 138, 50, 0.08));
}

.hp-nav a:hover::after,
.hp-nav a.active::after {
    transform: scaleX(1);
}

/* ========== MAIN CONTENT ========== */
.hp-main {
    position: relative;
    flex: 1;
    padding: 60px 22px 80px;
    background:
        radial-gradient(circle at 50% 0%, rgba(175, 91, 24, 0.12), transparent 34rem),
        linear-gradient(180deg, #050301 0%, #080503 60%, #050301 100%);
}

.hp-main::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: min(900px, 90vw);
    height: 1px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, transparent, rgba(255, 210, 125, 0.38), transparent);
}

.hp-section-head {
    margin: 0 auto 28px;
    text-align: center;
}

.hp-section-head span {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--hp-gold-soft);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2.8px;
}

.hp-section-head h2 {
    margin: 0;
    color: var(--hp-gold-bright);
    font-size: clamp(24px, 3vw, 38px);
    line-height: 1.2;
    font-weight: 700;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.65);
}

.hp-section-head p {
    margin: 8px 0 0;
    color: var(--hp-muted);
    font-size: 14px;
    line-height: 1.65;
}

.hp-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: stretch;
}

.hp-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ========== PANELS ========== */
.hp-panel {
    position: relative;
    height: 100%;
    border: 1px solid var(--hp-edge);
    border-radius: var(--hp-radius);
    background:
        linear-gradient(180deg, rgba(255, 224, 150, 0.055), transparent 45%),
        linear-gradient(145deg, var(--hp-surface-2), var(--hp-surface));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.055),
        0 18px 42px rgba(0, 0, 0, 0.42);
    overflow: hidden;
}

.hp-panel::before,
.hp-panel::after {
    content: "";
    position: absolute;
    width: 28px;
    height: 28px;
    pointer-events: none;
    opacity: 0.78;
}

.hp-panel::before {
    top: 10px;
    left: 10px;
    border-top: 1px solid rgba(255, 220, 140, 0.45);
    border-left: 1px solid rgba(255, 220, 140, 0.45);
}

.hp-panel::after {
    right: 10px;
    bottom: 10px;
    border-right: 1px solid rgba(255, 220, 140, 0.35);
    border-bottom: 1px solid rgba(255, 220, 140, 0.35);
}

.hp-panel-title {
    position: relative;
    margin: 0 0 18px;
    padding: 0 0 14px;
    color: var(--hp-gold-bright);
    border-bottom: 1px solid rgba(138, 91, 39, 0.38);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.25px;
    text-align: center;
}

.hp-panel-title::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -1px;
    width: 84px;
    height: 1px;
    transform: translateX(-50%);
    background: linear-gradient(90deg, transparent, var(--hp-gold-bright), transparent);
}

/* ========== AUTH PANEL ========== */
.hp-auth-panel,
.hp-rank-panel,
.hp-social-panel {
    padding: 22px;
}

.hp-auth-btns {
    display: grid;
    gap: 12px;
}

.hp-login-btn,
.hp-register-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 72px;
    padding: 14px 18px;
    border: 1px solid rgba(200, 154, 82, 0.5);
    border-radius: 14px;
    color: var(--hp-gold-bright);
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.hp-login-btn::before,
.hp-register-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.1) 48%, transparent 56%);
    transform: translateX(-120%);
    transition: transform 0.42s ease;
    pointer-events: none;
}

.hp-login-btn:hover::before,
.hp-register-btn:hover::before {
    transform: translateX(120%);
}

.hp-login-btn:hover,
.hp-register-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 224, 150, 0.78);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.36);
    filter: brightness(1.08);
}

.hp-login-btn {
    background:
        linear-gradient(180deg, rgba(255, 220, 140, 0.11), transparent),
        linear-gradient(135deg, #4e2c12, #1c0d05);
}

.hp-register-btn {
    color: #ffe0d0;
    border-color: rgba(240, 96, 64, 0.5);
    background:
        linear-gradient(180deg, rgba(255, 140, 98, 0.14), transparent),
        linear-gradient(135deg, #7b1c12, #2d0805);
}

.hp-login-btn i,
.hp-register-btn i {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 222, 145, 0.22);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    font-size: 19px;
}

.hp-login-btn span,
.hp-register-btn span {
    display: block;
    color: #fff5d8;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.15;
}

.hp-login-btn small,
.hp-register-btn small {
    display: block;
    margin-top: 4px;
    color: rgba(233, 207, 163, 0.58);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2.3px;
    text-transform: uppercase;
}

/* ========== RANK PANEL ========== */
.hp-guild-rank {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hp-guild-rank li {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 7px 4px;
    color: var(--hp-text-soft);
    border-bottom: 1px solid rgba(97, 62, 28, 0.32);
    font-size: 13px;
}

.hp-guild-rank li:last-child {
    border-bottom: none;
}

.hp-guild-rank .rank {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(216, 155, 64, 0.5);
    border-radius: 9px;
    color: #f6dfae;
    background: linear-gradient(180deg, #684018 0%, #261405 100%);
    font-size: 11px;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.hp-guild-rank li:nth-child(1) .rank {
    color: #3b1b05;
    border-color: #ffe7a8;
    background: linear-gradient(180deg, #ffe08a 0%, #aa7423 100%);
}

.hp-guild-rank li:nth-child(2) .rank {
    color: #1a1a1a;
    border-color: #eeeeee;
    background: linear-gradient(180deg, #f1f1f1 0%, #777777 100%);
}

.hp-guild-rank li:nth-child(3) .rank {
    border-color: #f0a569;
    background: linear-gradient(180deg, #d98a45 0%, #623211 100%);
}

.hp-guild-rank .name {
    overflow: hidden;
    color: #ead4a5;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.hp-guild-rank em {
    color: var(--hp-muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.hp-btn-mini {
    position: relative;
    display: block;
    margin-top: 16px;
    padding: 10px 12px;
    color: #efd39a;
    border: 1px solid rgba(203, 145, 65, 0.42);
    border-radius: 12px;
    background: rgba(14, 7, 3, 0.66);
    text-align: center;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.35px;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.hp-btn-mini:hover {
    color: var(--hp-gold-bright);
    border-color: rgba(255, 222, 145, 0.72);
    background: rgba(39, 22, 10, 0.76);
    transform: translateY(-1px);
}

/* ========== SOCIAL PANEL ========== */
.hp-social-inner {
    min-height: 172px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 13px;
    padding: 4px 0;
    text-align: center;
}

.hp-social-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #2879f5, #0e4fb5);
    box-shadow: 0 12px 26px rgba(24, 119, 242, 0.24);
    font-size: 22px;
}

.hp-social-info strong {
    display: block;
    margin-bottom: 5px;
    color: var(--hp-gold-bright);
    font-size: 16px;
    font-weight: 700;
}

.hp-social-info small {
    display: block;
    max-width: 260px;
    color: var(--hp-muted);
    font-size: 12px;
    line-height: 1.55;
}

.hp-fb-like {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 9px 20px;
    border-radius: 999px;
    background: #1877f2;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.25px;
    box-shadow: 0 10px 24px rgba(24, 119, 242, 0.18);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.hp-fb-like:hover {
    background: #2c86ff;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(24, 119, 242, 0.26);
}

.hp-fb-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    margin-left: 8px;
    padding: 9px 20px;
    border-radius: 999px;
    background: #42526e;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.25px;
    box-shadow: 0 10px 24px rgba(66, 82, 110, 0.18);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.hp-fb-group:hover {
    background: #57698c;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(66, 82, 110, 0.26);
}

/* ========== FOOTER ========== */
.hp-footer {
    padding: 28px 22px;
    border-top: 1px solid rgba(100, 61, 24, 0.5);
    background:
        radial-gradient(circle at 50% 0%, rgba(150, 75, 20, 0.1), transparent 32rem),
        linear-gradient(180deg, #080503 0%, var(--hp-bg) 100%);
}

.hp-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.hp-footer-logo {
    height: 32px;
    width: auto;
    opacity: 0.82;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.75));
}

.hp-footer p {
    margin: 0;
    color: var(--hp-muted);
    font-size: 12px;
    letter-spacing: 0.25px;
    text-align: center;
}

.hp-footer-social {
    display: flex;
    gap: 9px;
}

.hp-footer-social a {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(139, 88, 34, 0.45);
    border-radius: 50%;
    color: var(--hp-gold-soft);
    background: rgba(18, 10, 5, 0.74);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.hp-footer-social a:hover {
    color: var(--hp-gold-bright);
    border-color: rgba(255, 222, 145, 0.64);
    background: rgba(36, 22, 10, 0.9);
    transform: translateY(-2px);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 980px) {
    :root {
        --hp-topbar-height: 58px;
    }

    .hp-topbar-inner {
        padding: 0 18px;
    }

    .hp-topbar-logo {
        height: 28px;
    }

    .hp-topbar-links {
        gap: 5px;
    }

    .hp-topbar-links a {
        padding: 7px 11px;
        font-size: 12px;
    }

    .hp-hero-content {
        margin-top: 12vh;
    }

    .hp-row {
        grid-template-columns: 1fr 1fr;
    }

    .hp-col-social {
        grid-column: 1 / -1;
    }

    .hp-social-inner {
        min-height: auto;
        flex-direction: row;
        justify-content: center;
        text-align: left;
    }
}

@media (max-width: 680px) {
    .hp-topbar-inner {
        height: auto;
        min-height: var(--hp-topbar-height);
        padding: 8px 12px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hp-topbar-brand {
        width: 100%;
        justify-content: center;
    }

    .hp-topbar-links {
        width: 100%;
        justify-content: center;
    }

    .hp-topbar-links a {
        min-height: 32px;
        padding: 6px 9px;
        font-size: 11px;
    }

    .hp-hero-bg {
        background-position: center center;
    }

    .hp-hero-content {
        margin-top: 130px;
        padding: 0 14px 56px;
        gap: 13px;
    }

    .hp-hero-kicker {
        padding: 6px 12px;
        font-size: 9px;
        letter-spacing: 1.5px;
    }

    .hp-hero-title {
        font-size: clamp(30px, 10vw, 46px);
    }

    .hp-hero-tagline {
        font-size: 13px;
        line-height: 1.65;
    }

    .hp-hero-actions {
        width: min(100%, 330px);
        flex-direction: column;
        gap: 10px;
    }

    .hp-action-btn {
        width: 100%;
        min-height: 58px;
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 16px;
        border-radius: 14px;
        text-align: left;
    }

    .hp-action-btn i {
        width: 34px;
        font-size: 21px;
        text-align: center;
    }

    .hp-action-th {
        font-size: 15px;
    }

    .hp-action-en {
        margin-left: auto;
        letter-spacing: 1.6px;
    }

    .hp-hero-meta {
        display: none;
    }

    .hp-nav {
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: none;
    }

    .hp-nav::-webkit-scrollbar {
        display: none;
    }

    .hp-nav a {
        flex: 0 0 auto;
        min-height: 48px;
        padding: 0 18px;
        font-size: 12px;
    }

    .hp-main {
        padding: 44px 14px 64px;
    }

    .hp-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .hp-col-social {
        grid-column: auto;
    }

    .hp-auth-panel,
    .hp-rank-panel,
    .hp-social-panel {
        padding: 18px;
    }

    .hp-social-inner {
        flex-direction: column;
        text-align: center;
    }

    .hp-footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
}

@media (max-width: 390px) {
    .hp-topbar-links a i {
        display: none;
    }

    .hp-topbar-links a {
        padding-inline: 8px;
    }

    .hp-action-en {
        display: none;
    }
}

/* =====================================================
   PLAYER RANKING PANEL — individual character ranking
   ===================================================== */
.hp-col-rank {
    grid-column: span 2;
}

.hp-character-rank-panel {
    min-height: 100%;
}

.hp-rank-head {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(138, 91, 39, 0.38);
}

.hp-rank-head span {
    display: block;
    margin-bottom: 6px;
    color: var(--hp-gold-soft);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2.2px;
    text-transform: uppercase;
}

.hp-rank-head h3 {
    margin: 0;
    color: var(--hp-gold-bright);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.hp-rank-head small {
    max-width: 220px;
    color: var(--hp-muted);
    font-size: 12px;
    line-height: 1.45;
    text-align: right;
}

.hp-rank-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.hp-rank-tab {
    min-height: 32px;
    padding: 7px 12px;
    border: 1px solid rgba(203, 145, 65, 0.26);
    border-radius: 999px;
    background: rgba(5, 3, 1, 0.32);
    color: var(--hp-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.hp-rank-tab:hover,
.hp-rank-tab.is-active {
    color: var(--hp-gold-bright);
    border-color: rgba(255, 222, 145, 0.62);
    background: rgba(200, 145, 66, 0.12);
    transform: translateY(-1px);
}

.hp-rank-state {
    min-height: 245px;
    display: grid;
    place-items: center;
    padding: 24px;
    border: 1px solid rgba(203, 145, 65, 0.22);
    border-radius: 14px;
    background: rgba(5, 3, 1, 0.28);
    color: var(--hp-muted);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.hp-rank-state.is-error {
    color: #ffb3a8;
    border-color: rgba(240, 76, 50, 0.3);
    background: rgba(171, 36, 22, 0.12);
}

.hp-character-rank-table {
    overflow: hidden;
    border: 1px solid rgba(203, 145, 65, 0.22);
    border-radius: 14px;
    background: rgba(5, 3, 1, 0.26);
}

.hp-rank-table-head,
.hp-rank-row {
    display: grid;
    grid-template-columns: 58px minmax(92px, 0.9fr) minmax(120px, 1.1fr) minmax(100px, 1fr) 70px 86px;
    align-items: center;
    gap: 10px;
}

.hp-rank-table-head {
    min-height: 38px;
    padding: 0 12px;
    color: rgba(255, 225, 161, 0.62);
    background: rgba(200, 145, 66, 0.08);
    border-bottom: 1px solid rgba(203, 145, 65, 0.22);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.hp-rank-row {
    min-height: 44px;
    padding: 7px 12px;
    border-bottom: 1px solid rgba(97, 62, 28, 0.3);
    color: var(--hp-text-soft);
    font-size: 13px;
}

.hp-rank-row:last-child {
    border-bottom: none;
}

.hp-rank-row:hover {
    background: rgba(255, 225, 161, 0.045);
}

.hp-rank-no {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(216, 155, 64, 0.5);
    border-radius: 10px;
    color: #f6dfae;
    background: linear-gradient(180deg, #684018 0%, #261405 100%);
    font-size: 12px;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.hp-rank-row:nth-child(2) .hp-rank-no {
    color: #3b1b05;
    border-color: #ffe7a8;
    background: linear-gradient(180deg, #ffe08a 0%, #aa7423 100%);
}

.hp-rank-row:nth-child(3) .hp-rank-no {
    color: #1a1a1a;
    border-color: #eeeeee;
    background: linear-gradient(180deg, #f1f1f1 0%, #777777 100%);
}

.hp-rank-row:nth-child(4) .hp-rank-no {
    border-color: #f0a569;
    background: linear-gradient(180deg, #d98a45 0%, #623211 100%);
}

.hp-rank-tribe {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid rgba(203, 145, 65, 0.24);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.18);
    color: #ead4a5;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

/* Tribe colors keyed by 0-based aTribe, matching the CBT ranking palette
   (0=เทพกระบี่ green, 1=สราญรมย์ blue, 2=ปีศาจโลหิต red, 3=เมฆาเทพยุทธ purple). */
.hp-rank-tribe.tribe-0 { background: rgba(46, 204, 113, 0.16);  color: #8ff0b6; border-color: rgba(46, 204, 113, 0.3); }
.hp-rank-tribe.tribe-1 { background: rgba(108, 166, 255, 0.16); color: #aeccff; border-color: rgba(108, 166, 255, 0.3); }
.hp-rank-tribe.tribe-2 { background: rgba(231, 76, 60, 0.16);   color: #ff9e94; border-color: rgba(231, 76, 60, 0.3); }
.hp-rank-tribe.tribe-3 { background: rgba(187, 134, 252, 0.16); color: #d6b8ff; border-color: rgba(187, 134, 252, 0.3); }

.hp-rank-name,
.hp-rank-guild {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hp-rank-name {
    color: #fff4d2;
    font-weight: 700;
}

.hp-rank-guild {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--hp-text-soft);
    font-weight: 700;
}

/* The guild's approved mark (64x64 art), in front of its name. */
.hp-rank-guild-mark {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    object-fit: contain;
    border: 1px solid rgba(203, 145, 65, 0.4);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 6px rgba(255, 200, 110, 0.12);
}

.hp-rank-guild-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hp-rank-level,
.hp-rank-point {
    white-space: nowrap;
    text-align: right;
    font-weight: 700;
}

.hp-rank-level {
    color: #dcc79c;
}

.hp-rank-point {
    color: var(--hp-gold-bright);
}

@media (max-width: 980px) {
    .hp-col-rank,
    .hp-col-social {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .hp-rank-head {
        flex-direction: column;
    }

    .hp-rank-head small {
        max-width: none;
        text-align: left;
    }

    .hp-character-rank-table {
        overflow-x: auto;
    }

    .hp-rank-table-head,
    .hp-rank-row {
        min-width: 680px;
    }
}

/* =====================================================
   DISCORD COMMUNITY INVITE POPUP
   Bottom-right toast-style card, shown once per visitor
   (after a language is chosen). See homepage.php popup.
   ===================================================== */
.hp-discord-popup {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 400;
    width: min(360px, calc(100vw - 32px));
    padding: 18px 18px 16px;
    border: 1px solid rgba(88, 101, 242, 0.5);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(88, 101, 242, 0.16), transparent 46%),
        linear-gradient(145deg, rgba(23, 18, 32, 0.98), rgba(12, 9, 18, 0.98));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 20px 48px rgba(0, 0, 0, 0.6),
        0 0 32px rgba(88, 101, 242, 0.22);
    color: var(--hp-text);
    overflow: hidden;
    animation: hp-dc-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes hp-dc-in {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.hp-discord-glow {
    position: absolute;
    top: -40%;
    left: -20%;
    width: 90%;
    height: 120%;
    background: radial-gradient(circle at 30% 30%, rgba(88, 101, 242, 0.35), transparent 60%);
    filter: blur(10px);
    pointer-events: none;
}

.hp-discord-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.28);
    color: #cfd3ff;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.hp-discord-close:hover {
    color: #fff;
    background: rgba(88, 101, 242, 0.4);
    border-color: rgba(140, 150, 255, 0.6);
}

.hp-discord-head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-right: 26px;
}

.hp-discord-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(140deg, #5865f2, #4149c9);
    box-shadow: 0 10px 22px rgba(88, 101, 242, 0.4);
    font-size: 22px;
    animation: hp-dc-bob 2.4s ease-in-out infinite;
}

@keyframes hp-dc-bob {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50%      { transform: translateY(-4px) rotate(3deg); }
}

.hp-discord-copy strong {
    display: block;
    margin-bottom: 4px;
    color: #eef0ff;
    font-size: 15px;
    font-weight: 700;
}

.hp-discord-copy p {
    margin: 0;
    color: var(--hp-text-soft);
    font-size: 12.5px;
    line-height: 1.55;
}

.hp-discord-actions {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.hp-discord-join {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 11px;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(140deg, #5865f2, #4149c9);
    box-shadow: 0 10px 24px rgba(88, 101, 242, 0.36);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.hp-discord-join:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(88, 101, 242, 0.5);
    filter: brightness(1.08);
}

.hp-discord-later {
    flex: 0 0 auto;
    padding: 10px 14px;
    border: 1px solid rgba(203, 145, 65, 0.3);
    border-radius: 11px;
    background: rgba(5, 3, 1, 0.4);
    color: var(--hp-muted);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.hp-discord-later:hover {
    color: var(--hp-text-soft);
    border-color: rgba(224, 174, 96, 0.5);
    background: rgba(20, 12, 5, 0.6);
}

@media (max-width: 520px) {
    .hp-discord-popup {
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hp-discord-popup { animation: none; }
    .hp-discord-icon  { animation: none; }
}

.hp-rank-updated {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    padding: 7px 12px;
    color: var(--hp-muted);
    font-size: 11px;
    letter-spacing: 0.2px;
    background: rgba(200, 145, 66, 0.05);
}

.hp-rank-updated i {
    font-size: 10px;
    opacity: 0.75;
}
