/* === VARIABLES === */
:root {
    --primary: #d4af37;
    --text: #e0e0e0;
}

/* === BASE === */
html {
    overflow-x: hidden;   /* belt-and-suspenders: no horizontal pan/zoom on mobile */
}

body {
    margin: 0;
    padding: 2rem 0;
    min-height: 100vh;
    box-sizing: border-box;
    overflow-x: hidden;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: "Liberation Sans", Arial, sans-serif;
    color: var(--text);
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('mubg.webp') no-repeat center center fixed;
    background-size: cover;
    background-color: #0a0a0a;
}

.stats-body {
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('mubg.webp') no-repeat center center fixed;
    background-size: cover;
}

/* === LANGUAGE SWITCHER === */
.lang-switch {
    text-align: right;
    font-size: 0.7rem;
    margin-bottom: -10px;
    font-weight: bold;
}

.lang-switch span {
    cursor: pointer;
    color: #666;
    transition: 0.3s;
    padding: 0 5px;
}

.lang-switch span.active {
    color: var(--primary);
}

/* === CONTAINER === */
.container {
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
}

.stats-body .container {
    max-width: 800px;
}

/* === HEADINGS === */
h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 2rem;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* === FORMS === */
.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: #aaa;
    text-transform: uppercase;
}

input {
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 6px;
    transition: 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.7);
}

/* === BUTTONS === */
button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #d4af37 0%, #a68a2d 100%);
    border: none;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    border-radius: 6px;
    text-transform: uppercase;
    transition: 0.3s;
    margin-top: 1rem;
}

button:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
}

/* === MESSAGES === */
#message {
    margin-top: 1.5rem;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    display: none;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
}

