/* Keep the language entry outside the game's fixed-height panels and overlays. */
.i18n-language-control {
    position: fixed;
    right: 8px;
    bottom: 8px;
    z-index: 100;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    box-sizing: border-box;
    max-width: calc(100vw - 16px);
    padding: 6px 8px;
    border: 1px solid #888;
    border-radius: 3px;
    background: #fff;
    color: #000;
    font:
        13px/1.4 "Helvetica Neue",
        Helvetica,
        Arial,
        sans-serif;
}

.i18n-language-control label {
    white-space: nowrap;
}

.i18n-language-control select {
    max-width: 100%;
    min-height: 28px;
    font: inherit;
    color: inherit;
    background: #fff;
}

.i18n-language-control select:focus-visible {
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* Leave room to scroll content clear of the fixed language entry. */
html.i18n-ready body {
    padding-bottom: 64px;
}

html.i18n-ready .projectButton,
html.i18n-ready .projectButton:hover,
html.i18n-ready .projectButton:active {
    box-sizing: border-box;
    min-height: 60px;
    height: auto;
    padding: 6px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

html.i18n-ready:lang(zh-CN) .projectButton {
    font-family:
        "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei",
        sans-serif;
}

/* These panels contain floats or translated rows; their height must follow content.
   Ordinary display declarations deliberately leave the game's inline hiding intact. */
html.i18n-ready #qComputing,
html.i18n-ready #investmentEngine,
html.i18n-ready #tournamentStuff,
html.i18n-ready #tournamentTable,
html.i18n-ready #tournamentManagement,
html.i18n-ready #consoleDiv {
    display: flow-root;
    height: auto;
}

html.i18n-ready #qComputing {
    min-height: 70px;
}

html.i18n-ready #btnQcompute {
    display: block;
    clear: both;
}

html.i18n-ready #qCompDisplay {
    display: block;
    margin: 4px 0 0;
    overflow-wrap: anywhere;
}

html.i18n-ready #processorDisplay,
html.i18n-ready #memoryDisplay,
html.i18n-ready .toolTip2 {
    height: auto;
    min-height: 22px;
    line-height: 1.4;
}

html.i18n-ready #investmentDiv1,
html.i18n-ready #stratDiv1 {
    line-height: 1.4;
}

html.i18n-ready #investmentEngine .table1 {
    clear: both;
}

html.i18n-ready #investmentEngine .table1 th,
html.i18n-ready #investmentEngine .table1 td {
    padding: 2px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

html.i18n-ready #tournamentStuff {
    min-height: 58px;
}

html.i18n-ready #horizStrat {
    height: auto;
    min-height: 56px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

html.i18n-ready #tourneyButton,
html.i18n-ready #autoTourneyControl {
    width: auto;
    margin-right: 8px;
}

html.i18n-ready #autoTourneyStatusDiv {
    width: auto;
    white-space: nowrap;
}

html.i18n-ready #tournamentManagement > p {
    clear: both;
    margin-top: 6px;
}

html.i18n-ready #swarmSliderDiv {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    width: 100%;
}

html.i18n-ready #swarmSlider {
    position: static;
    width: auto;
    min-width: 0;
    margin: 0;
}

html.i18n-ready #sliderLabelThink {
    left: auto;
}

html.i18n-ready #sliderLabelWork,
html.i18n-ready #sliderLabelThink {
    white-space: nowrap;
}

html.i18n-ready #slider {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin: 0;
}

html.i18n-ready #giftShopDiv {
    position: static;
    float: right;
    margin: 0 0 6px 12px;
}

/* Keep the 310 x 150 drawing surface unchanged, while the text overlay contributes
   to panel height instead of escaping the canvas and covering the honor row. */
html.i18n-ready #battleCanvasDiv {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin: 5px 5px 10px;
    background: #808080;
}

html.i18n-ready #battleCanvasDiv canvas {
    grid-area: 1 / 1;
    align-self: start;
    margin: 0 auto;
}

html.i18n-ready #battleInterfaceDiv {
    grid-area: 1 / 1;
    position: relative;
    left: auto;
    top: auto;
    min-width: 0;
    box-sizing: border-box;
    padding: 8px 15px;
    overflow-wrap: anywhere;
}

html.i18n-ready #victoryDiv {
    width: auto;
    max-width: 100%;
}

html.i18n-ready #battleInterfaceDiv .clean2 {
    line-height: 1.4;
}

html.i18n-ready .toolTip2 .toolTipText2 {
    left: 0;
    margin-left: 0;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    padding: 6px;
    font-size: 12px;
    line-height: 1.5;
}

html.i18n-ready #rightColumn::after {
    content: "";
    display: block;
    clear: both;
}

/* Chinese cost labels need a complete resource name, not a last glyph on its own. */
html.i18n-ready:lang(zh-CN) .engineText8,
html.i18n-ready:lang(zh-CN) #giftTimer {
    font-size: 12px;
    line-height: 1.5;
}

html.i18n-ready #giftCountdown {
    white-space: nowrap;
}

html.i18n-ready:lang(zh-CN) .projectButton > span:first-child {
    display: block;
    margin-bottom: 2px;
}

@media (max-width: 700px) {
    html.i18n-ready #mobile {
        min-height: 100vh;
        height: auto;
        padding-bottom: 64px;
        box-sizing: border-box;
    }
}
