/* =====================================================
   LABERINT — CSS
   ===================================================== */

.maze-section {
    padding-top: calc(var(--header-h) + 1rem);
    padding-bottom: 2rem;
    min-height: calc(100vh - 80px);
}

.maze-panel {
    max-width: 560px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
    position: relative;
}

/* ==================== PANTALLA INICI ==================== */
.maze-char-preview {
    width: 90px;
    height: 90px;
    object-fit: contain;
    margin: 0 auto 1rem;
}

.maze-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 900;
    color: var(--verde);
    margin-bottom: .5rem;
}

.maze-intro {
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: .35rem;
}

.maze-hint {
    font-size: .9rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

.maze-start-items {
    display: flex;
    gap: .5rem;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
}

/* ==================== PANTALLA JOC ==================== */
.maze-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    margin-bottom: .5rem;
    font-weight: 800;
}

.maze-level-label {
    color: var(--verde);
    font-size: .95rem;
}

.maze-timer {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text);
    background: var(--bg);
    padding: .25rem .75rem;
    border-radius: var(--r-full);
    min-width: 55px;
    text-align: center;
    transition: color .2s ease, background .2s ease;
}

.maze-timer-danger {
    color: #e53935;
    background: #ffebee;
    animation: timer-pulse .5s ease infinite alternate;
}

@keyframes timer-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

/* Progress dots */
.maze-progress {
    display: flex;
    gap: .4rem;
    justify-content: center;
    margin-bottom: .75rem;
}

.maze-dot {
    font-size: 1.1rem;
    opacity: .3;
    transition: opacity .2s ease, transform .2s ease;
}

.maze-dot-done {
    opacity: 1;
}

.maze-dot-current {
    opacity: 1;
    transform: scale(1.25);
}

/* Grid */
.maze-grid {
    display: inline-grid;
    gap: 0;
    margin: 0 auto .5rem;
    border-radius: var(--r);
    overflow: hidden;
    border: 3px solid var(--verde);
}

.maze-cell {
    width: var(--cell-size, 40px);
    height: var(--cell-size, 40px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.maze-cell-wall { background: var(--verde); }
.maze-cell-path { background: var(--white); }
.maze-cell-player { background: var(--white); }
.maze-cell-goal { background: var(--white); }

.maze-player-img {
    width: 80%;
    height: 80%;
    object-fit: contain;
    animation: maze-bounce .5s ease infinite alternate;
}

.maze-goal-img {
    width: 65%;
    height: 65%;
    object-fit: contain;
}

.maze-goal-emoji,
.maze-player-emoji {
    font-size: calc(var(--cell-size, 40px) * 0.55);
    line-height: 1;
}

@keyframes maze-bounce {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-2px); }
}

.maze-moves-label {
    font-size: .9rem;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: .25rem;
}

.maze-exit-btn {
    position: absolute;
    top: .75rem;
    right: .75rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--muted);
    font-size: .9rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.maze-exit-btn:hover {
    background: var(--verde);
    color: var(--white);
}

/* ==================== CONTROLS TÀCTILS ==================== */
.maze-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    margin-top: .5rem;
}

.maze-controls-row {
    display: flex;
    gap: .3rem;
}

.maze-btn-dir {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--verde);
    color: var(--white);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    transition: background .1s ease, transform .1s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.maze-btn-dir:hover { background: #7aa31a; }
.maze-btn-dir:active { transform: scale(.9); background: #6e9010; }

@media (min-width: 769px) {
    .maze-controls { display: none; }
}

/* ==================== PANTALLA VICTÒRIA NIVELL ==================== */
.maze-lvl-title {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 900;
    color: var(--verde);
    margin-bottom: .5rem;
}

.maze-lvl-score {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

/* ==================== PANTALLA TEMPS ESGOTAT ==================== */
.maze-timeup-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 900;
    color: #e53935;
    margin-bottom: .5rem;
}

.maze-timeup-msg {
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.maze-timeup-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================== PANTALLA VICTÒRIA FINAL ==================== */
.maze-char-winner {
    animation: maze-winner-bounce 1s ease infinite alternate;
}

@keyframes maze-winner-bounce {
    0%   { transform: translateY(0) rotate(-3deg); }
    100% { transform: translateY(-10px) rotate(3deg); }
}

.maze-final-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 900;
    color: var(--verde);
    margin-bottom: .4rem;
}

.maze-final-msg {
    font-size: 1.1rem;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.maze-final-items {
    display: flex;
    gap: .5rem;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

.maze-final-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
    .maze-panel { padding: 1.25rem .75rem; }
    .maze-btn-dir { width: 48px; height: 48px; font-size: 1rem; }
    .maze-char-preview { width: 70px; height: 70px; }
    .maze-timeup-actions,
    .maze-final-actions { flex-direction: column; align-items: stretch; }
}
