/* mobile-land.css — a phone on its side, the way Citavon is played on a phone (the user, 2026-11-20: "make it use the
   screen horizontally … ensure things are visible, easy to click on … the town view, city view, map view, zoom,
   barracks training, researching, upgrading each building, speedups and in-town things especially").
   Loaded after mobile-shell/touch/win.css and laid over them; every rule sits inside
     @media (max-height: 500px) and (orientation: landscape)
   (a phone held sideways: 330-430 CSS px tall), so tablets, desktops and a phone upright are unchanged.
   Upright, mobile.js puts up a "turn your phone sideways" card (#m-turn, below) — the game can still be played that
   way after "Play upright anyway".
   The budget on the smallest phone in a browser (iPhone SE, Safari's bar showing): 667 x 330. */

/* ---- what mobile.js adds for this: hidden everywhere else */
#m-turn, #m-full-btn { display: none; }

@media (max-height: 500px) and (orientation: landscape) {

  /* ======== the round buttons: two narrow columns down the left, the in-town ones first ======== */
  #game .left { grid-template-columns: 100px minmax(0, 1fr); }
  #game .btncol { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 49px; align-content: start; gap: 0;
    padding: 2px 0 12px; overflow-x: hidden; overflow-y: auto; }
  #game .btncol .round, #game .btncol .jobtabs button { width: auto; min-width: 0; height: 49px; flex: none; padding: 3px 0 0; gap: 1px; }
  #game .btncol .round .disc, #game .jobtabs .m-ico { width: 31px; height: 31px; }
  #game .btncol .round .lbl, #game .jobtabs .m-short { margin: 0; max-width: 48px; padding: 0; border: 0; border-image: none; background: none;
    font: 700 10.5px/12px Georgia, serif; color: #f6e2ad; text-shadow: 0 1px 1px #000, 0 0 3px #000; letter-spacing: -.1px; }
  #game .btncol .round .count { top: 0; right: 1px; min-width: 17px; padding: 0 4px; font-size: 10.5px; line-height: 16px; }
  #game .jobtabs button.on .m-ico { box-shadow: 0 0 0 2px #e0782e, 0 0 6px rgba(242, 213, 138, .8); }
  /* Construction and Troops first: what a player in town does most; then the quests, the chat and the mail */
  #jobs-build { order: 0; }   #jobs-troops { order: 1; }   #quests-btn { order: 2; }   #m-chat-btn { order: 3; }
  #mail-btn { order: 4; }   #reports-btn { order: 5; }   #alliance-btn { order: 6; }   #shop-btn { order: 7; }
  #m-full-btn { order: 8; }   #stats-btn { order: 9; }   #forum-btn { order: 10; }   #contact-btn { order: 11; }
  /* two names too long for the column, shortened here only */
  #game #stats-btn .lbl, #game #contact-btn .lbl { font-size: 0; }
  #game #stats-btn .lbl::after { content: 'Stats'; font-size: 10.5px; }
  #game #contact-btn .lbl::after { content: 'Contact'; font-size: 10.5px; }
  /* the chat sheet and its ✕ start beside the wider column */
  #game .chatbox, #game .chatbox.tall { left: calc(104px + env(safe-area-inset-left)); width: min(520px, calc(100vw - 124px)); }
  html.m-chat-open #game .m-chat-x { left: calc(104px + env(safe-area-inset-left) + min(520px, calc(100vw - 124px)) - 28px); }

  /* the full-screen button (mobile.js: where the browser can, and not opened from the home screen already) */
  html.m-can-full #game #m-full-btn { display: flex; }
  #game #m-full-btn .disc { display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff6dc, #e2c17e 65%, #a87a34);
    border: 2px solid #8a6a2a; box-shadow: 0 2px 3px rgba(0, 0, 0, .45); }
  #game #m-full-btn .disc svg { width: 19px; height: 19px; }

  /* ======== the top bar: a little more room for the strip of resources ======== */
  #game .tabs.big button { width: 88px; }
  #game .tabs.big button .ic, #game .tabs.big button img, #game .tabs.big button svg { width: 20px; height: 20px; }

  /* ======== the lord and city drawer: as wide as the screen beside the buttons, its banner a strip ======== */
  #game aside.right { width: min(720px, calc(100vw - 100px - env(safe-area-inset-left))); grid-template-columns: minmax(0, 45%) minmax(0, 1fr); }
  #game aside.right .brand { height: 54px; }
  #game aside.right .brand .logo .brand-mark { height: 44px; }
  #game aside.right .citybox { min-height: 0; }
  #game aside.right .city-list button { min-height: 36px; }
  #game aside.right .ctabs button { flex: 1 1 0; min-width: 0; }
  #game aside.right .lord .face { max-height: 150px; }

  /* ======== over the view: the Beginner/truce chip a size smaller ======== */
  #game .peacechip { height: 36px; padding: 0 4px 0 2px; gap: 2px; }
  #game .peacechip svg { width: 22px; height: 22px; }
  #game .peacechip .pc-t b { font-size: 11px; }
  #game .peacechip .pc-t small { font-size: 11px; }
  #game .peacechip .pc-caret { display: none; }
  #game .buffbar { max-width: calc(100% - 170px); }
  /* the Lucky Charm a disc without its name, so the jobs panel (its Speed up and ✕) keeps clear of it */
  #game .charm-btn .lbl { display: none; }
  #game .charm-btn .disc { width: 46px; height: 46px; }
  #game .jobs, #game .jobs:not([hidden]) { left: 6px; right: 62px; bottom: 6px; max-height: calc(100% - 56px); }
  #game .scene-zoom { gap: 4px; }
  #game .scene-zoom button { min-width: 40px; min-height: 40px; width: 40px; height: 40px; padding: 0; }

  /* ======== the map: its bar along the bottom-left, out of the map's middle ======== */
  #game .map-bar { top: auto; bottom: max(6px, env(safe-area-inset-bottom)); left: 6px; right: auto; max-width: calc(100% - 78px);
    flex-wrap: nowrap; gap: 4px; padding: 3px 5px; }
  #game .map-bar.more { flex-wrap: wrap; }
  #game .map-bar button { min-width: 40px; min-height: 40px; padding: 0 8px; }
  #game .map-bar input { width: 52px; min-height: 38px; padding: 0 4px; }
  #game .view:has(> #map:not([hidden])) .buffbar { max-width: calc(100% - 12px); }
  /* the jobs panel over the map sits above its bar, which stays in reach */
  #game .view:has(> #map:not([hidden])) .jobs:not([hidden]) { bottom: calc(58px + env(safe-area-inset-bottom)); max-height: calc(100% - 110px); }
  #game .peacemenu { top: 4px; max-height: calc(100% - 8px); }
  /* the tile window down the right: a third of the screen is enough, the map stays in sight */
  #win.side { width: min(340px, 46vw); }

  /* ======== windows: everything in them drawn at 80% (the user, 2026-11-21: "the pages that open within the town … and
     the reports, quests, alliance … all seem very big"): 286 px of window height held a desktop's 14 px words, 42 px
     tabs and buttons and 43 px table heads. zoom scales the words, pictures, gaps, tabs and tables alike; a button stays
     ~32 px on the glass, enough for a finger. Text boxes 20 px here = 16 px on the glass, so an iPhone does not zoom in
     when one is tapped. The bar above (title, ✕) slimmer too. The hover/(i) box hangs on <body>, outside the zoom. */
  #win .win-body, #win .pop-body { zoom: .8; }
  #win .win-body input:not([type=checkbox]):not([type=radio]), #win .win-body select, #win .win-body textarea,
  #win .pop-body input:not([type=checkbox]):not([type=radio]), #win .pop-body select, #win .pop-body textarea { font-size: 20px; }
  #win:not(.side) > .win-bar { height: 34px; grid-template-columns: 36px 1fr auto 1fr 36px; }
  #win .win-title { height: 30px; padding-top: 4px; font-size: 13px; }
  #win .win-close, #win .pop .win-close { width: 36px; height: 36px; }
  #win:not(.side) .win-body { font-size: 15px; line-height: 1.35; padding: 6px 8px; }
  #win:not(.side) .win-body h3 { font-size: 17px; margin: 2px 0 4px; }
  #win:not(.side) .win-body h4 { font-size: 16px; margin: 2px 0 4px; }
  #win .small-text, #win .cost, #win .tc-stats { font-size: 13.5px; }
  /* the head: a small picture (Move and Demolish knobs on it) beside the words, which show two lines until tapped */
  .bhead { grid-template-columns: 104px minmax(0, 1fr); gap: 8px; margin-bottom: 4px; }
  .bhead .pic { height: 62px; }
  .bhead .move-btn, .bhead .demo-btn { width: 34px; height: 34px; }
  .bhead .move-btn { right: 38px; }
  .bhead .demo-btn { right: 1px; bottom: 1px; }
  .bhead .move-btn svg, .bhead .demo-btn svg { width: 28px; height: 28px; }
  .bhead .desc { position: relative; max-height: 62px; overflow: hidden; padding: 3px 26px 3px 8px; font-size: 12.5px; line-height: 1.3; cursor: pointer; }
  .bhead .desc::after { content: '▾'; position: absolute; right: 0; bottom: 0; width: 24px; height: 22px; display: grid; place-items: center;
    color: #6e4318; font-size: 13px; background: linear-gradient(90deg, transparent, #fbf0d6 40%); }
  .bhead .desc.m-open { max-height: none; }
  .bhead .desc.m-open::after { content: '▴'; }
  /* the next level and its Upgrade: one line where it fits */
  #win .opt { gap: 6px 10px; padding-block: 4px; }

  /* the barracks and the Academy: the line (what trains, its Speed up) a narrow column kept in sight, the troops or
     studies beside it with smaller pictures, their story one line */
  .bk { grid-template-columns: 178px minmax(0, 1fr); gap: 8px; }
  .bk-line { padding: 4px 6px; }
  #win:not(.side) .bk-line h4 { font-size: 14px; }
  .bk-line .batch .row { flex-wrap: wrap; gap: 4px; }
  .troopcard { padding: 5px 0; }
  .troopcard.unit { gap: 6px; }
  .troopcard.unit .tc-pic { width: 52px; height: 52px; }
  .troopcard.unit .tc-pic svg, .troopcard.unit .tc-pic img { max-width: 48px; max-height: 48px; }
  .troopcard.unit .tc-body > .quiet.small-text { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .troopcard .count { flex-wrap: wrap; gap: 4px 6px; }
  .troopcard .count input { width: 92px; }
  .bk-troops > .row:first-child select { max-width: 100%; }
}

/* ======== a phone upright: turn it sideways (in the game only; the login, the account page and the site are fine either way) ======== */
@media (max-width: 699px) and (orientation: portrait) {
  html:not(.m-upright-ok) body:has(> main#game:not([hidden])) #m-turn { display: flex; }
}
#m-turn { position: fixed; inset: 0; z-index: 200; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: max(20px, env(safe-area-inset-top)) 24px max(20px, env(safe-area-inset-bottom)); text-align: center;
  background: radial-gradient(ellipse at 50% 40%, #4a2a12, #1b1210 75%); color: #f6e7c2; font-family: Georgia, serif; }
#m-turn .m-turn-phone { width: 96px; height: 96px; animation: m-turn 2.4s ease-in-out infinite; }
#m-turn h2 { margin: 0; font-size: 22px; color: #ffe08a; text-shadow: 0 2px 2px #000; }
#m-turn p { margin: 0; max-width: 300px; font-size: 15px; line-height: 1.4; color: #e8d6ae; }
#m-turn button { min-height: 44px; padding: 0 18px; font: 700 15px Georgia, serif; }
#m-turn .m-turn-full { display: none; }
html.m-can-full #m-turn .m-turn-full { display: inline-block; }
#m-turn .m-turn-anyway { background: none; border: 0; box-shadow: none; color: #d9c49a; text-decoration: underline; font-weight: 400; }
@keyframes m-turn { 0%, 25% { transform: rotate(0); } 50%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { #m-turn .m-turn-phone { animation: none; transform: rotate(-90deg); } }
