/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #333;
}

/* === Portal Layout === */
.portal {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}

/* === Header === */
.portal-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
}

.portal-header h1 {
    font-size: 2.8rem;
    color: white;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.tagline {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

/* === Section Headings === */
.players-section,
.games-section {
    margin-bottom: 36px;
}

.players-section h2,
.games-section h2 {
    color: white;
    font-size: 1.3rem;
    margin-bottom: 16px;
    padding-left: 4px;
}

/* === Players Grid === */
.players-grid {
    display: flex;
    gap: 24px;
    justify-content: center;
}

.player-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 24px 32px;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}

.player-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.player-avatar-wrapper {
    position: relative;
    cursor: pointer;
    border-radius: 50%;
    padding: 3px;
    border: 3px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s;
}

.player-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.4);
    transition: border-color 0.2s;
    background: rgba(255, 255, 255, 0.1);
}

.player-avatar-wrapper:hover .player-avatar {
    border-color: #ffd93d;
}

.avatar-edit-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 28px;
    height: 28px;
    background: #ffd93d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s;
}

.player-avatar-wrapper:hover .avatar-edit-badge {
    opacity: 1;
}

.player-name {
    color: white;
    font-weight: 700;
    font-size: 1.05rem;
    text-align: center;
}

/* Player title badge & catchphrase on portal */
.player-title-badge {
    font-size: 0.78rem;
    font-weight: 700;
    color: #ffd93d;
    text-shadow: 0 1px 6px rgba(255,217,61,0.3);
    text-align: center;
}

.player-catchphrase {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.45);
    font-style: italic;
    text-align: center;
    max-width: 140px;
    line-height: 1.3;
}

/* === Portal Avatar Frames (simplified) === */
.player-avatar-wrapper.frame-gold { border-color: #ffd700; box-shadow: 0 0 16px rgba(255,215,0,0.3); }
.player-avatar-wrapper.frame-gold::after { content:'👑'; position:absolute; top:-14px; left:50%; transform:translateX(-50%); font-size:1.1rem; z-index:2; }
.player-avatar-wrapper.frame-hearts { border-color: #ff69b4; box-shadow: 0 0 16px rgba(255,105,180,0.3); }
.player-avatar-wrapper.frame-rainbow {
    border: 3px solid transparent;
    background-image: linear-gradient(rgba(26,26,46,1), rgba(26,26,46,1)),
                      conic-gradient(#ff0000,#ff8800,#ffff00,#00ff00,#0088ff,#8800ff,#ff0000);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}
.player-avatar-wrapper.frame-sparkle { border-color: #c0c0ff; box-shadow: 0 0 16px rgba(192,192,255,0.4); }
.player-avatar-wrapper.frame-flowers { border-color: #77dd77; box-shadow: 0 0 16px rgba(119,221,119,0.3); }
.player-avatar-wrapper.frame-ocean { border-color: #00bcd4; box-shadow: 0 0 16px rgba(0,188,212,0.3); }
.player-avatar-wrapper.frame-fire { border-color: #ff5722; box-shadow: 0 0 16px rgba(255,87,34,0.3); }

/* === Games Grid === */
.games-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.game-card {
    display: flex;
    align-items: center;
    gap: 18px;
    background: white;
    border-radius: 16px;
    padding: 20px 24px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 5px solid var(--accent, #667eea);
}

.game-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.game-card.coming-soon {
    opacity: 0.5;
    pointer-events: none;
    border-left-color: #aaa;
}

.game-emoji {
    font-size: 2.4rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.game-info {
    flex: 1;
}

.game-info h3 {
    font-size: 1.15rem;
    margin-bottom: 4px;
    color: #222;
}

.game-info p {
    font-size: 0.88rem;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.4;
}

.game-topics {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.topic-badge {
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #f0f2ff;
    color: #667eea;
}

.game-play-arrow {
    font-size: 1.4rem;
    color: var(--accent, #667eea);
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.game-card:hover .game-play-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* === Modal (Avatar Picker) === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

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

.modal-content h3 {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.modal-player-name {
    color: #888;
    margin-bottom: 20px;
}

.avatar-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.avatar-option {
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
    aspect-ratio: 1;
}

.avatar-option:hover {
    border-color: #667eea;
    transform: scale(1.1);
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #f0f0f0;
}

.btn-secondary-sm {
    padding: 8px 24px;
    background: #f0f0f0;
    color: #666;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary-sm:hover {
    background: #e0e0e0;
}

/* === Responsive === */
@media (max-width: 600px) {
    .portal-header h1 {
        font-size: 2rem;
    }

    .players-grid {
        gap: 16px;
    }

    .player-avatar {
        width: 70px;
        height: 70px;
    }

    .player-card {
        padding: 18px 22px;
    }

    .game-card {
        padding: 16px 18px;
        gap: 14px;
    }

    .game-emoji {
        font-size: 1.8rem;
        width: 44px;
        height: 44px;
    }

    .avatar-options {
        grid-template-columns: repeat(3, 1fr);
    }
}
