:root {
    --bg-color: #091D4A;
    --primary: #ffffff;
    --accent: #F6BB24;
    --btn-bg: #E1923A;
    --btn-hover: #DA5114;
    --tile-glow: #F6BB24AA;
    --modal-bg: rgba(9, 29, 74, 0.95);
    --heading-gradient-top: #F6BB24;
    --heading-gradient-bottom: #DA5114;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--primary);
    height: 100%;
    width: 100%;
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-color);
    text-align: center;
    padding: 1rem;
}

.portrait-wrapper {
    width: 100%;
    height: 100%;
    max-width: 420px;
    max-height: 800px;
    background-color: var(--bg-color);
    margin: auto;
    border-radius: 16px;
    box-shadow: 0 0 15px var(--tile-glow);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-bg);
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal-content {
    background-color: var(--bg-color);
    padding: 0.75rem;
    border-radius: 12px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 15px var(--accent);
}
#ad-banner {
    width: 90%;
    height: 12rem;
    margin: 1rem 1rem 0 1rem;
    border-radius: 12px;
    box-shadow: 0 0 12px var(--tile-glow);
    background-color: #1a1a2f;
    display: flex;
    justify-content: center;
    align-items: center;
}

    #ad-banner img {
        max-width: 100%;
        height: 12rem;
        border-radius: 8px;
        object-fit: cover;
    }


.game-title,
.title-text,
.result-text,
h2,
h3{
    font-size: 1.5rem;
    background: linear-gradient(to bottom, var(--heading-gradient-top), var(--heading-gradient-bottom));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    text-shadow: none;
}

/* Options Bar*/
.options-bar {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}
/* Game Screen Choices */
.choices {
    display: flex;
    justify-content: space-around;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tile-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tile {
    width: 90px;
    height: 90px;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 0 10px var(--tile-glow);
    overflow: hidden;
    cursor: pointer;
}

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

.tile-label {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: bold;
}

.player-label, .opponent-label {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-style: italic;
    text-transform: uppercase;
}

#revealed-ai-tile {
    background-color: var(--tile-glow);
}

.triangle-img {
    margin: 1rem;
    width: 100%;
    max-width: 300px;
}

.action-button {
    font-size: 0.85rem;
    padding: 0.75rem 1.5rem;
    margin: 0.5rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background-color: var(--btn-bg);
    color: #fff;
    box-shadow: 0 0 8px var(--tile-glow);
    transition: background-color 0.3s ease;
}
.main-button,
.secondary-button,
.modal-btn,
.tab-btn {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    margin: 0.5rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background-color: var(--btn-bg);
    color: var(--primary);
    box-shadow: 0 0 8px var(--tile-glow);
    transition: background-color 0.3s ease;
}

    .action-button:hover,
    .main-button:hover,
    .secondary-button:hover,
    .modal-btn:hover,
    .tab-btn:hover {
        background-color: var(--btn-hover);
        color: #fff;
    }

.logout-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
}

    .logout-icon:hover {
        transform: scale(1.1);
        box-shadow: 0 0 10px var(--accent);
    }

.modal-close {
    position: inherit;
    margin-left: 95%;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    cursor: pointer;
    background: transparent;
    border: none;
}

    .modal-close:hover {
        color: #f00;
    }

.icon-center svg {
    display: block;
    margin: auto;
    margin-top: 0.4rem;
}

/* Collection Modal */
#collection-content, #stats-content {
    max-height: 90vh; /* Responsive height */
    overflow-y: auto;
    overflow-x: hidden;
}

.collection-grid {
    width: 100%;
    padding: 0.1rem;
}

    .collection-grid h3 {
        color: var(--accent);
        margin: 0.5rem 0 0.5rem;
        font-size: 1.2rem;
        text-align: left;
    }

.locked-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.85);
    color: #fff;
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-block;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10;
    border-radius: 12px;
    backdrop-filter: blur(2px);
}
    .locked-overlay h3 {
        color: var(--accent);
        margin-top: 2rem;
        font-size: 1.2rem;
        text-align: center;
    }
.bonus-rewards {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    color: #fff;
}

.bonus-reward-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

    .bonus-reward-item img {
        width: 20px;
        height: 20px;
    }

.collection-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.5rem;
    position: relative;
    padding: 0.25rem;
}

.collection-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 90px;
    margin-bottom: 0.5rem;
}

.card-image-wrapper {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 10px var(--tile-glow);
    background: #fff;
}

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

.card-label {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
    margin-top: 0.3rem;
}
.activate-class-btn {
    font-size: 0.7rem;
    padding: 4px 8px;
    background-color: #222;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    margin-left: auto;
    transition: background 0.2s ease;
}

    .activate-class-btn:hover {
        background-color: var(--accent);
        color: #000;
    }
