.warian-menu-item, .warian-extra-links { display: none; }
@media (max-width: 700px) {
  html, body { width: 100% !important; min-width: 0 !important; margin: 0 !important; overflow-x: hidden; }
  body #wrapper, body .bodyWrapper { width: 100% !important; min-width: 0 !important; margin: 0 !important; }
  body #header, body #mtop { width: 100% !important; height: 155px !important; }
  body #logoutContainer, body #ingameManual, body #anwersQuestionMark, body #footer, body #stime { display: none !important; }
  body #navigation { position: fixed !important; z-index: 1001; left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: 100% !important; height: 54px !important; margin: 0 !important; padding: 3px 0 env(safe-area-inset-bottom, 0px) !important; display: flex !important; direction: rtl; align-items: center; justify-content: space-evenly; background: #6d553d; box-shadow: 0 -2px 6px #0006; }
  body #navigation li { position: relative !important; float: none !important; left: auto !important; right: auto !important; top: auto !important; margin: 0 !important; zoom: .65; flex: 0 0 70px; }
  body #navigation li a { display: block; }
  body #navigation .warian-menu-item { display: block; width: 70px; height: 70px; }
  body .warian-menu-button { width: 70px; height: 70px; border: 3px solid #bca67f; border-radius: 50%; color: #f7e7c5; background: #6d553d; font: bold 39px/1 sans-serif; cursor: pointer; }
  body #mid { width: 100% !important; min-width: 0 !important; min-height: 0 !important; padding: 0 0 78px !important; margin: 0 !important; }
  body #contentOuterContainer { float: none !important; position: relative !important; left: auto !important; right: auto !important; margin: 0 auto !important; zoom: var(--warian-scale, .6); }
  body #side_info { display: none; position: fixed !important; z-index: 1002; top: 8px !important; left: 8px !important; right: auto !important; bottom: 65px; overflow: auto; max-height: calc(100dvh - 78px); margin: 0 !important; background-color: #e7d7ac; box-shadow: 0 2px 12px #0009; }
  body.warian-menu-open #side_info { display: block !important; }
  body #header { position: relative !important; }
  body #logo { display: none !important; }
  body #header > .sideInfoHero { display: block; width: 145px; height: 136px; position: absolute !important; z-index: 10; top: 2px !important; left: 4px !important; right: auto !important; float: none !important; margin: 0 !important; zoom: .5; }
  body #header > .sideInfoHero .heroImage { width: 106px; margin-right: 8px; margin-top: 15px; }
  body #header > .sideInfoHero .heroImageBorder { width: 145px; height: 136px; position: absolute; right: 0; top: 0; background-image: url("../gpack/travian_Travian_4.0_41/img/layout/sign_heroBorder-rtl.png"); }
  body #header > .sideInfoHero .heroProfile, body #header > .sideInfoHero .adventures, body #header > .sideInfoHero .auctions { display: block; position: absolute; }
  body #header > .sideInfoHero .heroProfile { height: 95px; width: 93px; right: 15px; top: 30px; }
  body #header > .sideInfoHero .adventures { height: 30px; width: 30px; right: 112px; top: 36px; }
  body #header > .sideInfoHero .auctions { height: 30px; width: 30px; right: 115px; top: 68px; }
  body #plusLink { position: absolute !important; z-index: 10; top: 7px !important; left: auto !important; right: 4px !important; }
  body #res { position: absolute !important; top: 78px !important; left: 2% !important; right: auto !important; width: 96% !important; height: auto !important; display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding: 0 !important; margin: 0 !important; direction: rtl; background: rgba(245, 243, 229, .94); }
  body #res li { float: none !important; position: static !important; width: auto !important; min-width: 0; overflow-x: auto; overflow-y: hidden; }
  body #res li p { white-space: nowrap; }
  body #villageName, body #sideInfoCountdown { position: relative !important; top: auto !important; left: auto !important; right: auto !important; margin: 4px auto 65px !important; }
  body .warian-extra-links { display: none; position: fixed; z-index: 1004; bottom: 67px; left: 212px; max-width: calc(100vw - 220px); padding: 8px; background: #e7d7ac; border: 1px solid #8e704d; direction: rtl; }
  body.warian-menu-open .warian-extra-links { display: grid; gap: 10px; }
  body .warian-extra-links a { color: #4e3521; white-space: nowrap; }
}

@media (max-width: 350px) {
  body #navigation li { zoom: .56; }
}

/* Village views retain their original artwork and image maps. */
@media (max-width: 700px) {
  body.village1 #contentOuterContainer, body.village1 #contentOuterContainer .contentContainer, body.village1 #content.village1 { width: 500px !important; min-width: 500px !important; box-sizing: border-box; }
  body.village1 #contentOuterContainer .contentContainer, body.village1 #content.village1 { padding: 0 !important; min-height: 0 !important; }
  body.village1 #content.village1 #village_map { float: none !important; margin: 0 auto 12px !important; }
  body.village1 #content.village1 #map_details { position: static !important; width: 100% !important; margin: 0 auto !important; overflow: hidden; }
  body.village1 #map_details > .movements { width: 100% !important; max-width: none !important; min-height: 0 !important; float: none !important; }
  body.village1 #map_details > .production, body.village1 #map_details > .units { margin: 0 10px 10px 0 !important; }
  body.village1 #content .buildingList, body.village2 #content .buildingList { position: relative !important; top: auto !important; left: auto !important; right: auto !important; float: none !important; margin: 8px auto !important; max-width: 100%; }
  body.village2 #contentOuterContainer { margin: 0 auto !important; }
}

.warian-drawer-toggle, .warian-drawer-veil, .warian-info-drawer, .warian-mobile-troops, .warian-troops-source { display: none; }
@media (max-width: 700px) {
  body.warian-menu-open #side_info { display: none !important; }
  body #side_info { top: 68px !important; bottom: 60px !important; left: 0 !important; right: auto !important; width: 216px !important; max-height: none !important; padding: 8px 10px; box-sizing: border-box; overflow-x: hidden; overflow-y: auto; }
  body.warian-left-open #side_info { display: block !important; }
  body .warian-info-drawer #villageName { position: relative !important; display: block !important; margin: 8px auto !important; transform: scale(.9); transform-origin: center top; }
  body .warian-info-drawer { display: none; position: fixed; z-index: 1002; right: 0; left: auto; top: 68px; bottom: 60px; width: 216px; box-sizing: border-box; overflow: auto; padding: 10px; background: #e7d7ac; box-shadow: 0 2px 12px #0009; direction: rtl; }
  body.warian-right-open .warian-info-drawer { display: block; }
  body #side_info #stime { display: block !important; position: relative !important; top: auto !important; left: auto !important; right: auto !important; margin: 0 auto 12px !important; }
  body .warian-info-drawer #sideInfoCountdown { display: block !important; position: relative !important; top: auto !important; left: auto !important; right: auto !important; margin: 10px auto !important; }
  body .warian-info-drawer .sideInfoAlly, body .warian-info-drawer #linkList { margin: 10px auto; padding: 8px; background: #f4e8c7; border: 1px solid #aa9067; direction: rtl; }
  body .warian-info-drawer a { color: #513a22; }
  body .warian-info-drawer ul { padding: 0 18px; margin: 5px 0; }
  body .warian-drawer-veil:not([hidden]) { display: block; position: fixed; inset: 68px 0 57px; background: rgba(0,0,0,.35); z-index: 1000; }
  body .warian-drawer-toggle { display: block; position: fixed; z-index: 1003; top: 46%; width: 24px; height: 58px; padding: 0; border: 1px solid #8e704d; background: #dfc99d; color: #513a22; font: bold 30px/1 Arial,sans-serif; cursor: pointer; }
  body .warian-drawer-left { left: 0; border-radius: 0 6px 6px 0; }
  body .warian-drawer-right { right: 0; border-radius: 6px 0 0 6px; }
  body.warian-left-open .warian-drawer-left { left: 216px; }
  body.warian-right-open .warian-drawer-right { right: 216px; }
  body .warian-extra-links { left: 8px; right: auto; max-width: calc(100vw - 32px); }
  body .warian-mobile-troops { display: block; position: fixed; right: 14px; bottom: calc(120px + env(safe-area-inset-bottom, 0px)); z-index: 999; }
  body .warian-troops-toggle { display: flex; justify-content: center; align-items: center; width: 48px; height: 48px; padding: 5px; border: 1px solid #80664c; border-radius: 50%; background: #e7d7ac; box-shadow: 0 2px 4px #0007; cursor: pointer; }
  body .warian-troops-toggle svg { width: 30px; height: 38px; }
  body .warian-troops-toggle .outline { fill: #31520d; stroke: #31520d; stroke-width: 3px; stroke-linejoin: round; }
  body .warian-troops-toggle .icon { fill: #78a329; }
  body .warian-troops-panel:not([hidden]) { display: block; position: absolute; right: 0; bottom: 55px; max-width: min(260px, 85vw); max-height: 50vh; overflow: auto; padding: 5px; background: #f4e8c7; border: 1px solid #80664c; box-shadow: 0 2px 5px #0006; }
  body .warian-troops-panel .units { position: relative !important; float: none !important; margin: 0 !important; }
  body .warian-troops-panel #troops td.un { display: none; }
  body .warian-troops-panel #troops td { white-space: nowrap; }
}

/* Mobile village HUD and readable inner pages. */
@media (max-width:700px) {
  body.village1 #map_details { display: none !important; }
  body.village1 .warian-mobile-movement { display:block; position:fixed !important; z-index:90; top:155px !important; right:6px !important; left:auto !important; width:min(185px, calc(100vw - 140px)) !important; max-width:none !important; min-height:0 !important; max-height:35vh; overflow:auto; margin:0 !important; padding:0 !important; }
  body.village1 .warian-mobile-movement:has(> .movements.hide) { display:none !important; }
  body.village1 .warian-mobile-movement > .movements { position:static !important; min-height:0 !important; width:100% !important; }
  body.village1 .warian-mobile-movement .boxes { float:none !important; width:100% !important; box-sizing:border-box; }
  body.village1 .warian-mobile-movement #movements { width:100% !important; }
  body .warian-info-drawer .production { float:none !important; position:relative !important; margin:10px auto !important; max-width:100%; }
  body:not(.village1):not(.village2) #contentOuterContainer { zoom:1 !important; width:calc(100% - 12px) !important; max-width:605px !important; min-width:0 !important; box-sizing:border-box; margin:8px auto !important; }
  body:not(.village1):not(.village2) #contentOuterContainer .contentContainer { box-sizing:border-box; width:100% !important; min-width:0 !important; padding:0 4px !important; }
  body:not(.village1):not(.village2) #content { box-sizing:border-box; width:100% !important; min-width:0 !important; max-width:100% !important; padding:18px 10px 22px !important; overflow-x:auto; overflow-y:visible; }
  body:not(.village1):not(.village2) #content h1.titleInHeader { box-sizing:border-box; max-width:100%; overflow-wrap:anywhere; }
  body:not(.village1):not(.village2) #content .contentNavi { display:flex !important; float:none !important; box-sizing:border-box; width:100% !important; max-width:100% !important; height:auto !important; min-height:38px; overflow-x:auto !important; overflow-y:hidden; white-space:nowrap; }
  body:not(.village1):not(.village2) #content .contentNavi > .container { float:none !important; flex:0 0 auto; }
  body:not(.village1):not(.village2) #content .contentNavi > .clear { display:none; }
  body:not(.village1):not(.village2) #content input[type=text], body:not(.village1):not(.village2) #content textarea, body:not(.village1):not(.village2) #content select { box-sizing:border-box; max-width:100%; }
  body:is(.messages,.reports,.statistics) #content table { max-width:none; }
  body:is(.messages,.reports) #content table#overview { min-width:440px; }
  body.statistics #content table.row_table_data { min-width:400px; }
  body.build #content #build { max-width:100%; }
  body.build #content .build_desc { overflow:auto; overflow-wrap:anywhere; }
  body.build #content .contentNavi { margin-bottom:12px; }
}

@media (max-width:700px) {
  body:not(.village1):not(.village2) #content .contentNavi { position:static !important; margin:0 0 12px !important; }
  body.messages #write_content .paper { width:100% !important; min-width:0 !important; height:auto !important; min-height:0 !important; box-sizing:border-box; background:#f7f0dc; }
  body.messages #write_content .paper > .layout { display:none !important; }
  body.messages #write_content .paperContent { position:relative !important; inset:auto !important; width:auto !important; height:auto !important; padding:12px !important; box-sizing:border-box; overflow-wrap:anywhere; }
  body.messages #write_content :is(#recipient,#subject) { display:flex; flex-wrap:wrap; align-items:center; gap:4px; width:100% !important; }
  body.messages #write_content :is(#recipient,#subject) > .header.label { float:none !important; width:55px !important; flex:0 0 55px; }
  body.messages #write_content :is(#recipient,#subject) > .header.text { float:none !important; width:auto !important; flex:1 1 180px; min-width:0; }
  body.messages #write_content #receiver { width:calc(100% - 55px) !important; min-width:0; }
  body.messages #write_content input#subject { width:100% !important; min-width:0; }
  body.messages #write_content :is(#bbEditor,#message_container,textarea#message) { width:100% !important; max-width:100% !important; min-width:0 !important; box-sizing:border-box; }
  body.messages #write_content #message_toolbar { height:auto !important; min-height:24px; }
}

@media (max-width:700px) {
  body.statistics #content table#player, body:is(.messages,.reports) #content table#overview { width:100% !important; min-width:0 !important; table-layout:fixed; }
  body:is(.messages,.reports,.statistics) #content :is(#overview,#player) :is(th,td) { box-sizing:border-box; padding:4px 2px; white-space:normal !important; overflow-wrap:anywhere; }
  body:is(.messages,.reports) #content #overview td.sel { width:25px !important; }
  body.messages #content #overview :is(th.send,td.send) { width:70px !important; }
  body:is(.messages,.reports) #content #overview :is(th.dat,th.sent,td.dat) { width:76px !important; }
  body:is(.messages,.reports) #content #overview :is(.subjectWrapper,td.sub > div) { width:auto !important; max-width:100%; white-space:normal !important; overflow-wrap:anywhere; }
  body.statistics #content #player td.ra { width:26px !important; }
}

@media (max-width:700px) {
  body:not(.village1):not(.village2) #content h1.titleInHeader { left:10px !important; right:10px !important; width:auto !important; max-width:none !important; }
  body:not(.village1):not(.village2) #content h4.round { box-sizing:border-box; width:100% !important; max-width:100% !important; left:auto !important; right:auto !important; }
}

@media (max-width:700px) {
  body:is(.messages,.reports) #content table#overview { table-layout:auto; }
  body:is(.messages,.reports) #content #overview td.sel { min-width:25px; max-width:25px; }
}

/* Keep the original landscape artwork behind the entire mobile village. */
@media (max-width: 700px) {
  body:is(.village1,.village2) #wrapper {
    min-height: 100vh !important;
    min-height: 100dvh !important;
    background-position: center calc(155px - 115px * var(--warian-scale, .6)) !important;
    background-size: auto calc(100vh - 155px) !important;
    background-size: auto calc(100dvh - 155px) !important;
    background-repeat: no-repeat !important;
  }
}

@media (max-width: 700px) {
  body.village2 #wrapper {
    background-color: #a3ba7e;
    background-position: calc(50% - 15px * var(--warian-scale, .6)) calc(155px - 115px * var(--warian-scale, .6)) !important;
    background-size: auto calc(730px * var(--warian-scale, .6)) !important;
  }
}

@media (max-width: 700px) {
  body:is(.village1,.village2) #header {
    background: url("../gpack/travian_Travian_4.0_41/img/layout/bgVillage-rtl.jpg") center top / auto no-repeat;
  }
}

/* Five troop types per row on narrow screens; keep full numbers readable. */
@media (max-width: 700px) {
  body #content table.warian-troop-split { width: 100% !important; min-width: 0 !important; max-width: 100% !important; table-layout: fixed; border-collapse: collapse; }
  body #content table.warian-troop-split :is(th,td) { box-sizing: border-box; padding: 3px 1px; text-align: center; }
  body #content table.warian-troop-split :is(th:first-child,td.role) { width: 64px !important; }
  body #content table.warian-troop-split tbody.units td { font: 11px/1.25 Arial, sans-serif; direction: ltr; white-space: normal !important; overflow-wrap: anywhere; word-break: break-word; }
  body #content table.warian-troop-split tbody:not(.units) td { white-space: normal; overflow-wrap: anywhere; }
  body #content table.warian-troop-split .res .resource { display: inline-block; white-space: nowrap; }
}

/* Mobile drawers, flexible original page frames and the original hero controls. */
@media (max-width: 700px) {
  body .warian-info-drawer, body #side_info {
    background: rgba(68, 52, 35, .96) !important;
  }
  body:not(.village1):not(.village2) #contentOuterContainer .contentTitle,
  body:not(.village1):not(.village2) #contentOuterContainer .contentFooter {
    background-size: 100% 100% !important;
    background-repeat: no-repeat !important;
  }
  body:not(.village1):not(.village2) #contentOuterContainer .contentContainer {
    background-size: 100% auto !important;
    background-repeat: repeat-y !important;
  }
  body #header > .sideInfoHero { zoom: .58; }
  body #res { top: 82px !important; }
  body #header > .sideInfoHero :is(.adventures,.auctions) {
    background-image: url("../gpack/travian_Travian_4.0_41/img/layout/bgIngameStaticElements-rtl.png");
    background-repeat: no-repeat;
  }
  body #header > .sideInfoHero .adventures { background-position: -616px -61px; }
  body #header > .sideInfoHero .auctions { background-position: -613px -93px; }
}

@media (max-width: 700px) {
  body #side_info .sideInfoPlayer {
    right: auto !important;
    margin: 0 auto 8px !important;
    box-sizing: border-box;
    border: 1px solid #aa9067;
    border-radius: 4px;
    background: #f4e8c7;
  }
}

/* Show village information beneath the map and retain troop table grid lines. */
@media (max-width: 700px) {
  body #content table.warian-troop-split :is(th,td) { border: 1px solid #bcbcbc !important; }
  body.village1 #content.village1 #map_details {
    display: flex !important; flex-direction: column; align-items: center;
    width: calc(500px * var(--warian-scale, .6)) !important;
    zoom: calc(1 / var(--warian-scale, .6));
    overflow: visible;
  }
  body.village1 #map_details > .movements {
    position: relative !important; width: min(245px, 100%) !important;
    min-width: 0 !important; min-height: 0 !important; max-width: 245px !important; margin: 0 auto 10px !important;
  }
  body.village1 #map_details > .movements:has(> .movements.hide) { display: none !important; }
  body.village1 #map_details > .movements > .movements { min-height: 0; min-width: 0; width: 100%; }
  body.village1 #map_details > .movements .boxes { float: none; width: 100%; box-sizing: border-box; }
  body.village1 #map_details > .production { float: none !important; margin: 0 auto 10px !important; max-width: 100%; }
  body.village1 #map_details > .clear { display: none; }
}

