* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --background: #f6f5f1;
  --surface: #ffffff;
  --surface-subtle: #f1efe9;
  --border: rgba(22, 20, 14, 0.1);
  --text: #1a1915;
  --text-dim: #6b675d;
  --text-muted: #918c81;
  --accent: #f5a705;
  --accent-hover: #dc9200;
  --accent-strong: #a76100;
  --accent-soft: #fff3d4;
  --online: #2faa5e;
  --online-soft: #e8f7ee;
  --danger: #c43d3d;
  --danger-soft: #fff0f0;
  --warning: #9b6500;
  --warning-soft: #fff6da;
  --shadow: 0 1px 2px rgba(22, 20, 14, 0.04), 0 10px 26px rgba(22, 20, 14, 0.05);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #1f1f1f;
  --surface: #232323;
  --surface-subtle: #2e2e2e;
  --border: rgba(255, 255, 255, 0.11);
  --text: #f7f7f7;
  --text-dim: #b0b0b0;
  --text-muted: #858585;
  --accent-hover: #ffbc26;
  --accent-strong: #ffd15a;
  --accent-soft: #332a13;
  --online: #46c97e;
  --online-soft: #172d20;
  --danger: #ff8585;
  --danger-soft: #351d1d;
  --warning: #ffd061;
  --warning-soft: #302711;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.32), 0 14px 32px rgba(0, 0, 0, 0.38);
}

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

body {
  background: var(--background);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="time"] {
  color: var(--text);
}

code {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  width: 252px;
  height: 100vh;
  flex: 0 0 252px;
  flex-direction: column;
  overflow-y: auto;
  padding: 22px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-header {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
}

.brand {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 22px;
  border-radius: 10px;
}

.brand:focus-visible,
.navigation-item:focus-visible,
.theme-toggle:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible,
.icon-button:focus-visible,
.library-card-link:focus-visible,
.browser-card:focus-visible,
select:focus-visible,
input[type="time"]:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  box-shadow: 0 2px 7px rgba(236, 139, 12, 0.38);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-product {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
}

.navigation {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.navigation-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  transition: background 150ms ease, color 150ms ease;
}

.navigation-item:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.navigation-item svg {
  flex: none;
}

.navigation-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

.sidebar-promos {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 22px;
}

.sidebar-mobile-promo {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: radial-gradient(130% 95% at 100% 0%, var(--accent-soft), transparent 58%), var(--surface-subtle);
}

.sidebar-mobile-promo::after {
  position: absolute;
  top: -42px;
  right: -48px;
  width: 110px;
  height: 110px;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.sidebar-mobile-header {
  display: flex;
  position: relative;
  z-index: 1;
  align-items: center;
  gap: 10px;
}

.sidebar-mobile-promo h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.sidebar-mobile-promo p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.store-links {
  display: flex;
  position: relative;
  z-index: 1;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 13px;
}

.store-badge-link {
  display: block;
  border-radius: 7px;
  line-height: 0;
}

.store-badge-link:focus-visible,
.donate-button:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.store-badge-link img {
  display: block;
  max-width: 100%;
}

.app-store-badge img {
  height: 40px;
  width: auto;
}

.google-play-badge img {
  width: 151px;
  height: auto;
}

.mobile-promotion-open {
  overflow: hidden;
}

.mobile-promotion-overlay {
  display: grid;
  position: fixed;
  z-index: 100;
  inset: 0;
  overflow-y: auto;
  padding: 24px;
  background: rgba(7, 7, 8, 0.74);
  place-items: center;
}

.mobile-promotion-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background:
    radial-gradient(90% 70% at 100% 0%, var(--accent-soft), transparent 58%),
    var(--surface);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  color: var(--text);
}

.mobile-promotion-close {
  display: grid;
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  cursor: pointer;
  place-items: center;
}

.mobile-promotion-close:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.mobile-promotion-close:focus-visible,
.mobile-platform-website:focus-visible,
.mobile-promotion-continue:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.mobile-promotion-close-icon {
  width: 17px;
  height: 17px;
}

.mobile-promotion-intro {
  max-width: 620px;
  padding-right: 34px;
}

.mobile-promotion-intro h2 {
  margin: 0;
  font-size: clamp(25px, 4vw, 34px);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.mobile-promotion-intro p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}

.mobile-promotion-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.mobile-promotion-features li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.mobile-promotion-check {
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 1px;
  color: var(--accent-strong);
  stroke-width: 2.4;
}

.mobile-promotion-feature-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.mobile-promotion-feature-copy strong {
  color: var(--text);
  font-size: 12px;
}

.mobile-promotion-feature-copy span {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.mobile-promotion-more {
  margin: -10px 0 18px 26px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.mobile-promotion-more strong {
  color: var(--text);
}

.mobile-platform-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mobile-platform-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 13px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface-subtle) 88%, transparent);
}

