/* tbcounter.com/calendar - the public event calendar.
   The site's palette (site/src/app/globals.css): dark editorial, gold scrollwork. One theme,
   painted explicitly. Fraunces carries the brand and the month, Geist the rest. */

:root {
  --bg: #0b0b0d;
  --surface: #131316;
  --surface-2: #1a1a1e;
  --surface-3: #232228;
  --border: rgba(200, 152, 99, 0.10);
  --border-strong: rgba(200, 152, 99, 0.22);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #f3eee0;
  --text-muted: #a8a193;
  --text-dim: #6b6557;
  --gold: #c89863;
  --gold-bright: #e0b97a;
  --gold-deep: #8a6a3d;
  --gold-ink: #17110a;
  --font-ui: "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --radius: 12px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font-ui);
  min-height: 100vh;
}
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

/* ---- header: pinned (Barak 2026-10-18), the month on top (2026-10-19) ----
   One grid. First row: the brand, the month, the time zone. Second row: the kingdom, a pill
   switch, and the kind of event, tabs with a gold underline on the one shown - two controls
   that look different because they do different jobs. The middle column holds the month and
   the tabs, centred; the switch keeps the left column, so it never moves when Forest Events
   shows. On a phone everything is centred (see the phones block). */
.head {
  position: sticky; top: 0; z-index: 35;
  background: rgba(11, 11, 13, 0.94); border-bottom: 1px solid var(--border-strong);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hdr {
  max-width: 1320px; margin: 0 auto; padding: 12px 16px 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "brand month tz" "king tabs .";
  align-items: center; gap: 4px 20px;
}
/* a row the page scrolls to lands under the pinned header, not behind it */
.vt-day, #details { scroll-margin-top: calc(var(--head-h, 0px) + 10px); }
.brand { grid-area: brand; justify-self: start; display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: inherit; }
.brand-name {
  font-family: var(--font-display); font-weight: 600; font-size: 1.45rem; letter-spacing: 0.01em;
  color: var(--gold-bright); font-variation-settings: "opsz" 60;
}
.brand-sub { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-muted); }
/* In Chest Manager's Calendar tab (?embed=1): the tab names the page, so no brand. */
.embed .brand { display: none; }

/* the month: the one large thing in the header */
.month { grid-area: month; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.monthnav { display: flex; align-items: center; gap: 14px; }
.month-title {
  margin: 0; font-family: var(--font-display); font-weight: 500; font-size: clamp(1.55rem, 1.15rem + 1.3vw, 2.15rem);
  font-variation-settings: "opsz" 90; letter-spacing: -0.005em; line-height: 1.15;
  min-width: 6.9em; text-align: center; white-space: nowrap;      /* the arrows stay put from May to September */
}
.month-title .yr { color: var(--text-muted); font-weight: 500; }
.nav {
  width: 36px; height: 36px; flex: none; font-size: 1.5rem; line-height: 1; display: inline-grid; place-items: center; padding: 0 0 3px;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text); cursor: pointer;
  border-radius: 999px; transition: background 0.15s, border-color 0.15s;
}
.nav:hover { background: var(--surface-3); border-color: var(--gold); }
.note { font-size: 0.78rem; color: var(--text-muted); text-align: center; }
.note:empty { display: none; }

/* the kingdom: a two-way pill switch, filled where it stands */
.seg {
  grid-area: king; justify-self: start; margin: 6px 0 10px;
  display: inline-flex; padding: 3px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
}
.seg button {
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
  padding: 6px 15px; border-radius: 999px; font-size: 0.86rem; font-weight: 600; letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--gold); color: var(--gold-ink); }

/* the kind of event: tabs sitting on the header's lower edge, underlined where they are */
.tabs { grid-area: tabs; justify-self: center; align-self: end; display: flex; gap: 28px; }
.tabs button {
  border: 0; background: none; cursor: pointer; color: var(--text-muted);
  padding: 10px 2px 11px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  font-size: 0.93rem; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--gold-bright); border-bottom-color: var(--gold); }
.tabs button[hidden] { display: none; }