.success {
    background: rgba(39, 174, 96, 0.2);
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.error {
    background: rgba(192, 57, 43, 0.2);
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

/* === WARNING BOX === */
.warning-box {
    background: rgba(212, 175, 55, 0.1);
    border-left: 3px solid var(--primary);
    padding: 10px;
    font-size: 0.75rem;
    margin-top: 10px;
    color: #d4af37;
}

/* === LOADER SPINNER === */
.spinner-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 3px solid #000;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === FOOTER NAV === */
.footer-nav {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.nav-link {
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 20px;
    border-radius: 8px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.nav-link:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
}

.nav-link:active {
    transform: translateY(0);
}

/* === CREDITS === */
.credits {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.credits a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.3);
    transition: all 0.4s ease;
    font-weight: 400;
}

.credits a span {
    font-weight: 300;
}

.credits a:hover {
    color: var(--primary);
    opacity: 1;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

/* === RANKING TABLE === */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th {
    text-align: left;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

td {
    padding: 15px;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.master-level {
    text-align: center;
}

td.master-level {
    color: #8b0000;
    font-weight: bold;
}

tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.char-name {
    font-weight: bold;
    color: #fff;
}

.rank-number {
    color: var(--primary);
    font-weight: bold;
    width: 30px;
}

.reset-badge {
    background: rgba(212, 175, 55, 0.15);
    color: var(--primary);
    border: 1px solid rgba(212, 175, 55, 0.4);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 10px;
    display: inline-block;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:nth-child(1) .char-name {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* characters who reached the server reset cap (muConfig.maxResets) get a glowing
   reset badge — rank #1 is marked separately by its gold character name */
.reset-badge.max-reset {
    background: rgba(255, 215, 0, 0.25);
    border-color: #ffd700;
    color: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.45);
}

.table-loader {
    text-align: center;
    padding: 20px;
    color: var(--primary);
}

/* === SERVER STATUS === */
.server-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: -10px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #aaa;
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #666;
    display: inline-block;
    flex-shrink: 0;
    transition: background 0.3s;
}

#statusText {
    line-height: 1;
}

.status-dot.online {
    background: #2ecc71;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.6);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background: #e74c3c;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === ARMORY === */
.armory-body {
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('mubg.webp') no-repeat center center fixed;
    background-size: cover;
}

.armory-body .container {
    max-width: 860px;
}

.armory-search {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 1.8rem;
}

.armory-search input {
    flex: 1 1 auto;
    width: auto;          /* override global "input { width: 100% }" */
    min-width: 0;         /* allow the flex item to shrink properly */
    max-width: 300px;
    padding: 0.7rem 1rem;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    font-size: 1rem;
}

.armory-search input:focus {
    outline: none;
    border-color: var(--primary);
}

.armory-search button {
    flex: 0 0 auto;       /* keep the button at its content size */
    width: auto;          /* override global "button { width: 100% }" */
    margin-top: 0;        /* override global "button { margin-top: 1rem }" */
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #1a1a1a;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    cursor: pointer;
    transition: filter 0.2s;
}

.armory-search button:hover {
    filter: brightness(1.1);
}

.armory-content {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

/* Left: character panel */
.armory-char {
    flex: 0 0 240px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.armory-char-image {
    width: 100%;
    max-width: 200px;
    height: auto;
    opacity: 0.9;
}

.armory-char-name {
    color: var(--primary);
    font-size: 1.3rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

.armory-char-class {
    color: #aaa;
    font-style: italic;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.armory-char-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--text);
}

.armory-char-stats b {
    color: #fff;
}

/* Right: equipment paper doll */
.armory-equip {
    flex: 1;
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.armory-doll {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
}

.armory-slot {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.armory-slot.filled {
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.08);
    cursor: help;
}

.armory-slot img {
    max-width: 86%;
    max-height: 86%;
    object-fit: contain;
    image-rendering: pixelated;
}

.armory-slot img.img-missing {
    visibility: hidden;
}

.armory-slot .slot-label {
    color: #555;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.armory-slot .badge {
    position: absolute;
    font-size: 0.6rem;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 4px;
    line-height: 1.2;
}

.armory-slot .badge.exc { top: 3px; left: 3px; background: rgba(46, 204, 113, 0.85); color: #07210f; }
.armory-slot .badge.anc { top: 3px; right: 3px; background: rgba(255, 215, 0, 0.9); color: #2a2100; }
.armory-slot .badge.sock { bottom: 3px; right: 3px; background: rgba(155, 89, 182, 0.9); color: #fff; }

.armory-message {
    text-align: center;
    color: #aaa;
    padding: 1rem;
}

.armory-message.error {
    color: #e74c3c;
}

/* Themed item tooltip */
.item-tooltip {
    display: none;
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    max-width: 320px;
    padding: 10px 13px;
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-top: 3px solid var(--primary);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 0.8rem;
    line-height: 1.55;
    color: #cfcfcf;
}

.item-tooltip .tip-head {
    color: var(--primary);
    font-weight: bold;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.item-tooltip .tip-line.opt { color: #4aa3ff; }   /* normal options & luck - blue */
.item-tooltip .tip-line.exc { color: #2ecc71; }   /* excellent options - green */
.item-tooltip .tip-line.skill { color: #ffffff; } /* skill - white */
.item-tooltip .tip-line.sock { color: #b18bd8; }  /* sockets - purple */

/* armory paper-doll stacks earlier (640px) than the global phone breakpoint */
@media (max-width: 640px) {
    .armory-content {
        flex-direction: column;
    }
    .armory-char {
        flex: none;
        width: 100%;
        box-sizing: border-box;
    }
}

/* === MOBILE (phones) === */
@media (max-width: 480px) {
    body {
        padding: 1rem 0.75rem;   /* horizontal breathing room, stop edge-clipping */
    }

    .container {
        padding: 1.5rem;         /* tighter than the 2.5rem desktop padding */
    }

    h2 {
        font-size: 1.3rem;
        letter-spacing: 1px;
        margin-bottom: 1.5rem;
        word-break: break-word;
    }

    .footer-nav {
        gap: 10px;
        margin-top: 1.8rem;
        padding-top: 1.5rem;
    }

    .nav-link {
        padding: 8px 14px;
        font-size: 0.78rem;
    }

    /* ranking table: fit 5 columns on a narrow screen */
    th,
    td {
        padding: 8px 6px;
        font-size: 0.82rem;
    }

    .reset-badge {
        margin-left: 6px;
        padding: 1px 5px;
        font-size: 0.65rem;
    }
}
