:root {
  color-scheme: dark;
  --bg: #111;
  --panel: #1c1c1c;
  --card: #050505;
  --text: #f7f7f7;
  --muted: #aaa;
  --line: #333;
  --accent: #f4d735;
  --danger: #ff6961;
  --bottom-nav-space: 86px;
}

* { box-sizing: border-box; }

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body:has(.bottom-nav) {
  padding-bottom: calc(var(--bottom-nav-space) + env(safe-area-inset-bottom));
}

button, input, select {
  font: inherit;
}

button,
select,
input[type="button"],
input[type="reset"],
input[type="submit"],
summary,
a[href],
label[for] {
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
}

a { color: inherit; }

a { text-decoration-thickness: 1px; }

svg[data-lucide] {
  width: 1em;
  height: 1em;
  stroke-width: 2.4;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: calc(18px + env(safe-area-inset-top)) 18px 10px;
  background: rgba(17, 17, 17, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar h1, .login-panel h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
}

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 14px 14px 34px;
}

.app-shell > section + section {
  margin-top: 10px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 -14px 18px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  padding: 18px 10px 14px;
  text-align: center;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 900;
}

.tabs a.active {
  color: var(--text);
  border-bottom: 4px solid var(--text);
}

.list {
  display: grid;
  gap: 12px;
}

.media-card {
  display: grid;
  grid-template-columns: 96px 1fr 64px;
  min-height: 118px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.media-card-completing {
  background: #153d24;
  border-color: #3f9f5a;
  box-shadow: 0 0 0 1px rgba(71, 210, 120, .32);
}

.media-card-completing .poster {
  background: #173521;
}

.media-card-completing .check-button {
  background: #7bd13b;
  color: #fff;
  transform: scale(1.06);
}

.poster {
  display: grid;
  place-items: center;
  background: #282828;
  color: #777;
  font-size: 32px;
  font-weight: 900;
  text-decoration: none;
}

.poster-portrait {
  width: 96px;
  aspect-ratio: 2 / 3;
  align-self: center;
}

.poster svg {
  width: 34px;
  height: 34px;
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-pending {
  background: #201d10;
  color: var(--accent);
}

.mini-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(244, 215, 53, .24);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.media-copy {
  min-width: 0;
  padding: 16px 14px;
}

.media-copy h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.2;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.status-badge-success {
  border-color: rgba(123, 209, 59, .55);
  background: rgba(123, 209, 59, .14);
  color: #9eea6c;
}

.status-badge-pending {
  border-color: rgba(244, 215, 53, .52);
  background: rgba(244, 215, 53, .12);
  color: #f4d735;
}

.status-badge-muted {
  border-color: rgba(170, 170, 170, .34);
  background: rgba(255, 255, 255, .05);
  color: var(--muted);
}

.media-copy p {
  margin: 0;
  color: var(--muted);
}

.subtitle {
  color: var(--text) !important;
  font-size: 24px;
  font-weight: 900;
}

.check-button, .icon-button {
  border: 0;
  cursor: pointer;
  line-height: 0;
}

.check-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 35px 12px 0 0;
  border-radius: 50%;
  background: #fff;
  color: #777;
  font-size: 28px;
  font-weight: 900;
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}

.check-button:not(.watched-button):not(.add-button):not(.as-link):not(:disabled):hover,
.check-button:not(.watched-button):not(.add-button):not(.as-link):not(:disabled):focus-visible {
  background: #d7f4c7;
  color: #428f25;
  transform: translateY(-1px);
}

.check-button svg,
.icon-button svg {
  width: 22px;
  height: 22px;
  stroke-width: 3;
}

.as-link {
  text-decoration: none;
}

.add-button {
  color: #111;
  background: var(--accent);
}

.add-button svg {
  stroke-width: 3.4;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #2a2a2a;
  color: var(--text);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(5, 5, 5, .96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 9px 6px calc(10px + env(safe-area-inset-bottom));
}

.bottom-nav a {
  display: grid;
  gap: 4px;
  place-items: center;
  color: #777;
  text-decoration: none;
  font-size: 26px;
  min-height: 54px;
  border-radius: 8px;
}

.bottom-nav svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.2;
}

.bottom-nav span {
  font-size: 12px;
  font-weight: 700;
}

.bottom-nav a.active {
  color: var(--text);
  background: #111;
}

.empty, .panel, .manual-add {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty h2, .panel h2, .manual-add h2 {
  margin-top: 0;
}

.pill-button, .primary-button, .search-box button, .inline-form button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--text);
  border-radius: 999px;
  padding: 0 18px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}

