* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

#app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    width: 100%;
    max-width: 432px;
    position: relative;
}

/* --- Header --- */
header {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    justify-content: space-between;
}

h1 {
    font-size: 2.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #f7971e, #ffd200);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.level-badge {
    background: #16213e;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* --- Score display --- */
.score-display {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* --- Progress bar --- */
.progress-section {
    width: 100%;
    position: relative;
    height: 50px;
    display: flex;
    align-items: flex-end;
    padding-bottom: 4px;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.12);
    border-radius: 3px;
    overflow: hidden;
    position: absolute;
    bottom: 4px;
    left: 0;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s ease-out, background 0.5s;
}

.progress-markers {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

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

.marker .tile-mini {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 800;
}

.marker-current .tile-mini {
    width: 36px;
    height: 36px;
    font-size: 0.65rem;
    border: 2px solid #ffd200;
}

.goal-label {
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 2px;
}

/* --- Grid --- */
#grid {
    border-radius: 12px;
    cursor: pointer;
}

/* --- Button --- */
#new-game {
    background: linear-gradient(135deg, #f7971e, #ffd200);
    color: #1a1a2e;
    border: none;
    border-radius: 8px;
    padding: 10px 28px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}

#new-game:active {
    transform: scale(0.95);
}

/* --- Level up overlay --- */
.level-up-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.level-up-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.level-up-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 48px;
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    transform: scale(0.5);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.level-up-overlay.show .level-up-content {
    transform: scale(1);
}

.level-up-crown {
    font-size: 3rem;
}

.level-up-text {
    font-size: 1.8rem;
    font-weight: 900;
    color: #ffd200;
}