/* the time zone: a small chip as wide as its words, a globe for its label */
.tz { grid-area: tz; justify-self: end; min-width: 0; }
.tz-box { position: relative; display: flex; align-items: center; max-width: 100%; }
.tz-globe {
  position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%);
  fill: none; stroke: var(--gold); stroke-width: 1.6; pointer-events: none;
}
#tzSearch {
  width: auto; max-width: 100%; text-overflow: ellipsis;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 6px 30px 6px 32px; font: inherit; font-size: 0.84rem; font-weight: 600;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
#tzSearch:hover, #tzSearch:focus { border-color: var(--gold); outline: none; }
#tzSearch::placeholder { color: var(--text-dim); font-weight: 500; }
.tz-list {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; width: max(100%, 290px); max-height: 320px; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px; padding: 4px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.tz-list[hidden] { display: none; }
.tz-item { padding: 7px 10px; border-radius: 8px; font-size: 0.86rem; cursor: pointer; }
.tz-item:hover, .tz-item.active { background: rgba(200, 152, 99, 0.16); }
.tz-item.current { color: var(--gold-bright); font-weight: 600; }
.tz-none { padding: 8px 10px; font-size: 0.82rem; color: var(--text-muted); }
/* The box's words stay English in every language (the zone's names, "Game time (UTC+7)"; website translation part
   3c): on a right-to-left page it is a left-to-right block, so a label's parentheses and offset keep their order. Only
   Chest Manager's frame shows it; a left-to-right page is untouched. */
html[dir="rtl"] .tz-box, html[dir="rtl"] .tz-list { direction: ltr; }

.page { max-width: 1320px; margin: 0 auto; padding: 16px 16px 40px; }

/* ---- the floating rail: Today, on the left beside the dates ---- */
.float-nav {
  position: fixed; left: max(18px, calc((100vw - 1320px) / 2 - 64px)); top: 50%; transform: translateY(-50%); z-index: 30;
  display: flex; flex-direction: column; gap: 6px; padding: 6px;
  background: rgba(19, 19, 22, 0.88); border: 1px solid var(--border-strong); border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.fn-btn {
  width: 50px; height: 50px; border-radius: 50%; border: 1px solid transparent; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.2s;
}
.fn-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fn-btn svg .dot { fill: currentColor; stroke: none; }
.fn-btn span { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1; }
.fn-btn:hover { color: var(--gold-bright); background: rgba(200, 152, 99, 0.12); border-color: var(--border-strong); }
#fnToday { color: var(--gold-bright); }
/* a lane for the rail where the window has no margin to hold it (wide windows have one),
   the header and month bar indented with the page so their left edges line up */
@media (min-width: 641px) and (max-width: 1479px) {
  .hdr, .page { padding-left: 96px; }
}
.foot { margin: 18px 0 0; font-size: 0.8rem; color: var(--text-dim); max-width: 70ch; }

/* ---- states ---- */
.loading, .empty, .error {
  padding: 40px 20px; text-align: center; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.error { color: #e0a0a0; }
.linkbtn {
  margin-left: 6px; padding: 4px 12px; font: inherit; font-weight: 600; cursor: pointer;
  color: var(--gold-ink); background: var(--gold); border: 0; border-radius: 6px;
}
.linkbtn:hover { background: var(--gold-bright); }

/* ---- details card (a clicked bar or day) ---- */
.details[hidden] { display: none; }
.details {
  display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-start;
  margin: 0 0 14px; padding: 14px; background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius); position: relative;
}
.details .art {
  width: 260px; max-width: 100%; aspect-ratio: 389 / 123; border-radius: 10px; object-fit: contain; flex: 0 0 auto;
  background: #0b0b0d;
}
.details .body { flex: 1 1 260px; min-width: 0; }
.details h2 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; font-variation-settings: "opsz" 40; }
.details .when { color: var(--text-muted); font-size: 0.9rem; }
.details .meta { margin-top: 6px; font-size: 0.86rem; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.details .state { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.details .state.live { background: rgba(106, 147, 119, 0.25); color: #9ccfae; }
.details .state.soon { background: rgba(200, 152, 99, 0.2); color: var(--gold-bright); }
.details .state.past { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }
.details .close {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.details .daylist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.details .daylist li { display: flex; align-items: center; gap: 10px; }
.details .daylist .mini { width: 72px; aspect-ratio: 389 / 123; border-radius: 6px; object-fit: cover; background: var(--surface-3); flex: 0 0 auto; }
.details .daylist .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.details .daylist button { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.details .daylist button:hover { color: var(--gold-bright); }
.details .daylist .sub { color: var(--text-muted); font-size: 0.82rem; margin-left: 6px; }

/* ---- month grid ---- */
.cal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-wd { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border-strong); }
.cal-wd span {
  padding: 10px 6px 8px; text-align: center; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted);
}
.cal-wd span.wknd { color: var(--gold-deep); }
.cal-week { border-top: 1px solid var(--border-soft); }
.cal-week:first-of-type { border-top: 0; }
.cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-days button {
  border: 0; background: none; cursor: pointer; text-align: left; padding: 8px 8px 4px; min-height: 36px;
  font-variant-numeric: tabular-nums; font-size: 0.86rem; font-weight: 600; color: var(--text);
}
.cal-days button:hover { color: var(--gold-bright); }
.cal-days button.out { color: var(--text-dim); font-weight: 500; }
.cal-days button.wknd:not(.out) { color: var(--gold-bright); }
.cal-days button span {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 999px;
}
.cal-days button.today span { background: var(--gold); color: var(--gold-ink); }
.cal-lanes {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 24px;
  row-gap: 3px; padding: 0 0 10px; min-height: 36px;
}
.cal-lanes .bar {
  display: flex; align-items: center; gap: 6px; min-width: 0; height: 22px; margin: 0 3px;
  padding: 0 7px; border: 0; border-radius: 6px; cursor: pointer; text-align: left;
  background: var(--c, var(--surface-3)); color: #fff; font-size: 0.78rem; font-weight: 600; line-height: 22px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: filter 0.15s, transform 0.15s;
}
.cal-lanes .bar:hover { filter: brightness(1.12); }
.cal-lanes .bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-lanes .bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.cal-lanes .bar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-lanes .bar.marker {
  background: var(--surface-2); border: 1px dashed var(--c, var(--text-dim)); color: var(--text); text-shadow: none; box-shadow: none;
}
.cal-lanes .bar.marker .flag { color: var(--c, var(--gold)); font-size: 0.7rem; }
.cal-lanes .bar.past { opacity: 0.6; }
.cal-lanes .bar.past:hover { opacity: 1; }

/* ---- timeline (vertical: a row per day, the day's new events as cards of one width) ---- */
.vt { position: relative; }
.vt::before { content: ""; position: absolute; left: 35px; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.vt-day {
  display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 0 16px; padding: 12px 0;
  border-top: 1px solid var(--border-soft); position: relative;
}
/* a day with Summon Mastery: the captain's rail at the right end */
.vt-day.has-sm { grid-template-columns: 72px minmax(0, 1fr) auto; }
.vt-sm {
  display: flex; flex-direction: column; gap: 10px; width: 112px; padding: 0 0 0 8px;
  border-left: 1px dashed var(--border-strong); margin-left: 4px;
}
/* a tile is as tall as the day's event cards, and as wide as lets the portrait (the game's square
   captain card) fill its whole top edge to edge: both set by the script. A wider tile left black
   bars beside the square (Barak 2026-10-19). */
.vt-sm { align-items: center; }
.sm-tile {
  display: flex; flex-direction: column; width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; text-align: center; box-shadow: inset 0 0 0 1px rgba(200, 152, 99, 0.08);
}
.sm-tile img { display: block; flex: 0 0 auto; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; }
.sm-tile .noart { flex: 1 1 auto; min-height: 40px; background: linear-gradient(135deg, var(--surface-3), var(--surface)); }
.sm-tile .smn { flex: 0 0 auto; padding: 5px 5px 1px; font-size: 0.8rem; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; }
.sm-tile .sms { flex: 0 0 auto; padding: 0 5px 6px; font-size: 0.68rem; color: var(--text-muted); display: flex; flex-wrap: nowrap; white-space: nowrap; overflow: hidden; justify-content: center; gap: 2px 6px; align-items: center; }
.sm-tile .state { display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 0.88em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
/* the event cards' DAY 1/2 pill (Barak 2026-10-20), in em so the tile's fit still shrinks it */
.sm-tile .chip {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: rgba(200, 152, 99, 0.15); color: var(--gold-bright);
  font-size: 0.97em; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.sm-tile .state.live { background: rgba(106, 147, 119, 0.25); color: #9ccfae; }
.sm-tile .state.soon { background: rgba(200, 152, 99, 0.2); color: var(--gold-bright); }
/* Dimmed per card once ITS event has ended, never by the day: a run that began on a past
   day (in the viewer's zone, or a game day) and is still live stays bright (Barak 2026-10-18). */
.card.past, .sm-tile.past { opacity: 0.62; transition: opacity 0.15s; }
.card.past:hover, .sm-tile.past:hover { opacity: 1; }
.vt-day.past .vt-date { opacity: 0.7; }
.vt-day:first-child { border-top: 0; }
.vt-date { display: flex; flex-direction: column; align-items: center; gap: 1px; position: relative; padding-top: 4px; }
.vt-date .dow { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.vt-date .num {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  font-variant-numeric: tabular-nums; font-size: 1.05rem; font-weight: 600;
}
.vt-date .mon { font-size: 0.72rem; color: var(--text-muted); }
.vt-date .tag {
  margin-top: 4px; padding: 1px 8px; border-radius: 999px; background: var(--gold); color: var(--gold-ink);
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
/* the day the chosen zone's clocks change (Barak 2026-10-20); the change in full on hover */
.vt-date .dst {
  margin-top: 4px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--gold);
  background: rgba(200, 152, 99, 0.12); color: var(--gold-bright); cursor: help; white-space: nowrap;
  font-size: 0.58rem; font-weight: 700; letter-spacing: 0.06em;
}
.vt-day.wknd .dow { color: var(--gold-deep); }
.vt-day.today .num { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); box-shadow: 0 0 0 4px rgba(200, 152, 99, 0.2); }
.vt-body { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.vt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--c, var(--text-dim));
  border-radius: 10px; overflow: hidden; min-width: 0;
}
.card .art { display: block; width: 100%; aspect-ratio: 389 / 123; object-fit: contain; background: #0b0b0d; }
.card .art.none { background: linear-gradient(135deg, var(--surface-3), var(--surface)); }
.card .cb { padding: 8px 10px 9px; }
.card .ct { font-weight: 600; font-size: 0.9rem; line-height: 1.25; text-wrap: balance; }
.card .cs { margin-top: 3px; font-size: 0.78rem; color: var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.card .chip {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; vertical-align: 2px;
  background: rgba(200, 152, 99, 0.15); color: var(--gold-bright); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.card.marker { border-left-style: dashed; }
.card .state { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.card .state.live { background: rgba(106, 147, 119, 0.25); color: #9ccfae; }
.card .state.soon { background: rgba(200, 152, 99, 0.2); color: var(--gold-bright); }
/* The clan's target for the event, on a clan's calendar only: the last item of the card's
   bottom line, pushed to its right end (and onto a line of its own, still at the right,
   when the card is too narrow to share). The gold peel of the Leaderboard tab's target
   (web/chestapp/tbc-portal.css #upcomingEvents .uc-req; Barak 2026-11-19: the same look),
   at the size of this calendar's other pills. */
.card .req {
  margin-left: auto; padding: 1px 8px; border-radius: 999px;
  background: linear-gradient(180deg, #e6c288 0%, #c89863 55%, #a67a45 100%);
  color: #17110a; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 2px 5px rgba(0, 0, 0, 0.5);
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.02em;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* A group's name on each of its cards: a badge floating on the card's top edge at the left
   (Barak 2026-10-20 - after a boxed section, and after a diagonal corner ribbon that had
   room for "Olympus" but not "Easter Adventures"). Half above the edge, half over the art;
   the card stops clipping its children so the upper half shows, and the artwork rounds its
   own top corners instead. Dark, gold-rimmed and gold-lettered: the art runs every colour,
   and a gold badge vanished into the warm ones. */
.card.grouped { position: relative; overflow: visible; }
.card.grouped .art { border-radius: 6px 9px 0 0 / 9px 9px 0 0; }
.gbadge {
  position: absolute; top: -9px; left: 10px; z-index: 1; max-width: calc(100% - 20px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
  padding: 2px 10px; border-radius: 999px; border: 1px solid #c89863;
  background: linear-gradient(180deg, #34343b 0%, #16161a 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #f1cf8f; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.9);
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; line-height: 1.4;
}
.card.epic .ct::before { content: "\2694\FE0E"; margin-right: 6px; color: var(--gold-bright); font-size: 0.8em; }
.vt-none { font-size: 0.8rem; color: var(--text-dim); padding-top: 10px; }

/* ---- mini events: a day's hourly runs in time order, small cards ---- */
.mn-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.mini {
  width: 156px; background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--c, var(--text-dim));
  border-radius: 9px; overflow: hidden;
}
.mini .art { display: block; width: 100%; aspect-ratio: 389 / 123; object-fit: contain; background: #0b0b0d; }
.mini .art.none { background: linear-gradient(135deg, var(--surface-3), var(--surface)); }
.mini .cb { padding: 6px 8px 7px; }
.mini .ct { font-weight: 600; font-size: 0.8rem; line-height: 1.2; }
.mini .cs { margin-top: 2px; font-size: 0.74rem; color: var(--text-muted); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.mini .cbn { margin-top: 3px; font-size: 0.7rem; color: var(--gold-bright); line-height: 1.25; }
.mini .state { display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.mini .state.live { background: rgba(106, 147, 119, 0.25); color: #9ccfae; }
.mini .state.soon { background: rgba(200, 152, 99, 0.2); color: var(--gold-bright); }
.mini .cd-line { color: var(--text); font-weight: 600; white-space: nowrap; }
.mini .cd { font-variant-numeric: tabular-nums; color: var(--gold-bright); }
.mini .cs .small { font-size: 0.68rem; }
.mini.live { border-color: rgba(106, 147, 119, 0.5); box-shadow: 0 0 0 2px rgba(106, 147, 119, 0.18); }
.mini.next { border-color: rgba(200, 152, 99, 0.45); box-shadow: 0 0 0 2px rgba(200, 152, 99, 0.14); }
.mini.past { opacity: 0.62; transition: opacity 0.15s; }
.mini.past:hover { opacity: 1; }

/* ---- hover tooltip (pointer devices) ---- */
.tip {
  position: fixed; z-index: 50; width: 280px; pointer-events: none;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
/* shown whole: a Summon Mastery portrait is not a 389x123 strip */
.tip img { display: block; width: 100%; aspect-ratio: 389 / 123; object-fit: contain; background: #0b0b0d; }
.tip .tb { padding: 8px 10px 10px; }
.tip .tt { font-weight: 600; font-size: 0.9rem; }
.tip .ts { color: var(--text-muted); font-size: 0.8rem; margin-top: 2px; }

/* ---- phones ---- */
@media (max-width: 640px) {
  /* a compact pinned header, everything centred (Barak 2026-10-19): the month, then the
     kingdom switch with the time-zone chip beside it, then the event tabs on the lower edge */
  /* A wrapping row, not the desktop grid: the brand, the month and the tabs take a line each;
     the switch and the time-zone chip share one, centred, and on a phone too narrow for both
     the chip moves to its own centred line rather than being cut. */
  .hdr { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; padding: 10px 12px 0; gap: 8px 10px; }
  .brand { order: 0; flex-basis: 100%; justify-content: center; }
  .month { order: 1; flex-basis: 100%; }
  .seg { order: 2; margin: 0; }
  .tz { order: 3; min-width: 0; max-width: 100%; }
  .tabs { order: 4; flex-basis: 100%; justify-content: center; gap: 22px; }
  .brand-name { font-size: 1.15rem; }
  .brand-sub { display: none; }
  .nav { width: 32px; height: 32px; }
  .monthnav { gap: 10px; }
  .month-title { font-size: 1.45rem; }
  .note { font-size: 0.72rem; }
  .seg button { padding: 5px 12px; font-size: 0.8rem; }
  #tzSearch { max-width: 100%; font-size: 0.8rem; padding: 6px 26px 6px 30px; background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; }
  .tz-globe { left: 10px; width: 14px; height: 14px; }
  .tabs button { padding: 8px 2px 9px; font-size: 0.86rem; }
  .page { padding-left: 12px; padding-right: 12px; }
  .cal-days button { padding: 6px 4px 2px; font-size: 0.78rem; }
  .cal-days button span { min-width: 22px; height: 22px; }
  .cal-lanes { grid-auto-rows: 20px; row-gap: 2px; }
  .cal-lanes .bar { height: 18px; line-height: 18px; margin: 0 1px; padding: 0 4px; font-size: 0.66rem; gap: 4px; }
  .cal-lanes .bar.w1 .name { display: none; }    /* one day wide: the colour; tap for the name */
  .cal-lanes .bar.cont-l, .cal-lanes .bar.cont-r { margin: 0; }
  .details .art { width: 100%; }
  /* the rail sits at the bottom left on a phone, by the dates */
  .float-nav { top: auto; bottom: 16px; left: 10px; transform: none; }
  .fn-btn { width: 46px; height: 46px; }
  .page { padding-bottom: 140px; }
  .vt::before { left: 27px; }
  .vt-day { grid-template-columns: 56px minmax(0, 1fr); gap: 0 10px; }
  .vt-date .num { width: 34px; height: 34px; font-size: 0.95rem; }
  .vt-cards { grid-template-columns: 1fr; }
  /* the Summon Mastery rail goes under the day's cards, its tiles side by side */
  .vt-day.has-sm { grid-template-columns: 56px minmax(0, 1fr); }
  .vt-sm { grid-column: 2; width: auto; flex-direction: row; flex-wrap: wrap; gap: 8px; align-items: flex-start; border-left: 0; border-top: 1px dashed var(--border-strong); margin: 10px 0 0; padding: 8px 0 0; }
  .sm-tile { width: calc(50% - 4px); }
  .mini { width: calc(50% - 4px); }
}
/* narrow phones (360-380px): the switch and the time-zone chip share one row, so both tighten
   a little and "Game time (UTC+7)" still reads whole */
@media (max-width: 380px) {
  .hdr { gap: 8px 6px; padding-left: 8px; padding-right: 8px; }
  .seg button { padding: 5px 9px; font-size: 0.76rem; }
  #tzSearch { font-size: 0.76rem; padding: 6px 22px 6px 27px; background-position: calc(100% - 12px) 55%, calc(100% - 7px) 55%; }
  .tz-globe { left: 9px; width: 13px; height: 13px; }
  .tabs { gap: 16px; }
}

/* ---- inside the site (?chrome=1: index.php puts tbc-tool on <html>) ----
   The site's bar is fixed on top, its height --tbc-chrome-h (set on <html> by the chrome's
   module; 64 px until it has run), and the tool's header line follows in the flow. The
   calendar's own header sticks under the bar, its inner container lined up with the header
   line (site-chrome.css .tbc-toolhead: 1500 px wide, 28 px a side, 16 px in the phone
   layout). Its time zone box is hidden: the bar has one, and the box stays in the page for
   the script. A row the page scrolls to lands under the bar and the header.
   What answers to the bar waits for the bar: the module puts tbc-has-nav on <html> once it is
   mounted. Without the module (blocked, or a browser too old for it) the header stays at the
   top, the time zone box shows and a row lands under the header alone, as on today's page. */
html.tbc-tool.tbc-has-nav .head { top: var(--tbc-chrome-h, 64px); }
.tbc-tool .hdr { max-width: 1500px; padding-left: 28px; padding-right: 28px; }
html.tbc-tool.tbc-phone .hdr { padding-left: 16px; padding-right: 16px; }
html.tbc-tool.tbc-has-nav .tz { display: none; }
html.tbc-tool.tbc-has-nav .vt-day, html.tbc-tool.tbc-has-nav #details { scroll-margin-top: calc(var(--tbc-chrome-h, 64px) + var(--head-h, 0px) + 10px); }
/* the Today rail steps aside while the footer is on screen (calendar.js sets fn-away), so it never
   covers a footer link, on a phone (bottom left) or wider (centred on the left); without the module
   the footer is an empty placeholder with no link, and the rail stays */
.tbc-tool .float-nav { transition: opacity 0.2s, visibility 0.2s; }
html.tbc-tool.tbc-has-nav .float-nav.fn-away { opacity: 0; visibility: hidden; pointer-events: none; }

@media (hover: none) {
  .tip { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- another language on the page (website translation part 3c, task 5): html[lang] other than "en" and
   html[dir="rtl"] are only ever on a translated page (index.php writes chrome.php's <html lang dir>), so English
   matches none of these and reads every rule above as it always has ---- */

/* Right to left: what is drawn by a side changes sides. The header's grid, the day grid, the timeline's rows and every
   flex row turn by themselves; these are the rules that name a side. (The month arrows need nothing: &#8249; and
   &#8250; mirror themselves in a right-to-left line, so the previous month, now at the right, points right.) */
/* the Today rail beside the dates, now at the right, the page making room for it there; on a phone it stays at the
   bottom left: the support chat's button holds the bottom right on every page of the site */
html[dir="rtl"] .float-nav { left: auto; right: max(18px, calc((100vw - 1320px) / 2 - 64px)); }
@media (min-width: 641px) and (max-width: 1479px) {
  html[dir="rtl"]:not(.tbc-tool) .hdr, html[dir="rtl"] .page { padding-left: 16px; padding-right: 96px; }
}
@media (max-width: 640px) {
  html[dir="rtl"] .float-nav { left: 10px; right: auto; }
}
/* the timeline's line through the date column; the Summon Mastery rail's dashed edge on its cards' side (on a phone
   the rail goes under the cards, edged on top, as in English) */
html[dir="rtl"] .vt::before { left: auto; right: 35px; }
@media (min-width: 641px) {
  html[dir="rtl"] .vt-sm { border-left: 0; border-right: 1px dashed var(--border-strong); margin-left: 0; margin-right: 4px; padding: 0 8px 0 0; }
}
@media (max-width: 640px) {
  html[dir="rtl"] .vt::before { right: 27px; }
}
/* a card's coloured edge at its start, and the art's corner beside it; the group's badge over its start; the DAY chip
   after the name, the sword before it; the clan's target pushed to the line's end */
html[dir="rtl"] .card { border-left: 1px solid var(--border); border-right: 4px solid var(--c, var(--text-dim)); }
html[dir="rtl"] .card.marker { border-right-style: dashed; }
html[dir="rtl"] .card.grouped .art { border-radius: 9px 6px 0 0 / 9px 9px 0 0; }
html[dir="rtl"] .gbadge { left: auto; right: 10px; }
html[dir="rtl"] .card .chip { margin-left: 0; margin-right: 6px; }
html[dir="rtl"] .card.epic .ct::before { margin-right: 0; margin-left: 6px; }
html[dir="rtl"] .card .req { margin-left: 0; margin-right: auto; }
/* a mini card's coloured edge, with the specificity of the rule it mirrors: a live or next card's border colour wins
   over it, as it does in English */
:where(html[dir="rtl"]) .mini { border-left: 1px solid var(--border); border-right: 3px solid var(--c, var(--text-dim)); }
/* the details: the close button at the far end from the title; a day's list from the right */
html[dir="rtl"] .details .close { right: auto; left: 8px; }
html[dir="rtl"] .details .daylist button { text-align: right; }
html[dir="rtl"] .details .daylist .sub { margin-left: 0; margin-right: 6px; }
html[dir="rtl"] .linkbtn { margin-left: 0; margin-right: 6px; }
/* the month grid: day numbers and bars from the right; a bar that goes on from last week squares its right end (the
   week starts there), one that goes on into next week its left end; a season's start flag points the way time runs */
html[dir="rtl"] .cal-days button, html[dir="rtl"] .cal-lanes .bar { text-align: right; }
html[dir="rtl"] .cal-lanes .bar.cont-l { border-top-left-radius: 6px; border-bottom-left-radius: 6px; margin-left: 3px; }
html[dir="rtl"] .cal-lanes .bar.cont-r { border-top-right-radius: 6px; border-bottom-right-radius: 6px; margin-right: 3px; }
html[dir="rtl"] .cal-lanes .bar.cont-l { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
html[dir="rtl"] .cal-lanes .bar.cont-r { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
@media (max-width: 640px) {
  html[dir="rtl"] .cal-lanes .bar.cont-l, html[dir="rtl"] .cal-lanes .bar.cont-r { margin: 0; }
}
html[dir="rtl"] .cal-lanes .bar.marker .flag { transform: scaleX(-1); }
/* the embed's own time zone list (a left-to-right block, task 3) opens from its box's left edge: the box stands at the
   header's left end now, and the list ran off the screen */
html[dir="rtl"] .tz-list { right: auto; left: 0; }

/* Another language's words fitting. */
/* a mini card's Live / Next pill ("EN DIRECT", "PROCHAIN") and its hours each stay on one line, the hours under the
   pill when both do not fit */
html[lang]:not([lang="en"]) .mini .cs { flex-wrap: wrap; row-gap: 2px; }
html[lang]:not([lang="en"]) .mini .state, html[lang]:not([lang="en"]) .mini .cs .small { white-space: nowrap; }
/* a mini card's countdown sentence (French "Se termine dans 1 h 00 min 00 s", Korean's with the countdown first)
   wraps before or after the countdown, which stays whole */
html[lang]:not([lang="en"]) .mini .cd-line { flex-wrap: wrap; row-gap: 0; white-space: normal; }
html[lang]:not([lang="en"]) .mini .cd-line .cd { white-space: nowrap; }
/* the kingdom switch never breaks its words (Japanese breaks between any two characters, and beside New York's long
   clock-change note the switch was squeezed to a column); the note wraps at about the width English's takes */
html[lang]:not([lang="en"]) .seg button { white-space: nowrap; }
html[lang]:not([lang="en"]) .month .note { max-width: 60em; }
/* the Today rail's word and a Summon Mastery tile's day line, a little less spaced: Ukrainian "Today" inside the round
   rail, its "day 1/2, in 31 h" on one line at the tile's smallest size */
html[lang]:not([lang="en"]) .fn-btn span { letter-spacing: 0.02em; }
html[lang]:not([lang="en"]) .sm-tile .sms { column-gap: 4px; }
html[lang]:not([lang="en"]) .sm-tile .state,
html[lang]:not([lang="en"]) .sm-tile .chip { letter-spacing: 0.02em; padding-left: 4px; padding-right: 4px; }
@media (max-width: 640px) {
  /* a phone's three tabs: closer together, a little smaller, and the last (Forest Events) may take two lines */
  html[lang]:not([lang="en"]) .tabs { gap: 14px; }
  html[lang]:not([lang="en"]) .tabs button { font-size: 0.8rem; flex-shrink: 0; }
  html[lang]:not([lang="en"]) .tabs button[data-view="forest"] { flex-shrink: 1; white-space: normal; text-align: center; }
  /* Ukrainian, Russian, Dutch "Today" in the 56 px date column: less spaced, so the tag keeps clear of the day's cards */
  html[lang]:not([lang="en"]) .vt-date .tag { letter-spacing: 0.04em; padding: 1px 6px; }
}
/* Arabic is written joined: the spaced capitals of the labels are never letter-spaced (last, with the fitting rules'
   specificity: they space a few labels a little less in every other language) */
html[lang="ar"][dir="rtl"] .brand-sub, html[lang="ar"][dir="rtl"] .seg button, html[lang="ar"][dir="rtl"] .tabs button,
html[lang="ar"][dir="rtl"] .fn-btn span, html[lang="ar"][dir="rtl"] .details .state,
html[lang="ar"][dir="rtl"] .cal-wd span, html[lang="ar"][dir="rtl"] .vt-date .dow, html[lang="ar"][dir="rtl"] .vt-date .tag,
html[lang="ar"][dir="rtl"] .vt-date .dst, html[lang="ar"][dir="rtl"] .card .chip, html[lang="ar"][dir="rtl"] .card .state,
html[lang="ar"][dir="rtl"] .gbadge, html[lang="ar"][dir="rtl"] .mini .state, html[lang="ar"][dir="rtl"] .sm-tile .state,
html[lang="ar"][dir="rtl"] .sm-tile .chip { letter-spacing: 0; }
