/* =========================================================
   Jersey 25 (local, latin + latin-ext)
   ========================================================= */
@font-face {
  font-family: "Jersey 25";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jersey25-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Jersey 25";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jersey25-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* =========================================================
   Tokeny
   ========================================================= */
:root {
  --bg-page: #0e1128;
  --bg-app: #161939;
  --bg-panel: #191d73;
  --bg-chip: #202665;
  --bg-chip-hover: #272e78;
  --accent: #8c94ed;
  --text-soft: #afb4e8;
  --line: rgba(140, 148, 237, 0.35);

  --radius: 31px;
  --gap: clamp(14px, 1.8vw, 24px);
  --pad: clamp(12px, 1.8vw, 26px);
}

/* =========================================================
   Base
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg-page);
  color: var(--accent);
  font-family: "Jersey 25", ui-monospace, "Courier New", monospace;
  font-weight: 400;
  font-synthesis: none;
  font-size: 16px;
  line-height: 1.05;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent);
  color: var(--bg-app);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

/* =========================================================
   Shell
   ========================================================= */
.page {
  padding: clamp(0px, 2.2vw, 34px);
  min-height: 100svh;
  display: flex;
}

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: var(--pad);
  background: var(--bg-app);
  border-radius: var(--radius);
  border: 1px solid rgba(140, 148, 237, 0.12);
  min-height: 100%;
}

/* On the list page the shell stays put and only the cards scroll, so the
   header, filters and footer are always in reach. */
body.list .app {
  height: calc(100svh - 2 * clamp(0px, 2.2vw, 34px));
  min-height: 560px;
}

body.list .results {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-chip) transparent;
}

body.list .results::-webkit-scrollbar {
  width: 10px;
}

body.list .results::-webkit-scrollbar-track {
  background: transparent;
}

body.list .results::-webkit-scrollbar-thumb {
  background: var(--bg-chip);
  background-clip: content-box;
  border: 2px solid transparent;
  border-radius: 999px;
}

body.list .results::-webkit-scrollbar-thumb:hover {
  background: var(--bg-chip-hover);
  background-clip: content-box;
}

body.list .grid {
  flex: none;
}

/* =========================================================
   Header
   ========================================================= */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 85px;
  padding: clamp(8px, 1.2vw, 16px) clamp(14px, 2vw, 28px);
  background: var(--bg-panel);
  border-radius: var(--radius);
  text-align: center;
}

.header__title {
  margin: 0;
  font-size: clamp(24px, 4.6vw, 64px);
  font-weight: 400;
  line-height: 1;
  color: var(--accent);
  text-wrap: balance;
  text-shadow: 0 0 26px rgba(140, 148, 237, 0.35);
}

/* =========================================================
   Toolbar
   ========================================================= */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(10px, 1.4vw, 22px);
  padding: clamp(8px, 1vw, 12px) clamp(10px, 1.4vw, 18px);
  background: var(--bg-panel);
  border-radius: var(--radius);
  min-height: 85px;
}

/* --- Filters: dropdown --- */
.filters {
  position: relative;
  flex: 0 0 auto;
}

.filters__btn {
  display: inline-flex;
  align-items: center;
  gap: clamp(6px, 0.9vw, 14px);
  padding: clamp(6px, 0.7vw, 10px) clamp(10px, 1.2vw, 18px);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: clamp(20px, 2.9vw, 44px);
  line-height: 1;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background-color 0.15s ease;
}

.filters__btn::-webkit-details-marker {
  display: none;
}

.filters__btn::marker {
  content: "";
}

.filters__btn:hover,
.filters[open] .filters__btn {
  background: var(--bg-chip);
}

.filters__arrow {
  width: 0.55em;
  height: auto;
  flex: 0 0 auto;
  color: var(--accent);
  transition: transform 0.18s ease;
}

.filters__btn:hover .filters__arrow {
  transform: translateY(2px);
}

.filters[open] .filters__arrow {
  transform: rotate(180deg);
}

