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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a12;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #fff;
    cursor: crosshair;
}

#game {
    display: block;
    width: 100%;
    height: 100%;
}

/* ========== Overlays ========== */
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.overlay > * {
    pointer-events: auto;
}

/* ========== Title screen ========== */
#title-screen .title {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #00e0ff, #ff3cac);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

#title-screen .subtitle {
    font-size: 1.1rem;
    opacity: 0.6;
    margin-bottom: 1.5rem;
}

.enemy-guide {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 1.2rem;
    padding: 1rem 1.4rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.eg-row {
    font-size: 0.88rem;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 8px;
}

.eg-row b {
    min-width: 52px;
    opacity: 1;
}

.eg-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Title stats */
.title-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 20px;
    margin-bottom: 1.2rem;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 250px;
}

.title-stats:empty {
    display: none;
}

.ts-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    opacity: 0.5;
    padding: 2px 0;
}

.ts-row span:last-child {
    font-weight: 700;
    opacity: 1;
    color: #00e0ff;
}

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

/* ========== Buttons ========== */
.btn {
    padding: 0.9rem 2.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: linear-gradient(135deg, #00e0ff, #7b5cff);
    color: #fff;
    letter-spacing: 0.05em;
    transition: transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 0 20px rgba(0, 224, 255, 0.25);
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 224, 255, 0.45);
}

.btn:active {
    transform: scale(0.97);
}

.btn-row {
    display: flex;
    gap: 8px;
    margin-top: 0.7rem;
}

.btn-sm {
    padding: 0.5rem 1.2rem;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.65);
    transition: background 0.15s, color 0.15s, transform 0.1s;
}

.btn-sm:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    transform: scale(1.04);
}

.btn-sm:active {
    transform: scale(0.96);
}

/* ========== Level-up screen ========== */
#level-up {
    background: rgba(5, 5, 15, 0.75);
    backdrop-filter: blur(6px);
}

.lu-title {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    background: linear-gradient(135deg, #ffaa00, #ff3cac);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.2rem;
}

.lu-subtitle {
    font-size: 1rem;
    opacity: 0.5;
    margin-bottom: 1.8rem;
}

.lu-cards {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.lu-card {
    width: 185px;
    padding: 1.3rem 1rem 1.1rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    text-align: center;
    transition: transform 0.12s, border-color 0.15s, box-shadow 0.15s;
    pointer-events: auto;
}

.lu-card:hover {
    transform: scale(1.06) translateY(-4px);
    border-color: var(--card-color, rgba(255, 255, 255, 0.3));
    box-shadow: 0 0 24px var(--card-glow, rgba(0, 224, 255, 0.2));
}

.lu-card:active {
    transform: scale(0.98);
}

.lu-card-icon {
    font-size: 2rem;
    margin-bottom: 0.4rem;
    line-height: 1;
}

.lu-card-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.lu-card-level {
    font-size: 0.75rem;
    opacity: 0.45;
    margin-bottom: 0.4rem;
}

.lu-card-desc {
    font-size: 0.82rem;
    opacity: 0.65;
    line-height: 1.3;
}

/* ========== Game-over screen ========== */
#game-over .go-title {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #ff3c6f;
    margin-bottom: 0.4rem;
}

#game-over .go-score {
    font-size: 1.6rem;
    margin-bottom: 0.15rem;
}

#game-over .go-level {
    font-size: 1.1rem;
    opacity: 0.7;
    color: #ffaa00;
    margin-bottom: 0.1rem;
}

#game-over .go-wave {
    font-size: 0.95rem;
    opacity: 0.5;
    color: #00e0ff;
    margin-bottom: 0.1rem;
}

#game-over .go-time {
    font-size: 0.9rem;
    opacity: 0.4;
    margin-bottom: 0.2rem;
}

#game-over .go-high {
    font-size: 1rem;
    opacity: 0.55;
    margin-bottom: 0.5rem;
}

.go-name-row {
    margin-bottom: 1rem;
}

#go-name {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    padding: 0.55rem 1rem;
    width: 150px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    outline: none;
    font-family: inherit;
}

#go-name::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

#go-name:focus {
    border-color: #00e0ff;
    box-shadow: 0 0 12px rgba(0, 224, 255, 0.2);
}

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

/* ========== Leaderboard ========== */
.lb-panel,
.ach-panel {
    background: rgba(10, 10, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.8rem 2.2rem;
    min-width: 340px;
    max-width: 420px;
    backdrop-filter: blur(10px);
}

.lb-title,
.ach-title {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #00e0ff, #7b5cff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lb-tabs {
    display: flex;
    gap: 3px;
    margin-bottom: 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    padding: 3px;
}

.lb-tab {
    flex: 1;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.15s;
    font-family: inherit;
}

.lb-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.lb-tab:hover {
    color: rgba(255, 255, 255, 0.7);
}

.lb-list {
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.lb-entry {
    display: flex;
    align-items: center;
    padding: 0.45rem 0.5rem;
    border-radius: 4px;
    gap: 8px;
    font-size: 0.85rem;
}

.lb-entry:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.lb-rank {
    font-weight: 800;
    min-width: 28px;
    opacity: 0.4;
}

.lb-name {
    font-weight: 700;
    flex: 1;
}

.lb-score {
    font-weight: 800;
    color: #00e0ff;
    min-width: 48px;
    text-align: right;
}

.lb-meta {
    font-size: 0.72rem;
    opacity: 0.35;
    min-width: 52px;
    text-align: right;
}

.lb-gold .lb-rank  { color: #ffd700; opacity: 1; }
.lb-silver .lb-rank { color: #c0c0c0; opacity: 1; }
.lb-bronze .lb-rank { color: #cd7f32; opacity: 1; }

.lb-empty {
    text-align: center;
    padding: 2rem;
    opacity: 0.3;
    font-size: 0.88rem;
}

/* ========== Achievements ========== */
.ach-grid {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 380px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.ach-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.ach-unlocked {
    border-color: rgba(255, 200, 0, 0.18);
    background: rgba(255, 200, 0, 0.04);
}

.ach-locked {
    opacity: 0.4;
}

.ach-icon {
    font-size: 1.4rem;
    min-width: 30px;
    text-align: center;
}

.ach-info {
    flex: 1;
    min-width: 0;
}

.ach-name {
    font-weight: 700;
    font-size: 0.88rem;
}

.ach-desc {
    font-size: 0.76rem;
    opacity: 0.5;
    line-height: 1.3;
}

/* ========== Scrollbar ========== */
.lb-list::-webkit-scrollbar,
.ach-grid::-webkit-scrollbar {
    width: 4px;
}

.lb-list::-webkit-scrollbar-track,
.ach-grid::-webkit-scrollbar-track {
    background: transparent;
}

.lb-list::-webkit-scrollbar-thumb,
.ach-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}
