*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #020617;
    color: #e5e7eb;
    overflow: hidden;
}

.game-wrapper {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

#gameCanvas {
    flex: 1;
    display: block;
    background: radial-gradient(circle at 50% 0%, #1d283a 0, #020617 60%);
}

/* HUD */

.hud {
    padding: 8px 16px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.7);
    z-index: 10;
}

.hud-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.hud-title h1 {
    font-size: 18px;
    margin-bottom: 4px;
}

.hud-title p {
    font-size: 13px;
    color: #9ca3af;
}

.hud-status {
    flex: 1;
    max-width: 540px;
}

#hp-bar {
    width: 100%;
    height: 18px;
    border-radius: 999px;
    border: 1px solid #4b5563;
    background: #020617;
    overflow: hidden;
    margin-bottom: 4px;
}

#hp-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #65a30d);
    transition: width 0.15s ease-out;
}

.hud-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
}

.hud-status-row span {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(30, 64, 175, 0.3);
    border: 1px solid rgba(96, 165, 250, 0.4);
}

.hud-scores {
    min-width: 180px;
    max-width: 220px;
}

.hud-scores h2 {
    font-size: 14px;
    margin-bottom: 4px;
}

#scores-list {
    list-style: none;
    font-size: 12px;
    max-height: 64px;
    overflow-y: auto;
    padding-right: 4px;
}

#scores-list li {
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

#scores-list li span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hud-controls {
    margin-top: 6px;
    font-size: 12px;
    color: #9ca3af;
}

.hud-controls kbd {
    background: #111827;
    border-radius: 4px;
    padding: 1px 4px;
    border: 1px solid #4b5563;
    font-size: 11px;
}

/* Overlay (shared) */

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.overlay.hidden {
    display: none;
}

.overlay-box {
    background: #020617;
    border-radius: 12px;
    padding: 24px 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.75);
    border: 1px solid #1e293b;
    text-align: center;
    max-width: 360px;
}

.overlay-box.wide {
    max-width: 720px;
    text-align: left;
}

.overlay-box h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

.overlay-box p {
    font-size: 14px;
    color: #9ca3af;
    margin-bottom: 16px;
}

.overlay-highscore {
    margin-bottom: 16px;
}

.overlay-highscore label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.overlay-highscore input {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #4b5563;
    background: #020617;
    color: #e5e7eb;
    margin-bottom: 6px;
    font-size: 13px;
}

.overlay-highscore button {
    cursor: pointer;
    border-radius: 999px;
    padding: 6px 14px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    background: #3b82f6;
    color: #e5f0ff;
    margin-bottom: 6px;
}

.overlay-box button {
    cursor: pointer;
    border-radius: 999px;
    padding: 8px 20px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    background: #22c55e;
    color: #022c22;
    box-shadow: 0 6px 14px rgba(34, 197, 94, 0.35);
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out, background 0.1s ease-out;
}

.overlay-box button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(34, 197, 94, 0.45);
    background: #16a34a;
}

.overlay-box button:active {
    transform: translateY(1px);
    box-shadow: 0 3px 8px rgba(34, 197, 94, 0.35);
}

.small-note {
    font-size: 12px;
    color: #6b7280;
    margin-top: -6px;
    margin-bottom: 12px;
}

/* Pause content */

.pause-content {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pause-column {
    flex: 1;
    min-width: 260px;
}

.pause-column h3 {
    font-size: 15px;
    margin-bottom: 8px;
}

/* Save slots */

#save-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.save-slot {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #1f2937;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.save-slot-info {
    display: flex;
    flex-direction: column;
}

.save-slot-actions {
    display: flex;
    gap: 6px;
}

.save-slot button {
    cursor: pointer;
    border-radius: 999px;
    padding: 4px 8px;
    border: none;
    font-size: 11px;
    font-weight: 500;
    background: #1d4ed8;
    color: #e5f0ff;
}

.save-slot button:nth-child(2) {
    background: #4b5563;
}

/* Inventory */

#inventory-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.inventory-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #1f2937;
    background: rgba(15, 23, 42, 0.9);
}

.inventory-item-main {
    display: flex;
    flex-direction: column;
}

.inventory-item-status.locked {
    color: #f97316;
}

.inventory-item-status.unlocked {
    color: #22c55e;
}

.inventory-item button {
    cursor: pointer;
    border-radius: 999px;
    padding: 4px 8px;
    border: none;
    font-size: 11px;
    font-weight: 500;
    background: #22c55e;
    color: #022c22;
}
