/* Colours are the Ohara app's Treasure palette, light and dark, so the two feel related. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/BricolageGrotesque.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}
:root {
  --bg: #f5f2ee; --surface: #ffffff; --surface2: #ece9e3; --border: #e2ddd7;
  --text: #161310; --dim: #534c40; --faint: #6f675b;
  --accent: #8a6200; --fill: #eec146; --lip: #ca991f; --on-fill: #3a2c01;
  --c-red: #c7362c; --c-green: #2f7d4f; --c-blue: #2c6daf;
  --c-purple: #6d48c7; --c-black: #3f444c; --c-yellow: #b8860b;
  --head: "Bricolage Grotesque", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #110e0a; --surface: #1a1712; --surface2: #24201b; --border: #312d27;
    --text: #f7f5f1; --dim: #b2aa9f; --faint: #a1988d;
    --accent: #e7b643; --fill: #e7b643; --lip: #af8515; --on-fill: #2e1e01;
    --c-red: #d8443c; --c-green: #3e9e5f; --c-blue: #3b82c4;
    --c-purple: #8b5cf6; --c-black: #6b7079; --c-yellow: #e0b341;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, .name { font-family: var(--head); letter-spacing: -0.01em; margin: 0; }
/* Read by screen readers and search engines, not drawn. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The bar: the name, the two sections as tabs with the current one underlined, and the set.
   On a phone the tabs take their own line under the name. */
.top { display: flex; flex-wrap: wrap; align-items: center; column-gap: 20px; padding: 12px 16px 0; border-bottom: 1px solid var(--border); }
.top .brand { font-family: var(--head); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin-right: auto; padding: 6px 0; display: inline-flex; align-items: center; gap: 9px; }
.top .brand img { display: block; border-radius: 7px; }
.top .nav { display: contents; }
.top .tabs { order: 3; flex-basis: 100%; display: flex; gap: 24px; margin-top: 4px; }
.tab { padding: 10px 0 11px; font-weight: 600; color: var(--dim); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--text); }
.top .setpick select { background: var(--surface2); }
.link { color: var(--accent); font-weight: 700; }
.page { padding: 16px 16px 48px; max-width: 1320px; margin: 0 auto; }

.headrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; }
/* The two menus. Drawn by us, not the browser: its own arrow sat tight against the edge with
   the text off-centre. Same pill and the same height as the other controls. */
.setpick { position: relative; display: inline-flex; }
.setpick select { font: inherit; font-size: 14px; font-weight: 600; line-height: 20px; color: var(--text); background: var(--surface); border: 0; border-radius: 18px;
  padding: 8px 34px 8px 14px; min-height: 36px; margin: 0; appearance: none; -webkit-appearance: none; cursor: pointer; }
.setpick::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim);
  transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.head .name { font-size: 27px; font-weight: 700; line-height: 1.1; }