.primary-button:disabled,
.primary-button.is-loading {
  cursor: wait;
  opacity: .78;
}

.button-spinner {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 2px solid rgba(17, 17, 17, .35);
  border-top-color: #111;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .32);
}

.form-stack, .search-box, .inline-form {
  display: grid;
  gap: 12px;
}

.form-stack label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.section-note {
  margin: -4px 0 14px;
  color: var(--muted);
}

.section-note a {
  color: var(--text);
  font-weight: 800;
}

.tvtime-import-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 18px;
}

.tvtime-import-form .file-picker {
  min-width: 0;
  cursor: pointer;
}

.file-picker-control {
  display: flex;
  min-width: 0;
  min-height: 44px;
  overflow: hidden;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050505;
}

.file-picker:hover .file-picker-control,
.file-picker:focus-within .file-picker-control {
  border-color: var(--text);
}

.file-picker-button {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  background: #333;
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.file-picker-name {
  min-width: 0;
  overflow: hidden;
  padding: 0 12px;
  color: var(--muted);
  line-height: 42px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tvtime-import-form .primary-button {
  padding-inline: 24px;
}

input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #0a0a0a;
  color: var(--text);
}

.search-box {
  grid-template-columns: 1fr auto;
  margin-bottom: 16px;
}

.search-page .media-card {
  grid-template-columns: 80px minmax(0, 1fr) 56px;
  height: 164px;
  min-height: 0;
}

.search-page .media-copy {
  padding: 12px;
  overflow: hidden;
}

.search-page .media-copy h2,
.search-page .media-copy > p:not(.subtitle) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-page .media-copy h2 {
  -webkit-line-clamp: 2;
  margin-bottom: 4px;
  font-size: 18px;
  line-height: 1.25;
}

.search-page .media-copy .subtitle {
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.4;
}

.search-page .media-copy > p:not(.subtitle) {
  -webkit-line-clamp: 3;
  font-size: 14px;
  line-height: 1.4;
}

.search-page .media-card > form,
.search-page .media-card > .check-button {
  align-self: center;
  justify-self: center;
}

.search-page .media-card .check-button {
  width: 44px;
  height: 44px;
  margin: 0;
}

.manual-add {
  margin-bottom: 20px;
}

.manual-add-secondary {
  margin-top: 24px;
  background: #151515;
}

.manual-add-secondary p {
  margin-top: -4px;
  color: var(--muted);
}

.inline-form {
  grid-template-columns: 1fr auto auto;
}

.alert, .notice {
  padding: 12px;
  border-radius: 8px;
}

.alert {
  background: rgba(255, 105, 97, .14);
  border: 1px solid rgba(255, 105, 97, .5);
}

.alert a {
  font-weight: 800;
}

.notice {
  background: rgba(244, 215, 53, .14);
  border: 1px solid rgba(244, 215, 53, .5);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stats-grid div {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats-grid strong {
  display: block;
  font-size: 28px;
}

.stats-grid span, .activity-list span, .activity-list time {
  color: var(--muted);
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-list article {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.import-result {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151515;
}

.activity-list .import-result {
  border-bottom: 1px solid var(--line);
}

.import-result-success {
  border-color: rgba(102, 217, 94, 0.55);
  background: linear-gradient(135deg, rgba(102, 217, 94, 0.16), rgba(21, 21, 21, 0.96) 54%);
}

.import-result-warning {
  border-color: rgba(244, 215, 53, 0.9);
  box-shadow: inset 4px 0 0 var(--accent);
  background: linear-gradient(135deg, rgba(244, 215, 53, 0.18), rgba(35, 24, 4, 0.96) 58%);
}

.import-result-running {
  border-color: rgba(170, 170, 170, 0.55);
}

.import-result-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.import-result-header > div {
  display: grid;
  gap: 4px;
}

.import-result-summary {
  text-align: right;
}

.import-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.import-metric {
  display: grid;
  gap: 2px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.24);
  min-width: 0;
  overflow-wrap: anywhere;
}

.import-metric strong {
  color: var(--text);
  font-size: 20px;
  line-height: 1.1;
}

.import-metric-success {
  border-color: rgba(102, 217, 94, 0.45);
}

.import-metric-warning {
  border-color: rgba(244, 215, 53, 0.85);
  color: var(--text);
  background: rgba(244, 215, 53, 0.12);
}

.import-warning {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: #fff4b8;
  background: rgba(244, 215, 53, 0.12);
}

.profile-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.push-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.push-status {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  font-weight: 900;
}

.push-status[data-push-state="active"] {
  border-color: #4aa35f;
  color: #8ce28f;
}

.push-status[data-push-state="denied"],
.push-status[data-push-state="unsupported"] {
  border-color: rgba(255, 105, 97, .55);
  color: #ff9a94;
}

.profile-section {
  margin-top: 24px;
}

.profile-rail-section {
  margin-inline: -14px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
}

.section-heading a {
  color: var(--muted);
  font-weight: 800;
}

.profile-rail-heading {
  align-items: center;
  padding-inline: 14px;
}

.profile-rail-heading h2 {
  font-size: 24px;
}

.profile-rail-more {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
}

.profile-rail-more:hover,
.profile-rail-more:focus-visible {
  background: #202020;
}

.profile-stats-section {
  margin-inline: -14px;
}

.profile-stats-rail {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding: 0 14px 8px;
}

.profile-stats-rail::-webkit-scrollbar {
  display: none;
}

.profile-stat-card {
  flex: 0 0 min(300px, 82vw);
  min-height: 106px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
}

.profile-stat-card-count {
  flex-basis: min(210px, 68vw);
}

.profile-stat-card h3 {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.15;
}

.profile-stat-card h3 svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.profile-stat-card h3 span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-duration {
  min-height: 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  text-align: center;
}

.profile-duration span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.profile-duration strong,
.profile-stat-value {
  font-size: 24px;
  line-height: 1;
  font-weight: 950;
}

.profile-duration small {
  color: var(--text);
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-stat-value {
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 10px 14px;
}

.profile-rail-frame {
  position: relative;
}

.profile-rail-frame::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 48px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(17, 17, 17, 0), var(--bg));
}

.profile-rail {
  --profile-poster-width: clamp(104px, 13vw, 132px);
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding: 0 14px 10px;
}

.profile-rail::-webkit-scrollbar {
  display: none;
}

.profile-rail-card {
  flex: 0 0 var(--profile-poster-width);
  width: var(--profile-poster-width);
  color: inherit;
  text-decoration: none;
}

.profile-rail-poster {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid #242424;
  border-radius: 6px;
  background: #050505;
  color: #777;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.profile-rail-card:hover .profile-rail-poster,
.profile-rail-card:focus-visible .profile-rail-poster {
  border-color: #555;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .36);
}

.profile-rail-card:focus-visible {
  outline: none;
}

.profile-rail-card:focus-visible .profile-rail-poster {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.profile-rail-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-rail-poster > svg {
  width: 30px;
  height: 30px;
}

.profile-rail-poster > span:not(.mini-spinner):not(.profile-rail-badge):not(.profile-progress-track) {
  width: 100%;
  padding: 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.profile-rail-badge {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .72);
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  backdrop-filter: blur(8px);
}

.profile-rail-badge-success {
  color: #d9ffd7;
  background: rgba(67, 155, 75, .78);
}

.profile-rail-badge-pending {
  color: #1b1b1b;
  background: rgba(244, 215, 53, .92);
}

.profile-rail-badge-muted {
  color: var(--text);
  background: rgba(80, 80, 80, .78);
}

.profile-breakdown-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  min-height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 17, 17, .94);
  backdrop-filter: blur(12px);
}

.profile-breakdown-topbar h1 {
  min-width: 0;
  margin: 0;
  font-size: 17px;
  font-weight: 950;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-breakdown-back {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}

.profile-breakdown-back:hover,
.profile-breakdown-back:focus-visible {
  background: #202020;
}

.profile-breakdown-shell {
  width: min(1120px, 100%);
  padding-top: 16px;
}

.profile-filter {
  margin-bottom: 24px;
}

.profile-filter-field {
  position: relative;
  width: min(560px, 100%);
  margin: 0 auto;
}

.profile-filter-field svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 19px;
  height: 19px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.profile-filter-field input {
  padding-left: 42px;
  border-color: #2a2a2a;
  background: #070707;
}

.profile-filter-field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: transparent;
}

.profile-filter-empty {
  width: min(560px, 100%);
  margin: 14px auto 0;
  text-align: center;
}

.profile-filter-empty[hidden] {
  display: none;
}

.profile-filter-empty h2 {
  margin: 0;
}

.profile-breakdown-section {
  --section-color: #888;
  margin-top: 22px;
}

.profile-breakdown-section:first-of-type {
  margin-top: 0;
}

.profile-section-watching {
  --section-color: #f4d735;
}

.profile-section-planned {
  --section-color: #8c8c8c;
}

.profile-section-up-to-date {
  --section-color: #68d80d;
}

.profile-section-completed {
  --section-color: #a900ff;
}

.profile-section-watched {
  --section-color: #48a6ff;
}

.profile-breakdown-label {
  width: max-content;
  max-width: 100%;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #727272;
  color: #fff;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.profile-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 142px));
  gap: 4px;
  align-items: start;
}

.profile-breakdown-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.profile-breakdown-section[hidden],
.profile-breakdown-card[hidden] {
  display: none;
}

.profile-breakdown-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #1c1c1c;
  border-radius: 4px;
  background: #040404;
  color: #777;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.profile-breakdown-card:hover .profile-breakdown-poster,
.profile-breakdown-card:focus-visible .profile-breakdown-poster {
  border-color: #555;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .36);
}

.profile-breakdown-card:focus-visible {
  outline: none;
}

.profile-breakdown-card:focus-visible .profile-breakdown-poster {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.profile-breakdown-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-breakdown-poster > svg {
  width: 30px;
  height: 30px;
}

.profile-breakdown-poster > span:not(.mini-spinner):not(.profile-breakdown-badge):not(.profile-progress-track) {
  width: 100%;
  padding: 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.profile-breakdown-badge {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 12px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  backdrop-filter: blur(8px);
}

.profile-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, .12);
}

.profile-progress-fill {
  display: block;
  width: var(--progress, 0%);
  max-width: 100%;
  height: 100%;
  background: var(--section-color);
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .72);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}

.loading-panel p {
  margin: 0;
  color: var(--muted);
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .72);
}

.confirm-overlay[hidden] {
  display: none;
}

.confirm-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .5);
}

