/* PolyBonk smartphone controller CSS: circa-2015 CSS 3, flexbox only, touch-first portrait & landscape. */
* {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background: #121c1a;
    color: #f4f8f6;
    font-family: "Trebuchet MS", "Segoe UI", Arial, Helvetica, sans-serif;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.shell {
    max-width: 680px;
    margin: 0 auto;
    padding: 10px 12px 14px 12px;
}

.topBar {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    margin-bottom: 8px;
}

.backLink {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 8px;
    background: #1f2e2b;
    border: 1px solid #39544e;
    color: #eaf5f1;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}

.backLink:active { background: #2c433e; }

.commsBadge {
    font-size: 12px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 12px;
    background: #223036;
    color: #a9c6d4;
}

.commsBadge.is-ok {
    background: #1c442d;
    color: #8bf5a8;
}

.panel {
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #1a2625;
    border: 1px solid #2e4240;
}

/* Hero identity */
.heroHeader {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 8px;
}

.heroSwatch {
    width: 46px;
    height: 46px;
    line-height: 42px;
    text-align: center;
    border-radius: 11px;
    background: #ef4444;
    border: 2px solid #ffffff;
    color: #ffffff;
    font-size: 17px;
    font-weight: bold;
    margin-right: 10px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.heroMeta {
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
}

.heroTitle {
    font-size: 16px;
    font-weight: bold;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.heroSub {
    font-size: 12px;
    color: #afc8c2;
}

.upgBadge {
    min-width: 54px;
    padding: 7px 9px;
    border-radius: 9px;
    background: #243635;
    border: 1px solid #486865;
    text-align: center;
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
    color: #ffd56b;
}

.nameRow {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
}

.nameLabel {
    font-size: 13px;
    font-weight: bold;
    color: #b5cec8;
    margin-right: 8px;
}

.nameInput {
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #3f5a57;
    background: #101817;
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    -webkit-user-select: text;
    user-select: text;
}

.storageNotice {
    margin-left: 8px;
    font-size: 11px;
    color: #ffd56b;
}

/* Lobby strip */
.lobbyLevelRow {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 8px;
}

.btnLvlNav {
    width: 38px;
    height: 38px;
    line-height: 34px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #486460;
    background: #243634;
    color: #ffffff;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

.btnLvlNav:active { background: #36504d; }

.lobbyLevelMeta {
    -webkit-flex: 1;
    flex: 1;
    padding: 0 8px;
    min-width: 0;
}

.lobbyTitle {
    font-size: 14px;
    font-weight: bold;
    color: #8bf5a8;
}

.lobbySub {
    font-size: 12px;
    color: #c2d6d0;
    margin: 2px 0 0 0;
}

.actionRow {
    display: -webkit-flex;
    display: flex;
}

.btnPrimary, .btnSecondary {
    -webkit-flex: 1;
    flex: 1;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
    cursor: pointer;
}

.btnPrimary { background: #2e9d4f; border: 2px solid #82ef9f; }
.btnPrimary:active { background: #22783b; }
.btnSecondary { margin-left: 8px; background: #1e7fd6; border: 2px solid #7cc4ff; }

/* Stats & Weapons */
.barsRow {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 7px;
}

.barGroup {
    -webkit-flex: 1;
    flex: 1;
    margin-right: 10px;
}

.barLabels {
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    font-size: 11px;
    color: #b7cfc9;
    margin-bottom: 3px;
}

.barTrack {
    height: 10px;
    border-radius: 5px;
    background: #0e1615;
    border: 1px solid #354c49;
    overflow: hidden;
}

.barFill {
    height: 100%;
    width: 100%;
}

.hpFill { background: #ef4444; }
.xpFill { background: #38bdf8; }
.bossFill { background: #ef4444; }

.killsBox {
    min-width: 56px;
    text-align: center;
}

.killsLabel {
    display: block;
    font-size: 10px;
    font-weight: bold;
    color: #9cb9b2;
}

.killsVal {
    font-family: monospace;
    font-size: 17px;
    color: #ffd56b;
}

.weaponStrip {
    font-size: 12px;
    font-weight: bold;
    color: #d7ebe5;
    padding-top: 6px;
    border-top: 1px solid #2a3d3b;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Boss alert strip */
.bossStrip {
    background: #2f1417;
    border-color: #d44343;
}

.bossRow {
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    font-size: 12px;
    font-weight: bold;
    color: #ffd56b;
    margin-bottom: 5px;
}

.bossTrack { border-color: #7d2c2c; }

/* Upgrade Selection Panel (3 large tactile cards) */
.upgradePanel {
    background: #1d2633;
    border: 2px solid #ffd54f;
}

.upgradeHeader {
    text-align: center;
    margin-bottom: 10px;
}

.upgradeEyebrow {
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1.4px;
    color: #ffd54f;
}

.upgradeStep {
    font-size: 18px;
    font-weight: bold;
    margin-top: 2px;
}

.upgradeCards {
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
}

.upgCard {
    width: 100%;
    padding: 13px 14px;
    margin-bottom: 9px;
    border-radius: 12px;
    border: 2px solid #526b8c;
    background: #223044;
    color: #ffffff;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.upgCard:last-child { margin-bottom: 0; }
.upgCard:active { background: #334866; border-color: #ffffff; }
.upgCard.rar-uncommon  { border-color: #4cd964; background: #1a3526; }
.upgCard.rar-rare      { border-color: #56c6ff; background: #193148; }
.upgCard.rar-epic      { border-color: #c870ff; background: #2c1a40; }
.upgCard.rar-legendary { border-color: #ffb829; background: #422a0e; }

.upgCardTop {
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 4px;
}

.upgCardBadge {
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.9px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.14);
    color: #ffd56b;
}

.upgCardName {
    font-size: 17px;
    font-weight: bold;
    margin-bottom: 3px;
}

.upgCardDesc {
    font-size: 13px;
    color: #d2e4ef;
}

/* 360-degree Analog Touch Movement Joystick */
.joyDeck {
    text-align: center;
    padding: 12px;
}

.downedBanner {
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #5c1e1e;
    border: 1px solid #f06e6e;
    color: #ffe5e5;
    font-size: 13px;
    font-weight: bold;
}

.joyPad {
    position: relative;
    width: 100%;
    height: 256px;
    border-radius: 16px;
    background: #131d1c;
    border: 2px solid #2e4744;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    touch-action: none;
    cursor: pointer;
}

.joyBase {
    position: relative;
    width: 196px;
    height: 196px;
    border-radius: 50%;
    background: #1b2a28;
    border: 3px solid #486e68;
}

.joyAxisH, .joyAxisV {
    position: absolute;
    background: rgba(255, 255, 255, 0.12);
}
.joyAxisH { left: 18px; right: 18px; top: 50%; height: 2px; margin-top: -1px; }
.joyAxisV { top: 18px; bottom: 18px; left: 50%; width: 2px; margin-left: -1px; }

.joyDir {
    position: absolute;
    font-size: 11px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}
.joyN { top: 7px; left: 50%; margin-left: -5px; }
.joyS { bottom: 7px; left: 50%; margin-left: -4px; }
.joyW { left: 9px; top: 50%; margin-top: -7px; }
.joyE { right: 9px; top: 50%; margin-top: -7px; }

.joyKnob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 74px;
    height: 74px;
    margin-left: -37px;
    margin-top: -37px;
    border-radius: 50%;
    background: #ef4444;
    border: 4px solid #ffffff;
}

.joyPad.is-active .joyBase {
    border-color: #8bf5a8;
}

.autoHint {
    margin-top: 10px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.9px;
    color: #8bf5a8;
}

/* Footer */
.utilBar {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
}

.utilBtn {
    padding: 8px 12px;
    margin: 0 8px 6px 0;
    border-radius: 8px;
    border: 1px solid #3f5a57;
    background: #1f2e2c;
    color: #e6f2ef;
    font-family: inherit;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

.statusHint {
    font-size: 12px;
    color: #9cb7b1;
    margin-bottom: 6px;
}

/* Landscape phone optimization */
@media (orientation: landscape) and (max-height: 500px) {
    .shell { padding: 6px 10px; }
    .panel { padding: 6px 10px; margin-bottom: 6px; }
    .nameRow { display: none; }
    .joyPad { height: 182px; }
    .joyBase { width: 150px; height: 150px; }
    .joyKnob { width: 58px; height: 58px; margin-left: -29px; margin-top: -29px; }
    .upgradeCards { -webkit-flex-direction: row; flex-direction: row; }
    .upgCard { -webkit-flex: 1; flex: 1; margin: 0 4px; padding: 10px; }
}