.mobile-platform-copy h3 {
  margin: 0;
  font-size: 16px;
}

.mobile-platform-copy span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.mobile-platform-website {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 700;
}

.mobile-platform-website:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mobile-platform-link-icon {
  width: 14px;
  height: 14px;
}

.mobile-platform-card .store-badge-link {
  margin-top: auto;
}

.mobile-promotion-continue {
  display: block;
  min-width: 190px;
  margin: 22px auto 0;
}

.sidebar-donation {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 14px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-subtle);
}

.sidebar-donation-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-donation-copy strong {
  font-size: 12px;
}

.sidebar-donation-copy span {
  color: var(--text-muted);
  font-size: 10.5px;
}

.donate-button {
  display: flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-hover) 65%, transparent);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffc83d, var(--accent));
  box-shadow: 0 5px 14px rgba(220, 146, 0, 0.2);
  color: #2b1b00;
  font-size: 12px;
  font-weight: 800;
  transition: filter 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.donate-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(220, 146, 0, 0.26);
}

.donate-button-icon {
  width: 15px;
  height: 15px;
}

.compact-promo-actions {
  display: none;
}

.compact-promo-button {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  place-items: center;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

.compact-promo-button:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.compact-promo-button:focus-visible,
.compact-popover-close:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.compact-donate-button {
  color: var(--accent-strong);
}

.compact-promo-icon {
  width: 17px;
  height: 17px;
}

.compact-mobile-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  right: -46px;
  width: min(280px, calc(100vw - 36px));
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

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

.compact-mobile-popover::before {
  position: absolute;
  top: -6px;
  right: 59px;
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--surface);
  content: "";
  transform: rotate(45deg);
}

.compact-mobile-popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.compact-mobile-popover h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.015em;
}

.compact-mobile-popover p {
  margin: 8px 0 14px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.compact-mobile-popover > .store-badge-link {
  width: max-content;
  margin-right: auto;
  margin-left: auto;
}

.compact-mobile-popover > .store-badge-link + .store-badge-link {
  margin-top: 10px;
}

.compact-popover-close {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  place-items: center;
}

.compact-popover-close:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.compact-popover-close-icon {
  width: 16px;
  height: 16px;
}

.server-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 14px 8px 2px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11.5px;
}

.online-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--online);
  animation: pulse 2.4s infinite;
}

.main {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: blur(8px);
}

.eyebrow,
.section-title {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.page-title {
  margin: 2px 0 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.theme-toggle {
  display: grid;
  width: 40px;
  height: 40px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  place-items: center;
  transition: background 150ms ease, transform 150ms ease;
}

.sidebar-header .theme-toggle {
  margin-top: 2px;
  margin-left: 0;
}

.theme-toggle:hover {
  background: var(--surface-subtle);
  transform: translateY(-1px);
}

.theme-toggle .sun,
:root[data-theme="dark"] .theme-toggle .moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .sun {
  display: block;
}

.content {
  width: 100%;
  max-width: 1104px;
  margin: 0 auto;
  padding: 32px;
}

.status-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
  overflow: hidden;
  padding: 34px 36px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: radial-gradient(130% 150% at 100% 0%, var(--accent-soft), transparent 56%), var(--surface);
  box-shadow: var(--shadow);
}

.status-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--online);
  border-radius: 999px;
  background: var(--online-soft);
  color: var(--online);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.status-pill .online-dot {
  width: 8px;
  height: 8px;
}