.confirm-panel h2,
.confirm-panel p {
  margin: 0;
}

.confirm-panel p {
  color: var(--muted);
}

.watch-date-panel {
  width: min(460px, 100%);
}

.watch-date-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.watch-date-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.watch-date-fields input {
  text-align: center;
  font-size: 20px;
  font-weight: 900;
}

.watch-date-fields input:disabled {
  opacity: .45;
}

.watch-date-error {
  min-height: 18px;
  color: var(--danger) !important;
  font-weight: 800;
}

.watch-date-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #333;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.media-hero {
  position: relative;
  min-height: 340px;
  display: grid;
  align-content: end;
  gap: 18px;
  padding: 24px 18px 28px;
  background-color: #050505;
  background-position: center;
  background-size: cover;
}

.media-admin-button {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top));
  right: 14px;
  z-index: 2;
  background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(10px);
}

.back-link {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  text-decoration: none;
  line-height: 0;
}

.back-link svg {
  width: 28px;
  height: 28px;
  stroke-width: 2.6;
}

.media-hero-copy {
  width: min(980px, 100%);
  margin: 0 auto;
}

.media-hero:has(.media-hero-watch) .media-hero-copy {
  padding-right: 72px;
}

.media-hero h1 {
  margin: 0;
  max-width: 900px;
  font-size: clamp(34px, 8vw, 58px);
  letter-spacing: 0;
}