.filters__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: clamp(220px, 22vw, 300px);
  max-height: min(60vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  padding: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 24px;
}

.filters__panel::-webkit-scrollbar {
  width: 8px;
}

.filters__panel::-webkit-scrollbar-thumb {
  background: var(--accent);
}

.filters__panel::-webkit-scrollbar-track {
  background: transparent;
}

.filters__opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 14px 8px;
  border-radius: 18px;
  color: var(--text-soft);
  font-size: clamp(18px, 2.1vw, 30px);
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.filters__opt:hover {
  background: var(--bg-chip);
  color: var(--accent);
}

.filters__opt.is-active {
  background: var(--bg-chip);
  color: var(--accent);
}

.filters__opt.is-active::after {
  content: "";
  width: 0.32em;
  height: 0.32em;
  border-radius: 2px;
  background: currentColor;
}

/* --- Search --- */
.search {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 16px);
  flex: 1 1 240px;
  min-width: 0;
  font-size: clamp(20px, 2.9vw, 44px);
  padding: clamp(6px, 0.8vw, 10px) clamp(12px, 1.5vw, 22px);
  background: var(--bg-chip);
  border: 2px solid transparent;
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.search:focus-within {
  border-color: var(--line);
  background: #232a6e;
}

.search__icon {
  width: 0.95em;
  height: auto;
  flex: 0 0 auto;
  color: var(--accent);
  transition: transform 0.18s ease;
}

/* Hover nudges the magnifier along its handle, the same small move the
   Filters arrow makes. Transform only, so nothing around it shifts. */
.search:hover .search__icon {
  transform: translate(2px, 2px);
}

.search__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 1em;
  line-height: 1;
  letter-spacing: inherit;
  caret-color: var(--accent);
  appearance: none;
  -webkit-appearance: none;
}

.search__input:focus {
  outline: none;
}

.search__input::placeholder {
  color: var(--accent);
  opacity: 0.7;
}

.search__input::-webkit-search-decoration,
.search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

/* --- count --- */
.toolbar__count {
  flex: 0 0 auto;
  margin: 0 0 0 auto;
  padding: 0 clamp(4px, 0.6vw, 10px);
  font-size: clamp(18px, 2.5vw, 36px);
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
}

/* =========================================================
   Grid
   ========================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: var(--gap);
}

.card {
  /* karta je vlastní container, aby se text škáloval podle její šířky,
     ne podle okna */
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(6px, 1vw, 12px);
  min-height: 96px;
  padding: clamp(10px, 1.2vw, 18px);
  background: var(--bg-panel);
  border: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: background-color 0.16s ease, transform 0.18s ease;
}

.card:hover {
  background: #1f2573;
  transform: scale(1.02);
  z-index: 1;
}

.card__top {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  min-width: 0;
  margin: 0;
  font: inherit;
}

.card__name {
  display: block;
  flex: 1 1 100%;
  min-width: 0;
  margin: 0;
  padding: clamp(4px, 0.7vw, 8px) clamp(9px, 3.4cqw, 20px);
  background: var(--bg-chip);
  border-radius: 0;
  font-size: clamp(17px, 7.6cqw, 36px);
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
  color: var(--text-soft);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}

.card:hover .card__name {
  color: var(--accent);
}

.card__cat {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: clamp(4px, 0.7vw, 8px) clamp(9px, 3.4cqw, 20px);
  background: var(--bg-chip);
  border-radius: 0;
  font-size: clamp(14px, 5.8cqw, 27px);
  line-height: 1.15;
  text-align: center;
  color: var(--text-soft);
  white-space: normal;
  overflow-wrap: anywhere;
}

/* =========================================================
   Show more (list pagination)
   ========================================================= */
.more {
  display: flex;
  justify-content: center;
  margin-top: clamp(2px, 0.5vw, 8px);
}

.more__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 0.8vw, 12px);
  min-width: min(100%, 259px);
  padding: clamp(10px, 1.2vw, 16px) clamp(20px, 2.4vw, 34px);
  background: var(--bg-panel);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--accent);
  font-family: inherit;
  font-size: clamp(20px, 2.5vw, 34px);
  line-height: 1;
  letter-spacing: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.more__btn:hover {
  background: #1e2470;
  border-color: var(--line);
}

