/* tbcounter.com/seasonal-kingdoms - the marketing site's tokens (globals.css), as the calendar uses them. */
:root {
  --bg: #0b0b0d;
  --surface: #131316;
  --surface-2: #18181c;
  --border: rgba(200, 152, 99, 0.10);
  --border-strong: rgba(200, 152, 99, 0.24);
  --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;
  --gold-wash: rgba(200, 152, 99, 0.08);
  --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.5 var(--font-ui);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }

/* Header */
.head {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 24px 0;
}
.brand { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 20px; color: var(--text); letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }

.page { max-width: 1200px; margin: 0 auto; padding: 0 24px 48px; }

/* Intro + finder */
.intro { padding: 44px 0 28px; max-width: 760px; }
.eyebrow { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
/* Inside the site (?chrome=1) the title is an <h2>: the site's header line carries the page's <h1>. */
h1,
.tbc-tool .intro h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.lede { margin: 14px 0 0; color: var(--text-muted); font-size: 16px; max-width: 620px; }

.finder { margin-top: 28px; }
.finder label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.finder-box {
  position: relative;
  display: flex;
  align-items: center;
  width: min(100%, 340px);
  height: 52px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.finder-box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 152, 99, 0.16); }
.finder-box svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; }
.finder-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  margin-left: 10px;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.finder-box input::placeholder { color: var(--text-dim); font-weight: 500; }
.clear {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.clear:hover { background: var(--gold-wash); color: var(--text); }
.answer { min-height: 24px; margin: 12px 0 0; font-size: 16px; color: var(--text-muted); }
.answer strong { color: var(--text); font-weight: 600; }
.answer .to { color: var(--gold-bright); font-weight: 700; }
.answer.miss { color: #d98b7a; }

/* Board: the season's kingdoms as one band (27 = 9 x 3), the picked one's kingdoms under it.
   On a phone the list comes first, right under the answer, and the band follows. */
.board { display: flex; flex-direction: column; gap: 24px; }
.label { margin: 0 0 12px; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }

.grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, opacity 0.15s;
}
.tile:hover { border-color: var(--border-strong); background: var(--surface-2); }
.tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.tile-n { font-size: 19px; font-weight: 700; letter-spacing: 0.01em; }
.tile-c { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.tile[aria-pressed="true"] { background: var(--gold-wash); border-color: var(--gold); }
.tile[aria-pressed="true"] .tile-n { color: var(--gold-bright); }
.tile.yours::after {
  content: attr(data-tx-yours); /* "Yours" in the page's language: sk.js writes it on every tile */
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--gold-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.grid.filtered .tile:not(.yours):not([aria-pressed="true"]) { opacity: 0.45; }
.grid.filtered .tile:not(.yours):not([aria-pressed="true"]):hover { opacity: 1; }

.detail {
  padding: 22px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  scroll-margin-top: 16px;
}
.detail:empty { display: none; }
.detail-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.detail-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 34px; letter-spacing: -0.01em; }
.detail-title span { color: var(--gold-bright); }
.detail-count { color: var(--text-muted); font-size: 14px; }
.group { margin-top: 18px; }
.group h3 { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chip {
  min-width: 52px;
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--bg);
  text-align: center;
  font-size: 15px;
  font-weight: 600;
}
.chip.yours { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }

/* Each kingdom's top 10 clans by might (clans.js) */
.clans { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border-soft); }
.clans-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.clans-head h3 { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.clans-note { font-size: 12px; color: var(--text-dim); }
.clan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.clan-card { padding: 11px 12px 9px; background: var(--bg); border: 1px solid var(--border-soft); border-radius: 10px; min-width: 0; }
.clan-card.yours { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(200, 152, 99, 0.25); }
.clan-card h4 { margin: 0 0 7px; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.yours-tag { padding: 1px 7px; border-radius: 999px; background: var(--gold); color: var(--gold-ink); font-size: 11px; font-weight: 700; }
.clan-list { margin: 0; padding: 0; list-style: none; counter-reset: clan; }
.clan-list li {
  counter-increment: clan;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  font-size: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.clan-list li:first-child { border-top: 0; }
.clan-list li::before { content: counter(clan); color: var(--text-dim); font-size: 12px; text-align: right; }
.clan-list .cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clan-list .ct { color: var(--gold); font-weight: 600; }
.clan-list .cm { font-weight: 600; color: var(--text); }
.clans-none { margin: 12px 0 0; font-size: 12.5px; color: var(--text-dim); }

/* The season's events (../shared/live-events.css draws the inside) */
.events { margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--border); }

.foot { margin: 36px 0 0; color: var(--text-dim); font-size: 13px; max-width: 760px; }
.foot.small { margin-top: 8px; font-size: 12px; }

/* Tablet: the band keeps 9 columns, the tiles drop the word "kingdoms" */
@media (max-width: 1000px) {
  .grid { gap: 6px; }
  .tile { padding: 9px 10px; }
  .tile-c .w { display: none; }
  .tile.yours::after { content: ""; top: 9px; right: 9px; width: 8px; height: 8px; padding: 0; }
}

/* Phone */
@media (max-width: 560px) {
  .head { padding: 14px 16px 0; }
  .page { padding: 0 16px 36px; }
  .intro { padding: 28px 0 22px; }
  .lede { font-size: 15px; }
  .finder-box { width: 100%; }
  .detail { order: -1; }
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tile { align-items: center; padding: 9px 4px; }
  .tile-n { font-size: 15px; }
  .tile-c { display: none; }
  .tile.yours::after { top: 5px; right: 5px; width: 7px; height: 7px; }
  .detail { padding: 18px 16px 20px; }
  .detail-title { font-size: 28px; }
  .chip { min-width: 48px; padding: 6px 8px; font-size: 14px; }
}

/* ---- inside the site (?chrome=1: index.php puts tbc-tool on <html>) ----
   The site's bar is fixed on top, its height in --tbc-chrome-h (set on <html> by the chrome's
   module; 64 px until it has run): a picked kingdom's list scrolls into view below it. The events
   widget's own Game time / Your time switch is hidden, because the bar has the time zone and the
   widget follows it (tbc:tzchange). Only the switch in the widget's head: the widget gives its
   other switch (the homepage band's kingdom) the same class. Both wait 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 widget keeps its switch and the list lands where today's page puts it. */
html.tbc-tool.tbc-has-nav .detail { scroll-margin-top: calc(var(--tbc-chrome-h, 64px) + 16px); }
html.tbc-tool.tbc-has-nav .le-head .le-tz { display: none; }

/* ---- right to left (the page in Arabic: index.php writes dir="rtl" on <html>) ----
   The grids and the flex rows mirror by themselves; these are the sides set by name. A clan's name
   reads in its own script's direction, at the right of its cell. Arabic letters join: the spaced
   capitals are not letter-spaced in Arabic. Nothing here applies to a page that reads left to right. */
html[dir="rtl"] .finder-box input { margin-left: 0; margin-right: 10px; }
html[dir="rtl"] .tile { text-align: right; }
html[dir="rtl"] .tile.yours::after { right: auto; left: 8px; }
html[dir="rtl"] .clan-list li::before { text-align: left; }
html[dir="rtl"] .clan-list .cn { unicode-bidi: plaintext; text-align: right; }
html[lang="ar"] .eyebrow, html[lang="ar"] .label, html[lang="ar"] .group h3, html[lang="ar"] .clans-head h3 { letter-spacing: normal; }
@media (max-width: 1000px) {
  html[dir="rtl"] .tile.yours::after { left: 9px; }
}
@media (max-width: 560px) {
  html[dir="rtl"] .tile.yours::after { left: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
