:root {
  --ink: #071218;
  --ink-2: #0d1c24;
  --panel: rgba(14, 28, 36, 0.82);
  --line: rgba(232, 214, 176, 0.14);
  --text: #f3efe4;
  --muted: #9aa8a3;
  --amber: #e4b45a;
  --amber-deep: #c8892a;
  --teal: #2f9e8a;
  --danger: #d4645a;
  --radius: 18px;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--ink);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.label-short {
  display: none;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 700px at 8% -10%, rgba(47, 158, 138, 0.28), transparent 55%),
    radial-gradient(900px 600px at 100% 0%, rgba(228, 180, 90, 0.18), transparent 50%),
    linear-gradient(160deg, #050d12 0%, #0a171e 42%, #08131a 100%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding:
    max(0.85rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    0.85rem
    max(1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(7, 18, 24, 0.86);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 2.85rem;
  height: 2.85rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 0.9rem;
  background: transparent;
  box-shadow:
    0 0 0 1px rgba(228, 180, 90, 0.22),
    0 10px 24px rgba(200, 137, 42, 0.28);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-logo {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-text {
  display: grid;
  gap: 0.05rem;
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.22rem;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.brand-name em {
  font-style: normal;
  color: var(--amber);
  font-weight: 700;
}

.brand-tag {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  flex: 0 1 auto;
  min-width: 0;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1rem;
  min-height: 2.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  touch-action: manipulation;
}

.tab.is-active {
  background: rgba(228, 180, 90, 0.16);
  color: var(--amber);
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 max(3.5rem, calc(2rem + env(safe-area-inset-bottom)));
}

.view {
  display: none;
  animation: rise 0.45s ease both;
}

.view.is-active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.library-head {
  display: grid;
  gap: 1rem;
  align-items: stretch;
  justify-content: stretch;
}

.library-title-block {
  display: grid;
  gap: 0.4rem;
}

.library-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 500;
  max-width: 54rem;
  line-height: 1.45;
}

.releases-status {
  margin: 0;
  color: var(--amber);
  font-size: 0.92rem;
  font-weight: 600;
}

.releases-status.hidden {
  display: none;
}

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(10rem, 1.2fr) minmax(10rem, 0.9fr) auto auto auto;
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  max-width: 68rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.library-toolbar .filter-name {
  width: 100%;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border-color: transparent;
  background: rgba(0, 0, 0, 0.18);
  font-size: 1rem;
}

.library-toolbar .filter-name:focus {
  border-color: rgba(228, 180, 90, 0.45);
}

.library-toolbar .check-filter {
  margin: 0;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  height: 100%;
}

.sort-filter {
  display: block;
  margin: 0;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
  min-width: 0;
}

.sort-filter select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-color: transparent;
  background: rgba(0, 0, 0, 0.18);
}

.sort-filter select:focus {
  border-color: rgba(228, 180, 90, 0.45);
}

.library-toolbar .btn {
  white-space: nowrap;
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
}

h1,
h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 800;
}

.lede {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 42ch;
}

.check-filter {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.check-filter input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  min-width: 1.05rem;
  min-height: 1.05rem;
  padding: 0;
  margin: 0;
  accent-color: var(--amber);
  border-radius: 4px;
  flex: 0 0 auto;
}

.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-name {
  width: min(16rem, 100%);
  padding: 0.55rem 0.8rem;
  font-size: 0.92rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font-size: 1rem; /* evita zoom automático no iOS */
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  max-width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(228, 180, 90, 0.55);
  box-shadow: 0 0 0 3px rgba(228, 180, 90, 0.12);
}

.btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  min-height: 2.75rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    transform: translateY(-1px);
  }

  .series-card:hover {
    transform: translateY(-3px);
    border-color: rgba(228, 180, 90, 0.35);
  }

  .brand:hover .brand-mark {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
      0 0 0 1px rgba(228, 180, 90, 0.35),
      0 14px 28px rgba(200, 137, 42, 0.36);
  }

  .tab:hover {
    color: var(--text);
  }

  .episode-row:hover {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.03);
  }
}

.btn.primary {
  background: linear-gradient(145deg, var(--amber), var(--amber-deep));
  color: #1a1205;
  border-color: transparent;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: #ffd5d1;
  border-color: rgba(212, 100, 90, 0.45);
  background: rgba(212, 100, 90, 0.12);
}

.stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.stat {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.02);
}

.stat strong {
  color: var(--text);
  font-family: var(--font-display);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
}

.series-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 110px 1fr;
  min-height: 170px;
  transition: transform 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.series-card:active {
  border-color: rgba(228, 180, 90, 0.35);
}

.series-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #123;
}

.poster-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #12343c, #0b1c24);
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem;
}