/* Use the same Persian font as TravianWars throughout the game interface. */
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/vazirmatn/Vazirmatn-variable.woff2') format('woff2');
  font-style: normal; font-weight: 100 900; font-display: swap;
}
body, body :is(p, div, span, a, li, label, button, input, select, textarea, table, th, td, h1, h2, h3, h4, h5, h6):not(.warian-menu-button):not(.warian-drawer-toggle) {
  font-family: 'Vazirmatn', Tahoma, sans-serif !important;
}

/* Drawers continue the original page artwork at the same viewport position. */
@media (max-width: 700px) {
  body .warian-info-drawer, body #side_info {
    background: #a1bb79 url('../gpack/travian_Travian_4.0_41/img/layout/bgVillage-rtl.jpg') center top / auto no-repeat fixed !important;
  }
  body.village1 :is(.warian-info-drawer, #side_info) {
    background-image: url('../gpack/travian_Travian_4.0_41/img/layout/bgResources-rtl.jpg') !important;
    background-position: center calc(155px - 115px * var(--warian-scale, .6)) !important;
    background-size: auto calc(100dvh - 155px) !important;
  }
  body.village2 :is(.warian-info-drawer, #side_info) {
    background-color: #a3ba7e !important;
    background-position: calc(50% - 15px * var(--warian-scale, .6)) calc(155px - 115px * var(--warian-scale, .6)) !important;
    background-size: auto calc(730px * var(--warian-scale, .6)) !important;
  }
}

