/* PolySnake 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: #111d18;
    color: #f4f9f6;
    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: #1d3029;
    border: 1px solid #38584d;
    color: #eaf6f1;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}

.backLink:active { background: #29463c; }

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

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

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

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

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

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

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

.snakeSub {
    font-size: 12px;
    color: #afd0c4;
}

.scorePill {
    min-width: 66px;
    padding: 4px 10px;
    border-radius: 9px;
    background: #223834;
    border: 1px solid #456e66;
    text-align: center;
}

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

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

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

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

.nameInput {
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #3f5e56;
    background: #0f1916;
    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 bar */
.lobbyMeta { margin-bottom: 8px; }

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

.lobbySub {
    font-size: 12px;
    color: #c2dad0;
    margin-top: 2px;
}

.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: #26a050; border: 2px solid #82f0a2; }
.btnPrimary:active { background: #1d7d3d; }
.btnSecondary { margin-left: 8px; background: #1e7fd6; border: 2px solid #7cc4ff; }

/* Size Tier & Diet Bar */
.tierRow {
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-align-items: center;
    align-items: center;
    margin-bottom: 5px;
}

.tierBadge {
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.6px;
    color: #8bf5a8;
}

.lenVal {
    font-family: monospace;
    font-size: 12px;
    font-weight: bold;
    color: #ffd56b;
}

.barTrack {
    height: 10px;
    border-radius: 5px;
    background: #0d1715;
    border: 1px solid #35504a;
    overflow: hidden;
    margin-bottom: 5px;
}

.barFill {
    height: 100%;
    width: 20%;
    background: #4ade80;
}

.dietRow {
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    font-size: 12px;
}

.eatNow { color: #eaf6f1; font-weight: bold; }
.eatNext { color: #ffd56b; }

/* Army Alert Strip */
.armyStrip {
    background: #3d1416;
    border: 2px solid #ef4444;
    text-align: center;
}

.armyStrip.is-incoming {
    background: #3d2a0d;
    border-color: #f5b027;
}

.armyStrip.is-retreating {
    background: #173a25;
    border-color: #4ade80;
}

.armyTitle {
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.8px;
    color: #ffd56b;
}

.armyStrip.is-retreating .armyTitle {
    color: #8bf5a8;
}

.armySub {
    font-size: 11px;
    color: #f6dada;
    margin-top: 2px;
}

/* 360-degree Analog Steering Deck */
.steerDeck {
    text-align: center;
    padding: 12px;
}

.steerPad {
    position: relative;
    width: 100%;
    height: 244px;
    border-radius: 16px;
    background: #121f1c;
    border: 2px solid #2e4b45;
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    touch-action: none;
    cursor: pointer;
}

.steerBase {
    position: relative;
    width: 196px;
    height: 196px;
    border-radius: 50%;
    background: #1a2d28;
    border: 3px solid #48736a;
}

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

.steerDir {
    position: absolute;
    font-size: 11px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.36);
    pointer-events: none;
}
.dirN { top: 7px; left: 50%; margin-left: -5px; }
.dirS { bottom: 7px; left: 50%; margin-left: -4px; }
.dirW { left: 9px; top: 50%; margin-top: -7px; }
.dirE { right: 9px; top: 50%; margin-top: -7px; }

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

.steerPad.is-active .steerBase {
    border-color: #8bf5a8;
}

.deckControls {
    margin-top: 10px;
}

.dashBtn {
    width: 100%;
    min-height: 52px;
    border-radius: 12px;
    border: 2px solid #ffd56b;
    background: #d97706;
    color: #ffffff;
    font-family: inherit;
    font-size: 17px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
}

.dashBtn:active { background: #b45309; }
.dashBtn:disabled {
    opacity: 0.48;
    background: #475569;
    border-color: #64748b;
    cursor: default;
}

.steerHint {
    margin-top: 8px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.8px;
    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 #3f5e56;
    background: #1d302b;
    color: #e6f4ef;
    font-family: inherit;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

.statusHint {
    font-size: 12px;
    color: #9cbdb2;
    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; }
    .steerPad { height: 168px; }
    .steerBase { width: 144px; height: 144px; }
    .steerKnob { width: 56px; height: 56px; margin-left: -28px; margin-top: -28px; }
    .dashBtn { min-height: 42px; font-size: 15px; }
}
