:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070707;
  color: #f2f2f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #070707;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: #070707;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.status-screen {
  width: min(100% - 40px, 680px);
  min-height: 70vh;
  margin: 0 auto;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
  color: #bdbdbd;
}

.status-screen h1,
.status-screen p {
  margin: 0;
}

.status-screen--error {
  color: #f4f4f4;
}

.status-screen--error p {
  max-width: 42rem;
  color: #bdbdbd;
  line-height: 1.7;
}

.eyebrow {
  color: #858585;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.library {
  width: min(100% - 32px, 880px);
  margin: 0 auto;
  padding: max(48px, env(safe-area-inset-top)) 0 max(56px, env(safe-area-inset-bottom));
}

.library-header {
  padding: 12px 0 28px;
  border-bottom: 1px solid #292929;
}

.library-header h1 {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
  font-size: clamp(1.7rem, 8vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.notice {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-left: 3px solid #d5a84b;
  background: #17140e;
  color: #e8d8b7;
  line-height: 1.55;
}

.library-section {
  padding-top: 32px;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 1.1rem;
}

.section-count {
  margin: 0;
  color: #8f8f8f;
  font-size: 0.84rem;
}

.entry-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry-link {
  min-height: 58px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #292929;
  border-radius: 6px;
  background: #121212;
  text-decoration: none;
}

.entry-link:active {
  background: #1c1c1c;
}

.entry-title {
  min-width: 0;
  font-weight: 650;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.entry-pages {
  flex: 0 0 auto;
  color: #949494;
  font-size: 0.86rem;
}

.empty-message {
  margin: 0;
  padding: 18px 0;
  color: #8f8f8f;
}

.reader-view {
  min-height: 100vh;
  min-height: 100dvh;
  background: #050505;
}

.reader-bar {
  position: sticky;
  z-index: 10;
  top: 0;
  min-height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  border-bottom: 1px solid #242424;
  background: rgba(10, 10, 10, 0.96);
}

.reader-bar__back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  padding: 0 10px;
  color: #ededed;
  text-decoration: none;
}

.reader-bar__title {
  margin: 0;
  padding: 8px 4px;
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

.mode-switch {
  justify-self: end;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 2px;
  border: 1px solid #303030;
  border-radius: 5px;
  background: #111;
}

.mode-button {
  min-width: 44px;
  min-height: 38px;
  padding: 0 7px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #929292;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
}

.mode-button[aria-pressed="true"] {
  background: #ededed;
  color: #101010;
}

.pages {
  width: min(100%, 820px);
  margin: 0 auto;
  background: #050505;
}

.page-frame {
  width: 100%;
  margin: 0;
  padding: 0;
}

.manga-page {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
  padding: 0;
}

.paged-stage {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 52px);
  min-height: calc(100svh - 52px);
  background: #050505;
}

.paged-media {
  position: relative;
  width: min(100%, 820px);
  min-height: calc(100vh - 52px);
  min-height: calc(100svh - 52px);
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.paged-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 96px);
  max-height: calc(100svh - 96px);
  display: block;
  object-fit: contain;
}

.paged-image--long {
  width: 100%;
  max-height: none;
}

.paged-turn-zone {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  width: 50%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.paged-turn-zone--previous {
  left: 0;
}

.paged-turn-zone--next {
  right: 0;
}

.paged-turn-zone:disabled {
  cursor: default;
}

.paged-turn-zone:focus-visible {
  outline: 2px solid #f2f2f2;
  outline-offset: -4px;
}

.paged-counter {
  position: fixed;
  z-index: 8;
  right: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(50%);
  margin: 0;
  padding: 5px 9px;
  border-radius: 4px;
  background: rgba(8, 8, 8, 0.78);
  color: #bdbdbd;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
}

.page-error {
  min-height: 150px;
  margin: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  border-block: 1px solid #272727;
  color: #aaa;
  text-align: center;
  line-height: 1.6;
}

.reader-empty {
  min-height: 45vh;
  margin: 0;
  display: grid;
  place-items: center;
  color: #969696;
}

.reader-footer {
  padding: 32px max(12px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  border-top: 1px solid #242424;
  background: #0a0a0a;
}

.reader-footer__label {
  margin: 0 0 16px;
  color: #858585;
  font-size: 0.8rem;
  text-align: center;
  overflow-wrap: anywhere;
}

.reader-nav {
  width: min(100%, 680px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.nav-action {
  min-height: 48px;
  padding: 8px 6px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #343434;
  border-radius: 5px;
  background: #171717;
  color: #f0f0f0;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.nav-action__direction {
  font-weight: 700;
}

.nav-action__chapter {
  margin-top: 3px;
  color: #9d9d9d;
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.3;
}

.nav-action:active {
  background: #232323;
}

.nav-action.is-disabled {
  border-color: #202020;
  background: #0d0d0d;
  color: #505050;
}

@media (hover: hover) {
  .entry-link:hover,
  .nav-action:not(.is-disabled):hover,
  .reader-bar__back:hover,
  .mode-button:not([aria-pressed="true"]):hover {
    background: #202020;
  }
}

@media (min-width: 560px) {
  .library {
    width: min(100% - 56px, 880px);
  }

  .entry-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .reader-bar__title {
    font-size: 1rem;
  }

  .mode-button {
    min-width: 50px;
  }
}

@media (min-width: 900px) {
  .library {
    padding-top: 72px;
  }

  .entry-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (forced-colors: active) {
  .entry-link,
  .reader-bar,
  .reader-footer,
  .nav-action {
    border-color: CanvasText;
  }

  .mode-switch {
    border-color: CanvasText;
  }
}
