/* The layout for small and short screens. (The online drawer it was named
 * for is gone: how many are online is said under Chat's title.)
 *
 * One of the stylesheets split out of the old style.css. index.html links them
 * in the order they had in that file, so the cascade is unchanged - keep
 * that order when adding a rule, or a later sheet may win where it used to lose. */

ul { margin: 0; padding: 0; list-style: none; }

@media (max-width: 760px), (max-height: 540px) {
  #player-hud { top: 12px; left: 12px; width: 280px; min-width: 0; min-height: 78px; padding: 8px; gap: 9px; }
  #player-avatar { width: 57px; flex-basis: 57px; font-size: 28px; }
  .player-hud-content { gap: 5px; }
  .player-hud-title { font-size: 13px; }
  #player-level, .stat-row { font-size: 10px; }
  .stat-track { height: 9px; }
  .stat-value { width: 56px; }
  #compass { top: 12px; width: 70px; height: 70px; }
  #minimap { width: 50px; height: 50px; }
  #compass-needle { top: 21px; left: 31px; height: 28px; transform-origin: 50% 14px; }
  #compass-needle::before { border-bottom-width: 14px; }
  #compass-needle::after { border-top-width: 14px; }
  .cardinal { font-size: 9px; }
  .cardinal.north { top: 6px; }
  .cardinal.east { right: 6px; }
  .cardinal.south { bottom: 6px; }
  .cardinal.west { left: 6px; }
  #floor-status { top: 92px; min-width: 146px; padding: 5px 8px; font-size: 8px; }
  .label { display: none; }
  .controls { padding: 0 14px 14px; }
  #exploration-ui button, #btn-forward { min-width: 58px !important; min-height: 58px !important; padding: 9px; }
  #combat-log { width: min(440px, calc(100% - 160px)); max-height: 82px; margin-bottom: 8px; padding: 7px 10px; font-size: 11px; }
  #combat-status { min-width: auto; padding: 9px 10px; font-size: 11px; }
  /* Six combat commands in one row ran off the right edge of a landscape
     phone (667x375), taking Potion, Run and Guard with them - with no keyboard
     there was no other way to heal, flee or brace. They wrap instead. */
  .combat-controls > .control-group:last-child {
    flex: 1 1 auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; gap: 6px;
  }
  .combat-controls .control-group:last-child button { min-height: 44px; padding: 6px 9px; font-size: 12px; }
  .city-panel { gap: 9px; padding: 16px 20px; }
  .city-emblem { width: 42px; height: 42px; font-size: 20px; }
  .job-picker button { min-width: 130px; padding: 10px; }
}

@media (max-width: 560px) {
  #player-hud { width: 210px; }
  #player-avatar { display: none; }
  #compass {
    top: 68px;
    right: 8px;
    left: auto;
    width: 66px;
    height: 66px;
    transform: none;
  }
  #minimap { width: 48px; height: 48px; }
  .cardinal { font-size: 8px; }
  .cardinal.north { top: 4px; }
  .cardinal.east { right: 4px; }
  .cardinal.south { bottom: 4px; }
  .cardinal.west { left: 4px; }
  /* Centred at this width it lands on the status panel's title row, so it
     sits under the panel rather than beside it. */
  #floor-status { top: auto; bottom: 96px; min-width: 132px; }
  #combat-log { width: calc(100% - 24px); }
  #system-message { top: 150px; }
}

@media (max-height: 420px) {
  #player-hud { min-height: 68px; }
  #player-avatar { width: 48px; flex-basis: 48px; }
  #combat-log { max-height: 62px; }
  .city-panel h1 { font-size: 21px; }
  .hint, .city-emblem { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #compass-needle, .stat-fill { transition: none; }
  button:active:not(:disabled) { transform: none; }
}

/* A portrait phone fights in a column: the log, the turn line, then the six
 * actions in a full-width grid - Attack, Heavy and Potion; the calling's
 * Special across the whole width, since it carries a second line; Run and
 * Guard. The actions used to wrap into a narrow column on the right, one word
 * per line, pushing the log up over the turn order and the monster. */
@media (max-width: 560px) {
  .combat-controls {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
    padding: 0 10px calc(10px + var(--edge-bottom));
  }
  .combat-controls > .control-group:first-child { justify-content: stretch; }
  #combat-status { width: 100%; min-width: 0; padding: 6px 10px; font-size: 11px; white-space: normal; }
  .combat-controls > .control-group:last-child {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }
  .combat-controls .control-group:last-child button {
    min-width: 0;
    min-height: 44px;
    padding: 6px 6px;
    font-size: 12px;
  }
  #btn-attack { order: 1; grid-column: span 2; }
  #btn-heavy { order: 2; grid-column: span 2; }
  #btn-potion { order: 3; grid-column: span 2; }
  #btn-special { order: 4; grid-column: 1 / -1; }
  #btn-run { order: 5; grid-column: span 3; }
  #btn-guard { order: 6; grid-column: span 3; }
  #combat-log { width: calc(100% - 20px); max-height: 64px; margin-bottom: 8px; padding: 6px 10px; font-size: 12px; }
  .event-card { padding: 12px 14px 14px; }
}