.status-heading {
  max-width: 720px;
  margin: 0;
  font-size: clamp(28px, 4vw, 34px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
}

.status-description {
  max-width: 52ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.55;
}

.hero-logo {
  width: 84px;
  height: 84px;
  flex: none;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(236, 139, 12, 0.35);
}

.section {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-top: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-header-main {
  display: flex;
  align-items: center;
  gap: 11px;
}

.count {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
}

.meta-card,
.library-card,
.settings-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.meta-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  padding: 18px;
}

.meta-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.meta-value {
  overflow: hidden;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-value.os {
  line-height: 1.35;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.library-description {
  margin: -5px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.5;
}

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

.library-card {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  padding: 16px;
  transition: border-color 180ms ease, transform 180ms ease;
}

.library-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Lift a card above its neighbours while its actions menu is open so the
   popover is not painted underneath the card in the next row. */
.library-card:has(.library-menu-popover:not([hidden])) {
  z-index: 3;
}

/* The card name is the browse link; its ::after stretches across the whole
   card so clicking anywhere navigates, while the refresh button sits above it. */
.library-card-link {
  display: block;
  overflow: hidden;
  color: inherit;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.library-arrow {
  flex: none;
  color: var(--text-muted);
  transition: color 180ms ease, transform 180ms ease;
}

.library-card:hover .library-arrow {
  color: var(--accent-strong);
  transform: translateX(2px);
}

.library-menu {
  position: relative;
  z-index: 2;
  flex: none;
}

/* The card already has a border, so the trigger stays borderless to avoid a
   double-border look; it just gets a soft hover. The compound selector keeps
   this ahead of the generic `.icon-button` rule defined later in the file. */
.library-menu-toggle.icon-button {
  border: 0;
  background: transparent;
}

.library-menu-toggle.icon-button:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.library-menu-toggle.icon-button[disabled]:hover {
  background: transparent;
}

.library-menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 5;
  min-width: 178px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition: background 150ms ease, color 150ms ease;
}

.menu-item:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.menu-item[disabled] {
  cursor: default;
  opacity: 0.55;
}

.menu-item[disabled]:hover {
  background: transparent;
  color: var(--text);
}

/* Indeterminate "ping-pong" bar near the bottom while the card updates.
   Inset from the edges and rounded so it stays clear of the card's corners. */
.library-progress {
  position: absolute;
  right: 14px;
  bottom: 8px;
  left: 14px;
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 150ms ease;
}

.library-card.is-updating .library-progress {
  opacity: 1;
}

.library-progress::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  border-radius: 999px;
  background: var(--accent);
  animation: pingpong 1.15s ease-in-out infinite alternate;
}

@keyframes pingpong {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(150%);
  }
}

.library-initial {
  display: grid;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
  font-weight: 600;
  place-items: center;
}

.library-copy {
  min-width: 0;
  flex: 1;
}

.library-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-path {
  overflow: hidden;
  margin-top: 4px;
  color: var(--text-muted);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 30px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--text-dim);
  text-align: center;
}

.browser-topbar {
  min-height: 73px;
}

.browser-back {
  display: none;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  place-items: center;
  transition: background 150ms ease, transform 150ms ease;
}

.browser-back:hover {
  background: var(--surface-subtle);
  transform: translateX(-1px);
}

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

.browser-heading {
  min-width: 0;
}

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

.browser-search {
  display: flex;
  width: min(40vw, 430px);
  min-width: 220px;
  height: 42px;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-muted);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.browser-search[hidden] {
  display: none;
}