.media-hero p {
  margin: 8px 0 0;
  font-size: 20px;
}

.media-hero-subtitle {
  color: var(--text);
}

.media-hero-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 34px;
  margin-top: 28px;
}

.media-hero-fact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
}

.media-hero-fact svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.4;
}

.media-hero-fact-button {
  cursor: pointer;
  transition: color .18s ease;
}

.media-hero-fact-button:hover,
.media-hero-fact-button:focus-visible {
  color: var(--accent);
}

.admin-settings-modal[hidden] {
  display: none;
}

.admin-settings-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.admin-settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(10px);
}

.admin-settings-panel {
  position: relative;
  width: min(940px, 100%);
  max-height: min(760px, calc(100vh - 34px));
  overflow: auto;
  border: 1px solid #454545;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 26px 90px rgba(0, 0, 0, .55);
}

.admin-settings-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(28, 28, 28, .96);
  backdrop-filter: blur(10px);
}

.admin-settings-header h2,
.admin-settings-section h3 {
  margin: 0;
}

.admin-settings-section {
  padding: 18px;
}

.admin-settings-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.admin-settings-section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
}

.episode-order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.episode-order-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101010;
}

.episode-order-card-active {
  border-color: rgba(123, 209, 59, .68);
  background: rgba(25, 50, 20, .42);
}

