/* Self-hosted so the share-image canvas draws with them (and nothing loads from a third party). */
@font-face { font-family: "Alfa Slab One"; font-weight: 400; font-display: swap; src: url(fonts/alfa-slab-one-400.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(fonts/barlow-400.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(fonts/barlow-500.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(fonts/barlow-600.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-600.woff2) format("woff2"); }
/* RSS Panthers: black, white and the logo's red; slab type after the wordmark. Single centred widget, arrows step through the season. */
:root, .app {
  --floor: #0b0b0b;
  --card: #171717;
  --line: #2b2b2b;
  --ink: #ffffff;
  --muted: #a3a3a3;
  --plate: #ffffff;                         /* white tile behind crests, so every logo shows */
  --glow-home: rgba(227, 36, 43, .55);      /* glow around the frames */
  --glow-away: rgba(220, 225, 232, .35);
  --frame-home: var(--red);                 /* Panthers' tile: red, a lighter glint orbits it */
  --frame-away: #a9afb8;                    /* the opponent's tile: silver */
  --red: #e3242b;        /* the panther's red, from the club logo */
  --win: #4fc27a;
  --loss: #4a4a4a;
  --slab: "Alfa Slab One", Rockwell, Georgia, serif;   /* echoes the PANTHERS wordmark */
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  /* Sizes follow the window height (dvh; vh where dvh is unknown) so the widget does not scroll; they
     shrink on short screens; when that is not enough the page scrolls (html.scrolls). */
  --tile: clamp(72px, 13.5vh, 112px);
  --tile: clamp(72px, 13.5dvh, 112px);
  --gap: clamp(8px, 1.8vh, 16px);
  --gap: clamp(8px, 1.8dvh, 16px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
/* Set by fitPage() in app.js when the content does not fit the window (a phone on its side, a small
   or zoomed phone): then the page scrolls instead of cutting off the bottom. */
html.scrolls, html.scrolls body { height: auto; overflow-x: hidden; overflow-y: visible; }
/* iOS enlarges text when the phone turns to landscape; that widens the chips after they were
   measured and pushes "Lisää" out of the row. Sizes here are already set for the screen. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--floor);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  padding: clamp(10px, 2.5vh, 24px) 16px;
  padding: clamp(10px, 2.5dvh, 24px) 16px;
}
/* A very dim nebula drifting over the black floor: faint clouds of the logo's red and a cold blue,
   one slow sway a minute. Not in the embed, whose background belongs to the host page. */
html:not(.embed) body::before {
  content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 30% at 22% 28%, rgba(227, 36, 43, .11), transparent 70%),
    radial-gradient(34% 40% at 78% 64%, rgba(70, 90, 190, .10), transparent 70%),
    radial-gradient(26% 22% at 60% 18%, rgba(150, 70, 160, .07), transparent 70%),
    radial-gradient(30% 26% at 30% 82%, rgba(227, 36, 43, .07), transparent 70%);
  filter: blur(30px);
  animation: nebula 60s ease-in-out infinite alternate;
}
@keyframes nebula {
  from { transform: translate(-3%, -2%) rotate(0deg) scale(1); }
  to   { transform: translate(3%, 2%) rotate(8deg) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  html:not(.embed) body::before { animation: none; }
}
/* Opening scene (index.html .intro), page only: 0.3 s after the first card is drawn, three claw marks tear down the left of the
   background, 0.15 s each, and the card shakes from the hit; they fade by about 4.7 s. Then the panther's
   face rises out of the dark at the bottom right, its coat barely lit, and its eyes light up from 9.4 s. */
.intro > * { position: fixed; z-index: -1; pointer-events: none; }
html.embed .intro { display: none; }
/* Everything waits, delays included, until app.js has drawn the first card (html.go). */
:is(html, .app):not(.go) :is(.claws, .claws .reveal, .peek, .peek-eyes, .card) { animation-play-state: paused; }
.claws {
  left: 3vw; top: 50%; height: min(72vh, 620px); width: auto; aspect-ratio: 300 / 500;
  transform: translateY(-50%) rotate(-8deg);
  opacity: 0;
  filter: drop-shadow(0 0 6px rgba(227, 36, 43, .7)) drop-shadow(0 0 22px rgba(227, 36, 43, .35));
  animation: claws-life 4.4s linear .3s forwards;
}
.claws .reveal { stroke-dasharray: 1 2; stroke-dashoffset: 1; visibility: hidden; animation: tear .15s cubic-bezier(.55, 0, .85, .35) forwards; }
.claws .r0 { animation-delay: .3s; }
.claws .r1 { animation-delay: .37s; }
.claws .r2 { animation-delay: .44s; }
/* Hidden until its own tear starts: Safari can leave a cap or sliver at the end of a fully offset pathLength dash. */
@keyframes tear { from { visibility: visible; } to { visibility: visible; stroke-dashoffset: 0; } }
@keyframes claws-life { 0%, 22% { opacity: 1; } 100% { opacity: 0; } }
html:not(.embed) .card { animation: hit .225s cubic-bezier(.36, .07, .19, .97) .32s both, glare 14s linear infinite; }
@keyframes hit {
  0%, 100% { transform: none; }
  12% { transform: translate(-7px, 2px) rotate(-.6deg); }
  26% { transform: translate(6px, -2px) rotate(.5deg); }
  42% { transform: translate(-4px, 1px) rotate(-.3deg); }
  58% { transform: translate(3px, 0) rotate(.2deg); }
  76% { transform: translate(-1px, 0); }
}
/* The face sits on the bottom edge; peek.avif is cropped below its eyes. */
.peek {
  right: 1vw; bottom: 0; width: clamp(260px, 34vw, 540px); aspect-ratio: 2146 / 733;
  opacity: 0;
  animation: peek-in 7s ease-in-out 4.9s forwards;
}
.peek > div {
  position: absolute; inset: 0;
  background: url(peek.png) center / contain no-repeat;
  background-image: image-set(url(peek.avif) type("image/avif"), url(peek.png) type("image/png"));
}
@keyframes peek-in { from { opacity: 0; transform: translateY(14%); } to { opacity: 1; transform: none; } }
/* Barely lit: the coat's edges and forehead sink into the page. */
.peek-coat {
  opacity: .3;
  -webkit-mask-image: radial-gradient(70% 95% at 50% 100%, #000 45%, transparent 100%);
          mask-image: radial-gradient(70% 95% at 50% 100%, #000 45%, transparent 100%);
}
/* Only the eye whites (centred at 34.4 % and 65.6 % across, 84.6 % down the picture). */
.peek-eyes {
  opacity: 0; filter: brightness(1.15) drop-shadow(0 0 6px rgba(255, 255, 255, .35));
  -webkit-mask-image: radial-gradient(5% 8% at 34.4% 84.6%, #000 55%, transparent 100%), radial-gradient(5% 8% at 65.6% 84.6%, #000 55%, transparent 100%);
          mask-image: radial-gradient(5% 8% at 34.4% 84.6%, #000 55%, transparent 100%), radial-gradient(5% 8% at 65.6% 84.6%, #000 55%, transparent 100%);
  animation: eyes-wake 3s ease-out 9.4s forwards, eyes-breathe 9s ease-in-out 12.4s infinite;
}
@keyframes eyes-wake { from { opacity: 0; } to { opacity: .85; } }
@keyframes eyes-breathe { 0%, 100% { opacity: .85; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  .claws, html:not(.embed) .card { animation: none; }
  .claws { display: none; }
  .peek { animation: none; opacity: 1; }
  .peek-eyes { animation: none; opacity: .85; }
}

/* minmax(0, 1fr): the one-row chip list must not widen the column to fit all its chips. */
.wrap { max-width: 420px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }

header { display: flex; align-items: center; justify-content: center; gap: 12px; position: relative; }
/* The club logo: 136px on a tall window, shrinking quickly with the height (tile 112px → 136px,
   72px → 48px) so the page still fits; on phone-width screens at most 72px. */
.crest { width: clamp(48px, calc((var(--tile) - 72px) * 2.2 + 48px), 136px); height: auto; aspect-ratio: 1; display: block; }
@media (max-width: 480px) {
  .crest { width: clamp(48px, calc((var(--tile) - 72px) * .6 + 48px), 72px); }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.chip {
  font: 600 13px/1 var(--body); color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer;
}
.chip[aria-pressed="true"] { color: var(--ink); background: var(--red); border-color: var(--red); }
/* One row of chips; the rest open from "Lisää" in a panel over the card. */
.filters { position: relative; min-width: 0; }
/* The padding (and matching negative margin) leaves room for the focus ring inside overflow: hidden. */
.chip-row { display: flex; gap: 8px; flex-wrap: nowrap; overflow: hidden; padding: 4px; margin: -4px; }
.chip { flex: none; white-space: nowrap; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* Your team (long-press, app.js): a star before the name, first in the row. */
.chip .star { margin-right: 4px; color: var(--red); }
.chip[aria-pressed="true"] .star { color: var(--ink); }
.chip-more { display: inline-flex; gap: 6px; align-items: center; }
.chip-more[hidden] { display: none; } /* the display above would otherwise beat [hidden] */
.chip-more[aria-expanded="true"] { color: var(--ink); border-color: var(--muted); }
.more-panel {
  position: absolute; z-index: 5; top: calc(100% + 8px); left: 0; right: 0;
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .55);
}
.more-panel[hidden] { display: none; }

.card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  /* Roomy inside; shrinks with the window height like everything else. */
  padding: clamp(22px, calc(var(--gap) * 2.25), 36px) clamp(16px, 6vw, 28px); display: grid; gap: calc(var(--gap) * 1.6);
  grid-template-columns: minmax(0, 1fr); /* a long line inside never widens the card */
  /* The top border is the claw marks' muted red (--red at their 40 % over the card), with the Panthers
     crest's glint sliding along it: the transparent border shows a gradient painted under the padding box. */
  --rest: color-mix(in srgb, var(--red) 40%, var(--card)); --glint: #ff5a60; --hot: #ffd2d2;
  border-top: 4px solid transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(90deg, var(--rest) calc(var(--glare) - 24%), var(--glint) calc(var(--glare) - 4%),
      var(--hot) var(--glare), var(--rest) calc(var(--glare) + 15%)) border-box;
  animation: glare 14s linear infinite;
}
/* One pass from off the left edge to off the right, then round again. */
@property --glare { syntax: "<percentage>"; inherits: false; initial-value: -20%; }
@keyframes glare { from { --glare: -20%; } to { --glare: 125%; } }
/* The intro's three red claw marks (claws.svg), faint, raked across the top-right corner. */
.card::before {
  content: ""; position: absolute; top: -40px; right: -14px; width: 120px; aspect-ratio: 300 / 500;
  background: url(claws.svg) center / contain no-repeat;
  opacity: .4; transform: rotate(24deg); pointer-events: none;
}
/* The team is the card's headline: "RSS Panthers" white on one line, the age group red on the next,
   the official series small below. Always two lines tall, so every card is the same height. */
.card-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.headline { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.tname {
  margin: 0; font: 400 calc(var(--tile) * .27)/1.05 var(--slab); text-transform: uppercase; text-wrap: balance;
  min-height: 2.1em; display: flex; align-items: end;
}
.tname em { font-style: normal; color: var(--red); display: block; } /* the team always on its own line */
.top-right { display: flex; align-items: center; gap: 6px; position: relative; } /* above the corner claw marks */
.share-btn {
  width: 32px; height: 32px; margin: -6px -8px -6px 0; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.share-btn:hover { color: var(--ink); background: var(--line); }
.series { font: 500 12px/1.2 var(--body); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
/* With the venue after it, one line cut short at the card's edge. */
.series { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-bottom: 5px; margin-bottom: -5px; }
.series .at { text-transform: none; letter-spacing: 0; font-size: 13px; }
/* At the hall the venue links to the hall's programme (/ohjelma). The padding above keeps its underline from being clipped. */
.series a.at { color: inherit; text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.series a.at:hover { color: var(--ink); }

.when { display: flex; align-items: baseline; gap: 14px; }
.when .tp { align-self: center; margin: 0 0 0 -4px; }
.date { font: 400 calc(var(--tile) * .32)/1 var(--slab); text-transform: uppercase; white-space: nowrap; }
.time { font: 600 calc(var(--tile) * .29)/1 var(--display); color: var(--red); font-variant-numeric: tabular-nums; }

/* Sides align at the top so both logo tiles sit on one line even when a name wraps to two lines;
   vs / score is centred on the tiles, not on the taller block. */
/* minmax(0, …): a long name must not widen its column past the card; fitNames() shrinks it instead. */
.teams { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 10px; }
.teams > .vs, .teams > .score { height: var(--tile); display: grid; place-items: center; }
.side { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 8px; text-align: center; min-width: 0; }
/* Both crests sit on equal white tiles with glowing frames: red for Panthers, silver for the opponent.
   A brighter glint orbits each frame, one lap in 28 s; the opponent's runs half a lap behind, so the
   two glints are always 180° apart. The frame is a conic gradient under the white padding box. */
@property --orbit { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.slot { height: var(--tile); display: grid; place-items: center; position: relative; isolation: isolate; }
/* Shred (app.js shredOpponent): clicking either crest rips the opponent's tile with red claw
   marks into strips that pull apart, then fall off the card, leaving the marks; 1.5 s later a new
   sticker of the tile is rolled on from the top-left corner over them. A hidden extra: the crests keep
   the normal cursor, so nothing gives it away. */
.slot.shredded > .plate { visibility: hidden; }
.shred, .scar { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.shred > * { grid-area: 1 / 1; }
/* The claw marks lie over the strips while the tile is torn, then drop under everything as the strips
   fall, so the new sticker covers them (the slot's isolation keeps them above the card). */
.scar.under { z-index: -1; }
.plate.strip { visibility: visible; animation: strip-split .18s cubic-bezier(.2, .8, .3, 1) var(--delay) forwards; }
/* Each strip's copy of the tile's glow would be cut by its clip into slanted chunks; instead the
   strips glow together, around every piece's own edges. */
.plate.strip { box-shadow: none; }
.shred { filter: drop-shadow(0 0 calc(var(--tile) * .08) var(--glow-away)); }
@keyframes strip-split {
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); }
}
.rips {
  width: var(--tile); height: var(--tile); overflow: visible;
  filter: drop-shadow(0 0 3px rgba(227, 36, 43, .7)) drop-shadow(0 0 10px rgba(227, 36, 43, .35)); /* the intro claws' glow */
  /* The marks (in their own .scar layer) outlast the strips: they hold for a second, then fade over
     4 s, under the new sticker by the end. */
  animation: rips-fade 4s ease-in-out 1s forwards;
}
.rips .reveal {
  stroke-dasharray: 1 2; stroke-dashoffset: 1; visibility: hidden; animation: tear .15s cubic-bezier(.55, 0, .85, .35) forwards;
}
@keyframes rips-fade { to { opacity: 0; } }
.sticker, .gloss {
  position: absolute; inset: 0; margin: auto; width: var(--tile); height: var(--tile); pointer-events: none;
}
/* The new sticker: the tile, flat where it is stuck, and thin bands of it squeezed onto the curl of
   the loose part (app.js rollOn). It glows like the tile, around whatever of it is down so far. */
.sticker { filter: drop-shadow(0 0 calc(var(--tile) * .08) var(--glow-away)); }
.sticker .plate { position: absolute; left: 0; top: 0; box-shadow: none; }
.sticker .roll { position: absolute; inset: 0; filter: drop-shadow(1px 4px 4px rgba(0, 0, 0, .45)); }
.sticker .band { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
/* The sticker's back, seen where the roll turns over. */
.sticker .back {
  width: var(--tile); height: var(--tile); border-radius: calc(var(--tile) * .16); border: 3px solid #c3c8cf;
  background: linear-gradient(135deg, #f7f8fa, #dfe2e6 60%, #c9cdd3);
}
/* Once it is down, a sheen sweeps across it, as if smoothed under a thumb. */
.gloss { border-radius: calc(var(--tile) * .16); overflow: hidden; z-index: 2; }
.gloss::before {
  content: ""; position: absolute; inset: -30% auto -30% 0; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75) 45%, rgba(255, 255, 255, .95) 50%, rgba(255, 255, 255, .75) 55%, transparent);
  transform: translateX(-120%) skewX(-14deg); mix-blend-mode: screen;
  animation: gloss .5s cubic-bezier(.4, 0, .2, 1) forwards;
}
@keyframes gloss { to { transform: translateX(320%) skewX(-14deg); } }
.plate {
  --rest: var(--frame-away); --glint: #e9edf2; --hot: #ffffff;
  display: grid; place-items: center; border-radius: calc(var(--tile) * .16);
  border: 3px solid transparent;
  background:
    linear-gradient(var(--plate), var(--plate)) padding-box,
    conic-gradient(from var(--orbit), var(--rest) 0 60%, var(--glint) 80%, var(--hot) 85%, var(--rest) 100%) border-box;
  box-shadow: 0 0 0 1px rgba(220, 225, 232, .4), 0 0 calc(var(--tile) * .2) var(--glow-away);
  animation: orbit 28s linear -14s infinite;
}
.plate { width: var(--tile); height: var(--tile); }
/* The red frame and glow always mark Panthers, on whichever side it plays. */
.plate.panthers {
  --rest: var(--frame-home); --glint: #ff5a60; --hot: #ffd2d2;
  box-shadow: 0 0 0 1px rgba(227, 36, 43, .5), 0 0 calc(var(--tile) * .2) var(--glow-home);
  animation-delay: 0s;
}
@keyframes orbit { to { --orbit: 360deg; } }
/* A light golden shimmer drifts slowly across "RSS Panthers" in the headline, outlined in black. */
.tname .pn {
  background: linear-gradient(90deg, var(--ink) 0 36%, #f7eed6 46%, #eed79c 50%, #f7eed6 54%, var(--ink) 64% 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 1px #000; paint-order: stroke fill; /* narrow black outline */
  animation: shimmer 14s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) {
  .plate, .tname .pn, .card { animation: none; }
}
.plate img { display: block; width: calc(var(--tile) * .8); height: calc(var(--tile) * .8); object-fit: contain; }
/* Always two lines tall, so the card keeps its height whether a name wraps or not; a name that would
   take three lines, or has a word wider than the column, gets a smaller font (fitNames in app.js). */
.team {
  font: 400 17px/1.1 var(--slab); text-transform: uppercase; text-wrap: balance; min-height: 2.2em;
  max-width: 100%;
}
.vs { font: 600 14px/1 var(--body); color: var(--muted); }
.score {
  font: 400 38px/1 var(--slab); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.result {
  justify-self: center; font: 600 12px/1 var(--body); text-transform: uppercase; letter-spacing: .08em;
  padding: 6px 8px; border-radius: 6px; color: var(--floor);
}
.result.w { background: var(--win); } .result.l { background: var(--loss); color: var(--ink); } .result.d { background: var(--muted); }

/* Venue, and the ticket link on the same line: a game with tickets is no taller than one without.
   The row is as tall as the link, so it does not grow when one appears. */
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; }
.venue { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 14px; min-width: 0; }
.tickets {
  flex: none; font: 600 14px/1 var(--body); color: var(--ink); text-decoration: none;
  background: var(--red); border-radius: 999px; padding: 10px 14px;
}
.tickets:hover { filter: brightness(1.1); }
.venue svg { flex: none; }

/* The venue as a button when there are games elsewhere too: a pill with a chevron, and a menu that
   opens above it (the card clips anything below its bottom edge). */
.venue-pick { position: relative; min-width: 0; }
.venue-btn {
  display: flex; gap: 7px; align-items: center; max-width: 100%;
  font: 500 14px/1 var(--body); color: var(--ink); background: #202020;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 10px 8px 9px; cursor: pointer;
}
.venue-btn:hover, .venue-btn[aria-expanded="true"] { border-color: var(--muted); }
.venue-btn svg { flex: none; }
.venue-btn .vlabel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.venue-btn .chev { color: var(--muted); transition: transform .15s; }
.venue-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.venue-menu {
  position: absolute; z-index: 5; bottom: calc(100% + 6px); left: 0; min-width: 240px;
  background: #1e1e1e; border: 1px solid var(--line); border-radius: 14px; padding: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .6);
}
.venue-menu[hidden] { display: none; }
.venue-menu button {
  display: flex; width: 100%; gap: 10px; align-items: center; text-align: left;
  background: none; border: 0; color: var(--ink); font: 500 14px/1.2 var(--body);
  padding: 10px; border-radius: 9px; cursor: pointer;
}
.venue-menu button:hover, .venue-menu button:focus-visible { background: #2a2a2a; outline: none; }
.venue-menu small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.venue-menu .tick { flex: none; color: var(--red); visibility: hidden; }
.venue-menu [aria-checked="true"] .tick { visibility: visible; }
.card > .notice + .foot-row { margin-top: 4px; justify-content: center; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  font: 600 15px/1 var(--body); border-radius: 10px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn.primary { background: var(--red); border-color: var(--red); color: var(--ink); flex: 1; justify-content: center; }
.btn:disabled { opacity: .6; cursor: default; }
.btn:hover { border-color: var(--red); }
.btn.primary:hover { filter: brightness(1.1); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.nav .pos { text-align: center; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.arrow {
  width: clamp(36px, calc(var(--tile) * .4), 44px); height: clamp(36px, calc(var(--tile) * .4), 44px);
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font-size: 20px; cursor: pointer;
}
.arrow:disabled { opacity: .35; cursor: default; }

dialog {
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0,0,0,.7); }
.dlg { display: grid; gap: 12px; }
.dlg h2 { margin: 0; font: 400 22px/1 var(--slab); text-transform: uppercase; }
.dlg img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.dlg .preview { max-height: 60vh; overflow: auto; }
.dlg p { margin: 0; color: var(--muted); font-size: 13px; }
.formats { display: flex; gap: 8px; }
.tags { margin: 0; text-align: center; font: 600 15px/1.4 var(--body); color: var(--ink); }
.foot { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
/* To the weekly page (/viikko/) and the calendar page (/kalenteri/): quiet pills under the hashtags. */
.more-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cal-link {
  display: inline-flex; align-items: center; gap: 7px;
  font: 600 13px/1 var(--body); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px;
}
.cal-link svg { color: var(--red); }
.cal-link:hover { border-color: var(--red); }
:is(html, .app).light .cal-link { color: var(--out-ink); border-color: var(--out-line); }
/* Swipe (app.js): the card follows the finger sideways and leaves up-and-down to the page. It moves by
   translate and rotate, which stack on the intro's "hit" shake (transform) instead of fighting it. */
.card { touch-action: pan-y pinch-zoom; -webkit-touch-callout: none; } /* a long press opens the quick actions, not iOS's image menu */
.card.dragging { cursor: grabbing; }
/* A short note at the bottom, e.g. when a team is starred. */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 20;
  translate: -50% 150%; opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); width: max-content; text-align: center;
  background: #f4f4f4; color: #111; font: 500 14px/1.35 var(--body);
  padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  transition: translate .3s cubic-bezier(.2, .9, .25, 1), opacity .3s;
}
.toast.on { translate: -50% 0; opacity: 1; }

/* "5 peliä hallissa ›" in the venue row on a tournament day: opens the day's programme. */
.day-pill {
  align-self: center; flex: none;
  font: 600 12px/1 var(--body); color: var(--ink); cursor: pointer;
  background: color-mix(in srgb, var(--red) 14%, transparent); border: 1px solid color-mix(in srgb, var(--red) 45%, transparent);
  border-radius: 999px; padding: 6px 10px;
}
.day-pill:hover { border-color: var(--red); }
/* Right side of the venue row, before any ticket button; the venue name gives way first. */
.foot-row .day-pill { margin-left: auto; }

/* Bottom sheets (index.html #actions, #day): modal dialogs that rise from the bottom edge. */
dialog.sheet {
  margin: auto auto 0; width: min(520px, 100%); max-width: 100%; max-height: 85dvh; overflow: auto;
  padding: 0; border-bottom: 0; border-radius: 22px 22px 0 0;
}
dialog.sheet[open] { animation: sheet-up .32s cubic-bezier(.2, .9, .25, 1); }
@keyframes sheet-up { from { translate: 0 100%; } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }
.sheet-body:focus { outline: none; } /* focused on open, in place of the first button */
.sheet-body { display: grid; gap: 12px; padding: 8px 18px max(20px, env(safe-area-inset-bottom)); }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 2px auto 4px; }
.sheet h2 { margin: 0; font: 400 20px/1.15 var(--slab); }
.sheet h3 { margin: 6px 0 0; font: 600 13px/1.2 var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sheet-sub { margin: -6px 0 0; color: var(--muted); font-size: 13px; }
.acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.act {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  font: 600 14px/1.2 var(--body); color: var(--ink); text-decoration: none; cursor: pointer;
  background: var(--floor); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
.act:hover { border-color: var(--red); }
.act.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; }
.act[hidden] { display: none; }
.act svg { color: var(--red); flex: none; }
.act small { display: block; margin-top: 3px; font-weight: 400; font-size: 12px; color: var(--muted); }
.prog { list-style: none; margin: 0; padding: 0; }
.prog li { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.prog .tm { font: 600 16px/1 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.prog .vs-line small { display: block; color: var(--muted); font-size: 12px; }
.prog .sc { display: inline-flex; align-self: center; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; color: var(--muted); }
.prog .sc .tp { margin: -6px -3px; } /* the game in Tulospalvelu, after the score */
.prog li.ours .tm { color: var(--red); }
.prog li.ours .vs-line { font-weight: 600; }
.prog li.this { background: color-mix(in srgb, var(--red) 10%, transparent); margin: 0 -8px; padding-inline: 8px; border-radius: 8px; }
.prog li.done { opacity: .5; }
/* The current time, between the game that has started and the next one. */
.prog li.now { display: block; position: relative; height: 0; padding: 0; border: 0; }
.prog li.now::after { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: #ffcf6a; }
.prog li.now span {
  position: absolute; left: 0; top: -9px; z-index: 1; padding: 1px 6px; border-radius: 4px;
  font: 700 10px/16px var(--body); letter-spacing: .06em; text-transform: uppercase; background: #ffcf6a; color: #2a2010;
}
.sheet-more { justify-self: center; color: var(--muted); font-size: 13px; text-underline-offset: 3px; }
.sheet-more:hover { color: var(--ink); }
/* Loading skeletons (index.html .skeleton): the real elements with grey bars for their text, each bar
   the height of a capital in its element's font, so the line boxes, and the card, keep their real size.
   A faint light sweeps across them. */
.sk {
  display: inline-block; vertical-align: middle; height: .72em; max-width: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--line) 0 40%, #3a3a3a 50%, var(--line) 60% 100%) 0 0 / 300% 100%;
  animation: sk-sweep 1.6s linear infinite;
}
.sk.line { display: block; margin-top: .33em; } /* the team's line under "RSS Panthers" */
@keyframes sk-sweep { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.skeleton .plate { background: var(--line); box-shadow: none; animation: none; }
.skeleton .vs { opacity: .5; }
.chip-row .chip:has(.sk) { cursor: default; }
:is(html, .app).light .filters .sk { background: var(--out-line); animation: none; }
:is(html, .app).one-team .filters.skeleton { display: none; }
.nav.skeleton .arrow:disabled { opacity: .5; }
.notice { color: var(--muted); text-align: center; margin: 0; }
.notice.error { color: var(--ink); }
.badge {
  position: absolute; top: 0; right: 0; font: 600 11px/1 var(--body); text-transform: uppercase; letter-spacing: .08em;
  border: 1px dashed var(--muted); color: var(--muted); border-radius: 999px; padding: 6px 9px;
}
/* No network (app.js showOffline): the page shows what sw.js saved. Top left, apart from the sample badge. */
.badge.offline { right: auto; left: 0; border: 1px solid #5a4a20; background: #2a2416; color: #ffcf6a; }

/* Inside widget.js's iframe (?embed=1): the iframe takes the page's height, so sizes follow the width
   instead of the window height (which would only chase the iframe), and the page never scrolls.
   No background of its own: the host page shows around the card. color-scheme normal, like the host
   page, or the browser paints the iframe opaque. */
html.embed, html.embed body { height: auto; overflow: hidden; background: transparent; }
:is(html, .app).embed {
  --tile: clamp(72px, 24vw, 112px);
  --gap: 14px;
  color-scheme: normal;
}
html.embed body { padding: 4px; } /* room for focus rings and the card's edge */
:is(html, .app).embed .crest { width: clamp(48px, calc((var(--tile) - 72px) + 48px), 88px); }
/* The widget without an iframe (inline.js): the app in a Shadow DOM on the host page, in an .app
   element that stands in for <html> and <body>. Sized by its own width (a container), not the window. */
.app.inline {
  container-type: inline-size; --tile: clamp(72px, 24cqw, 112px);
  color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.4; padding: 4px;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
/* ?bare=1 (widget.js data-bare), for a host page that already shows the club's logo and links:
   just the chips, the card and the arrows. */
:is(html, .app).bare .wrap > header, :is(html, .app).bare .tags, :is(html, .app).bare .more-links, :is(html, .app).bare .foot { display: none; }

/* ?theme=light, for light host pages: everything outside the card in dark ink. The card itself, and
   the "Lisää" panel and share dialog over it, stay dark. */
:is(html, .app).light { --out-ink: #111; --out-muted: #555; --out-line: #d4d4d4; }
:is(html, .app).light .tags { color: var(--out-ink); }
:is(html, .app).light .foot, :is(html, .app).light .nav .pos { color: var(--out-muted); }
:is(html, .app).light .badge { color: var(--out-muted); border-color: var(--out-muted); }
:is(html, .app).light .chip-row .chip:not([aria-pressed="true"]) { color: var(--out-muted); border-color: var(--out-line); }
:is(html, .app).light .chip-row .chip-more[aria-expanded="true"] { color: var(--out-ink); border-color: var(--out-muted); }
:is(html, .app).light .arrow { background: #fff; border-color: var(--out-line); color: var(--out-ink); }
.card.empty { overflow: visible; }

/* Tulospalvelu: a small icon after a game, team, series or venue, linking to it on the results
   service (tulospalvelu.js). The negative margins keep it from making its line taller. */
.tp { display: inline-flex; vertical-align: middle; padding: 3px; margin: -10px -3px -10px 2px; opacity: .8; border-radius: 4px; }
.tp:hover, .tp:focus-visible { opacity: 1; }
.tp img { display: block; width: 22px; height: 26px; }