h2 { font-size: 17px; font-weight: 700; margin: 22px 0 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.card { background: var(--surface); border-radius: 16px; border-bottom: 2px solid var(--border); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 14px 2px; padding: 14px 6px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 2px 0; min-height: 44px; }
.tile .pic { position: relative; display: block; }
.tile .badge {
  position: absolute; right: -5px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
  box-shadow: 0 0 0 1px var(--border);
}
.tile .nm { font-size: 11px; line-height: 1.2; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tile.dim .pic { opacity: 0.55; }
.tile[aria-current="true"] .face { outline: 3px solid var(--accent); outline-offset: 1px; }
.tile[aria-current="true"] .nm { font-weight: 700; }

/* A leader's face. The ring is the leader's colours, split on the diagonal when there are two.
   If the art fails to load the image is removed and the ring colours fill the tile, as in the app. */
.face { display: inline-block; width: var(--s, 56px); height: var(--s, 56px); border-radius: 23%; padding: 2px;
  background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); flex: none; }
.face img { display: block; width: 100%; height: 100%; border-radius: 20%; object-fit: cover; background: var(--surface2); }

/* The matchup on the page: the opponent's picture and name over its games. */
.vsh { display: flex; align-items: center; justify-content: flex-start; gap: 10px; font-size: 19px; margin: 18px 0 10px; }
.more { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 16px; margin-top: 14px; font-weight: 600; color: var(--dim); min-height: 48px; }


/* The list measures itself: a game's columns line up only where the list is wide enough for them.
   Asking the window instead got it wrong whenever the list sat in a narrow column of a wide window. */
.rows { margin-top: 10px; container-type: inline-size; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 12px; min-height: 56px; }
.row.full { background: var(--surface); border-radius: 14px; border-bottom: 2px solid var(--border); margin-bottom: 8px; }
.row.part { border-bottom: 1px solid var(--border); }
.row .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row .src { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row .ev { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.row .vs { color: var(--faint); font-size: 13px; font-weight: 600; }
.row .rk { flex: none; font-size: 13px; color: var(--dim); }
.row .meta { font-size: 13px; color: var(--dim); display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.evh { font-size: 24px; font-weight: 700; margin: 2px 0 14px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.evh .when { font: 500 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--dim); letter-spacing: 0; }
.events .rows { max-width: 760px; }
.events .row .who > .src { margin-left: 4px; flex-wrap: wrap; gap: 0 8px; }
.tag { font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; color: var(--dim); background: var(--surface2); border-radius: 7px; padding: 3px 7px; }
.tiles.capped .tile.over { display: none; }
.row.full .meta { color: var(--text); font-weight: 700; }
.row .act { justify-self: end; color: var(--faint); display: flex; }
.empty { font-family: var(--head); font-size: 20px; font-weight: 700; margin: 20px 0 4px; }


/* Picker */
.search { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--faint); border-radius: 12px; padding: 12px 14px; }
.search::placeholder { color: var(--faint); }
.pick .tiles { padding: 14px 0 0; }
.strips { margin-top: 16px; }

@media (min-width: 900px) {
  /* Wide: one line. Name, tabs beside it, the set at the far end. */
  .top { flex-wrap: nowrap; padding: 0 40px; column-gap: 32px; }
  .top .brand { margin-right: 0; padding: 18px 0; }
  .top .tabs { order: 0; flex-basis: auto; margin-top: 0; align-self: stretch; align-items: stretch; }
  .tab { display: flex; align-items: center; padding: 0; }
  .top .setpick { margin-left: auto; }
  .page { padding: 28px 40px 64px; }
  .cols { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 44px; align-items: start; }
  .cols .right h2:first-child { margin-top: 0; }
  .pick { max-width: 760px; }
}
/* A fixed width for the length, so the rows line up column for column. */
@container (min-width: 780px) {
  .row { grid-template-columns: minmax(0, 1fr) 230px auto; gap: 16px; padding: 12px 14px; }
  .row .meta { justify-content: flex-end; }
}
@media (max-width: 380px) {
  .row { gap: 8px; }
}
/* A phone: a game's tags and length go under its name, so two tags never squeeze the name.
   A long event name takes a second line instead of being cut. */
@container (max-width: 500px) {
  .row .ev { white-space: normal; }
}
@container (max-width: 460px) {
  .right .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who act" "meta act"; row-gap: 3px; }
  .right .row .who { grid-area: who; }
  .right .row .meta { grid-area: meta; }
  .right .row .act { grid-area: act; }
}
/* An event's rows carry two pictures. On a phone they sit side by side without the "vs", a
   little smaller, so the stage and the rank beside them are never clipped. */
@container (max-width: 400px) {
  .events .row .vs { display: none; }
  .events .row .face { --s: 30px !important; }
  .events .row .who { gap: 6px; }
}
@container (max-width: 330px) {
  /* The rank goes under the name instead of squeezing it. */
  .row .who > .src { flex-wrap: wrap; gap: 0 8px; }
  .row .who .face { --s: 30px !important; }
  /* The narrowest lists: an event's length goes under its pictures. */
  .events .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who act" "meta act"; row-gap: 4px; }
  .events .row .who { grid-area: who; }
  .events .row .meta { grid-area: meta; }
  .events .row .act { grid-area: act; }
}
