/* PolyBonk XR styles — circa-2015 CSS 3 with WebKit prefixes, responsive viewports & lean-paint overrides. */
*,
*:before,
*:after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #13221c;
    color: #f3f7fb;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

#webgl-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.hidden,
[hidden] {
    display: none !important;
}

#error-banner {
    position: fixed;
    top: 42%;
    left: 8%;
    right: 8%;
    z-index: 50;
    max-width: 520px;
    margin: 0 auto;
    padding: 18px 20px;
    border-radius: 10px;
    background: #2f1419;
    border: 2px solid #dc2626;
    color: #fee2e2;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

/* Top-Left Brand & Hero Stats Column */
.hud-left {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 20;
    max-width: 346px;
    pointer-events: none;
}

.brand-bar {
    pointer-events: auto;
    display: -webkit-inline-box;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(13, 22, 32, 0.90);
    border: 1px solid rgba(251, 191, 36, 0.52);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}

.brand-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    margin-right: 8px;
}

.brand-title {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #fef3c7;
    margin-right: 8px;
    white-space: nowrap;
}

.brand-badge {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border-radius: 5px;
    background: rgba(56, 189, 248, 0.24);
    border: 1px solid rgba(125, 211, 252, 0.55);
    color: #bae6fd;
    margin-right: 8px;
    white-space: nowrap;
}

.icon-mini {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.10);
    color: #f8fafc;
    font-family: Georgia, serif;
    font-style: italic;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.icon-mini:hover {
    background: rgba(251, 191, 36, 0.30);
}

.stats-card {
    pointer-events: auto;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(13, 22, 32, 0.90);
    border: 1px solid rgba(251, 191, 36, 0.42);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}

.stats-head {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 7px;
}

.lvl-pill {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 5px;
    background: #4fa86c;
    color: #0b1610;
    margin-right: 7px;
    white-space: nowrap;
}

.lvl-name {
    font-size: 12px;
    font-weight: 700;
    color: #f8fafc;
    margin-right: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-pill {
    font-size: 11px;
    font-weight: 800;
    color: #fde047;
    margin-left: 8px;
    white-space: nowrap;
}

.kills-pill {
    font-size: 11px;
    font-weight: 700;
    color: #e2e8f0;
    margin-left: 7px;
    white-space: nowrap;
}

.hp-row {
    margin-bottom: 6px;
}

.hp-track {
    position: relative;
    width: 100%;
    height: 22px;
    border-radius: 7px;
    background: rgba(127, 29, 29, 0.45);
    border: 1px solid rgba(248, 113, 113, 0.55);
    overflow: hidden;
}

.hp-fill {
    height: 100%;
    width: 100%;
    border-radius: 6px;
    background: #ef4444;
    -webkit-transition: width 0.14s ease-out;
    transition: width 0.14s ease-out;
}

.hp-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 12px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.bar-row {
    margin-bottom: 5px;
}

.up-track,
.mega-track {
    position: relative;
    width: 100%;
    height: 15px;
    border-radius: 5px;
    overflow: hidden;
}

.up-track {
    background: rgba(12, 74, 110, 0.48);
    border: 1px solid rgba(56, 189, 248, 0.50);
}

.mega-track {
    background: rgba(20, 83, 45, 0.50);
    border: 1px solid rgba(74, 222, 128, 0.55);
}

.up-fill {
    height: 100%;
    width: 4%;
    border-radius: 4px;
    background: #0ea5e9;
    -webkit-transition: width 0.18s ease-out;
    transition: width 0.18s ease-out;
}

.mega-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: #22c55e;
    -webkit-transition: width 0.16s ease-out;
    transition: width 0.16s ease-out;
}

.mega-fill.is-active {
    background: #4ade80;
}

.bar-overlay-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-size: 10px;
    font-weight: 800;
    line-height: 13px;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
    white-space: nowrap;
}