.episode-order-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.episode-order-card-header > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.episode-order-card-header strong {
  font-size: 17px;
  line-height: 1.15;
}

.episode-order-card-header span:not(.status-badge) {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.episode-order-resolved,
.episode-order-detail,
.episode-order-warning,
.episode-order-match {
  margin: 0;
}

.episode-order-resolved {
  font-weight: 900;
}

.episode-order-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.episode-order-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.episode-order-season-list {
  display: grid;
  gap: 5px;
  max-height: 260px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.episode-order-season-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.episode-order-season-list li:last-child {
  border-bottom: 0;
}

.episode-order-season-list span {
  color: var(--text);
}

.episode-order-season-list strong {
  white-space: nowrap;
  font-size: 13px;
}

.episode-order-detail {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.episode-order-warning {
  padding: 8px 10px;
  border-radius: 8px;
  color: #fff4b8;
  background: rgba(244, 215, 53, .12);
  font-size: 13px;
  line-height: 1.3;
}

.episode-order-match {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(123, 209, 59, .14);
  color: #9eea6c;
  font-size: 13px;
  font-weight: 900;
}

.episode-order-match svg {
  width: 14px;
  height: 14px;
}

.episode-order-card form {
  margin-top: 2px;
}

.episode-order-card button {
  width: 100%;
}

.progress-label {
  color: var(--accent);
  font-weight: 900;
}

.hydration-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.hydration-panel h2 {
  margin: 0 0 8px;
}

.hydration-panel p {
  margin: 0;
  color: var(--muted);
}

.media-hero-watch {
  position: absolute;
  right: max(18px, calc((100% - 980px) / 2 + 18px));
  bottom: 28px;
}

.media-hero-watch .check-button {
  margin: 0;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .38);
}

.watch-action-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.media-hero-watch .watch-action-group {
  justify-content: flex-end;
}

.media-hero-watch .watch-choice-popover {
  top: auto;
  right: 0;
  bottom: 60px;
}

.media-hero-watch .note-popover {
  top: calc(100% + 12px);
  right: 0;
  bottom: auto;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.movie-watch-events-control .note-popover {
  top: calc(100% + 10px);
  left: 0;
  right: auto;
}

.provider-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.watch-panel {
  display: grid;
  gap: 18px;
}

.watch-panel h2,
.watch-panel .attribution {
  margin: 0;
}

.media-note-list {
  display: grid;
  gap: 10px;
}

.media-note-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
}

.media-note-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.media-note-meta strong,
.media-note-meta span {
  color: var(--text);
}

.watch-availability-group {
  display: grid;
  gap: 6px;
}

.watch-availability-group h3 {
  margin: 0;
  font-size: 17px;
}

.watch-availability-copy {
  margin: 0;
  font-weight: 800;
}

.provider-list p {
  margin: 0;
}

.provider-badge {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #080808;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.provider-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.continue-panel {
  display: grid;
  grid-template-columns: 104px 1fr auto;
  gap: 16px;
  align-items: center;
  background: #070707;
}

.continue-panel .episode-poster {
  min-height: 124px;
  overflow: hidden;
  border-radius: 8px;
}

.continue-copy h2 {
  margin: 0 0 4px;
  font-size: 26px;
}

.continue-copy p:not(.eyebrow) {
  margin: 0 0 4px;
}

.continue-panel .check-button {
  margin: 0;
}

.attribution, small {
  color: var(--muted);
}

.attribution a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.episodes-section h2 {
  margin: 24px 0 12px;
}

.season-panel {
  position: relative;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.season-panel > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 7px;
  cursor: pointer;
  background: #050505;
  font-size: 22px;
  font-weight: 900;
}

.season-panel[open] > summary {
  border-radius: 7px 7px 0 0;
}

.season-panel > summary > span:first-child {
  min-width: 0;
}

.season-optional-label {
  display: inline-flex;
  margin-left: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  vertical-align: middle;
}

.season-summary-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.season-check {
  display: grid;
  place-items: center;
}

.season-check .check-button {
  width: 40px;
  height: 40px;
  margin: 0;
}

.season-check-form {
  display: none;
}

.season-check .check-button:disabled {
  opacity: 1;
}

.danger-zone button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: transparent;
  color: var(--text);
}

.episode-list {
  display: grid;
}

.episode-row {
  display: grid;
  grid-template-columns: 92px 1fr 112px;
  column-gap: 14px;
  min-height: 104px;
  border-top: 1px solid var(--line);
  background: #050505;
}

.episode-row:last-child {
  border-radius: 0 0 7px 7px;
}

.episode-row:last-child .episode-poster {
  border-bottom-left-radius: 7px;
  overflow: hidden;
}

.episode-row.watched {
  background: #101310;
}

.episode-row h3 {
  margin: 14px 0 4px;
  font-size: 24px;
}

.episode-row p {
  margin: 0 0 4px;
}

.episode-row small {
  display: inline-block;
  margin-right: 8px;
}

.watch-events-control {
  display: inline-block;
  margin-right: 8px;
}

.watch-count-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.watch-count-button:hover,
.watch-count-button:focus-visible {
  color: var(--text);
}

.episode-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding: 0 10px 0 0;
}

