/* mobile-gate.css — phones and tablets (2026-11-14); see mobile.js for the three screen kinds and their media queries:
   compact @media (max-width: 1099px) · phone @media (max-width: 699px), (max-height: 500px) · touch @media (pointer: coarse).
   Every rule here sits inside one of those, so a desktop with a mouse at 1100 px or wider is unchanged — but for the
   account page's Menu button, which only a phone shows (its one rule at the top hides it everywhere else).
   This file: what comes before and around the game — the gate (#login), the account page (#acct), the loading screen
   (#loading) and the portrait picker (#face-pick, faces.js). */

/* the account page's Menu button (index.html .acct-head): the header's links fold into it on a phone */
.acct-menu { display: none; }

/* ---------------- compact: tablets upright, small windows ---------------- */
@media (max-width: 1099px) {
  /* the 1280 px the game frame needs is not wanted before the game: the gate, the account page and the loading screen
     fit the screen. Only while the game is hidden: its own frame is mobile-shell.css's. */
  body:has(> main#game[hidden]) { min-width: 0; }

  /* the gate's paragraph under the frame: as wide as it can be, centred on the 500 px gate, never past the screen */
  .gate-foot { width: min(760px, calc(100vw - 24px)); margin-left: calc((500px - min(760px, 100vw - 24px)) / 2); }
  .gate-tagline { margin-left: 0; margin-right: 0; }

  /* the account page: the screen's width, less a gutter, in place of a fixed 1000 px */
  #acct { width: auto; max-width: 1000px; margin: 1vh 12px 3vh; }
  #acct .citavon img { width: min(400px, 46vw); }
  .acct-head { flex-wrap: wrap; align-items: center; }
  .acct-head nav { line-height: 1.9; }
  .acct-tools { flex-wrap: wrap; }
  /* a closed (i) note takes no room: hidden but laid out, one near the right edge widened the page past a phone's screen */
  .info:not(:hover):not(:focus)::after { display: none; }

  /* the portrait picker: never taller than the screen; the faces scroll inside, the buttons stay in sight */
  .fp-box { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .fp-body { display: flex; flex-direction: column; min-height: 0; }
  .fp-grid { flex: 1 1 auto; min-height: 120px; max-height: none; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .fp-foot { flex-wrap: wrap; }
}

/* ---------------- phone: under 700 px wide, or under 500 px tall (a phone either way up) ---------------- */
@media (max-width: 699px), (max-height: 500px) {
  /* the crest smaller, so the form shows under it without scrolling */
  .citavon img { width: min(330px, 80vw); }
  #acct .citavon img { width: min(260px, 64vw); }

  /* the painted frame thinner round a narrow form: the same picture, its wood two thirds as wide */
  .gate-frame { padding: 38px 30px 36px; }
  .gate-frame::before { border-image-width: 44px 40px 46px 40px; }

  /* the gate: the screen's width, a 8 px gutter each side */
  #login { width: 100%; max-width: 516px; margin: 2vh auto 3vh; padding: 0 8px; }
  #login .gate-frame { margin-top: -8px; }
  .gate-tagline { margin: 14px 0 0; font-size: 17px; }
  .gate-foot { width: auto; margin: 10vh 0 0; padding: 18px 16px 14px; }
  .gate-foot p { text-align: left; }
  :is(#login, #acct) .row { grid-template-columns: 1fr; }
  :is(#login, #acct) .row > a { text-align: center; }

  /* the account page */
  #acct { margin: 1vh 6px 3vh; }
  #acct .gate-frame { margin-top: -6px; padding: 38px 28px 34px; }
  #acct .acct-head h3 { font-size: 19px; }
  .acct-head > div { flex: 1; min-width: 0; }
  .acct-head > div .small-text { display: block; overflow-wrap: anywhere; }
  /* the header's ten links fold into the Menu button: a grid of big ones under the header when open */
  .acct-menu { display: inline-flex; align-items: center; gap: 6px; flex: none; position: relative; }
  .acct-head:has(#acct-invites:not([hidden])) .acct-menu::after { content: ''; position: absolute; top: 2px; right: 4px; width: 9px; height: 9px;
    border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px #fbf0d6; }
  .acct-head nav { display: none; }
  /* flex, not grid: the " · " between the links are text, and a grid gives each its own cell (font-size 0 hides them) */
  .acct-head.open nav { display: flex; flex-wrap: wrap; flex-basis: 100%; margin: 0 -3px; font-size: 0; line-height: 1.2; }
  .acct-head.open nav a { flex: 1 1 40%; display: flex; align-items: center; justify-content: center; min-height: 42px; margin: 3px; padding: 6px 8px; font-size: 15px;
    text-align: center; text-decoration: none; white-space: normal; border: 1px solid rgba(160,122,62,.75); border-radius: 4px; background: rgba(255,250,236,.62); }
  #acct .acct-head.open nav a.on { color: #fff4dc; background: linear-gradient(#a8442a, #7a2414); border-color: #4a1206; }
  .acct-head nav .acct-badge { font-size: 10.5px; }

  .acct-tools #acct-search { flex: 1 1 100%; }
  .acct-tools #acct-sort { flex: 1; }
  #acct-count { min-width: 0; }
  .acct-server > header { flex-wrap: wrap; row-gap: 4px; }
  /* one lord a row, and the page scrolls (no box scrolling inside the page) */
  .acct-lords { grid-template-columns: 1fr; max-height: none; min-height: 0; padding-right: 2px; }
  .acct-lord { padding: 8px 10px; }
  .acct-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .acct-actions > span { display: flex; }
  .acct-actions > span > button { flex: 1; }
  .acct-two { grid-template-columns: 1fr; }
  .login-face { width: 72px; height: 72px; font-size: 12px; }
  .login-face img.face-img { width: 64px; height: 64px; }
  .acct-note { flex-wrap: wrap; }
  #acct .acct-note input { flex: 1 1 100%; width: auto; }
  .share-grid { grid-template-columns: 1fr; }
  .acct-rows li { flex-wrap: wrap; }
  .acct-rows li > span:last-child { flex-wrap: wrap; }
  .acct-rows.history li > span:first-child { width: auto; flex-basis: 100%; }
  #acct input, #acct textarea { max-width: 100%; }
  #acct details ul { padding-left: 18px; }

  /* the loading screen: the screen's width, higher up */
  #loading { top: 3vh; width: calc(100vw - 16px); max-width: 520px; }
  #loading .gate-frame { padding: 38px 30px 34px; }

  /* the portrait picker fills the screen less a gutter */
  .fp-box { max-width: calc(100vw - 12px); }
  .fp-body { margin: 6px; padding: 8px; }
  .fp-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 5px; }
  .fp-sel { flex: 1 1 100%; margin-right: 0; }
  .fp-foot .fp-msg:empty { display: none; }
  .fp-foot button { flex: 1; }
}
/* a phone upright: the gallery of faces down the edges in one column a side (the form covers the rest) */
@media (max-width: 699px) {
  .crowd-face.c1, .crowd-face.c2 { display: none; }
}
/* a phone on its side: little height, so the crest is small and the page scrolls to the rest */
@media (max-height: 500px) {
  .citavon img { width: min(250px, 34vw); }
  #acct .citavon img { width: min(200px, 28vw); }
  #login { margin-top: 1vh; }
  #loading { top: 1vh; }
  .loading-tip { min-height: 3.2em; }
}

/* ---------------- touch: a finger, not a mouse ---------------- */
@media (pointer: coarse) {
  /* a tablet on its side (1180 px) is no compact screen, but the gate still need not be 1280 px wide */
  body:has(> main#game[hidden]) { min-width: 0; }

  /* 16 px in every box: Safari zooms the page into a smaller one and leaves it zoomed */
  :is(#login, #acct) input:not([type=hidden]):not([type=file]):not([type=checkbox]), :is(#login, #acct) select, :is(#login, #acct) textarea,
  #acct-sort, #acct .acct-two select, #acct .share-do label select { font-size: 16px; }
  #acct-sort { padding: 9px 8px; }

  /* links and buttons big enough for a finger */
  #login .signup-link, #login .forgot-link { margin: 2px 0 0; }
  #login .signup-link a, #login .forgot-link a, :is(#login, #acct) form > p.small-text:last-child a, #acct-settings > p.small-text:last-child a,
  :is(#login, #acct) .row > a, #import-mode, #acct-forgot, #friends-rename {
    display: inline-block; padding: 10px 8px; font-size: 14px; }
  .gate-foot nav { line-height: 1; }
  #login .gate-foot nav a { display: inline-block; margin: 0 2px; padding: 12px 6px; }
  .acct-head nav a { display: inline-block; padding: 12px 3px; }
  .acct-head nav { line-height: 1.2; }
  :is(#login, #acct) button:not(.acct-lord):not(.login-face):not(.fp-face):not(.tip-turn) { min-height: 40px; }
  #login label.check { min-height: 40px; margin-top: 6px; }
  #login label.check input, #acct label.check input { width: 22px; height: 22px; }
  #acct .share-lords label.check { min-height: 40px; }
  .share-do summary { padding: 10px 0; }
  #acct details summary { padding: 8px 0; }

  /* the (i) notes: a tap opens them by windows.js and mobile-win.css (one way for the game and the gate alike) */

  /* the loading screen's hint arrows */
  .tip-turn { width: 40px; height: 40px; font-size: 22px; }
  .loading-tips { gap: 6px; }

  /* the portrait picker */
  .fp-foot button, .fp-tabs button { min-height: 42px; padding-left: 16px; padding-right: 16px; }
  #face-pick .win-close { min-width: 40px; min-height: 40px; }
}