.weapons-line {
    font-size: 11px;
    font-weight: 600;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Top-Right Action Bar */
.hud-right {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 20;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: end;
    -webkit-justify-content: flex-end;
    justify-content: flex-end;
    max-width: 72%;
}

.hud-btn {
    margin: 0 0 6px 6px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(13, 22, 32, 0.88);
    color: #f1f5f9;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    -webkit-transition: background-color 0.15s ease, border-color 0.15s ease;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hud-btn:hover:not(:disabled) {
    background: rgba(30, 46, 66, 0.96);
    border-color: rgba(251, 191, 36, 0.65);
}

.hud-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.hud-btn.is-on {
    border-color: rgba(251, 191, 36, 0.55);
    color: #fef08a;
}

.hud-btn-primary {
    background: #16a34a;
    border-color: #4ade80;
    color: #ffffff;
}

.hud-btn-primary:hover:not(:disabled) {
    background: #22c55e;
}

.hud-btn-xr {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
}

.hud-btn-xr:hover:not(:disabled) {
    background: #0ea5e9;
}

.hud-btn-xr.is-active {
    background: #b91c1c;
    border-color: #f87171;
}

/* Centered Notices & Boss HP Bar */
.notice-stack {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    z-index: 18;
    text-align: center;
    pointer-events: none;
}

.xr-status-pill,
.center-notice {
    display: inline-block;
    max-width: 92%;
    margin: 4px auto;
    padding: 8px 16px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
}

.xr-status-pill {
    background: rgba(14, 34, 48, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.55);
    color: #e0f2fe;
}

.center-notice {
    background: rgba(16, 24, 36, 0.92);
    border: 2px solid #facc15;
    color: #fef08a;
    font-size: 15px;
    letter-spacing: 0.04em;
}

.boss-bar {
    display: block;
    width: 390px;
    max-width: 92%;
    margin: 4px auto;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(42, 12, 16, 0.92);
    border: 2px solid #f87171;
    color: #fff5f5;
}

.boss-head {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 5px;
}

.boss-track {
    width: 100%;
    height: 11px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.boss-fill {
    height: 100%;
    width: 100%;
    background: #ef4444;
    border-radius: 5px;
}

/* Start Hero Overlay */
.hero-card {
    position: fixed;
    left: 50%;
    bottom: 20px;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    z-index: 25;
    width: 580px;
    max-width: 92%;
    padding: 16px 20px;
    border-radius: 14px;
    background: rgba(12, 20, 30, 0.93);
    border: 2px solid rgba(251, 191, 36, 0.62);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.50);
}

.hero-head {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 8px;
}

.hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    margin-right: 14px;
    background: #ffffff;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.hero-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.10em;
    color: #fbbf24;
    margin-bottom: 2px;
}

.hero-title {
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.1;
}

.hero-copy {
    font-size: 13px;
    line-height: 1.46;
    color: #dbeafe;
    margin-bottom: 10px;
}

.world-picker {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    padding: 7px 10px;
    margin-bottom: 10px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.world-arrow {
    width: 34px;
    height: 34px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.world-arrow:hover {
    background: rgba(251, 191, 36, 0.30);
}

.world-info {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    text-align: center;
    padding: 0 8px;
}

.world-tag {
    font-size: 12px;
    font-weight: 800;
    color: #fde047;
    letter-spacing: 0.05em;
}

.world-sub {
    font-size: 11px;
    color: #cbd5e1;
}

.hero-actions {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.btn-big {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 150px;
    flex: 1 1 150px;
    margin: 4px;
    padding: 11px 14px;
    border-radius: 10px;
    border: 2px solid transparent;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    color: #ffffff;
    -webkit-transition: background-color 0.15s ease, -webkit-transform 0.12s ease;
    transition: background-color 0.15s ease, transform 0.12s ease;
}

.btn-big:disabled {
    opacity: 0.52;
    cursor: default;
}

.btn-xr {
    background: #0284c7;
    border-color: #7dd3fc;
}

.btn-xr:hover:not(:disabled) {
    background: #0ea5e9;
}

.btn-vr {
    background: #4f46e5;
    border-color: #a5b4fc;
}

.btn-vr:hover:not(:disabled) {
    background: #6366f1;
}

.btn-play {
    background: #16a34a;
    border-color: #86efac;
}

.btn-play:hover:not(:disabled) {
    background: #22c55e;
}

.hero-hints {
    font-size: 11px;
    line-height: 1.48;
    color: #94a3b8;
}

.hero-hints span {
    display: block;
}

/* Desktop Upgrade & Results Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 35;
    background: rgba(6, 12, 20, 0.72);
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    padding: 14px;
}

.upgrade-dialog,
.results-dialog {
    width: 680px;
    max-width: 100%;
    padding: 18px 20px;
    border-radius: 14px;
    background: rgba(13, 21, 32, 0.96);
    border: 2px solid rgba(251, 191, 36, 0.72);
    text-align: center;
}

.upgrade-eyebrow,
.results-eyebrow {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.10em;
    color: #fde047;
    margin-bottom: 4px;
}

.upgrade-title,
.results-title {
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 14px;
}

.upgrade-cards {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    margin: 0 -6px 12px -6px;
}

.upg-card {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 180px;
    flex: 1 1 180px;
    margin: 6px;
    padding: 12px 13px;
    border-radius: 11px;
    border: 2px solid #94a3b8;
    background: rgba(28, 39, 54, 0.92);
    color: #f8fafc;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.upg-card:hover {
    border-color: #ffffff;
    background: rgba(42, 58, 78, 0.98);
}

.upg-card.rar-uncommon { border-color: #4ade80; }
.upg-card.rar-rare { border-color: #38bdf8; }
.upg-card.rar-epic { border-color: #c084fc; }
.upg-card.rar-legendary { border-color: #fbbf24; background: rgba(74, 48, 12, 0.92); }

.upg-top {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 6px;
}

.upg-badge {
    color: #fde047;
}

.upg-key {
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.upg-name {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 5px;
}

.upg-desc {
    font-size: 12px;
    line-height: 1.42;
    color: #cbd5e1;
}

.upgrade-hint {
    font-size: 12px;
    color: #94a3b8;
}

.results-stats {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.10);
    color: #fde047;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 10px;
}

.results-weapons {
    font-size: 13px;
    color: #cbd5e1;
    margin-bottom: 14px;
}

.results-actions {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}

/* Touch Steering Guide */
.touch-guide {
    position: fixed;
    z-index: 22;
    width: 96px;
    height: 96px;
    margin-left: -48px;
    margin-top: -48px;
    border-radius: 50%;
    border: 2px solid rgba(251, 191, 36, 0.72);
    background: rgba(15, 26, 36, 0.35);
    pointer-events: none;
}

.touch-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin-left: -17px;
    margin-top: -17px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #ffffff;
}

/* Info Modal */
.info-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    background: rgba(6, 12, 20, 0.78);
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    padding: 16px;
}

.info-dialog {
    width: 560px;
    max-width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 12px;
    background: #0f1b28;
    border: 2px solid rgba(251, 191, 36, 0.58);
    padding: 18px 20px;
    color: #e2e8f0;
}

.info-header {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 14px;
}

.info-brand {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}

.info-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #ffffff;
    margin-right: 10px;
}

