.sw-root { display: flex; flex-direction: column; }
.sw-screen.hidden { display: none !important; }

.sw-title { text-align: center; font-size: 2.4rem; margin: 8px 0 4px; }
.sw-subtitle { text-align: center; color: var(--muted); max-width: 560px; margin: 0 auto 24px; line-height: 1.5; }

.sw-mission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.sw-mission-card {
    text-align: left;
    background: var(--panel);
    border: none;
    border-left: 6px solid var(--theme, var(--accent));
    border-radius: 14px;
    padding: 18px 20px;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
}

.sw-mission-card:hover { transform: translateY(-2px); }

.sw-mission-badge {
    display: inline-block;
    background: var(--theme, var(--accent));
    color: #10132a;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.sw-mission-title { font-weight: 700; font-size: 1.15rem; margin-bottom: 6px; }
.sw-mission-desc { color: var(--muted); font-size: 0.88rem; line-height: 1.4; margin-bottom: 10px; }
.sw-mission-stars { color: var(--accent); }

/* ---------- Ekran gry ---------- */

.sw-play-header { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.sw-play-header .back-button {
    background: var(--panel); border: none; color: var(--accent-2);
    font-size: 0.95rem; cursor: pointer; padding: 8px 14px; border-radius: 10px; font-family: inherit;
}
.sw-mission-name { font-weight: 700; color: var(--accent); }

.sw-canvas-wrap {
    position: relative; width: 100%; aspect-ratio: 16 / 9;
    background: #05060a; border-radius: 14px; overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#sw-canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }

.sw-hud-top {
    position: absolute; top: 12px; left: 12px; right: 12px;
    display: flex; justify-content: space-between; align-items: center;
    pointer-events: none; font-family: var(--heading-font);
}

.sw-shield-block, .sw-objective-block {
    display: flex; flex-direction: column; gap: 3px;
    background: rgba(5, 6, 12, 0.55); padding: 6px 12px; border-radius: 10px; backdrop-filter: blur(2px);
}

.sw-shield-block .hud-label, .sw-objective-block .hud-label {
    font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted);
}

.sw-shield-bar { width: 140px; height: 12px; background: rgba(255,255,255,0.15); border-radius: 6px; overflow: hidden; }
.sw-shield-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #4dd0e1, #2ecc71); transition: width 0.2s ease; }
.sw-shield-fill.low { background: linear-gradient(90deg, #ff6b4d, #ff2d2d); }

.sw-lives-block { background: rgba(5, 6, 12, 0.55); padding: 6px 12px; border-radius: 10px; font-size: 1rem; backdrop-filter: blur(2px); }
.sw-objective-value { font-size: 1rem; font-weight: 700; color: var(--accent); white-space: nowrap; }

.sw-message {
    position: absolute; top: 70px; left: 50%; transform: translateX(-50%);
    background: rgba(5, 6, 12, 0.7); color: var(--accent); font-weight: 700;
    padding: 8px 20px; border-radius: 999px; font-size: 0.95rem; letter-spacing: 0.5px;
    pointer-events: none; white-space: nowrap;
}
.sw-message.hidden { display: none; }

/* ---------- Pojedynek na miecze świetlne ---------- */

.sw-duel-hud {
    position: absolute; top: 56px; left: 12px; right: 12px;
    display: flex; flex-direction: column; gap: 6px; pointer-events: none;
}
.sw-duel-hud.hidden { display: none; }

.sw-duel-bar-wrap { display: flex; align-items: center; gap: 8px; }
.sw-duel-bar-wrap-enemy { flex-direction: row-reverse; }

.sw-duel-name {
    font-size: 0.7rem; font-weight: 700; color: var(--text); text-shadow: 0 1px 3px #000;
    width: 70px; flex-shrink: 0;
}
.sw-duel-bar-wrap-enemy .sw-duel-name { text-align: right; }

.sw-duel-bar {
    flex: 1; max-width: 260px; height: 10px; background: rgba(0,0,0,0.4);
    border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,0.25);
}
.sw-duel-fill { height: 100%; width: 100%; transition: width 0.2s ease; }
.sw-duel-fill-player { background: linear-gradient(90deg, #4dd0e1, #2ecc71); }
.sw-duel-fill-enemy { background: linear-gradient(90deg, #ff6b4d, #ff2d2d); }

.sw-joystick {
    position: absolute; bottom: 24px; left: 24px; width: 100px; height: 100px;
    border-radius: 50%; background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.25);
    touch-action: none;
}
.sw-joystick.hidden { display: none; }
.sw-joystick-knob {
    position: absolute; top: 50%; left: 50%; width: 42px; height: 42px;
    margin: -21px 0 0 -21px; border-radius: 50%; background: rgba(255,255,255,0.55);
}

.sw-duel-buttons {
    position: absolute; bottom: 24px; right: 24px; display: flex; gap: 14px;
}
.sw-duel-buttons.hidden { display: none; }

.sw-duel-btn {
    width: 72px; height: 72px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.3);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 1.4rem; color: #fff; touch-action: none; user-select: none; gap: 2px;
}
.sw-duel-btn span { font-size: 0.55rem; font-weight: 800; letter-spacing: 0.5px; }

.sw-attack-btn {
    background: radial-gradient(circle at 35% 30%, #ff8a65, #e74c3c 60%, #a93226);
    box-shadow: 0 4px 0 #8e2a1f, 0 8px 14px rgba(0,0,0,0.4);
}
.sw-block-btn {
    background: radial-gradient(circle at 35% 30%, #6dd0ff, #2f86c9 60%, #1f5f94);
    box-shadow: 0 4px 0 #17456b, 0 8px 14px rgba(0,0,0,0.4);
}
.sw-duel-btn:active, .sw-duel-btn.pressed { transform: translateY(3px); box-shadow: none; }

.sw-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(5, 6, 14, 0.75);
}
.sw-overlay.hidden { display: none; }

.sw-overlay-panel { background: var(--panel); border-radius: 16px; padding: 28px 32px; text-align: center; max-width: 340px; }
.sw-overlay-panel h2 { color: var(--accent); margin-top: 0; }

.sw-overlay-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.sw-overlay-actions .primary-button, .sw-overlay-actions .secondary-button {
    border: none; border-radius: 12px; padding: 12px; font-weight: 700; cursor: pointer;
}
.sw-overlay-actions .primary-button { background: linear-gradient(180deg, #7ee787, #35b04a); color: #0e1024; }
.sw-overlay-actions .secondary-button { background: transparent; border: 1px solid var(--accent-2); color: var(--accent-2); }

.sw-hint { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 10px; }

@media (max-width: 640px) {
    .sw-shield-bar { width: 90px; }
    .sw-hud-top { font-size: 0.85rem; }
}