.series-body {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.series-body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.chip.streaming-netflix { color: #ff6b6b; border-color: rgba(255, 107, 107, 0.35); }
.chip.streaming-prime { color: #6bb6ff; border-color: rgba(107, 182, 255, 0.35); }
.chip.streaming-apple_tv { color: #d7d7d7; border-color: rgba(215, 215, 215, 0.35); }
.chip.status-watching { color: var(--teal); border-color: rgba(47, 158, 138, 0.4); }
.chip.status-watched { color: var(--amber); border-color: rgba(228, 180, 90, 0.4); }
.chip.status-dropped { color: var(--danger); border-color: rgba(212, 100, 90, 0.4); }
.chip.chip-pending {
  color: #1a1408;
  background: linear-gradient(145deg, #f0d28a, #d4a017);
  border-color: transparent;
  font-weight: 800;
}
.chip.chip-new-episodes {
  color: #14080a;
  background: linear-gradient(145deg, #ff8f7a, #e45b4a);
  border-color: transparent;
  font-weight: 800;
}
.chip.chip-complete {
  color: #1a1205;
  background: linear-gradient(145deg, var(--amber), var(--amber-deep));
  border-color: transparent;
}
.chip.chip-available {
  color: #0b1f1c;
  background: linear-gradient(145deg, #5ee0c4, var(--teal));
  border-color: transparent;
  font-weight: 800;
}
.chip.chip-watching {
  color: #071018;
  background: linear-gradient(145deg, #7ec8ff, #3a8fd6);
  border-color: transparent;
  font-weight: 800;
}
.watching-toggle {
  width: fit-content;
  margin: 0.85rem 0 0;
  max-width: 100%;
}
.chip.rating-ruim { color: #ff8f86; border-color: rgba(212, 100, 90, 0.45); }
.chip.rating-boa { color: #9ad0ff; border-color: rgba(107, 182, 255, 0.4); }
.chip.rating-muito_boa { color: #7de0c8; border-color: rgba(47, 158, 138, 0.45); }
.chip.rating-excelente { color: var(--amber); border-color: rgba(228, 180, 90, 0.5); }
.chip.rating-foda {
  color: #1a1205;
  background: linear-gradient(145deg, #f0c56d, #e07a3a);
  border-color: transparent;
  font-weight: 800;
}

.rating-field {
  max-width: 220px;
  margin: 0.85rem 0 0;
}

.progress {
  color: var(--text);
  font-size: 0.92rem;
}

.card-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: auto;
  flex-wrap: wrap;
}

.card-actions .btn {
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
}

.card-stats {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
}

.card-rating {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

.card-rating.rating-none {
  color: var(--muted);
  font-weight: 500;
}

.card-rating.rating-ruim { color: #ff8f86; }
.card-rating.rating-boa { color: #9ad0ff; }
.card-rating.rating-muito_boa { color: #7de0c8; }
.card-rating.rating-excelente { color: var(--amber); }
.card-rating.rating-foda { color: #e07a3a; }

.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;
}

.card-meta-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-years {
  color: var(--muted);
  font-size: 0.88rem;
}

.card-vote {
  color: var(--amber);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

.back-btn {
  margin-bottom: 1rem;
}

.detail-head {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.detail-hero {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.detail-hero img,
.detail-hero .poster-fallback {
  width: 140px;
  height: 210px;
  object-fit: cover;
  border-radius: 14px;
}

.detail-title-block {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
}

.detail-title-block .meta-row {
  margin: 0;
}

.detail-info {
  display: grid;
  gap: 0.85rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.seasons {
  display: grid;
  gap: 0.85rem;
}

.season-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(14, 28, 36, 0.72);
  padding: 0.35rem 0.85rem 0.85rem;
}

.season-block summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 0.15rem;
  font-family: var(--font-display);
  font-weight: 700;
}

.season-block summary::-webkit-details-marker {
  display: none;
}

.season-progress {
  color: var(--amber);
  font-size: 0.9rem;
}

.season-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.episode-list {
  display: grid;
  gap: 0.35rem;
}

.episode-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.7rem 0.65rem;
  min-height: 2.75rem;
  border-radius: 10px;
  border: 1px solid transparent;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
}

.episode-row input {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
  accent-color: var(--amber);
}

.episode-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.82rem;
}

.next-ep {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-next {
  margin: 0 0 0.75rem;
  color: var(--amber);
  font-size: 0.95rem;
}

.next-ep strong {
  color: var(--amber);
  font-weight: 600;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
}

.hidden {
  display: none !important;
}

.search-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.search-results {
  display: grid;
  gap: 0.85rem;
}

.search-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(14, 28, 36, 0.7);
  animation: rise 0.35s ease both;
}

.search-item img,
.search-item .poster-fallback {
  width: 72px;
  height: 108px;
  border-radius: 10px;
  object-fit: cover;
}

.search-item h3 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.search-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sheet {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 0;
  width: min(560px, calc(100% - 2rem));
  background: #0d1a21;
  color: var(--text);
  box-shadow: var(--shadow);
}

.sheet::backdrop {
  background: rgba(2, 8, 12, 0.72);
  backdrop-filter: blur(4px);
}

.sheet-body {
  padding: 1.25rem 1.35rem 1.35rem;
  display: grid;
  gap: 1rem;
}

.sheet-body header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  touch-action: manipulation;
  flex: 0 0 auto;
}

.sheet-preview {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.9rem;
  align-items: start;
}

.sheet-preview img {
  width: 90px;
  height: 135px;
  object-fit: cover;
  border-radius: 10px;
  background: #123;
}

.sheet-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-height: 8.5rem;
  overflow: auto;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.full {
  display: grid;
}

.sheet-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.spacer {
  flex: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(120%);
  background: #13252e;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.75rem 1.2rem;
  z-index: 50;
  transition: transform 0.3s ease;
  max-width: min(92vw, 420px);
  text-align: center;
  box-sizing: border-box;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
  .library-toolbar {
    grid-template-columns: 1fr 1fr;
    max-width: none;
  }

  .library-toolbar .filter-name,
  .library-toolbar .sort-filter {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .label-long {
    display: none;
  }

  .label-short {
    display: inline;
  }

  .top {
    gap: 0.75rem;
  }

  .brand {
    min-width: 0;
    flex: 1 1 auto;
  }

  .brand-mark {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.75rem;
  }

  .brand-name {
    font-size: 1.05rem;
  }

  .tabs {
    flex: 0 0 auto;
  }

  .tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }

  main {
    width: calc(100% - 1.25rem);
    padding-top: 1.15rem;
  }

  h1 {
    font-size: clamp(1.45rem, 6.5vw, 1.9rem);
  }

  .library-summary,
  .lede {
    font-size: 0.92rem;
    max-width: none;
  }

  .library-toolbar {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    padding: 0.65rem;
    border-radius: 14px;
  }

  .library-toolbar .check-filter,
  .library-toolbar .btn {
    justify-content: flex-start;
    height: auto;
    width: 100%;
  }

  .library-toolbar .btn {
    justify-content: center;
  }

  .check-filter {
    white-space: normal;
    line-height: 1.25;
  }

  .library-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .series-card {
    grid-template-columns: 92px 1fr;
    min-height: 0;
    border-radius: 14px;
  }

  .series-body {
    padding: 0.75rem 0.8rem 0.85rem;
    gap: 0.35rem;
    min-width: 0;
  }

  .series-body h3 {
    font-size: 0.98rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .meta-row {
    gap: 0.3rem;
  }

  .chip {
    font-size: 0.66rem;
    padding: 0.22rem 0.45rem;
  }

  .card-stats,
  .card-years,
  .card-vote,
  .card-rating {
    font-size: 0.84rem;
  }

  .search-bar {
    grid-template-columns: 1fr;
  }

  .search-bar .btn {
    width: 100%;
  }

  .search-item {
    grid-template-columns: 64px 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .search-item .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .search-item img,
  .search-item .poster-fallback {
    width: 64px;
    height: 96px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .detail-head {
    gap: 1rem;
    margin-bottom: 1.1rem;
  }

  .detail-hero {
    grid-template-columns: 100px 1fr;
    gap: 0.9rem;
  }

  .detail-hero img,
  .detail-hero .poster-fallback {
    width: 100px;
    height: 150px;
    border-radius: 12px;
  }

  .detail-title-block h1 {
    font-size: 1.35rem;
    line-height: 1.15;
  }

  .rating-field,
  .watching-toggle {
    max-width: none;
    width: 100%;
  }

  .detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .detail-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .back-btn {
    min-height: 2.5rem;
    padding-left: 0.35rem;
  }

  .season-block {
    padding: 0.25rem 0.65rem 0.75rem;
    border-radius: 14px;
  }

  .season-block summary {
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.85rem 0.1rem;
    font-size: 0.95rem;
  }

  .season-progress {
    flex: 0 0 auto;
  }

  .season-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }

  .season-toolbar .btn {
    width: 100%;
    justify-content: center;
    padding: 0.55rem 0.5rem;
    font-size: 0.88rem;
  }

  .sheet {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    max-height: min(92dvh, 100%);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sheet-body {
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    gap: 0.85rem;
    overflow: auto;
    max-height: min(92dvh, 100%);
  }

  .sheet-preview {
    grid-template-columns: 72px 1fr;
    gap: 0.75rem;
  }

  .sheet-preview img {
    width: 72px;
    height: 108px;
  }

  .sheet-preview p {
    max-height: 6.5rem;
    font-size: 0.86rem;
  }

  .sheet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .sheet-actions .spacer {
    display: none;
  }

  .sheet-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .toast {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
    transform: translateY(120%);
    border-radius: 14px;
  }

  .toast.is-visible {
    transform: translateY(0);
  }

  .empty {
    padding: 1.35rem 1rem;
  }
}

@media (max-width: 420px) {
  .top {
    flex-wrap: wrap;
  }

  .brand {
    width: 100%;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    text-align: center;
  }

  .detail-hero {
    grid-template-columns: 84px 1fr;
  }

  .detail-hero img,
  .detail-hero .poster-fallback {
    width: 84px;
    height: 126px;
  }

  .detail-actions {
    grid-template-columns: 1fr;
  }

  .series-card {
    grid-template-columns: 80px 1fr;
  }
}

@media (min-width: 721px) and (max-width: 900px) {
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}