.info-sub {
    font-size: 12px;
    color: #fde047;
}

.info-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
}

.info-body h3 {
    font-size: 14px;
    color: #fde047;
    margin: 12px 0 6px 0;
}

.info-body p {
    font-size: 13px;
    line-height: 1.5;
    color: #dbeafe;
}

.info-list {
    margin: 0 0 8px 18px;
    font-size: 13px;
    line-height: 1.55;
    color: #dbeafe;
}

.diag-box {
    position: fixed;
    left: 12px;
    bottom: 12px;
    z-index: 30;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(8, 14, 22, 0.88);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fde047;
    font-family: monospace;
    font-size: 11px;
    line-height: 1.45;
    pointer-events: none;
}

.no-script {
    position: fixed;
    top: 40%;
    left: 10%;
    right: 10%;
    padding: 16px;
    background: #162230;
    border: 1px solid #fbbf24;
    color: #ffffff;
    text-align: center;
}

/* Lean-paint path for weak signage/headset browsers (flat colours, no shadows/transitions) */
body.lean-paint .brand-bar,
body.lean-paint .stats-card,
body.lean-paint .hero-card {
    box-shadow: none;
    background: #0e1824;
}

body.lean-paint .hud-btn,
body.lean-paint .btn-big,
body.lean-paint .hp-fill,
body.lean-paint .up-fill,
body.lean-paint .mega-fill {
    -webkit-transition: none;
    transition: none;
}

/* Mid-width Desktop / Half-HD (960x540) */
@media (max-width: 1120px) {
    .hud-btn {
        padding: 6px 8px;
        font-size: 11px;
        margin: 0 0 5px 5px;
    }
}

/* Narrow / Portrait Viewports (450x960, 1080x1920) */
@media (max-width: 780px) {
    .hud-left {
        top: 8px;
        left: 8px;
        max-width: 60%;
    }
    .hud-right {
        top: 8px;
        right: 8px;
        max-width: 56%;
    }
    .hud-btn {
        padding: 6px 8px;
        font-size: 11px;
        margin: 0 0 4px 4px;
    }
    .brand-badge {
        display: none;
    }
    .hero-card {
        bottom: 10px;
        padding: 13px 14px;
    }
    .hero-title {
        font-size: 20px;
    }
    .hero-icon {
        width: 46px;
        height: 46px;
    }
}

@media (max-width: 520px) {
    .hud-left {
        max-width: 96%;
    }
    .hud-right {
        top: 50px;
        left: 8px;
        right: 8px;
        max-width: none;
        -webkit-box-pack: start;
        -webkit-justify-content: flex-start;
        justify-content: flex-start;
    }
    .stats-card {
        margin-top: 56px;
    }
    .notice-stack {
        top: 118px;
    }
    .hero-copy {
        font-size: 12px;
    }
    .btn-big {
        padding: 10px 12px;
        font-size: 14px;
    }
}
