/* === Map Screen === */
.map-container {
    padding: 16px 8px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: none;
}

.map-container::-webkit-scrollbar {
    display: none;
}

/* === World Section === */
.map-world {
    margin-bottom: 24px;
}

.map-world-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, rgba(123, 47, 190, 0.3) 0%, transparent 100%);
    border-left: 3px solid var(--gold);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.world-emoji {
    font-size: 1.5rem;
}

.world-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.world-name {
    font-size: var(--font-size-lg);
    font-weight: bold;
    color: var(--gold);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

/* === Path (Level Nodes) === */
.map-path {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 12px;
    position: relative;
}

/* Vertical path line */
.map-path::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg,
        var(--primary-light) 0%,
        var(--gold) 50%,
        var(--primary-light) 100%
    );
    opacity: 0.3;
    transform: translateX(-50%);
}

/* === Map Node === */
.map-node {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    max-width: 75%;
}

/* Alternate left/right */
.map-node--left {
    align-self: flex-start;
}

.map-node--right {
    align-self: flex-end;
    flex-direction: row-reverse;
    text-align: right;
}

/* === Node States === */

/* Locked */
.map-node--locked {
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.1);
    opacity: 0.5;
    cursor: not-allowed;
}

.map-node--locked .node-number,
.map-node--locked .node-label {
    color: var(--text-muted);
}

/* Unlocked (available but not started) */
.map-node--unlocked {
    background: var(--bg-card);
    border: 2px solid var(--primary-light);
}

.map-node--unlocked:active {
    transform: scale(0.97);
    border-color: var(--gold);
}

/* Current (first unlocked incomplete) */
.map-node--current {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: 2px solid var(--gold);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.3);
    animation: currentPulse 2s ease-in-out infinite;
}

@keyframes currentPulse {
    0%, 100% { box-shadow: 0 0 16px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 24px rgba(255, 215, 0, 0.6); }
}

.map-node--current:active {
    transform: scale(0.97);
}

/* Completed */
.map-node--completed {
    background: rgba(76, 175, 80, 0.15);
    border: 2px solid var(--success);
}

.map-node--completed:active {
    transform: scale(0.97);
}

/* === Node Elements === */
.node-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-white);
    font-weight: bold;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.map-node--current .node-number {
    background: var(--gold);
    color: var(--bg-dark);
}

.map-node--completed .node-number {
    background: var(--success);
}

.map-node--locked .node-number {
    background: rgba(255, 255, 255, 0.1);
}

.node-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-white);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.node-stars {
    font-size: 0.8rem;
    letter-spacing: 1px;
    flex-shrink: 0;
}

.node-lock {
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* === Boss Node === */
.map-node--boss {
    padding: 10px 14px;
    max-width: 85%;
}

.map-node--boss .node-emoji {
    font-size: 1.6rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(255, 82, 82, 0.5));
}

.node-boss-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.map-node--boss.map-node--locked .node-emoji {
    filter: grayscale(0.8);
}

.map-node--boss .node-label {
    font-size: 0.9rem;
    color: var(--error);
}

.map-node--boss.map-node--completed .node-label {
    color: var(--success);
}

/* === Map Header (back button area) === */
.map-header {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--bg-card);
}

.map-back-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: 4px 8px;
    -webkit-tap-highlight-color: transparent;
}

.map-back-btn:active {
    color: var(--gold);
}

/* === World Selection Screen === */
.worlds-container {
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
}

.worlds-title {
    font-size: var(--font-size-xl);
    color: var(--gold);
    text-align: center;
    margin: 0 0 20px;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.worlds-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 440px;
}

.world-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-card);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 16px 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.world-card:active {
    transform: scale(0.96);
    border-color: var(--gold);
}

.world-card--completed {
    border-color: var(--success);
    background: rgba(76, 175, 80, 0.1);
}

.world-card-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 8px rgba(123, 47, 190, 0.4));
}

.world-card-emoji {
    font-size: 3rem;
    margin-bottom: 8px;
}

.world-card-info {
    text-align: center;
    width: 100%;
}

.world-card-name {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--gold);
    margin-bottom: 4px;
    line-height: 1.2;
}

.world-card-level {
    font-size: 0.75rem;
    color: var(--text-white);
    margin-bottom: 2px;
}

.world-card-stars {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Logout / change player button */
.worlds-logout-btn {
    margin-top: 24px;
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.worlds-logout-btn:active {
    color: var(--gold);
    border-color: var(--gold);
}

/* World card info button & tooltip */
.world-card {
    position: relative;
}

.world-info-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    background: rgba(0, 0, 0, 0.4);
    color: var(--gold);
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}

.world-info-btn:active {
    background: var(--gold);
    color: var(--bg-dark);
}

.world-info-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-darker);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 0.75rem;
    color: var(--text-white);
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 200px;
    text-align: center;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    margin-bottom: 4px;
}

.world-info-tooltip.hidden {
    display: none;
}

/* World map header with back button */
.map-world-header--with-back {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-darker);
    margin-bottom: 12px;
}

.map-world-header--with-back .map-back-btn {
    margin-right: auto;
    font-size: 0.85rem;
    padding: 4px 0;
}
