:root {
  color-scheme: dark;
  --ink: #070707;
  --panel: rgba(16, 17, 17, 0.86);
  --panel-strong: rgba(10, 10, 10, 0.94);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f6f1df;
  --muted: #b8b0a2;
  --gold: #ffcc66;
  --red: #f75f46;
  --teal: #42d0c8;
  --green: #8bd97d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(7, 7, 7, 0.72), rgba(7, 7, 7, 0.36) 42%, rgba(7, 7, 7, 0.78)),
    var(--active-banner, url("/assets/banners/banner-01.png")) center / cover fixed,
    var(--ink);
  color: var(--text);
  overflow-x: hidden;
}

button {
  color: inherit;
  font: inherit;
}

.app-shell {
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) clamp(14px, 4vw, 44px) max(22px, env(safe-area-inset-bottom));
}

.topbar,
.status-strip,
.reader-topbar,
.reader-controls {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-radius: 8px;
}

.kicker,
.label,
.reader-title,
.reader-progress {
  color: var(--muted);
  margin: 0;
}

.kicker,
.label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.2rem, 7vw, 5.5rem);
  line-height: 0.92;
  margin: 6px 0 0;
}

.unlock-clock {
  border-left: 1px solid var(--line);
  min-width: 138px;
  padding-left: 18px;
  text-align: right;
}

.unlock-clock span,
.unlock-clock strong {
  display: block;
}

.unlock-clock span {
  color: var(--gold);
  font-size: 0.86rem;
  font-weight: 800;
}

.unlock-clock strong {
  font-size: 1.12rem;
}

.status-strip {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 8px;
}

.weekly-banner {
  align-items: end;
  aspect-ratio: 21 / 7;
  background:
    linear-gradient(90deg, rgba(5, 5, 5, 0.84), rgba(5, 5, 5, 0.18) 52%, rgba(5, 5, 5, 0.72)),
    var(--active-banner, url("/assets/banners/banner-01.png")) center / cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  margin: 0 0 18px;
  min-height: 176px;
  overflow: hidden;
  padding: 18px;
  position: relative;
}

.weekly-banner::after {
  background:
    repeating-linear-gradient(105deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 18px),
    radial-gradient(circle at 74% 28%, rgba(255, 204, 102, 0.22), transparent 24%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.banner-copy {
  max-width: min(430px, 76%);
  position: relative;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.82);
  z-index: 1;
}

.banner-copy h2 {
  font-size: clamp(1.6rem, 4vw, 3.4rem);
  line-height: 0.96;
  margin: 5px 0 0;
}

.status-strip strong {
  display: block;
  margin-top: 3px;
}

.primary-action,
.ghost-button,
.icon-button {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  min-height: 44px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-action {
  background: linear-gradient(135deg, var(--red), #ffb24b);
  border-color: rgba(255, 255, 255, 0.28);
  color: #120805;
  font-weight: 900;
  min-width: 116px;
  padding: 0 18px;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
  padding: 0 14px;
}

.icon-button {
  background: rgba(255, 255, 255, 0.08);
  font-size: 2rem;
  height: 48px;
  line-height: 1;
  width: 48px;
}

.primary-action:active,
.ghost-button:active,
.icon-button:active,
.volume-card:active {
  transform: translateY(1px) scale(0.99);
}

.primary-action:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.5;
}

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

.volume-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: inherit;
  cursor: pointer;
  min-height: 302px;
  overflow: hidden;
  padding: 0;
  position: relative;
  text-align: left;
}

.volume-card[disabled] {
  cursor: not-allowed;
}

.volume-card.current {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(255, 204, 102, 0.38), var(--shadow);
}

.cover {
  aspect-ratio: 3 / 4;
  background:
    radial-gradient(circle at 72% 22%, rgba(255, 255, 255, 0.22), transparent 18%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), var(--accent) 42%, #111);
  border-bottom: 1px solid var(--line);
  display: grid;
  overflow: hidden;
  padding: 12px;
  place-items: end start;
  position: relative;
}

.cover::before,
.cover::after {
  content: "";
  inset: 0;
  position: absolute;
}

.cover::before {
  background:
    repeating-linear-gradient(105deg, rgba(255, 255, 255, 0.2) 0 1px, transparent 1px 16px),
    radial-gradient(circle at 24% 72%, rgba(0, 0, 0, 0.34), transparent 34%);
  mix-blend-mode: overlay;
}

.cover::after {
  border: 2px solid rgba(255, 255, 255, 0.32);
  inset: 10px;
}

.locked .cover {
  filter: grayscale(1) brightness(0.48);
}

.cover-title {
  font-size: 1.08rem;
  font-weight: 950;
  line-height: 1;
  max-width: 100%;
  position: relative;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.68);
  word-break: break-word;
  z-index: 1;
}

.cover-number {
  color: rgba(255, 255, 255, 0.72);
  font-size: 3rem;
  font-weight: 950;
  position: absolute;
  right: 12px;
  top: 8px;
  z-index: 1;
}