.browser-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.browser-search input {
  min-width: 0;
  height: 100%;
  flex: 1;
  padding: 0 5px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.browser-search input::placeholder {
  color: var(--text-muted);
}

.browser-search input::-webkit-search-cancel-button {
  display: none;
}

.browser-search-submit,
.browser-search-clear {
  display: grid;
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  place-items: center;
}

.browser-search-submit:hover,
.browser-search-clear:hover {
  background: var(--surface-subtle);
  color: var(--accent-strong);
}

.browser-search-submit:focus-visible,
.browser-search-clear:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.breadcrumbs {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.breadcrumbs a,
.breadcrumb-current {
  max-width: min(26vw, 240px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumbs a {
  transition: color 150ms ease;
}

.breadcrumbs a:hover {
  color: var(--accent-strong);
}

.breadcrumb-separator {
  color: var(--border);
}

.browser-content {
  max-width: 1240px;
}

.browser-library-header {
  margin-bottom: 25px;
}

.browser-library-header h2 {
  margin: 6px 0 7px;
  font-size: clamp(27px, 4vw, 38px);
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.browser-library-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.continue-reading-shelf {
  margin: 0 0 34px;
  padding: 20px 0 22px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.continue-reading-heading {
  display: flex;
  position: relative;
  z-index: 1;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.continue-reading-heading h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.018em;
}

.continue-reading-list {
  --continue-reading-main-width: calc(100vw - 252px);
  --continue-reading-inline-padding: max(32px, calc(50vw - 714px));

  display: grid;
  width: var(--continue-reading-main-width);
  overflow-x: auto;
  grid-auto-columns: 142px;
  grid-auto-flow: column;
  align-items: start;
  gap: 20px;
  margin: -40px 0 -26px calc(-1 * var(--continue-reading-inline-padding));
  padding: 44px var(--continue-reading-inline-padding) 40px;
  -ms-overflow-style: none;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  scroll-padding-inline: var(--continue-reading-inline-padding);
  scroll-snap-type: inline proximity;
}

.continue-reading-list::-webkit-scrollbar {
  display: none;
}

.continue-reading-item {
  min-width: 0;
  scroll-snap-align: start;
}

.browser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  align-items: start;
  gap: 28px 20px;
}

.browser-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-radius: 13px;
  cursor: pointer;
  transition: transform 180ms ease;
}

.browser-card:hover {
  transform: translateY(-4px);
}

.browser-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 0.68;
  filter: drop-shadow(0 9px 13px rgba(0, 0, 0, 0.18));
}

.browser-card:hover .browser-cover {
  filter: drop-shadow(0 12px 17px rgba(0, 0, 0, 0.24));
}

.browser-cover-image,
.cover-placeholder {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
}

.browser-cover-image {
  z-index: 2;
  border-radius: 7px;
  object-fit: cover;
}

.cover-placeholder {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: linear-gradient(145deg, var(--surface-subtle), var(--surface));
  color: var(--text-muted);
  place-items: center;
}

.comic-placeholder::after {
  position: absolute;
  width: 48%;
  height: 1px;
  top: 62%;
  left: 26%;
  background: var(--border);
  box-shadow: 0 9px 0 var(--border), 0 18px 0 var(--border);
  content: "";
}

.comic-glyph {
  display: grid;
  width: 48px;
  height: 48px;
  margin-top: -28px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 19px;
  font-weight: 700;
  place-items: center;
}

.folder-cover {
  margin-top: 8px;
}

.folder-cover-back,
.folder-cover-middle,
.folder-cover-front {
  position: absolute;
  width: 94%;
  height: 96%;
  left: 3%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-subtle);
  transform-origin: center;
}

.folder-cover-back {
  top: 2%;
  opacity: 0.5;
  transform: rotate(-4deg);
}

.folder-cover-middle {
  top: 2%;
  opacity: 0.72;
  transform: rotate(3deg);
}

.folder-cover-front {
  z-index: 1;
  overflow: hidden;
  top: 2%;
  background: var(--surface);
}

.folder-cover .browser-cover-image,
.folder-cover .cover-placeholder {
  border-radius: 6px;
}

.folder-placeholder {
  background: linear-gradient(145deg, var(--surface-subtle), var(--surface));
}

.folder-glyph {
  position: relative;
  width: 46%;
  height: 31%;
  border: 2px solid var(--text-muted);
  border-radius: 5px;
  opacity: 0.52;
}

.folder-glyph::before {
  position: absolute;
  width: 45%;
  height: 22%;
  top: -24%;
  left: -2px;
  border: 2px solid var(--text-muted);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  content: "";
}

.browser-card-copy {
  min-width: 0;
  padding: 11px 3px 0;
}

.browser-card-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.browser-card-meta {
  overflow: hidden;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comic-status {
  position: absolute;
  z-index: 4;
  top: 8px;
  right: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.comic-status.read {
  background: var(--online);
  color: #ffffff;
}

.comic-status.reading {
  background: var(--accent);
  color: #281a00;
}

.comic-progress {
  position: absolute;
  z-index: 4;
  height: 4px;
  right: 7px;
  bottom: 7px;
  left: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
}

.comic-progress-value {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.browser-loading-header {
  width: min(360px, 70%);
  height: 52px;
  margin-bottom: 28px;
  border-radius: 10px;
  background: var(--surface-subtle);
  animation: loading-pulse 1.4s ease-in-out infinite;
}

.browser-loading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 28px 20px;
}

.browser-loading-card {
  aspect-ratio: 0.58;
  border-radius: 9px;
  background: var(--surface-subtle);
  animation: loading-pulse 1.4s ease-in-out infinite;
}

.browser-state {
  display: flex;
  min-height: 380px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 36px;
  color: var(--text-dim);
  text-align: center;
}

.browser-state.compact {
  min-height: 300px;
  border: 1px dashed var(--border);
  border-radius: 16px;
}

.browser-state-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
  border-radius: 15px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 23px;
  font-weight: 800;
  place-items: center;
}

.browser-state-search-icon {
  padding: 13px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.folder-state-icon {
  position: relative;
  background: var(--accent-soft);
}

.folder-state-icon::before {
  width: 23px;
  height: 15px;
  border: 2px solid var(--accent-strong);
  border-radius: 3px;
  content: "";
}

.browser-state h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 20px;
}

.browser-state p {
  max-width: 52ch;
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
}

.comic-detail {
  display: grid;
  grid-template-columns: minmax(190px, 270px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(32px, 6vw, 70px);
}

.comic-detail-cover-column {
  position: sticky;
  top: 105px;
}

.comic-detail-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 0.68;
  filter: drop-shadow(0 16px 23px rgba(0, 0, 0, 0.25));
}

.comic-detail-cover .browser-cover-image,
.comic-detail-cover .cover-placeholder {
  border-radius: 10px;
}

.comic-detail-copy {
  min-width: 0;
  padding-top: 5px;
}

.comic-detail-copy > h2 {
  margin: 7px 0 5px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.comic-file-name {
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--text-muted);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11.5px;
}

.comic-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.comic-fact {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 700;
}

.comic-fact.success {
  border-color: color-mix(in srgb, var(--online) 42%, var(--border));
  background: var(--online-soft);
  color: var(--online);
}

.comic-fact.accent {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.comic-copy-section {
  margin-top: 30px;
  padding-top: 25px;
  border-top: 1px solid var(--border);
}

.comic-copy-section h3 {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.comic-copy-section > p,
.comic-synopsis {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.7;
}

.comic-copy-section > p {
  white-space: pre-line;
}

.comic-synopsis > :first-child {
  margin-top: 0;
}

.comic-synopsis > :last-child {
  margin-bottom: 0;
}

.comic-synopsis p,
.comic-synopsis blockquote,
.comic-synopsis ul,
.comic-synopsis ol,
.comic-synopsis pre,
.comic-synopsis table {
  margin: 0 0 1em;
}

.comic-synopsis .synopsis-plain {
  white-space: pre-line;
}

.comic-synopsis h1,
.comic-synopsis h2,
.comic-synopsis h3,
.comic-synopsis h4,
.comic-synopsis h5,
.comic-synopsis h6 {
  margin: 1.25em 0 0.45em;
  color: var(--text);
  font-size: 1em;
  line-height: 1.35;
}

.comic-copy-section a,
.comic-metadata-field a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-underline-offset: 2px;
}

.comic-synopsis blockquote {
  padding-left: 15px;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}

.comic-synopsis ul,
.comic-synopsis ol {
  padding-left: 24px;
}

.comic-synopsis code,
.comic-synopsis pre {
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.comic-synopsis pre {
  overflow-x: auto;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-subtle);
  font-size: 12px;
  white-space: pre-wrap;
}

.comic-synopsis table {
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12px;
}

.comic-synopsis th,
.comic-synopsis td {
  padding: 9px 11px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.comic-synopsis th {
  background: var(--surface-subtle);
  color: var(--text);
  font-weight: 700;
}

.comic-synopsis tr > :last-child {
  border-right: 0;
}

.comic-synopsis tbody tr:last-child > *,
.comic-synopsis tfoot tr:last-child > * {
  border-bottom: 0;
}

.comic-metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--border);
}

.comic-metadata-field {
  min-width: 0;
  padding: 15px 16px;
  background: var(--surface);
}

.comic-metadata-field dt {
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.comic-metadata-field dd {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.secondary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.comic-read-button {
  width: 100%;
  margin-top: 18px;
}

.comic-mobile-compact-actions {
  position: relative;
  margin-top: 8px;
}

.comic-read-mobile-button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.comic-read-mobile-icon {
  width: 16px;
  height: 16px;
}

.comic-mobile-popover {
  top: calc(100% + 8px);
  right: auto;
  left: 0;
  width: 100%;
}

.comic-mobile-popover::before {
  right: auto;
  left: calc(50% - 5px);
}

.web-reader-active {
  overflow: hidden;
}

.web-reader-active .sidebar,
.web-reader-active .browser-topbar {
  display: none;
}

.web-reader-active .main {
  height: 100vh;
  overflow: hidden;
}

.web-reader-active .browser-content {
  width: 100%;
  max-width: none;
  height: 100vh;
  padding: 0;
}

.web-reader {
  display: flex;
  width: 100%;
  height: 100vh;
  flex-direction: column;
  background: #111;
  color: #f7f7f7;
}

.web-reader-toolbar {
  display: grid;
  min-height: 58px;
  grid-template-columns: minmax(82px, auto) minmax(0, 1fr) minmax(72px, auto);
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: #1b1b1b;
}

.reader-toolbar-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: #252525;
  color: #f7f7f7;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.reader-toolbar-button:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: #303030;
}

.reader-toolbar-button:focus-visible,
.reader-page-button:focus-visible {
  outline: 3px solid rgba(245, 167, 5, 0.45);
  outline-offset: -3px;
}

.reader-toolbar-icon {
  width: 17px;
  height: 17px;
}

.web-reader-heading {
  min-width: 0;
  text-align: center;
}

.web-reader-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.web-reader-page-indicator {
  min-width: 72px;
  color: #b8b8b8;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}

.web-reader-stage {
  display: flex;
  position: relative;
  min-height: 0;
  flex: 1;
  background: #0d0d0d;
}

.web-reader-image-frame {
  display: flex;
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.web-reader-page {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.web-reader-page[hidden] {
  display: none;
}

.reader-page-button {
  display: grid;
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  width: clamp(48px, 7vw, 88px);
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  place-items: center;
}

.reader-previous-button {
  left: 0;
}

.reader-next-button {
  right: 0;
}

.reader-page-button:hover:not(:disabled) {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.34), transparent);
  color: #fff;
}

.reader-next-button:hover:not(:disabled) {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.34), transparent);
}

.reader-page-button:disabled {
  color: rgba(255, 255, 255, 0.16);
  cursor: default;
}

.reader-page-button-icon {
  width: 26px;
  height: 26px;
}

.web-reader-loading,
.web-reader-error {
  display: flex;
  position: absolute;
  z-index: 2;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 11px;
  background: rgba(13, 13, 13, 0.84);
  color: #bdbdbd;
  font-size: 12px;
  text-align: center;
}

.web-reader-loading[hidden],
.web-reader-error[hidden] {
  display: none;
}

.web-reader-error span {
  max-width: 280px;
  color: #888;
  line-height: 1.45;
}

.web-reader-error .secondary-button {
  border-color: rgba(255, 255, 255, 0.18);
  background: #252525;
  color: #eee;
}

.web-reader-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

.settings-content {
  max-width: 960px;
}

.settings-intro {
  margin-bottom: 24px;
}

.settings-intro h2 {
  margin: 7px 0 8px;
  font-size: clamp(27px, 4vw, 34px);
  letter-spacing: -0.03em;
}

.settings-intro p {
  max-width: 58ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.55;
}

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.notice svg {
  flex: none;
}

.notice.success {
  border-color: var(--online);
  background: var(--online-soft);
  color: var(--online);
}

.notice.error {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-card {
  overflow: hidden;
}

.settings-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

.settings-card-heading h3 {
  margin: 5px 0 0;
  font-size: 18px;
  letter-spacing: -0.015em;
}

.settings-badge {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10.5px;
  font-weight: 600;
}

.setting-row {
  display: flex;
  min-height: 84px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: 0;
}

label.setting-row {
  cursor: pointer;
}

.setting-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 5px;
}

.setting-name {
  font-size: 14px;
  font-weight: 650;
}

.setting-description {
  max-width: 62ch;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.setting-control-group {
  display: flex;
  flex: none;
  align-items: center;
  gap: 14px;
}

select,
input[type="time"] {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-subtle);
  font-size: 12.5px;
}

select {
  min-width: 174px;
  padding: 0 34px 0 11px;
}

input[type="time"] {
  width: 112px;
  padding: 0 10px;
}

select:disabled,
input[type="time"]:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 42px;
  height: 24px;
  flex: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-subtle);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.24);
  content: "";
  transition: transform 160ms ease;
}

