:root {
  --gallery-ink: #14231c;
  --gallery-muted: #637168;
  --gallery-green: #276a38;
  --gallery-green-dark: #174924;
  --gallery-lime: #e5f2d6;
  --gallery-border: #dce4de;
  --gallery-surface: #ffffff;
  --gallery-bg: #f3f6f3;
}

.tv-gallery-login-body {
  min-height: 100vh;
  margin: 0;
  background: var(--gallery-bg);
  color: var(--gallery-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tv-gallery-login {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.tv-gallery-login-panel {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--gallery-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(27, 45, 34, .12);
}

.tv-gallery-login-panel > img {
  display: block;
  width: 207px;
  height: 40px;
  margin-bottom: 28px;
  object-fit: contain;
}

.tv-gallery-login-panel h1 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -.03em;
}

.tv-gallery-login-panel > p:not(.tv-gallery-kicker) {
  margin: 10px 0 24px;
  color: var(--gallery-muted);
  line-height: 1.5;
}

.tv-gallery-login-panel label {
  display: block;
  margin: 14px 0 6px;
  font-size: .84rem;
  font-weight: 800;
}

.tv-gallery-login-panel input {
  width: 100%;
  min-height: 46px;
  box-sizing: border-box;
  padding: 0 12px;
  border: 1px solid var(--gallery-border);
  border-radius: 10px;
  background: #f8faf8;
  color: var(--gallery-ink);
  font: inherit;
  outline: none;
}

.tv-gallery-login-panel input:focus {
  border-color: var(--gallery-green);
  box-shadow: 0 0 0 3px rgba(39, 106, 56, .14);
}

.tv-gallery-login-panel button {
  width: 100%;
  min-height: 46px;
  margin-top: 22px;
  border: 0;
  border-radius: 10px;
  background: var(--gallery-green-dark);
  color: #fff;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.tv-gallery-login-panel button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.tv-gallery-login-error {
  margin: 0 0 15px;
  padding: 11px 12px;
  border: 1px solid #f0b7b7;
  border-radius: 9px;
  background: #fff3f3;
  color: #9f2727;
  font-size: .84rem;
  font-weight: 700;
}

.tv-gallery-page {
  min-height: 70vh;
  padding: 42px max(18px, calc((100vw - 1240px) / 2)) 72px;
  background: var(--gallery-bg);
  color: var(--gallery-ink);
}

.tv-gallery-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
  padding: 34px 38px;
  border: 1px solid #d8e2da;
  border-radius: 24px;
  background: #eef4e9;
}

.tv-gallery-hero-copy {
  max-width: 760px;
}

.tv-gallery-kicker {
  margin: 0 0 9px;
  color: var(--gallery-green);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.tv-gallery-hero h1 {
  margin: 0;
  color: var(--gallery-ink);
  font-size: clamp(2rem, 4vw, 3.55rem);
  font-weight: 900;
  line-height: .98;
  letter-spacing: -.045em;
}

.tv-gallery-hero-copy > p:last-child {
  max-width: 660px;
  margin: 18px 0 0;
  color: #4e5d53;
  font-size: 1rem;
  line-height: 1.55;
}

.tv-gallery-total {
  display: flex;
  min-width: 132px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  border-radius: 18px;
  background: var(--gallery-green-dark);
  color: #fff;
}

.tv-gallery-total strong {
  font-size: 2.15rem;
  font-weight: 900;
  line-height: 1;
}

.tv-gallery-total span {
  margin-top: 5px;
  color: #d7eadb;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.tv-gallery-hero-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
}

.tv-gallery-hero-actions form {
  margin: 0;
}

.tv-gallery-logout {
  width: 100%;
  min-height: 38px;
  border: 1px solid #b9c9bc;
  border-radius: 10px;
  background: #fff;
  color: var(--gallery-green-dark);
  font-size: .78rem;
  font-weight: 850;
  cursor: pointer;
}

.tv-gallery-logout:hover,
.tv-gallery-logout:focus-visible {
  border-color: var(--gallery-green-dark);
  outline: none;
}

.tv-gallery-toolbar {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding: 12px;
  border: 1px solid rgba(213, 223, 216, .92);
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 30px rgba(35, 56, 43, .08);
  backdrop-filter: blur(12px);
}

.tv-gallery-search {
  position: relative;
  display: block;
}

.tv-gallery-search-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 15px;
  height: 15px;
  transform: translateY(-58%);
  border: 2px solid #708078;
  border-radius: 50%;
  pointer-events: none;
}

.tv-gallery-search-icon::after {
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  transform: rotate(45deg);
  border-radius: 2px;
  background: #708078;
  content: "";
}

.tv-gallery-search input {
  width: 100%;
  min-height: 46px;
  padding: 0 16px 0 43px;
  border: 1px solid var(--gallery-border);
  border-radius: 12px;
  background: #f8faf8;
  color: var(--gallery-ink);
  font-size: .92rem;
  outline: none;
}

.tv-gallery-search input:focus {
  border-color: var(--gallery-green);
  box-shadow: 0 0 0 3px rgba(39, 106, 56, .14);
}

.tv-gallery-filters {
  display: flex;
  gap: 6px;
}

.tv-gallery-filters button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #536259;
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.tv-gallery-filters button:hover {
  background: #f0f4f0;
}

.tv-gallery-filters button.is-active {
  border-color: #cadecc;
  background: var(--gallery-lime);
  color: var(--gallery-green-dark);
}

.tv-gallery-results {
  min-width: 82px;
  margin: 0;
  color: var(--gallery-muted);
  font-size: .82rem;
  font-weight: 750;
  text-align: right;
}

.tv-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 20px;
}