.badge {
  background: var(--gold);
  border-radius: 999px;
  color: #17100a;
  font-size: 0.72rem;
  font-weight: 950;
  padding: 5px 8px;
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
}

.badge.done {
  background: var(--green);
}

.volume-info {
  padding: 12px;
}

.volume-info h2 {
  font-size: 0.98rem;
  line-height: 1.16;
  margin: 0 0 10px;
}

.meta-line {
  color: var(--muted);
  font-size: 0.82rem;
  min-height: 2.2em;
}

.progress-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-fill {
  background: linear-gradient(90deg, var(--teal), var(--gold));
  height: 100%;
  width: 0%;
}

.reader-view {
  background: #050505;
  display: grid;
  gap: 10px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100svh;
  inset: 0;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  position: fixed;
  overflow: hidden;
  z-index: 10;
}

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

.reader-topbar {
  align-items: center;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  margin: 0 auto;
  max-width: 1100px;
  padding: 8px;
  border-radius: 8px;
  width: 100%;
}

.reader-title {
  color: var(--text);
  font-weight: 900;
}

.reader-actions {
  display: flex;
  gap: 8px;
}

.reader-actions .ghost-button {
  min-width: 86px;
}

.reader-stage {
  align-items: center;
  background: #111;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  height: 100%;
  justify-items: center;
  margin: 0 auto;
  max-width: 1100px;
  min-height: 0;
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
  width: 100%;
}

.page-canvas {
  background: white;
  box-shadow: 0 14px 46px rgba(0, 0, 0, 0.62);
  max-height: 100%;
  max-width: 100%;
}

.tap-zone {
  background: transparent;
  border: 0;
  bottom: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  position: absolute;
  top: 0;
  width: 50%;
  z-index: 2;
}

.tap-zone::after {
  align-items: center;
  background: rgba(5, 5, 5, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: var(--gold);
  display: flex;
  font-size: 2rem;
  font-weight: 950;
  height: 46px;
  justify-content: center;
  line-height: 1;
  opacity: 0.62;
  width: 46px;
}

.tap-zone:disabled {
  cursor: default;
}

.tap-zone:disabled::after {
  opacity: 0.16;
}

.tap-left {
  left: 0;
  justify-content: flex-start;
  padding-left: 12px;
}

.tap-left::after {
  content: "<";
}

.tap-right {
  right: 0;
  justify-content: flex-end;
  padding-right: 12px;
}

.tap-right::after {
  content: ">";
}

.reader-loading {
  background: rgba(0, 0, 0, 0.74);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--gold);
  font-weight: 900;
  left: 50%;
  padding: 10px 14px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

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

.reader-controls {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 0 auto;
  max-width: 1100px;
  padding: 8px;
  border-radius: 8px;
  width: 100%;
}

.page-jump-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  min-height: 48px;
  min-width: 96px;
  padding: 0 14px;
  text-align: center;
}

.page-jump-button:active {
  transform: translateY(1px) scale(0.99);
}

.page-jump-modal {
  align-items: center;
  background: rgba(0, 0, 0, 0.68);
  display: grid;
  inset: 0;
  padding: 18px;
  place-items: center;
  position: fixed;
  z-index: 30;
}

.page-jump-modal[hidden] {
  display: none;
}

.page-jump-panel {
  background: rgba(10, 10, 10, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-width: 340px;
  padding: 18px;
  width: min(100%, 340px);
}

.page-jump-panel label {
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: 950;
}

.page-jump-panel input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 1.6rem;
  font-weight: 900;
  min-height: 54px;
  padding: 8px 12px;
  width: 100%;
}

.page-jump-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.toast {
  background: rgba(10, 10, 10, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  bottom: max(18px, env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: 800;
  left: 50%;
  max-width: min(520px, calc(100vw - 28px));
  padding: 12px 16px;
  position: fixed;
  text-align: center;
  transform: translateX(-50%);
  z-index: 20;
}

@media (max-width: 620px) {
  .topbar {
    align-items: stretch;
    display: grid;
  }

  .unlock-clock {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 12px 0 0;
    text-align: left;
  }

  .volume-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .volume-card {
    min-height: 272px;
  }

  .status-strip {
    align-items: stretch;
    display: grid;
  }

  .weekly-banner {
    aspect-ratio: 4 / 3;
    min-height: 210px;
  }

  .banner-copy {
    max-width: 92%;
  }

  .primary-action {
    width: 100%;
  }

  .reader-stage {
    height: 100%;
  }

  .reader-topbar {
    grid-template-columns: 44px 1fr;
  }

  .reader-actions {
    grid-column: 1 / -1;
  }

  .reader-actions .ghost-button {
    flex: 1;
  }

  .tap-zone {
    width: 42%;
  }

  .tap-zone::after {
    height: 42px;
    width: 42px;
  }
}