.switch input:checked + .switch-track {
  border-color: var(--accent);
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.warning-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 18px 22px 22px;
  padding: 13px 15px;
  border: 1px solid var(--warning);
  border-radius: 11px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 12.5px;
  line-height: 1.5;
}

.warning-note svg {
  flex: none;
  margin-top: 1px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 0 10px;
}

.form-actions p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.primary-button {
  flex: none;
  padding: 10px 17px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #261900;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.primary-button:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.primary-button[disabled] {
  cursor: default;
  opacity: 0.7;
  transform: none;
}

/* Compact "Update all" button in the Libraries section header. */
.ghost-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 650;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.ghost-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* Icon-only refresh button on each library card. */
.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  place-items: center;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.ghost-button[disabled],
.icon-button[disabled] {
  cursor: default;
  opacity: 0.55;
}

.ghost-button[disabled]:hover,
.icon-button[disabled]:hover {
  border-color: var(--border);
  color: var(--text-muted);
}

.update-icon {
  display: inline-flex;
}

.update-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

/* While a button is the active updater, swap its icon for a spinner. */
.is-busy .update-icon {
  display: none;
}

.is-busy .update-spinner {
  display: inline-block;
}

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

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 170, 94, 0.45);
  }

  70% {
    box-shadow: 0 0 0 9px rgba(47, 170, 94, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(47, 170, 94, 0);
  }
}