/* Restore the original Warian wooden sidebar signs on mobile. */
@media (max-width: 700px) {
  body .warian-info-drawer .sideInfoAlly {
    position: relative; right: auto; width: 178px; height: 48px; padding: 0; margin: 10px auto;
    border: 0; background: url('../gpack/travian_Travian_4.0_41/img/layout/sign_ally-rtl.png') right top no-repeat;
  }
  body .warian-info-drawer .sideInfoAlly .signLink { position: absolute; right: 6px; top: 6px; width: 114px; height: 21px; padding: 9px 44px 0 0; font-weight: bold; text-align: center; }
  body .warian-info-drawer .sideInfoAlly .signLink .wrap { display: block; width: 114px; height: 21px; overflow: hidden; white-space: nowrap; }
  body .warian-info-drawer .sideInfoAlly .crest { position: absolute; right: 15px; top: 7px; width: 25px; height: 30px; background: url('../gpack/travian_Travian_4.0_41/img/layout/icons/crestDefault-rtl.gif'); }
  body .warian-info-drawer #linkList { position: relative; right: auto; width: 160px; padding: 0; margin: 10px auto; border: 0; background: none; overflow: hidden; }
  body .warian-info-drawer #linkList .head { height: 66px; background: url('../gpack/travian_Travian_4.0_41/img/layout/signLinksTop-rtl.png') no-repeat; }
  body .warian-info-drawer #linkList .head a { position: relative; display: block; right: 18px; top: 30px; width: 105px; height: 16px; padding-right: 20px; color: #252525; font-size: 12px; background: url('../gpack/travian_Travian_4.0_41/img/layout/icons/editLinks.gif') right center no-repeat; }
  body .warian-info-drawer #linkList .list { position: relative; max-height: 112px; min-height: 42px; padding-bottom: 15px; background-position: 0 bottom; background-repeat: repeat-y; }
  body .warian-info-drawer #linkList .list.none { background-image: url('../gpack/travian_Travian_4.0_41/img/layout/signLinksBottom_none-rtl.png'); }
  body .warian-info-drawer #linkList .list.forward { background-image: url('../gpack/travian_Travian_4.0_41/img/layout/signLinksBottom_forward-rtl.png'); }
  body .warian-info-drawer #linkList .list.back { background-image: url('../gpack/travian_Travian_4.0_41/img/layout/signLinksBottom_back-rtl.png'); }
  body .warian-info-drawer #linkList .list.both { background-image: url('../gpack/travian_Travian_4.0_41/img/layout/signLinksBottom_both-rtl.png'); }
  body .warian-info-drawer #linkList ul { position: relative; top: -18px; margin: 0; padding: 0; list-style: none; font-size: 12px; }
  body .warian-info-drawer #linkList li { height: 14px; line-height: 14px; margin-right: 21px; }
  body .warian-info-drawer #linkList li a { display: block; width: 117px; margin-right: 17px; overflow: hidden; white-space: nowrap; font-weight: normal; }
  body .warian-info-drawer #linkList .pager { position: absolute; bottom: 0; width: 160px; height: 30px; }
  body .warian-info-drawer #linkList .pager a { position: absolute; display: block; width: 10px; height: 9px; background-image: url('../gpack/travian_Travian_4.0_41/img/navi/naviSmall.gif'); }
  body .warian-info-drawer #linkList .pager a.back { right: 6px; bottom: 10px; background-position: right 0; }
  body .warian-info-drawer #linkList .pager a.next { left: 9px; bottom: 14px; background-position: left 0; }
  body #side_info .sideInfoPlayer { border: 0; border-radius: 0; background: url('../gpack/travian_Travian_4.0_41/img/layout/sign_ally-rtl.png') center top no-repeat; }
}