.episode-watch-form {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 10px 0 0;
}

.episode-actions .check-button,
.episode-watch-form .check-button {
  margin: 0;
}

.watch-menu-wrap,
.note-menu-wrap {
  position: relative;
}

.note-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: #777;
  line-height: 0;
  opacity: .7;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease;
}

.note-button:hover,
.note-button:focus-visible {
  border-color: #666;
  color: var(--text);
  opacity: 1;
}

.note-button-filled {
  border-color: var(--accent);
  background: var(--accent);
  color: #111;
  opacity: 1;
}

.note-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.6;
}

.note-save-status {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  white-space: nowrap;
  color: #9eea6c;
  font-size: 12px;
  font-weight: 800;
}

.watch-choice-popover {
  position: absolute;
  top: 84px;
  right: 12px;
  z-index: 5;
  width: 180px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 32px rgba(0, 0, 0, .45);
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  cursor: default;
}

.watch-choice-popover[hidden] {
  display: none;
}

.note-popover {
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 6;
  width: min(380px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 32px rgba(0, 0, 0, .45);
}

.note-popover[hidden] {
  display: none;
}

.note-popover form,
.note-popover label {
  display: grid;
  gap: 10px;
}

.note-popover label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.note-popover textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #0a0a0a;
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

.series-notes-popover {
  display: grid;
  gap: 12px;
  width: min(420px, calc(100vw - 32px));
  color: var(--text);
}

.series-notes-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.series-notes-heading strong {
  font-size: 15px;
}

.series-notes-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.series-notes-popover .media-note-list {
  max-height: min(360px, calc(100vh - 220px));
  overflow: auto;
}

.series-notes-popover .media-note-item p {
  margin: 0;
}

.watch-events-popover {
  display: grid;
  gap: 12px;
  width: min(460px, calc(100vw - 32px));
  color: var(--text);
}

.watch-event-list {
  display: grid;
  gap: 10px;
  max-height: min(420px, calc(100vh - 220px));
  overflow: auto;
}

.watch-event-item {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
}

.watch-event-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.watch-event-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.watch-event-meta strong {
  font-size: 14px;
}

.watch-event-meta small,
.watch-event-note {
  color: var(--muted);
}

.watch-event-note {
  margin: 0;
  font-size: 14px;
}

.watch-event-edit {
  flex: 1 1 auto;
  min-width: 0;
}

.watch-event-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  cursor: pointer;
}

.watch-event-summary::-webkit-details-marker {
  display: none;
}

.watch-event-edit[open] .watch-event-summary {
  margin-bottom: 10px;
}

.watch-event-edit-form {
  display: grid;
  gap: 10px;
}

.watch-event-delete-form {
  flex: 0 0 auto;
}