@keyframes loading-pulse {
  0%,
  100% {
    opacity: 0.55;
  }

  50% {
    opacity: 1;
  }
}

@media (max-width: 800px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    z-index: 20;
    width: 100%;
    height: auto;
    flex-basis: auto;
    overflow: visible;
    padding: 14px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    padding: 0;
  }

  .sidebar-header {
    align-items: center;
  }

  .sidebar-header .theme-toggle {
    margin-top: 0;
  }

  .navigation {
    flex-direction: row;
    margin-top: 13px;
  }

  .navigation-item {
    flex: 1;
    justify-content: center;
  }

  .sidebar-promos {
    display: none;
  }

  .compact-promo-actions {
    display: flex;
    position: relative;
    align-items: center;
    gap: 6px;
    margin-left: auto;
  }

  .server-summary {
    display: none;
  }

  .topbar {
    padding: 14px 20px;
  }

  .browser-topbar {
    flex-wrap: wrap;
  }

  .browser-heading {
    flex: 1;
  }

  .browser-search {
    width: 100%;
    min-width: 0;
    flex-basis: 100%;
    margin-left: 0;
  }

  .browser-back:not([hidden]) {
    display: grid;
  }

  .content {
    padding: 22px 20px 30px;
  }

  .browser-grid {
    grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
    gap: 24px 16px;
  }

  .continue-reading-list {
    --continue-reading-main-width: 100vw;
    --continue-reading-inline-padding: 20px;

    grid-auto-columns: 125px;
    gap: 16px;
  }

  .browser-loading-grid {
    grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
    gap: 24px 16px;
  }

  .comic-detail {
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
    gap: 32px;
  }

}

