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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #0a0a12;
    color: #eee;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 960px;
    padding: 16px;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.screen.active {
    display: flex;
}

.stickman-home {
    align-self: flex-start;
    color: hsla(0, 0%, 100%, 0.55);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid hsla(0, 0%, 100%, 0.15);
}

.stickman-home:hover {
    color: #f7c948;
    border-color: hsla(45, 80%, 55%, 0.4);
}

.game-title {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #ff6b35, #f7c948, #ff6b35);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.game-subtitle {
    color: #888;
    font-size: 1rem;
    letter-spacing: 2px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 280px;
}

.btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b35, #e8450a);
    color: #fff;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: #2a2a3a;
    color: #ccc;
    border: 1px solid #444;
}

.coin-display {
    font-size: 1.2rem;
    font-weight: 700;
    color: #f7c948;
    letter-spacing: 1px;
}

.unlock-progress {
    color: #888;
    font-size: 0.9rem;
}

.chest-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 500px;
}

.chest-card {
    background: #14141f;
    border: 2px solid #444;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.2s;
}

.chest-card:hover:not(.disabled) {
    transform: translateY(-3px);
    border-color: #f7c948;
}

.chest-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.chest-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.chest-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.chest-cost {
    color: #f7c948;
    font-weight: 700;
    margin: 8px 0;
}

.chest-desc {
    font-size: 0.8rem;
    color: #888;
}

.chest-reveal {
    background: #14141f;
    border: 2px solid #f7c948;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    animation: revealPop 0.4s ease;
}

.chest-reveal.hidden {
    display: none;
}

@keyframes revealPop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.reveal-rarity {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
}

.char-card.locked {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.char-card.locked:hover {
    transform: none;
    border-color: #333;
}

.lock-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.2rem;
}

.rarity-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.char-card {
    position: relative;
}

.controls-hint {
    color: #555;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 16px;
}

h2 {
    font-size: 1.6rem;
    letter-spacing: 2px;
}

.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    width: 100%;
    max-width: 800px;
}

#bossGrid {
    max-height: 440px;
    overflow-y: auto;
    padding-right: 8px;
}

#charGrid {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 8px;
}

#bossGrid::-webkit-scrollbar,
#charGrid::-webkit-scrollbar {
    width: 6px;
}

#bossGrid::-webkit-scrollbar-thumb,
#charGrid::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.char-search {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 16px;
    padding: 10px 14px;
    border: 2px solid #333;
    border-radius: 8px;
    background: #14141f;
    color: #eee;
    font-size: 1rem;
    display: block;
}

.char-search:focus {
    outline: none;
    border-color: #f7c948;
}

.char-card {
    background: #14141f;
    border: 2px solid #333;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
    text-align: center;
}

.char-card:hover {
    border-color: #ff6b35;
    transform: scale(1.03);
}

.char-card.selected {
    border-color: #f7c948;
    box-shadow: 0 0 20px rgba(247, 201, 72, 0.3);
}

.char-card canvas {
    display: block;
    margin: 0 auto 12px;
}

.char-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.char-stats {
    font-size: 0.8rem;
    color: #888;
    line-height: 1.5;
}

.map-card canvas {
    border-radius: 6px;
    width: 100%;
}

.hud-map-name {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.7;
    pointer-events: none;
}

.select-status {
    font-size: 1.1rem;
    color: #f7c948;
    min-height: 1.5em;
}

#gameScreen {
    position: relative;
    width: 100%;
}

#gameCanvas {
    display: block;
    width: 100%;
    max-width: 900px;
    border-radius: 8px;
    border: 2px solid #333;
    background: #1a1a2e;
}

.hud {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.hud-panel {
    width: 42%;
}

.hud-name {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.hud-bar-bg {
    height: 18px;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #444;
}

.hud-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.2s;
}

.hud-bar-fill.p1 { background: linear-gradient(90deg, #3498db, #2980b9); }
.hud-bar-fill.p2 { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.hud-bar-fill.boss { background: linear-gradient(90deg, #9b59b6, #8e44ad); }

.hud-hp-text {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 2px;
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    border-radius: 8px;
}

.overlay.hidden {
    display: none;
}

#overlayText {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 3px;
}

#overlaySub {
    color: #aaa;
    font-size: 1rem;
}

.focus-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: #888;
    font-size: 0.85rem;
    pointer-events: none;
    transition: opacity 0.3s;
}

.focus-hint.hidden {
    opacity: 0;
}