/* The mobile drawers contain only the original game signs. */
@media (max-width: 700px) {
  body .warian-info-drawer, body #side_info, body:is(.village1,.village2) :is(.warian-info-drawer,#side_info) { background: transparent !important; box-shadow: none !important; }
  body .warian-drawer-veil:not([hidden]) { background: transparent; }
}

/* Keep all eleven digits visible in the marketplace resource inputs. */
body.build #build.gid17 table#send_select td.val input.text { box-sizing: border-box; width: 13ch; min-width: 13ch; direction: ltr; text-align: left; }
@media (max-width: 700px) {
  body.build #build.gid17 table#send_select { width: 100% !important; max-width: 360px; table-layout: auto; }
  body.build #build.gid17 table#send_select td.val { width: auto; }
  body.build #build.gid17 table#send_select td.val input.text { box-sizing: border-box; width: 13ch !important; min-width: 13ch; max-width: none !important; direction: ltr; text-align: left; }
}

/* Give large resource values enough room on high-speed desktop servers. */
@media (min-width: 701px) {
  body #res.high-speed { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; height: auto; box-sizing: border-box; padding: 4px 7px; background: transparent; border: 0; border-radius: 0; box-shadow: none; }
  body #res.high-speed li { float: none; width: auto; min-width: 0; padding: 0; }
  body #res.high-speed li p { white-space: nowrap; overflow-x: auto; overflow-y: hidden; }
  body #res.high-speed li .bar-bg { width: 100%; max-width: 160px; }
}

