/* ================================================================
   Leaderboard Join Modal — Canonical CSS Reference
   ================================================================
   This file is the canonical style reference for the leaderboard
   join integration. The join.js file injects these same styles
   inline via a <style> tag so it remains self-contained. When
   integrating into the main app, this file can be linked directly
   and the inline injection in join.js can be removed.
   ================================================================ */

/* Leaderboard Join Modal */
.lb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    backdrop-filter: blur(4px);
    animation: lbFadeIn 0.3s ease;
}

.lb-modal-overlay,
.lb-modal-content,
.lb-join-btn,
.lb-sign-btn,
.lb-modal-close,
.lb-creature-select,
.lb-modal-field input,
.lb-modal-field select {
    touch-action: manipulation;
}

.lb-modal-overlay.hidden {
    display: none;
}

@keyframes lbFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lb-modal-content {
    background: linear-gradient(180deg, #1a1a2e 0%, #12121f 100%);
    border: 2px solid #c9a227;
    border-radius: 12px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    position: relative;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 0 40px rgba(201, 162, 39, 0.4), 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: lbSlideUp 0.3s ease;
}

@keyframes lbSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.lb-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: #6b6b7b;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    transition: color 0.2s;
}

.lb-modal-close:hover {
    color: #c9a227;
}

.lb-modal-title {
    font-family: 'Cinzel Decorative', serif;
    font-size: 20px;
    color: #f4d03f;
    text-align: center;
    margin-bottom: 24px;
    text-shadow: 0 0 15px rgba(201, 162, 39, 0.4);
}

.lb-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Inventory-side character picker */
.lb-creature-panel {
    margin: -4px 0 14px;
    padding: 10px 12px;
    border: 1px solid #3d3a4a;
    border-radius: 6px;
    background: rgba(201, 162, 39, 0.06);
}

.lb-creature-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lb-creature-label {
    font-family: 'Cinzel', serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #a08c5b;
    white-space: nowrap;
}

.lb-creature-select {
    flex: 1;
    background: #12121f;
    border: 1px solid #3d3a4a;
    color: #f5e6c8;
    padding: 6px 10px;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    border-radius: 4px;
    outline: none;
}

.lb-creature-select:focus {
    border-color: #c9a227;
}

.lb-creature-select:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.lb-creature-help {
    margin-top: 6px;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #8d7f58;
}

.lb-modal-field label {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    color: #a08c5b;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.lb-modal-field input {
    width: 100%;
    background: #12121f;
    border: 1px solid #3d3a4a;
    color: #f5e6c8;
    padding: 10px 14px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.lb-modal-field select {
    width: 100%;
    background: #12121f;
    border: 1px solid #3d3a4a;
    color: #f5e6c8;
    padding: 10px 14px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.lb-modal-field input:focus {
    border-color: #c9a227;
}

.lb-modal-field select:focus {
    border-color: #c9a227;
}

.lb-field-help {
    display: block;
    margin-top: 6px;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #8d7f58;
}

.lb-char-count {
    display: block;
    text-align: right;
    font-size: 11px;
    color: #6b6b7b;
    margin-top: 4px;
    font-family: 'Fira Code', monospace;
}

.lb-modal-info {
    display: flex;
    justify-content: space-between;
    font-family: 'Cinzel', serif;
    font-size: 13px;
    color: #a08c5b;
    padding: 12px;
    background: rgba(201, 162, 39, 0.05);
    border: 1px solid #3d3a4a;
    border-radius: 4px;
}

.lb-modal-info strong {
    color: #f4d03f;
}

.lb-sign-btn {
    background: linear-gradient(180deg, #3d3a4a 0%, #2a2833 100%);
    border: 2px solid #c9a227;
    color: #c9a227;
    padding: 12px 24px;
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    min-height: 44px;
}

.lb-sign-btn:hover {
    background: rgba(201, 162, 39, 0.15);
    box-shadow: 0 0 15px rgba(201, 162, 39, 0.3);
}

.lb-sign-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toast */
.lb-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1a1a2e;
    border: 1px solid #c9a227;
    color: #f5e6c8;
    padding: 10px 18px;
    border-radius: 4px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    z-index: 9999;
    animation: lbToastIn 0.3s ease, lbToastOut 0.3s ease 2s forwards;
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.4);
}

@keyframes lbToastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes lbToastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Join button (below level) */
.lb-level-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.lb-join-btn-wrap {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.lb-join-btn {
    background: linear-gradient(180deg, #3d3a4a 0%, #2a2833 100%);
    border: 1px solid #c9a227;
    color: #c9a227;
    padding: 6px 12px;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    margin-top: 0;
    transition: all 0.2s ease;
    min-height: 40px;
}

.lb-update-tip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    max-width: 280px;
    padding: 6px 10px;
    border: 1px solid #c9a227;
    border-radius: 4px;
    background: rgba(12, 12, 24, 0.97);
    color: #f5e6c8;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 0 12px rgba(201, 162, 39, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.16s ease;
    z-index: 12;
}

.lb-update-tip.visible {
    opacity: 1;
    visibility: visible;
}

.lb-join-btn:hover {
    background: rgba(201, 162, 39, 0.15);
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.3);
}

.lb-join-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Rank badge */
.lb-rank-badge {
    display: inline-block;
    background: rgba(201, 162, 39, 0.15);
    border: 1px solid #c9a227;
    border-radius: 4px;
    padding: 2px 8px;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    color: #f4d03f;
    text-shadow: 0 0 8px rgba(201, 162, 39, 0.4);
    margin-left: 0;
}

@media (max-width: 900px) {
    .lb-modal-overlay {
        align-items: flex-start;
        padding: 16px 10px;
        overflow-y: auto;
    }

    .lb-modal-content {
        width: min(96vw, 460px);
        max-height: 90dvh;
        padding: 24px 16px;
        margin: 0 auto;
    }

    .lb-modal-title {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .lb-modal-info {
        flex-direction: column;
        gap: 8px;
    }

    .lb-modal-field input,
    .lb-modal-field select,
    .lb-creature-select {
        font-size: 16px;
        min-height: 44px;
    }

    .lb-toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        text-align: center;
    }
}

@media (max-width: 560px) {
    .lb-creature-row {
        flex-wrap: wrap;
    }

    .lb-creature-label {
        width: 100%;
    }

    .lb-level-actions {
        width: 100%;
    }

    .lb-join-btn-wrap {
        width: 100%;
    }

    .lb-join-btn {
        width: 100%;
    }

    .lb-update-tip {
        min-width: 0;
        width: min(92vw, 320px);
    }
}