.more__arrow {
  width: 0.55em;
  height: auto;
  flex: 0 0 auto;
  color: var(--accent);
  transition: transform 0.18s ease;
}

.more__btn:hover .more__arrow {
  transform: translateY(2px);
}

.more__btn:active {
  background: var(--bg-chip);
}

.more__btn.is-pressed {
  animation: pop 0.32s cubic-bezier(0.25, 0.9, 0.35, 1.3);
}

/* =========================================================
   Prázdný stav
   ========================================================= */
.empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: clamp(22px, 3.5vw, 52px) 0;
  text-align: center;
  color: var(--accent);
  opacity: 0.75;
  font-size: clamp(17px, 2vw, 28px);
  line-height: 1.2;
}

.empty--page {
  padding: clamp(28px, 4vw, 64px) clamp(16px, 2vw, 28px);
  background: var(--bg-panel);
  border-radius: var(--radius);
  opacity: 1;
}

.empty__text {
  margin: 0;
}

/* =========================================================
   Detail
   ========================================================= */
.header--sub {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(2px, 0.4vw, 6px);
  text-align: left;
}

.header__title--sub {
  font-size: clamp(22px, 3.4vw, 46px);
  line-height: 1.1;
  text-shadow: none;
}

/* title and Credits share one row; Credits stays on the right */
.header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 1.4vw, 20px);
  width: 100%;
}

.header__row .header__title {
  min-width: 0;
}

/* Credits is the same size as Download and points out with a pixel arrow */
.credits {
  display: inline-flex;
  align-items: center;
  gap: clamp(6px, 0.7vw, 9px);
  flex: 0 0 auto;
  padding: clamp(6px, 0.8vw, 10px) clamp(16px, 1.8vw, 26px);
  background: var(--bg-chip);
  border: 2px solid transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: clamp(16px, 1.8vw, 24px);
  line-height: 1;
  letter-spacing: inherit;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.credits:hover {
  background: var(--bg-chip-hover);
  border-color: var(--line);
}

.credits:active {
  transform: scale(0.96);
}

.credits__arrow {
  width: 0.5em;
  height: auto;
  flex: 0 0 auto;
  color: var(--accent);
  transition: transform 0.18s ease;
}

.credits:hover .credits__arrow {
  transform: translate(2px, -2px);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: clamp(5px, 0.7vw, 9px) clamp(10px, 1.2vw, 16px);
  background: var(--bg-chip);
  border-radius: var(--radius);
  color: var(--text-soft);
  text-decoration: none;
  font-size: clamp(17px, 1.9vw, 27px);
  line-height: 1;
  opacity: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.back:hover {
  background: var(--bg-chip-hover);
  color: var(--accent);
}

.back__arrow {
  width: 0.62em;
  height: auto;
  flex: 0 0 auto;
}

/* The same way back, repeated at the bottom of the detail page. */
.back--bottom {
  align-self: flex-start;
  margin-top: auto;
  padding: clamp(12px, 1.5vw, 19px) clamp(18px, 2.2vw, 30px);
  background: var(--bg-panel);
  font-size: clamp(20px, 2.7vw, 36px);
}

.back--bottom:hover {
  background: var(--bg-chip-hover);
}

.back--bottom + .footer {
  margin-top: 0;
}

.file {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-radius: var(--radius);
  /* no overflow:hidden — the detail Show less button needs to stick to the
     viewport while the long file is open */
}

.file__bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(10px, 1.4vw, 20px);
  padding: clamp(7px, 0.8vw, 10px) clamp(12px, 1.4vw, 20px);
  background: var(--bg-chip);
}

.file__name {
  grid-column: 1;
  justify-self: start;
  font-size: clamp(20px, 2.4vw, 34px);
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
}

/* category from models.json, centred between the file name and the buttons */
.file__cat {
  grid-column: 2;
  justify-self: center;
  text-align: center;
  font-size: clamp(13px, 1.4vw, 18px);
  line-height: 1.15;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.file__actions {
  grid-column: 3;
  justify-self: end;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  column-gap: clamp(6px, 0.8vw, 10px);
}

/* Download and its stats share one column, so the stats sit dead centre
   under the button no matter how wide the button is. */
.file__dl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 0.5vw, 7px);
}

