:root {
  color-scheme: light;
  --paper: #f7f4ed;
  --surface: #ffffff;
  --ink: #171916;
  --muted: #6f746e;
  --line: #d9d9d1;
  --soft: #eceee7;
  --red: #d94b3f;
  --red-dark: #a92e27;
  --teal: #197f79;
  --yellow: #e9b949;
  --reader: #111210;
  --shadow: 0 22px 70px rgba(25, 31, 28, 0.2);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background: #dfe6e1;
  color: var(--ink);
  letter-spacing: 0;
}

button,
input {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(25, 127, 121, 0.35);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

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

.prototype-stage {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.app-shell {
  position: relative;
  width: min(100%, 430px);
  height: min(900px, calc(100vh - 48px));
  min-height: 620px;
  overflow: hidden;
  border: 1px solid rgba(23, 25, 22, 0.25);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.app-topbar {
  position: absolute;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  height: calc(64px + env(safe-area-inset-top));
  align-items: flex-end;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 16px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 244, 237, 0.96);
}

.brand-button,
.icon-button,
.language-trigger,
.nav-item,
.text-button,
.chip-button,
.work-card,
.continue-card,
.menu-row,
.language-option,
.fallback-option {
  border: 0;
  background: transparent;
}

.brand-button {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 0;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-size: 16px;
  font-weight: 850;
}

.brand-word {
  font-size: 18px;
  font-weight: 850;
}

.topbar-actions,
.button-row,
.tag-row,
.meta-row,
.reader-statuses {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  padding: 0;
  border-radius: 6px;
}

.icon-button:hover {
  background: var(--soft);
}

.icon-button svg,
.nav-item svg,
.language-trigger svg,
.search-field svg,
.status-badge svg,
.menu-row svg,
.button svg,
.inline-note svg,
.reader-toolbar svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.language-trigger {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 750;
}

.app-content {
  position: absolute;
  top: calc(64px + env(safe-area-inset-top));
  right: 0;
  bottom: calc(68px + env(safe-area-inset-bottom));
  left: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.screen {
  min-height: 100%;
  padding: 18px 16px 28px;
}

.screen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.screen-title,
.section-title,
.detail-title,
.layer-header h2,
.bottom-sheet h2 {
  margin: 0;
  letter-spacing: 0;
}

.screen-title {
  font-size: 25px;
  line-height: 1.15;
}

.screen-subtitle,
.section-caption,
.muted,
.work-meta,
.detail-original,
.sheet-copy,
.empty-state p {
  color: var(--muted);
}

.screen-subtitle {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.section {
  margin: 0 0 28px;
}

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

.section-title {
  font-size: 18px;
  line-height: 1.2;
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.text-button {
  padding: 4px 0;
  color: var(--teal);
  font-size: 13px;
  font-weight: 750;
}

.continue-card {
  display: grid;
  width: 100%;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  padding: 0;
  text-align: left;
}

.continue-cover {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 5px;
  background: #cdd3ce;
}

.continue-cover img,
.work-cover img,
.detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.progress-bar {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #d9ddd8;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
}

.continue-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.continue-copy h3,
.work-copy h3 {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.continue-copy p {
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 12px;
}

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

.work-card {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  text-align: left;
}

.work-cover {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 5px;
  background: #cdd3ce;
}

.work-cover::after,
.detail-cover::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(23, 25, 22, 0.12);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.cover-badge {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: max-content;
  max-width: calc(100% - 14px);
  overflow: hidden;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(23, 25, 22, 0.86);
  color: #fff;
  font-size: 10px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-marker {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--red);
}

.favorite-marker svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.work-copy {
  padding-top: 9px;
}

.work-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 5px;
  font-size: 11px;
}

.tag-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
}

.tag-strip::-webkit-scrollbar {
  display: none;
}

.chip-button,
.tag,
.status-badge {
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  white-space: nowrap;
}

.chip-button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.chip-button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.bottom-nav {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  height: calc(68px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 6px 8px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.nav-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.nav-item.is-active {
  color: var(--red);
}

.nav-item svg {
  width: 21px;
  height: 21px;
}

.search-field {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.search-field:focus-within {
  border-color: var(--teal);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.search-toolbar {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}

.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.detail-screen {
  padding-top: 0;
}

.detail-hero {
  position: relative;
  margin: 0 -16px;
  padding: 18px 16px 22px;
  background: #e5e9e3;
}

.detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 16px;
  align-items: end;
}

.detail-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 12px 26px rgba(23, 25, 22, 0.18);
}

.detail-title {
  overflow-wrap: anywhere;
  font-size: 22px;
  line-height: 1.18;
}

.detail-original {
  margin: 8px 0 13px;
  font-size: 12px;
  line-height: 1.45;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  background: #d8ebe7;
  color: #125e5a;
  font-size: 10px;
  font-weight: 800;
}

.detail-body {
  padding-top: 22px;
}

.detail-description {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.75;
}

.tag-row {
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.tag {
  padding: 6px 9px;
  background: var(--soft);
  font-size: 11px;
  font-weight: 650;
}

.language-chips {
  display: flex;
  gap: 8px;
  margin: 10px 0 22px;
  overflow-x: auto;
  scrollbar-width: none;
}

.language-chip {
  flex: 0 0 auto;
  min-width: 86px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.language-chip.is-current {
  border-color: var(--teal);
  background: #edf7f5;
}

.language-chip strong,
.language-chip small {
  display: block;
}

.language-chip strong {
  font-size: 12px;
}

.language-chip small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.inline-note {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px;
  margin-bottom: 18px;
  padding: 12px;
  border-left: 3px solid var(--yellow);
  background: #fff7df;
  color: #5f4910;
  font-size: 12px;
  line-height: 1.55;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
}

.button-primary {
  background: var(--red);
  color: #fff;
}

.button-primary:hover {
  background: var(--red-dark);
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
}

.button-full {
  width: 100%;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 0 24px;
  border-bottom: 1px solid var(--line);
}

.avatar {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 18px;
  font-weight: 850;
}

.profile-hero h2,
.profile-hero p {
  margin: 0;
}

.profile-hero p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.stat {
  text-align: center;
}

.stat + .stat {
  border-left: 1px solid var(--line);
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  font-size: 22px;
}

.stat span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.menu-list {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.menu-row {
  display: grid;
  width: 100%;
  min-height: 58px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 2px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.menu-row-copy strong,
.menu-row-copy small {
  display: block;
}

.menu-row-copy strong {
  font-size: 14px;
}

.menu-row-copy small,
.menu-value {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #c7ccc7;
}

.toggle::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  content: "";
  transition: transform 160ms ease;
}

.toggle.is-on {
  background: var(--teal);
}

.toggle.is-on::after {
  transform: translateX(18px);
}

.empty-state {
  display: grid;
  min-height: 360px;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.empty-state-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  max-width: 260px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.app-layer {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  background: var(--paper);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
}

.app-layer.is-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.layer-header {
  display: grid;
  min-height: calc(64px + env(safe-area-inset-top));
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: end;
  padding: env(safe-area-inset-top) 14px 12px;
  border-bottom: 1px solid var(--line);
}

.layer-header h2 {
  align-self: center;
  text-align: center;
  font-size: 17px;
}

.layer-content {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 32px;
}

.language-search {
  position: sticky;
  z-index: 2;
  top: 0;
  margin-bottom: 20px;
  box-shadow: 0 8px 18px rgba(247, 244, 237, 0.95);
}

.language-group + .language-group {
  margin-top: 22px;
}

.language-group h3 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.language-option {
  display: grid;
  width: 100%;
  min-height: 54px;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 12px;
  padding: 7px 2px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.language-option strong,
.language-option small {
  display: block;
}

.language-option strong {
  font-size: 14px;
}

.language-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.language-option .check {
  color: var(--teal);
}

.dialog-backdrop {
  position: absolute;
  z-index: 100;
  inset: 0;
  display: flex;
  visibility: hidden;
  align-items: flex-end;
  background: rgba(17, 18, 16, 0.55);
  opacity: 0;
  transition: opacity 160ms ease, visibility 160ms;
}

.dialog-backdrop.is-open {
  visibility: visible;
  opacity: 1;
}

.bottom-sheet {
  width: 100%;
  max-height: 78%;
  overflow-y: auto;
  padding: 10px 16px calc(24px + env(safe-area-inset-bottom));
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  transform: translateY(100%);
  transition: transform 180ms ease;
}

.dialog-backdrop.is-open .bottom-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: #c7ccc7;
}

.sheet-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.bottom-sheet h2 {
  font-size: 21px;
}

.sheet-copy {
  margin: 12px 0 15px;
  font-size: 13px;
  line-height: 1.65;
}

.fallback-options {
  border-top: 1px solid var(--line);
}

.fallback-option {
  display: grid;
  width: 100%;
  min-height: 58px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.fallback-option strong,
.fallback-option small {
  display: block;
}

.fallback-option small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.reader-screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  background: var(--reader);
  color: #fff;
  overscroll-behavior: contain;
  scroll-snap-type: y proximity;
}

.reader-page {
  position: relative;
  height: 100%;
  min-height: 100%;
  scroll-snap-align: start;
  background: #0d0e0c;
}

.reader-page img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.12);
}

.reader-cover-layer {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.reader-cover-shape {
  position: absolute;
  display: block;
  border: 2px solid #111;
  background: #fff;
}

.reader-cover-shape.primary {
  right: 14px;
  bottom: calc(146px + env(safe-area-inset-bottom));
  width: min(74%, 310px);
  height: 72px;
}

.reader-cover-shape.secondary {
  top: 31%;
  left: 9%;
  width: 92px;
  height: 34px;
  border-color: rgba(17, 17, 17, .82);
  background: rgba(247, 247, 244, .96);
}

.reader-page:nth-child(2) img {
  filter: grayscale(0.82) contrast(1.05) brightness(0.7);
}

.reader-caption {
  position: absolute;
  right: 16px;
  bottom: calc(148px + env(safe-area-inset-bottom));
  max-width: 72%;
  padding: 9px 11px;
  border: 2px solid #111;
  background: #fff;
  color: #111;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  z-index: 3;
}

.reader-page-error {
  display: grid;
  place-items: center;
  padding: calc(78px + env(safe-area-inset-top)) 14px calc(82px + env(safe-area-inset-bottom));
  background: #111116;
}

.reader-error-card {
  position: relative;
  z-index: 5;
  width: min(100%, 330px);
  padding: 18px;
  border: 1px solid rgba(255, 107, 120, .58);
  border-radius: 6px;
  background: rgba(25, 25, 31, .97);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .42);
}

.reader-overlay-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.reader-error-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 4px;
  background: rgba(255, 107, 120, .12);
  color: #ff6b78;
}

.reader-error-icon svg {
  width: 19px;
  height: 19px;
}

.reader-error-page {
  display: block;
  margin-bottom: 4px;
  color: #ff9aa4;
  font-size: 10px;
  font-weight: 800;
}

.reader-error-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.reader-error-card p {
  margin: 8px 0 16px;
  color: #b8b8c2;
  font-size: 11px;
  line-height: 1.6;
}

.reader-error-actions,
.version-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.reader-error-actions .button,
.version-actions .button {
  min-width: 0;
  padding-inline: 10px;
  text-align: center;
  white-space: normal;
}

.reader-stale-badge {
  position: absolute;
  z-index: 4;
  top: calc(74px + env(safe-area-inset-top));
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 24px);
  padding: 6px 8px;
  border: 1px solid rgba(255, 209, 102, .55);
  border-radius: 4px;
  background: rgba(17, 17, 22, .9);
  color: var(--yellow);
  font-size: 10px;
  font-weight: 800;
}

.reader-stale-badge svg {
  width: 13px;
  height: 13px;
}

.reader-end {
  display: grid;
  min-height: 72vh;
  place-items: center;
  padding: 42px 24px;
  text-align: center;
}

.reader-end h2 {
  margin: 0;
  font-size: 25px;
}

.reader-end p {
  margin: 8px 0 22px;
  color: #b8bdb8;
  font-size: 13px;
}

.reader-toolbar {
  position: fixed;
  z-index: 30;
  right: auto;
  left: 50%;
  display: flex;
  width: min(390px, 100vw);
  align-items: center;
  background: rgba(13, 14, 12, 0.94);
  color: #fff;
  transform: translateX(-50%);
  transition: transform 180ms ease, opacity 180ms ease;
}

.reader-toolbar.top {
  top: 0;
  min-height: calc(62px + env(safe-area-inset-top));
  gap: 8px;
  padding: env(safe-area-inset-top) 10px 8px;
}

.reader-toolbar.bottom {
  bottom: 0;
  min-height: calc(64px + env(safe-area-inset-bottom));
  justify-content: space-between;
  padding: 8px 12px env(safe-area-inset-bottom);
}

.reader-toolbar .icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.reader-title {
  min-width: 0;
  flex: 1;
}

.reader-title strong,
.reader-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-title strong {
  font-size: 13px;
}

.reader-title small {
  margin-top: 3px;
  color: #b8bdb8;
  font-size: 10px;
}

.reader-language-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 11px;
  font-weight: 750;
}

.reader-screen.toolbar-hidden .reader-toolbar.top {
  opacity: 0;
  transform: translate(-50%, -100%);
}

.reader-screen.toolbar-hidden .reader-toolbar.bottom {
  opacity: 0;
  transform: translate(-50%, 100%);
}

.reader-progress {
  color: #d5d8d5;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.version-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 16px;
}

.version-summary > div,
.version-heading {
  display: grid;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.version-summary > div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.version-summary strong,
.version-summary small,
.version-heading strong,
.version-heading small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-summary strong,
.version-heading strong { font-size: 12px; }
.version-summary small,
.version-heading small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.version-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 4px;
}

.version-mark svg { width: 17px; height: 17px; }
.version-mark.source { background: rgba(255, 209, 102, 0.13); color: var(--yellow); }
.version-mark.translation { background: rgba(52, 213, 255, 0.13); color: var(--teal); }

.translation-progress { margin: 10px 0 16px; }
.progress-copy { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; font-size: 10px; }
.progress-copy strong { color: var(--teal); }
.progress-copy span, .translation-progress small { color: var(--muted); }
.translation-progress small { display: block; margin-top: 6px; font-size: 9px; }
.progress-bar.task { display: block; height: 5px; background: #33333b; }
.progress-bar.task > span { display: block; height: 100%; background: var(--teal); transition: width 240ms ease; }

.version-options { display: grid; gap: 10px; border-top: 0; }
.version-option { padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); }
.version-option.source-option { border-top: 2px solid var(--yellow); }
.version-option.translation-option { border-top: 2px solid var(--teal); }
.version-option.translation-option.ready { border-top-color: #55d58b; }
.version-option.translation-option.failed { border-top-color: #ff6b78; }
.version-option > p { margin: 10px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.version-heading { grid-template-columns: 34px minmax(0, 1fr) auto; }
.route-status { padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 9px; font-weight: 800; white-space: nowrap; }
.route-status.source { border-color: rgba(255, 209, 102, .48); color: var(--yellow); }
.route-status.processing, .route-status.queued { border-color: rgba(52, 213, 255, .48); color: var(--teal); }
.route-status.ready { border-color: rgba(85, 213, 139, .48); color: #55d58b; }
.route-status.failed { border-color: rgba(255, 107, 120, .48); color: #ff6b78; }
.route-status.stale { border-color: rgba(255, 209, 102, .48); color: var(--yellow); }
.target-language { display: inline-flex; align-items: center; gap: 2px; padding: 2px 0; border: 0; background: transparent; color: var(--muted); font-size: 9px; }
.target-language svg { width: 12px; height: 12px; }
.sheet-note { display: flex; gap: 8px; margin-top: 12px; padding: 10px; background: var(--soft); color: var(--muted); font-size: 10px; line-height: 1.5; }
.sheet-note svg { width: 15px; height: 15px; flex: 0 0 15px; color: var(--teal); }
.button-danger { border-color: rgba(255, 107, 120, .62); background: rgba(255, 107, 120, .12); color: #ff6b78; }

.reader-task-status {
  display: grid;
  min-width: 0;
  flex: 1;
  justify-items: end;
  gap: 4px;
  color: #b8bdb8;
  font-size: 9px;
  text-align: right;
}

.reader-task-status > span:first-child { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.reader-task-track { display: block; overflow: hidden; width: min(110px, 100%); height: 3px; background: #3b3b44; }
.reader-task-track span { display: block; height: 100%; background: var(--teal); }
.reader-task-status .task-ready { color: #55d58b; }
.reader-task-status .task-failed { color: #ff6b78; }
.reader-task-status .task-stale { color: var(--yellow); }

.toast {
  position: absolute;
  z-index: 130;
  right: 18px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  left: 18px;
  visibility: hidden;
  padding: 11px 13px;
  border-radius: 6px;
  background: rgba(23, 25, 22, 0.94);
  color: #fff;
  font-size: 12px;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}

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

.app-shell.is-reader .app-topbar,
.app-shell.is-reader .bottom-nav {
  display: none;
}

.app-shell.is-reader .app-content {
  inset: 0;
}

.app-shell.is-reader .toast {
  bottom: calc(76px + env(safe-area-inset-bottom));
}

/* Current HCOMIC theme and compact viewing-history surfaces. */
:root {
  color-scheme: dark;
  --paper: #0f0f12;
  --surface: #19191f;
  --ink: #f5f5f7;
  --muted: #a1a1ad;
  --line: #303038;
  --soft: #24242b;
  --red: #ec168c;
  --red-dark: #c70d72;
  --teal: #34d5ff;
  --yellow: #ffd166;
  --reader: #08080a;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.55);
}

body {
  background: #07070a;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline-color: rgba(52, 213, 255, 0.65);
}

.app-shell {
  border-color: #3a3a43;
  background: var(--paper);
}

.app-topbar {
  border-bottom-color: #2a2a31;
  background: rgba(15, 15, 18, 0.97);
}

.brand-mark {
  background: var(--red);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand-word {
  color: #ffffff;
}

.icon-button:hover,
.nav-item:hover,
.menu-row:hover,
.language-option:hover,
.fallback-option:hover {
  background: var(--soft);
}

.language-trigger,
.search-field,
.chip-button,
.language-chip,
.button-secondary {
  border-color: var(--line);
  background: var(--surface);
}

.section {
  margin-bottom: 24px;
}

.section-heading {
  margin-bottom: 10px;
}

.section-kicker,
.text-button {
  color: var(--teal);
}

.history-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.history-link svg {
  width: 15px;
  height: 15px;
}

.continue-card {
  min-height: 78px;
  grid-template-columns: 48px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  padding: 7px 8px 7px 7px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 4px;
  background: var(--surface);
}

.continue-card:hover {
  border-color: #474750;
  border-left-color: var(--red);
  background: #1e1e24;
}

.continue-cover {
  width: 48px;
  aspect-ratio: 3 / 4;
  border-radius: 2px;
}

.continue-copy p {
  margin: 4px 0 9px;
  font-size: 11px;
}

.continue-action,
.history-play {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: #ffffff;
}

.continue-action svg,
.history-play svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.progress-bar {
  height: 3px;
  background: #33333b;
}

.progress-bar span {
  background: var(--red);
}

.work-grid {
  gap: 16px 10px;
}

.work-cover {
  border-radius: 3px;
  background: #24242b;
}

.work-cover::after,
.detail-cover::after {
  border-color: rgba(255, 255, 255, 0.13);
}

.cover-badge {
  border-radius: 2px;
  background: rgba(7, 7, 10, 0.9);
  color: #ffffff;
}

.favorite-marker {
  background: rgba(15, 15, 18, 0.9);
  color: var(--red);
}

.chip-button {
  border-radius: 4px;
}

.chip-button.is-active {
  border-color: var(--red);
  background: var(--red);
}

.bottom-nav {
  border-top-color: #2a2a31;
  background: rgba(15, 15, 18, 0.98);
}

.nav-item.is-active {
  color: var(--red);
}

.search-field:focus-within {
  border-color: var(--teal);
}

.detail-hero {
  border-bottom: 1px solid var(--line);
  background: #15151a;
}

.detail-cover {
  border-radius: 3px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.status-badge {
  border-radius: 3px;
  background: rgba(52, 213, 255, 0.13);
  color: var(--teal);
}

.tag {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
}

.language-chip {
  border-radius: 4px;
}

.language-chip.is-current {
  border-color: var(--teal);
  background: rgba(52, 213, 255, 0.1);
}

.inline-note {
  border-left-color: var(--yellow);
  background: rgba(255, 209, 102, 0.1);
  color: #ffe3a0;
}

.button {
  border-radius: 4px;
}

.button-primary {
  background: var(--red);
}

.button-primary:hover {
  background: var(--red-dark);
}

.avatar {
  background: var(--red);
}

.menu-list,
.menu-row,
.profile-hero,
.stat-row {
  border-color: var(--line);
}

.toggle {
  background: #454550;
}

.toggle.is-on {
  background: var(--red);
}

.empty-state-icon {
  background: var(--soft);
}

.app-layer {
  background: var(--paper);
}

.layer-header,
.language-option,
.fallback-options,
.fallback-option {
  border-color: var(--line);
}

.language-search {
  box-shadow: 0 9px 18px rgba(15, 15, 18, 0.96);
}

.language-option .check {
  color: var(--teal);
}

.dialog-backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.bottom-sheet {
  background: #19191f;
}

.sheet-handle {
  background: #4a4a54;
}

.history-header {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: start;
  justify-content: initial;
  gap: 10px;
}

.history-header .icon-button {
  margin-left: -8px;
}

.history-list {
  border-top: 1px solid var(--line);
}

.history-row {
  display: grid;
  width: 100%;
  min-height: 106px;
  grid-template-columns: 62px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
}

.history-row:hover {
  background: #15151a;
}

.history-cover {
  width: 62px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 2px;
  background: var(--soft);
}

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

.history-copy {
  display: block;
  min-width: 0;
}

.history-copy strong,
.history-copy small,
.history-time {
  display: block;
}

.history-copy strong {
  overflow: hidden;
  margin-top: 2px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-copy small {
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.history-time {
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.clear-history {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.clear-history:hover {
  border-color: var(--red);
  color: var(--red);
}

.clear-history svg {
  width: 16px;
  height: 16px;
}

.reader-page {
  background: #050506;
}

.reader-toolbar {
  background: rgba(8, 8, 10, 0.96);
}

.reader-language-button {
  border-color: rgba(52, 213, 255, 0.45);
  border-radius: 4px;
  color: var(--teal);
}

.toast {
  border: 1px solid #3b3b44;
  border-radius: 4px;
  background: rgba(25, 25, 31, 0.97);
}

@media (max-width: 520px) {
  .prototype-stage {
    display: block;
    min-height: 100svh;
    padding: 0;
  }

  .app-shell {
    width: 100%;
    height: 100svh;
    min-height: 560px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 350px) {
  .reader-error-actions,
  .version-actions {
    grid-template-columns: 1fr;
  }
}

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