#game-logo {
    max-width: 300px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    border: none;
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--accent);
    cursor: pointer;
}

    .tab-btn.active {
        background: var(--btn-bg);
        color: #fff;
    }

.tab-content {
    display: none;
}
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    font-size: 0.85rem;
}

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.5rem;
        border-bottom: 1px solid #444;
        text-align: center;
    }

    .leaderboard-table th {
        background-color: #222;
        color: var(--accent);
    }

.highlight-row {
    background-color: #333 !important;
    color: var(--accent);
    font-weight: bold;
}

/* Profile Section */
.profile-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.1rem;
    margin: 1rem 0;
    padding: 0.5rem 0;
}

.profile-left {
    width: 70%;
    text-align: left;
}

.profile-right {
    width: 30%;
    text-align: right;
    font-size: 1.5rem;
}

.ign-address {
    font-size: 1.5rem;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.level-exp {
    height: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.xp-bar-wrap {
    flex-grow: 1;
}

#xp-bar-container {
    margin-top: 0.2rem;
    height: 18px;
    background: #444;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

#xp-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.5s ease-in-out;
}

#xp-label {
    text-align: center;
    font-size: 0.75rem;
    font-weight: bold;
    top: 0;
    line-height: 18px;
    color: #1c1c1c;
}

#level-label {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
}

.refresh-timer {
    font-size: 0.7rem;
    margin-top: 0.65rem;
    font-weight: bold;
}

.gold-display {
    color: var(--accent);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Results Modal */
.battle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    gap: 1rem;
}
.winner-glow {
    animation: neon-glow 1.5s infinite;
    border: 3px solid var(--accent);
    border-radius: 12px;
    z-index: 2;
}
@keyframes neon-glow {
    0% {
        box-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent), 0 0 20px var(--accent);
    }

    50% {
        box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent), 0 0 30px var(--accent);
    }

    100% {
        box-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent), 0 0 20px var(--accent);
    }
}

/* Loading Overlay */
.loader-overlay {
    opacity: 98%;
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    display: flex; /* default ON */
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #333;
    border-top: 5px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}
/* IGN Input */
.ign-input {
    width: 90%;
    padding: 0.5rem;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid #666;
    margin: 0 auto 1rem auto;
    display: block;
    background: #fff;
    color: var(--bg-color);
    text-align: center;
}

.ign-error {
    color: var(--btn-hover);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* Modal z-index*/
#how-to-play-modal, #gacha-modal {
    z-index: 9999;
    overflow-y: auto;
}

#gacha-reward-modal {
    z-index: 99999 !important;
}

/* Settings Modal */
.settings-btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

/* Gacha and Inventory*/
.reward-popup-text {
    font-size: 1.5rem;
    margin: 1rem 0;
    color: #F6BB24;
    text-align: center;
}
#gacha-reward-grid, #inventory-grid {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.gacha-reward-box, .inventory-item {
    width: 5.5rem;
    height: 7rem;
    border-radius: 1rem;
    background-color: #1a1a2f;
    border: 2px solid #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #fff;
    transition: border 0.3s, box-shadow 0.3s;
    position: relative;
}

    .gacha-reward-box.highlighted, .inventory-item.highlighted {
        border-color: #F6BB24;
        box-shadow: 0 0 12px #F6BB24;
        z-index: 2;
    }

    .gacha-reward-box img, .inventory-item img {
        width: 2.5rem;
        height: 2.5rem;
        margin-bottom: 6px;
    }

.gacha-subtext {
    font-style: italic;
    color: #ccc;
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.gacha-error-label {
    color: #ff5a5a;
    font-weight: bold;
    text-align: center;
    margin: 10px 0;
    min-height: 20px;
}
#gacha-roll-btn:disabled {
    background-color: #888 !important;
    opacity: 0.6;
    cursor: not-allowed;
}

.feedback-message {
    margin-bottom: 10px;
    text-align: center;
    font-weight: bold;
}

    .feedback-message.error {
        color: red;
    }

    .feedback-message.success {
        color: green;
    }
.use-label {
    color: var(--accent);
    cursor: pointer;
}


/* Mobile Adjustments */
@media (max-width: 480px) {
    .portrait-wrapper {
        border-radius: 16px;
        max-width: 100%;
    }

    .landing-wrapper {
        border-radius: 16px;
        max-width: 100%;
        justify-content: inherit;
    }

    .game-title {
        font-size: 2rem;
    }

    .main-button, .secondary-button {
        font-size: 1rem;
        padding: 0.5rem 1.5rem;
    }

    .action-button {
        font-size: 0.7rem;
        padding: 0.5rem 1rem;
    }

    .profile-right {
        font-size: 1.2rem;
    }

    .ign-address {
        font-size: 1.2rem;
    }
    #game-screen {
        max-height: 90vh;
    }
}