/* file stats: lines and size of the raw markdown, centred under Download */
.file__meta {
  margin: 0;
  font-size: clamp(15px, 1.5vw, 20px);
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.file__link,
.file__copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: clamp(6px, 0.8vw, 10px) clamp(16px, 1.8vw, 26px);
  background: var(--bg-panel);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--accent);
  font-family: inherit;
  font-size: clamp(16px, 1.8vw, 24px);
  line-height: 1;
  letter-spacing: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease,
    color 0.15s ease;
}

.file__link:hover,
.file__copy:hover {
  background: var(--bg-chip-hover);
  border-color: var(--line);
}

.file__link:active,
.file__copy:active {
  transform: scale(0.96);
}

/* krátké puknutí, když se něco zkopíruje nebo stáhne */
@keyframes pop {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(0.93);
  }
  65% {
    transform: scale(1.035);
  }
  100% {
    transform: scale(1);
  }
}

.file__link.is-done,
.file__copy.is-done,
.compose__btn.is-done {
  animation: pop 0.32s cubic-bezier(0.25, 0.9, 0.35, 1.3);
}

.file__copy.is-done {
  background: var(--accent);
  color: var(--bg-app);
}

.file__link.is-done {
  background: var(--accent);
  color: var(--bg-app);
}

.file__body {
  margin: 0;
  padding: clamp(14px, 1.8vw, 26px);
  color: var(--text-soft);
  font-family: inherit;
  font-size: clamp(14px, 1.35vw, 19px);
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* the file is clipped until you ask for the whole thing */
.file__clip {
  max-height: clamp(240px, 38vh, 430px);
  overflow: hidden;
}

.file__clip.is-clipped {
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent);
  mask-image: linear-gradient(to bottom, #000 82%, transparent);
}

.file__clip.is-open {
  max-height: none;
  -webkit-mask-image: none;
  mask-image: none;
}

.file__more {
  display: flex;
  justify-content: center;
  padding: 0 0 clamp(10px, 1.2vw, 16px);
}

.file__more[hidden] {
  display: none;
}

/* While the whole file is open, the toggle follows the viewport bottom and
   stops at the end of the file, so closing never means scrolling to the end. */
.file.is-open .file__more {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: clamp(10px, 1.4vw, 18px) 0 clamp(10px, 1.2vw, 16px);
  background: linear-gradient(to top, var(--bg-panel) 72%, transparent);
}

.file__toggle {
  min-width: clamp(160px, 18vw, 240px);
  padding: clamp(8px, 1vw, 12px) clamp(20px, 2.4vw, 34px);
  background: var(--bg-chip);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--accent);
  font-family: inherit;
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1;
  letter-spacing: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.file__toggle:hover {
  background: var(--bg-chip-hover);
  border-color: var(--line);
}

/* =========================================================
   Vlastní text + copy all / download all
   ========================================================= */
.compose {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1vw, 12px);
  padding: clamp(12px, 1.5vw, 20px);
  background: var(--bg-panel);
  border-radius: var(--radius);
}

.compose__title {
  margin: 0;
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 400;
  line-height: 1;
  color: var(--accent);
}

.compose__hint {
  margin: 0;
  font-size: clamp(13px, 1.4vw, 18px);
  line-height: 1.25;
  color: var(--text-soft);
  opacity: 0.8;
}

.compose__input {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: clamp(10px, 1.2vw, 16px);
  background: var(--bg-chip);
  border: 2px solid transparent;
  border-radius: 20px;
  color: var(--text-soft);
  font-family: inherit;
  font-size: clamp(14px, 1.5vw, 19px);
  line-height: 1.35;
  letter-spacing: inherit;
  caret-color: var(--accent);
}

