/* PolyRun 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: #10182b;
    color: #f8fafc;
    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: #1d2b49;
    border: 1px solid #3c5482;
    color: #f1f5f9;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}

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

.commsBadge {
    font-size: 12px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 12px;
    background: #1e293b;
    color: #94a3b8;
}

.commsBadge.is-ok {
    background: #14532d;
    color: #86efac;
}

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

/* Player Identity */
.playerHeader {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 8px;
}

.playerSwatch {
    width: 44px;
    height: 44px;
    line-height: 40px;
    text-align: center;
    border-radius: 11px;
    background: #f59e0b;
    border: 2px solid #ffffff;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    margin-right: 10px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

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

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

.playerSub {
    font-size: 12px;
    color: #93c5fd;
}

.scorePill {
    min-width: 68px;
    padding: 4px 10px;
    border-radius: 9px;
    background: #203152;
    border: 1px solid #4565a1;
    text-align: center;
}

.scoreLabel {
    display: block;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 0.8px;
    color: #93c5fd;
}

.scoreVal {
    font-family: monospace;
    font-size: 17px;
    color: #fde047;
}

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

.nameRow { margin-bottom: 7px; }

.nameLabel, .charLabel {
    font-size: 13px;
    font-weight: bold;
    color: #cbd5e1;
    width: 54px;
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
}

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

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

.charBtn {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    width: 38px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #4f6ca3;
    background: #223457;
    color: #ffffff;
    cursor: pointer;
}

.btnSvgSm {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.charBtn:active { background: #3b5891; }

.charName {
    -webkit-flex: 1;
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: #fde047;
}

/* Turn Panel */
.turnPanel {
    text-align: center;
}

.turnPanel.is-your-turn {
    background: #123b26;
    border: 2px solid #4ade80;
}

.turnPanel.is-waiting {
    background: #232042;
    border: 2px solid #818cf8;
}

.turnBadge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.14);
    color: #fde047;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.9px;
    margin-bottom: 4px;
}

.turnPanel.is-your-turn .turnBadge {
    background: #22c55e;
    color: #052e16;
}

.turnTitle {
    font-size: 17px;
    font-weight: bold;
    color: #ffffff;
}

.turnSub {
    font-size: 12px;
    color: #cbd5e1;
    margin: 2px 0 8px 0;
}

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

.btnPrimary, .btnSecondary, .btnCheer {
    -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: #16a34a; border: 2px solid #86efac; }
.btnPrimary:active { background: #15803d; }
.btnSecondary { margin-left: 8px; background: #0284c7; border: 2px solid #7dd3fc; }
.btnCheer { background: #db2777; border: 2px solid #f9a8d4; }
.btnCheer:active { background: #be185d; }

/* Live Run Stats */
.statsRow {
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: space-around;
    justify-content: space-around;
    font-size: 13px;
    color: #93c5fd;
}

.statCell strong {
    color: #fde047;
    font-family: monospace;
    font-size: 15px;
}

.statPower {
    margin-top: 6px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: #7dd3fc;
}

/* Swipe Pad & Tactile Buttons */
.controlDeck {
    padding: 10px;
}

.controlDeck.is-dim {
    opacity: 0.56;
}

.swipePad {
    width: 100%;
    height: 156px;
    border-radius: 14px;
    background: #0e1628;
    border: 2px solid #3c5482;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-align-items: center;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 10px;
    touch-action: none;
    cursor: pointer;
}

.swipePad.is-flash {
    border-color: #4ade80;
    background: #142c33;
}

.swipeMiddle {
    width: 100%;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: space-between;
    justify-content: space-between;
}

.swipeArrow {
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.7px;
    color: #7dd3fc;
}

.swipeCenter {
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #fde047;
}

.btnPad {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: stretch;
    align-items: stretch;
    -webkit-justify-content: space-between;
    justify-content: space-between;
}

.btnLrGroup {
    -webkit-flex: 1.15;
    flex: 1.15;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: stretch;
    align-items: stretch;
    margin-right: 10px;
}

.btnJdGroup {
    -webkit-flex: 1;
    flex: 1;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
}

.ctrlBtn {
    border-radius: 12px;
    border: 2px solid #60a5fa;
    background: #1d3a6e;
    color: #ffffff;
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
}

.btnSide {
    -webkit-flex: 1;
    flex: 1;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    min-height: 106px;
    padding: 0;
}

.btnArrowSvg {
    display: block;
    width: 36px;
    height: 36px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btnSide:first-child {
    margin-right: 8px;
}

.btnJump {
    min-height: 50px;
    margin-bottom: 6px;
    background: #16a34a;
    border-color: #86efac;
    font-size: 16px;
    letter-spacing: 1px;
}

.btnDuck {
    min-height: 50px;
    background: #ea580c;
    border-color: #fdba74;
    font-size: 15px;
    letter-spacing: 0.8px;
}

.ctrlBtn:active {
    background: #38bdf8;
    color: #0f172a;
}

.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 #3c5482;
    background: #1d2b49;
    color: #f1f5f9;
    font-family: inherit;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

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

/* Landscape phone layout */
@media (orientation: landscape) and (max-height: 500px) {
    .shell { padding: 6px 10px; }
    .panel { padding: 6px 10px; margin-bottom: 6px; }
    .nameRow { display: none; }
    .swipePad { height: 92px; margin-bottom: 6px; }
    .btnSide { min-height: 76px; font-size: 26px; }
    .btnJump, .btnDuck { min-height: 36px; font-size: 13px; }
}