/* Match the original light-blue resource frame on mobile. */
@media (max-width: 700px) {
  body #res.high-speed { box-sizing: border-box; background: linear-gradient(to bottom, rgba(239, 245, 255, .96), rgba(225, 235, 250, .96)); border: 1px solid rgba(146, 161, 183, .7); border-top: 0; border-radius: 0 0 8px 8px; box-shadow: 0 2px 3px rgba(75, 91, 111, .28); }
}

/* Align the resource landscape with the scaled map, below the header. */
@media (max-width: 700px) {
  body.village1 #wrapper { background-size: auto calc(730px * var(--warian-scale, .6)) !important; }
}

/* Keep lower-speed servers on a single resource row on mobile. */
@media (max-width: 700px) {
  body #res:not(.high-speed) { display: flex !important; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
  body #res:not(.high-speed) li { flex: 0 0 auto; min-width: max-content; overflow: visible; padding-left: 8px; }
}


/* Match mobile controls to the light-blue resource panel. */
@media (max-width: 700px) {
  body #navigation, body .warian-menu-button, body .warian-drawer-toggle, body .warian-extra-links { background: linear-gradient(to bottom, rgba(239, 245, 255, .96), rgba(225, 235, 250, .96)); border-color: rgba(146, 161, 183, .7); color: #293c51; }
  body .warian-extra-links a { color: #293c51; }
}

/* Research and upgrade cards must fit narrow mobile screens. */
@media (max-width: 700px) {
  body #build .research { box-sizing: border-box; max-width: 100%; }
  body #build .research .information { float: none !important; clear: both; width: 100% !important; max-width: 100%; box-sizing: border-box; }
  body #build .research :is(.costs, .showCosts, .contractLink) { box-sizing: border-box; max-width: 100%; overflow-wrap: anywhere; }
}

/* Keep desktop page titles below the second resource row. */
@media (min-width: 701px) {
  body:not(.village1):not(.village2):has(#res.high-speed) #contentOuterContainer { margin-top: 28px; }
}

/* Profile navigation and forms on narrow screens. */
@media (max-width: 700px) {
  body.spieler #content .contentNavi { flex-wrap: wrap; justify-content: flex-start; align-items: flex-end; gap: 4px; height: auto !important; min-height: 0 !important; overflow: visible !important; white-space: normal; padding: 5px; }
  body.spieler #content .contentNavi > .container { float: none !important; flex: 0 0 auto; margin: 0 !important; }
  body.spieler #content form { max-width: 100%; }
  body.spieler #content input.text, body.spieler #content select, body.spieler #content textarea { box-sizing: border-box; max-width: 100% !important; }
  body.spieler #content :is(#change_pass, #change_mail, #del_acc, table.sitters, #links) { width: 100% !important; table-layout: fixed; }
  body.spieler #content :is(#change_pass, #change_mail, #del_acc, table.sitters, #links) :is(th,td) { overflow-wrap: anywhere; }
  body.spieler #content :is(#change_pass, #change_mail, #del_acc, table.sitters, #links) input.text { width: 100%; }
  body.spieler #content #editDetails { width: 100% !important; }
  body.spieler #content #editDetails tr { display: flex; flex-wrap: wrap; align-items: center; }
  body.spieler #content #editDetails th { box-sizing: border-box; flex: 0 0 90px; }
  body.spieler #content #editDetails td { box-sizing: border-box; flex: 1 1 calc(100% - 90px); min-width: 0; }
  body.spieler #content textarea.editDescription { display: block; float: none !important; width: 100% !important; margin: 5px 0; }
  body.spieler #content > img.heroImage { float: none !important; display: block; margin: 8px auto; }
  body.spieler #content #details { float: none !important; width: 100% !important; }
}

@media (max-width: 700px) {
  body.spieler.spieler.spieler #content .contentNavi { overflow-x: visible !important; overflow-y: visible !important; }
  body.spieler #content #villages { width: 100% !important; table-layout: fixed; }
  body.spieler #content #villages :is(th, td) { min-width: 0 !important; width: auto !important; overflow-wrap: anywhere; }
  body.spieler #content #villages :is(th, td):first-child { width: 35% !important; }
  body.spieler #content #villages td.name input { box-sizing: border-box; width: 100% !important; max-width: 100% !important; }
  body.spieler #content #villages td.coords { white-space: normal !important; }
}

@media (max-width: 700px) {
  body.spieler #content #villages .coordinates.coordinatesAligned { width: auto !important; white-space: nowrap; }
  body.spieler #content #villages :is(.coordinateX, .coordinateY) { width: auto !important; float: none !important; display: inline !important; }
}

/* Login navigation and news drawer use the original Warian graphics. */
@media (max-width: 700px) {
  body:is(.login,.contact,.registration) #side_navi { display: none !important; }
  body:is(.login,.contact,.registration) #content h1.titleInHeader .warian-login-title { display: none; }
  body:is(.login,.contact,.registration) #content h1.titleInHeader .warian-login-title-menu { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; max-width: 100%; gap: 4px; font-size: clamp(12px, 3.5vw, 15px); line-height: 1.35; white-space: nowrap; }
  body:is(.login,.contact,.registration) #content h1.titleInHeader .warian-login-title-menu a { color: inherit; font: inherit; text-decoration: none; padding: 3px 6px; border: 1px solid #aebca8; border-radius: 4px; background: rgba(247, 250, 244, .85); }
  body:is(.login,.contact,.registration) #content h1.titleInHeader .warian-login-title-menu a[aria-current] { font-weight: bold; }
  @media (max-width: 350px) { body:is(.login,.contact,.registration) #content h1.titleInHeader .warian-login-title-menu { gap: 2px; font-size: 12px; } }
  body.login #side_info { top: 8px !important; bottom: 8px !important; }
  body.login .warian-login-drawer-veil:not([hidden]) { inset: 0; }
}

.warian-login-title-menu { display: none; }

body.contact #content .warian-contact-message { direction: rtl; text-align: center; line-height: 2.2; padding: 25px 8px; overflow-wrap: anywhere; }

/* Keep registration controls readable at narrow widths. */
@media (max-width: 700px) {
  body.registration #content h2, body.registration #content .tribeInfo, body.registration #content .checks { overflow-wrap: anywhere; line-height: 1.8; }
  body.registration #content #sign_input { display: block; width: 100%; max-width: 100%; }
  body.registration #content #sign_input tbody, body.registration #content #sign_input tr, body.registration #content #sign_input th, body.registration #content #sign_input td { display: block; box-sizing: border-box; width: 100%; }
  body.registration #content #sign_input th { text-align: right; }
  body.registration #content #sign_input input { box-sizing: border-box; width: 100%; max-width: 100%; }
  body.registration #content .tribeSelect { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 10px 4px; padding: 0; }
  body.registration #content .tribeSelect .tribe { float: none; width: auto; min-width: 83px; margin: 0; text-align: center; }
  body.registration #content .tribeSelect .clear { display: none; }
  body.registration #content #sign_select { display: block; width: 100%; }
  body.registration #content #sign_select tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  body.registration #content #sign_select tr { display: contents; }
  body.registration #content #sign_select td { box-sizing: border-box; width: auto; }
  body.registration #content #sign_select td.pos2 { display: none; }
  body.registration #content .checks { text-indent: 0; padding: 0; }
  body.registration #content center input { box-sizing: border-box; max-width: 100%; }
}