.compose__input:focus {
  outline: none;
  border-color: var(--line);
  background: #232a6e;
}

.compose__input::placeholder {
  color: var(--accent);
  opacity: 0.55;
}

.compose__actions {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1vw, 12px);
}

.compose__btn {
  padding: clamp(6px, 0.8vw, 10px) clamp(16px, 1.8vw, 26px);
  background: var(--bg-chip);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--accent);
  font-family: inherit;
  font-size: clamp(16px, 1.8vw, 24px);
  line-height: 1;
  letter-spacing: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.compose__btn:hover {
  background: var(--bg-chip-hover);
  border-color: var(--line);
}

.compose__btn.is-done {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-app);
}

/* =========================================================
   Footer
   ========================================================= */
.footer {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: clamp(8px, 1vw, 14px);
  margin-top: auto;
  padding-top: clamp(4px, 1vw, 10px);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  justify-self: start;
}

.footer__heart {
  flex: none;
  width: 1.15em;
  height: auto;
  margin-top: -0.05em;
  color: var(--accent);
  cursor: pointer;
  transition: color 0.25s ease;
}

.footer__heart.is-pink {
  color: #ff7ac8;
  animation: pop 0.32s cubic-bezier(0.25, 0.9, 0.35, 1.3);
}

.footer__text {
  display: inline-flex;
  align-items: center;
  gap: clamp(7px, 0.8vw, 11px);
  padding: clamp(6px, 0.7vw, 10px) clamp(12px, 1.4vw, 20px);
  background: var(--bg-panel);
  border-radius: var(--radius);
  font-size: clamp(14px, 1.5vw, 20px);
  line-height: 1;
  color: var(--accent);
}

.footer__update {
  margin: 0;
  padding: clamp(6px, 0.7vw, 10px) clamp(12px, 1.4vw, 20px);
  background: var(--bg-panel);
  border-radius: var(--radius);
  font-size: clamp(14px, 1.5vw, 20px);
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
  justify-self: end;
}

/* --- Footer help: same dropdown behaviour as Filters, but it opens up --- */
.footer__help {
  position: relative;
  justify-self: center;
}

.footer__help-btn {
  display: inline-flex;
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
  padding: clamp(6px, 0.7vw, 10px) clamp(12px, 1.4vw, 20px);
  background: var(--bg-panel);
  border-radius: var(--radius);
  font-size: clamp(14px, 1.5vw, 20px);
  line-height: 1;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background-color 0.15s ease;
}

.footer__help-btn::-webkit-details-marker {
  display: none;
}

.footer__help-btn::marker {
  content: "";
}

.footer__help-btn:hover,
.footer__help[open] .footer__help-btn {
  background: var(--bg-chip);
}

/* closed points up (panel opens upwards), open flips down like Filters */
.footer__help-arrow {
  width: 0.55em;
  height: auto;
  flex: 0 0 auto;
  color: var(--accent);
  transform: rotate(180deg);
  transition: transform 0.18s ease;
}

.footer__help-btn:hover .footer__help-arrow {
  transform: rotate(180deg) translateY(2px);
}

.footer__help[open] .footer__help-arrow {
  transform: rotate(0deg);
}

.footer__help-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(360px, calc(100vw - 40px));
  padding: clamp(10px, 1.2vw, 16px);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  font-size: clamp(14px, 1.5vw, 20px);
  line-height: 1.35;
  color: var(--text-soft);
  text-align: left;
}

.footer__help-panel p {
  margin: 0;
}

.footer__help-panel a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  overflow-wrap: anywhere;
}

.footer__help-panel a:hover {
  color: var(--text-soft);
}

/* =========================================================
   Responzivita
   ========================================================= */
