/* © 2026 Jattar Tajjar. Kroniki Lorviku. Wszelkie prawa zastrzeżone. */
/* KRONIKI LORVIKU - the portal pages: the home grid (the side column with the login, world and statistics boxes,
   the news in the centre, the ranking box), the side column next to the news, chronicle, ranking and help pages,
   the news entries, the chronicle entries, the ranking tables and filters, the help page. Loaded after library.css; only portal page classes
   live here. */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- the home grid */

/* two columns on a laptop: the side boxes and the ranking left, the centre right; three from 1000 px */
.portal {
  display: grid;
  gap: 16px;
  align-items: start;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "side centre" "rank centre";
}
.side { grid-area: side; min-width: 0; }
.centre { grid-area: centre; min-width: 0; }
.rankbox { grid-area: rank; }

/* the news, ranking and help pages: the content first, the side boxes under it in a row of their own; from
   1000 px the side column stands on the left, as on the home page */
.portal.sub { display: block; }
.portal.sub .side { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); column-gap: 16px; align-items: start; }

.box.login .btn { margin-top: 4px; }
.box.login .btn + .btn { margin-top: 8px; }
.box.login .me-line { margin: 0 0 8px; color: var(--head); font-weight: bold; word-break: break-word; }

/* the keyboard note shows where the game cannot be played: small screens and touch screens */
.touch-note { display: none; margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* the world row: the dot, the name and its kind, the players in game (on the same line when it fits); a piece
   never breaks inside and the gap is the only separator */
.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}
.status .part { white-space: nowrap; }
.status .wrow { display: inline-flex; align-items: center; gap: 8px; }
.status .dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line2);
  background: var(--muted);
}
.status.ok .dot { background: var(--ok); border-color: var(--ok); }
.status.bad .dot { background: var(--bad); border-color: var(--bad); }
.status .wname { font-size: 18px; font-weight: bold; letter-spacing: 0.08em; color: var(--head); }
.status .wtype { font-size: 14px; color: var(--muted); }
.status .players { margin-left: auto; color: var(--text); }
.status.ok .players { color: var(--ok); }
.status.bad .players { color: var(--bad); font-weight: bold; }
/* a server with channels: one line per channel under the world row */
.chans { list-style: none; margin: 6px 0 0; padding: 0; font-size: 14px; line-height: 1.6; }
.chans .chan { display: flex; justify-content: space-between; gap: 12px; white-space: nowrap; }
.chans .cname { color: var(--head); letter-spacing: 0.06em; }
.chans .ok .cplayers { color: var(--ok); }
.chans .full .cplayers, .chans .down .cplayers { color: var(--bad); font-weight: bold; }
.uptime { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.box.world .btn { margin-top: 12px; }
.box.community .btn { margin-top: 12px; }

.stat-list { margin: 0; }
.stat-list dd { color: var(--text); font-weight: bold; text-align: right; }

/* ---------------------------------------------------------------- news */

.welcome { margin: 0 0 14px; padding: 0 0 12px; border-bottom: 2px solid var(--line); color: var(--muted); }
.entry { padding: 0 0 12px; margin: 0 0 12px; border-bottom: 2px solid var(--line); }
.entry:last-of-type { border: 0; margin: 0; padding: 0; }
.entry time { display: block; font-size: 13px; letter-spacing: 0.1em; color: var(--gold); }
.entry h3 { margin: 2px 0 6px; font-size: 16px; letter-spacing: 0.08em; color: var(--text); }
.entry p { margin: 0; }
.entry .by { margin: 6px 0 0; font-size: 13px; color: var(--muted); text-align: right; font-style: italic; }

/* ---------------------------------------------------------------- chronicle */

/* each entry: the year on a bronze rail at the left, the dating line and the text beside it */
.rec { display: grid; grid-template-columns: 112px minmax(0, 1fr); column-gap: 14px; }
.rec .yr {
  margin: 0;
  padding: 2px 10px 0 0;
  border-right: 2px solid var(--frame2);
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 0.06em;
  text-align: right;
  white-space: nowrap;
  color: var(--gold);
}
.rec .body { min-width: 0; }
.rec h3 { margin: 0 0 6px; font-style: italic; letter-spacing: 0.04em; }
.box.chronicle > .by { margin: 12px 0 0; font-size: 14px; color: var(--muted); text-align: right; font-style: italic; }
.box.chronicle > .note { margin: 12px 0 0; padding: 10px 0 0; border-top: 2px solid var(--line); font-size: 14px; color: var(--muted); }

/* ---------------------------------------------------------------- ranking */

/* a block of its own, so the cell centres it like the plain numbers beside it */
.grid.rank .who { display: flex; align-items: center; gap: 8px; min-width: 0; line-height: 1.2; }
.grid.rank .who canvas { flex: 0 0 auto; display: block; }
.grid.rank td { vertical-align: middle; }
.grid.rank td.num { width: 1px; }
.rankpage .table-box { max-width: 760px; }
.small { font-size: 13px; margin: 8px 0 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.filter {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 16px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  background: var(--panel);
  border: 2px solid var(--frame2);
}
.filter:hover, .filter:focus-visible { border-color: var(--frame); color: var(--head); text-decoration: none; }
.filter.active { background: var(--frame2); border-color: var(--frame); color: var(--head); }

/* ---------------------------------------------------------------- help */

.help .cls { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 12px; }
.help .cls canvas { flex: 0 0 auto; }
.help .cls strong { display: block; color: var(--head); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 4px; }

.grid.keys td.key { color: var(--head); font-weight: bold; white-space: nowrap; }

/* ---------------------------------------------------------------- wide screens: three columns */

@media (min-width: 1000px) {
  .portal {
    grid-template-columns: 280px minmax(0, 1fr) 280px;
    grid-template-rows: auto;
    grid-template-areas: "side centre rank";
  }
  .portal.sub {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    grid-template-areas: "side centre";
  }
  .portal.sub .side { display: block; }
}

/* ---------------------------------------------------------------- touch screens and phones */

@media (max-width: 640px), (pointer: coarse) {
  .touch-note { display: block; }
}

/* phones: the boxes stack in source order (login, world, news, ranking); the statistics repeat the world box and
   the ranking box there, so they stay out */
@media (max-width: 640px) {
  .portal { display: block; }
  .portal.sub .side { display: block; }
  .box.stats { display: none; }
  table.grid { font-size: 14px; }
  .filter { flex: 1 1 auto; justify-content: center; padding: 6px 8px; }
  /* the chronicle: the year sits over its entry, the rail turns into a rule under it */
  .rec { display: block; }
  .rec .yr { padding: 0 0 2px; margin: 0 0 4px; border-right: 0; border-bottom: 2px solid var(--frame2); text-align: left; }
}