.watch-event-icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: #202020;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  transition: background-color .18s ease, color .18s ease;
}

.watch-event-icon-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.5;
}

.watch-event-summary:hover .watch-event-icon-button,
.watch-event-summary:focus-visible .watch-event-icon-button,
.watch-event-icon-button:hover,
.watch-event-icon-button:focus-visible {
  background: #2c2c2c;
  color: var(--text);
}

.danger-icon-button:hover,
.danger-icon-button:focus-visible {
  color: var(--danger);
}

.note-date-group {
  display: grid;
  gap: 10px;
}

.note-date-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.note-date-heading small {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.note-date-fields {
  gap: 8px;
}

.note-date-fields input {
  min-height: 38px;
  padding: 8px 6px;
  font-size: 16px;
  font-weight: 800;
}

.note-date-error {
  min-height: 16px;
  margin: -2px 0 0;
  font-size: 13px;
}

.note-date-shortcuts {
  gap: 8px;
}

.note-date-shortcuts .pill-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.note-actions .pill-button,
.note-actions .primary-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.watch-choice-popover p,
.watch-choice-popover > span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.watch-choice-popover form {
  display: grid;
}

.watch-choice-popover button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.episode-poster {
  min-height: 104px;
}

.watched-button {
  background: #7bd13b;
  color: #fff;
}

.season-check .watch-choice-popover {
  top: 48px;
  right: 0;
}

@media (max-width: 640px) {
  .profile-summary,
  .section-heading {
    display: grid;
  }

  .profile-actions {
    justify-content: flex-start;
  }

  .profile-rail-heading {
    display: flex;
  }

  .profile-rail {
    --profile-poster-width: 108px;
  }

  .profile-breakdown-shell {
    padding-inline: 10px;
  }

  .profile-breakdown-grid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 5px;
  }

  .profile-breakdown-section {
    margin-top: 24px;
  }

  .media-card {
    grid-template-columns: 86px 1fr 58px;
  }

  .poster-portrait {
    width: 86px;
  }

  .subtitle {
    font-size: 20px;
  }

  .search-box, .inline-form, .tvtime-import-form {
    grid-template-columns: 1fr;
  }

  .media-hero {
    min-height: 300px;
  }

  .episode-row {
    grid-template-columns: 78px 1fr 102px;
  }

  .episode-actions {
    gap: 12px;
    padding-right: 8px;
  }

  .episode-watch-form {
    padding-right: 8px;
  }

  .episode-actions .check-button,
  .episode-actions .note-button {
    width: 38px;
    height: 38px;
  }

  .continue-panel {
    grid-template-columns: 78px 1fr 58px;
    gap: 12px;
  }

  .continue-copy h2 {
    font-size: 22px;
  }

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

  .watch-date-shortcuts {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px), (max-height: 500px) {
  .note-menu-wrap > .note-popover {
    position: fixed;
    top: calc(var(--note-viewport-top, 0px) + max(12px, env(safe-area-inset-top)));
    left: calc(var(--note-viewport-left, 0px) + var(--note-viewport-width, 100vw) / 2);
    right: auto;
    bottom: auto;
    transform: translateX(-50%);
    z-index: 60;
    width: min(460px, calc(var(--note-viewport-width, 100vw) - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    max-height: calc(var(--note-viewport-height, 100dvh) - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
    overflow: auto;
    overscroll-behavior: contain;
    overflow-wrap: anywhere;
  }

  .note-popover .watch-event-list,
  .note-popover .media-note-list {
    max-height: none;
    overflow: visible;
  }

  .note-popover textarea {
    font-size: 16px;
  }
}

@media (min-width: 760px) {
  :root {
    --bottom-nav-space: 108px;
  }

  .bottom-nav {
    width: min(560px, calc(100% - 48px));
    left: 50%;
    right: auto;
    bottom: 18px;
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
  }

  .bottom-nav a {
    min-height: 52px;
  }
}

@media (min-width: 1180px) {
  :root {
    --bottom-nav-space: 0px;
  }

  .bottom-nav {
    width: 78px;
    left: min(calc(100% - 94px), calc(50% + 506px));
    top: 148px;
    bottom: auto;
    transform: none;
    grid-template-columns: 1fr;
    gap: 6px;
    border-radius: 18px;
    padding: 8px;
  }

  .bottom-nav a {
    min-height: 66px;
  }
}