@media (max-width: 900px) {
  .card {
    min-height: 92px;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 0;
  }

  .app {
    border-radius: 0;
    border: 0;
    padding: clamp(10px, 3vw, 16px);
    gap: 12px;
  }

  .header {
    min-height: 0;
    padding: 14px 12px 16px;
    border-radius: 24px;
  }

  .header__title {
    font-size: clamp(26px, 7.4vw, 38px);
  }

  .toolbar {
    min-height: 0;
    padding: 10px;
    border-radius: 24px;
    gap: 10px;
  }

  /* search takes its own full-width row on top */
  .search {
    order: -1;
    flex: 1 1 100%;
    border-radius: 22px;
  }

  .filters__btn {
    border-radius: 22px;
  }

  .filters__panel {
    min-width: min(260px, calc(100vw - 60px));
  }

  .toolbar__count {
    margin-left: auto;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .more__btn,
  .footer__text,
  .file,
  .file__toggle,
  .compose,
  .compose__btn {
    border-radius: 22px;
  }

  .more__btn {
    width: 100%;
  }

  .header--sub {
    align-items: flex-start;
  }

  .header__row {
    flex-wrap: wrap;
  }

  .credits {
    margin-left: auto;
  }

  .file__bar {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .file__name,
  .file__cat,
  .file__actions {
    grid-column: auto;
    justify-self: stretch;
  }

  .file__name {
    white-space: normal;
  }

  .file__cat {
    text-align: left;
  }

  .file__actions {
    align-items: start;
  }

  .file__toggle {
    width: 100%;
  }

  .back--bottom {
    width: 100%;
    justify-content: center;
  }

  .footer {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 8px;
  }

  .footer__inner {
    justify-content: center;
  }

  .footer__update {
    justify-self: center;
  }

  /* center the panel over the whole footer so it cannot run off the side */
  .footer__help {
    position: static;
  }

  .footer__help-panel {
    left: 50%;
    transform: translateX(-50%);
    width: min(360px, calc(100vw - 24px));
  }
}

@media (max-width: 380px) {
  .card__name,
  .card__cat {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* =========================================================
   Pixelové rohy u všech boxů
   Rohy jsou složené ze tří malých čtverečků (3 px), stejně jako
   písmo Jersey 25. Žádné hladké border-radius.
   ========================================================= */
:root {
  --pixel-corner: polygon(
    0 9px, 3px 9px, 3px 6px, 6px 6px, 6px 3px, 9px 3px, 9px 0,
    calc(100% - 9px) 0, calc(100% - 9px) 3px, calc(100% - 6px) 3px,
    calc(100% - 6px) 6px, calc(100% - 3px) 6px, calc(100% - 3px) 9px,
    100% 9px,
    100% calc(100% - 9px), calc(100% - 3px) calc(100% - 9px),
    calc(100% - 3px) calc(100% - 6px), calc(100% - 6px) calc(100% - 6px),
    calc(100% - 6px) calc(100% - 3px), calc(100% - 9px) calc(100% - 3px),
    calc(100% - 9px) 100%,
    9px 100%, 9px calc(100% - 3px), 6px calc(100% - 3px),
    6px calc(100% - 6px), 3px calc(100% - 6px), 3px calc(100% - 9px),
    0 calc(100% - 9px)
  );
}

.app,
.header,
.filters__btn,
.filters__panel,
.filters__opt,
.search,
.card,
.card__name,
.card__cat,
.back,
.back--bottom,
.more__btn,
.empty--page,
.file,
.file__link,
.file__copy,
.file__toggle,
.credits,
.compose,
.compose__input,
.compose__btn,
.footer__text,
.footer__update,
.footer__help-btn,
.footer__help-panel {
  border-radius: 0;
  clip-path: var(--pixel-corner);
}

/* Toolbar kreslí pozadí přes pseudo-element, aby její ořez nesežral
   rozbalovací panel filtrů, který z ní vyčnívá. */
.toolbar {
  position: relative;
  border-radius: 0;
  background: transparent;
}

.toolbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg-panel);
  clip-path: var(--pixel-corner);
}

.toolbar > * {
  position: relative;
  z-index: 1;
}

.toolbar > .filters {
  z-index: 3;
}
