/* Portal page layout - theme.css owns the palette and type, this file owns
 * geometry only. See its own header for why: another agent authors the
 * real theme.css, so tokens are consumed here, never redefined.
 *
 * .game-row and .scale-strip share ONE grid template (--row-grid) so the
 * era ticks drawn once above the list and every row's own lit segment/
 * marker land in the exact same horizontal coordinate space - the whole
 * point of the shared scale. Anywhere a rule below has to distinguish an
 * "act now" element from its own default, it uses a :not() guard rather
 * than a same-specificity override, so the amber colour theme.css already
 * assigns to .row-edge-act/.status-act can never be quietly cancelled by a
 * layout rule that loads after it in the cascade.
 */

:root {
  --row-grid: 4px minmax(120px, 1.5fr) 84px minmax(140px, 2.2fr) 60px 150px;
  --row-gap: 14px;
}

body.page {
  padding: 24px 20px 48px;
  max-width: 720px;
  margin: 0 auto;
  box-sizing: border-box;
}

.portal-head {
  margin-bottom: 18px;
}

.portal-account { margin-top: .5rem; }

.portal-head .wordmark {
  font-size: 1.6rem;
  text-align: center;
}

/* --- the shared scale --------------------------------------------------- */

.scale-strip {
  display: grid;
  grid-template-columns: var(--row-grid);
  column-gap: var(--row-gap);
  margin: 0 0 6px;
  padding: 0 14px;
}

.scale-track {
  position: relative;
  /* Tall enough for the .scale-tick-tier1/2/3 stagger below - four label
   * lines, not one (see portal.js's buildScaleStrip for why two was not
   * enough). */
  height: 74px;
}

.scale-axis {
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  height: 1px;
  background: var(--rule);
}

.scale-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scale-tick::before {
  content: "";
  width: 1px;
  height: 8px;
  background: var(--rule);
}

.scale-tick-label {
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--dim);
  white-space: nowrap;
}

/* Every era tick past the first (portal.js's buildScaleStrip) drops its
 * label to its OWN line - Medieval/Renaissance/Industrial bunch inside the
 * last ~21% of the axis close enough that any two of the three collide at
 * this page's width, so no two-line alternation can separate all of them
 * (see portal.js's own comment on why). Only the LABEL moves; every tier's
 * tick mark (::before) stays level with its neighbours', so the marks
 * themselves still read as one continuous row against the axis - only the
 * text staggers, one step lower per tier. */
.scale-tick-tier1 .scale-tick-label { margin-top: 18px; }
.scale-tick-tier2 .scale-tick-label { margin-top: 32px; }
.scale-tick-tier3 .scale-tick-label { margin-top: 46px; }

/* --- the game list ------------------------------------------------------- */

.game-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-row {
  display: grid;
  grid-template-columns: var(--row-grid);
  column-gap: var(--row-gap);
  align-items: center;
  padding: 14px;
  border-radius: 8px;
  background: var(--field);
  border: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}

.game-row:hover,
.game-row:focus-visible {
  border-color: var(--gild-dim, var(--gild));
  outline: none;
}

.row-edge {
  display: block;
  align-self: stretch;
  width: 4px;
  border-radius: 2px;
  /* Deliberately no colour of its own - .row-edge-act (theme.css) is the
     only thing that ever paints this, so an inactive row shows nothing
     here rather than a colour that would have to be un-set later. */
}

.game-name {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--gild);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-players {
  color: var(--dim);
  font-size: 0.85rem;
  white-space: nowrap;
}

.game-scale {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--rule);
}

.scale-lit {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 3px;
  background: var(--gild);
}

.scale-mark {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-left: -5px;
  margin-top: -5px;
  background: var(--parchment);
  transform: rotate(45deg);
  border-radius: 1px;
}

.game-scale-pending .scale-lit {
  background: transparent;
  border: 1px dashed var(--dim);
  box-sizing: border-box;
}

.game-turn {
  text-align: right;
  color: var(--parchment);
  font-size: 0.9rem;
  white-space: nowrap;
}

.game-status {
  text-align: right;
  font-size: 0.85rem;
  white-space: nowrap;
}

.game-status:not(.status-act) {
  color: var(--dim);
}

/* --- hints and the foot --------------------------------------------------- */

.hint {
  text-align: center;
  color: var(--dim);
  margin-top: 24px;
}

.hint-error {
  color: var(--parchment);
}

.portal-foot {
  margin-top: 32px;
  text-align: center;
}

.admin-link {
  color: var(--gild);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.admin-link:hover,
.admin-link:focus-visible {
  border-bottom-color: var(--gild);
}

/* Narrower, not gone: the scale is the whole point of the page and this is
 * a phone client first, so a small screen tightens the columns rather than
 * dropping the axis or the per-row marker. Only the tick LABELS go, since
 * the ticks themselves plus every row's own marker still read the shared
 * position without them. */
@media (max-width: 560px) {
  :root {
    --row-grid: 4px minmax(84px, 1.3fr) 48px minmax(64px, 1.4fr) 50px 92px;
    --row-gap: 8px;
  }

  body.page {
    padding: 18px 12px 40px;
  }

  .game-row {
    padding: 10px;
  }

  .game-name {
    font-size: 0.92rem;
  }

  .game-players,
  .game-turn,
  .game-status {
    font-size: 0.72rem;
  }

  .scale-tick-label {
    display: none;
  }

  /* The desktop track is tall enough for the four-tier label stagger
   * (.scale-tick-tier1/2/3) - wasted height here since the labels above are
   * hidden outright, leaving an empty gap over the game list. Back to just
   * enough for the tick marks themselves. */
  .scale-track {
    height: 30px;
  }
}