.tv-gallery-card {
  min-width: 0;
}

.tv-gallery-card[hidden] {
  display: none;
}

.tv-gallery-card > a {
  display: block;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--gallery-border);
  border-radius: 17px;
  background: var(--gallery-surface);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 7px 22px rgba(27, 45, 34, .07);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.tv-gallery-card > a:hover,
.tv-gallery-card > a:focus-visible {
  transform: translateY(-5px);
  border-color: #a9c3ad;
  box-shadow: 0 17px 36px rgba(27, 45, 34, .14);
  outline: none;
}

.tv-gallery-cover {
  position: relative;
  display: flex;
  aspect-ratio: 3 / 4;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #e9eeea;
}

.tv-gallery-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .28s ease;
}

.tv-gallery-card > a:hover .tv-gallery-cover img,
.tv-gallery-card > a:focus-visible .tv-gallery-cover img {
  transform: scale(1.025);
}

.tv-gallery-open {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 999px;
  background: rgba(17, 38, 25, .86);
  color: #fff;
  font-size: .76rem;
  font-weight: 850;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity .18s ease, transform .18s ease;
  backdrop-filter: blur(8px);
}

.tv-gallery-card > a:hover .tv-gallery-open,
.tv-gallery-card > a:focus-visible .tv-gallery-open {
  opacity: 1;
  transform: translateY(0);
}

.tv-gallery-open svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tv-gallery-card-copy {
  padding: 15px 16px 17px;
}

.tv-gallery-platform {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 9px;
  color: #5a685f;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .025em;
  text-transform: uppercase;
}

.tv-gallery-platform span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7a8a80;
  box-shadow: 0 0 0 3px #edf1ee;
}

.tv-gallery-platform.is-calameo {
  color: #185a2b;
}

.tv-gallery-platform.is-calameo span {
  background: #2e8a45;
  box-shadow: 0 0 0 3px #e2f2e5;
}

.tv-gallery-card h2 {
  display: -webkit-box;
  min-height: 2.65em;
  margin: 0;
  overflow: hidden;
  color: var(--gallery-ink);
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.32;
  letter-spacing: -.015em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tv-gallery-meta {
  margin: 9px 0 0;
  overflow: hidden;
  color: var(--gallery-muted);
  font-size: .76rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tv-gallery-message {
  padding: 42px 24px;
  border: 1px solid var(--gallery-border);
  border-radius: 18px;
  background: #fff;
  color: var(--gallery-muted);
  font-weight: 700;
  text-align: center;
}

@media (max-width: 1024px) {
  .tv-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tv-gallery-toolbar {
    grid-template-columns: 1fr auto;
  }

  .tv-gallery-results {
    display: none;
  }
}

@media (max-width: 760px) {
  .tv-gallery-page {
    padding: 24px 14px 52px;
  }

  .tv-gallery-hero {
    align-items: flex-start;
    margin-bottom: 18px;
    padding: 25px 22px;
  }

  .tv-gallery-total {
    min-width: 92px;
    padding: 13px;
  }

  .tv-gallery-total strong {
    font-size: 1.65rem;
  }

  .tv-gallery-toolbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .tv-gallery-filters {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tv-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 12px;
  }

  .tv-gallery-open {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 460px) {
  .tv-gallery-hero {
    display: block;
  }

  .tv-gallery-hero h1 {
    font-size: 2rem;
  }

  .tv-gallery-total {
    display: inline-flex;
    margin-top: 20px;
  }

  .tv-gallery-card-copy {
    padding: 12px 12px 14px;
  }

  .tv-gallery-platform {
    font-size: .6rem;
  }

  .tv-gallery-card h2 {
    font-size: .88rem;
  }

  .tv-gallery-meta {
    white-space: normal;
  }

  .tv-gallery-open span {
    display: none;
  }

  .tv-gallery-open {
    width: 38px;
    justify-content: center;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tv-gallery-card > a,
  .tv-gallery-cover img,
  .tv-gallery-open {
    transition: none;
  }
}