@media (max-width: 560px) {
  .mobile-promotion-overlay {
    align-items: start;
    padding: 12px;
  }

  .mobile-promotion-dialog {
    max-height: calc(100vh - 24px);
    padding: 22px 18px 18px;
    border-radius: 16px;
  }

  .mobile-promotion-close {
    top: 12px;
    right: 12px;
  }

  .mobile-promotion-intro {
    padding-right: 38px;
  }

  .mobile-promotion-intro h2 {
    font-size: 25px;
  }

  .mobile-promotion-features,
  .mobile-platform-grid {
    grid-template-columns: 1fr;
  }

  .mobile-promotion-features {
    margin: 20px 0;
  }

  .mobile-platform-card {
    padding: 15px;
  }

  .mobile-promotion-continue {
    width: 100%;
  }

  .web-reader-toolbar {
    min-height: 52px;
    grid-template-columns: 42px minmax(0, 1fr) 58px;
    gap: 9px;
    padding: 6px 8px;
  }

  .reader-exit-button {
    min-width: 38px;
    padding: 0;
  }

  .reader-exit-button span {
    display: none;
  }

  .web-reader-page-indicator {
    min-width: 58px;
    font-size: 11px;
  }

  .reader-page-button {
    width: 48px;
  }

  .reader-page-button-icon {
    width: 22px;
    height: 22px;
  }

  .status-card {
    align-items: flex-start;
    padding: 26px 24px;
  }

  .hero-logo {
    width: 58px;
    height: 58px;
    border-radius: 15px;
  }

  .system-grid,
  .library-grid {
    grid-template-columns: 1fr;
  }

  .breadcrumbs a,
  .breadcrumb-current {
    max-width: 34vw;
  }

  .browser-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 15px;
  }

  .browser-loading-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 15px;
  }

  .browser-card-title {
    font-size: 12.5px;
  }

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

  .comic-detail-cover-column {
    position: static;
    width: min(72vw, 270px);
    margin: 0 auto;
  }

  .comic-detail-copy > h2 {
    font-size: 30px;
  }

  .comic-metadata-grid {
    grid-template-columns: 1fr;
  }

  .settings-card-heading,
  .setting-row,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-card-heading {
    padding: 18px;
  }

  .settings-badge {
    align-self: flex-start;
  }

  .setting-row {
    gap: 14px;
    padding: 18px;
  }

  label.setting-row {
    align-items: center;
    flex-direction: row;
  }

  .setting-row-with-control {
    align-items: stretch;
  }

  .setting-control-group {
    justify-content: space-between;
  }

  .setting-control-group select {
    min-width: 0;
    flex: 1;
  }

  .warning-note {
    margin: 18px;
  }

  .primary-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
