html.novel-root,
body.novel-page {
  height: 100%;
  overflow: hidden;
}

body.novel-page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.novel-background {
  position: fixed;
  inset: -8%;
  z-index: 0;
  background-position: center;
  background-size: cover;
  opacity: .18;
  filter: blur(22px);
  pointer-events: none;
}

.novel-page main {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
}

body.novel-page .log.roastery {
  height: 100%;
  padding: clamp(48px, 7dvh, 68px) 0 max(12px, env(safe-area-inset-bottom));
}

.novel-page .log > .wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.novel-page .section-title {
  flex: none;
  margin: 0 54px 14px;
}

.novel-page .section-title .en {
  margin: 0;
  font-size: clamp(20px, 3vw, 30px);
  line-height: 1.15;
}
.novel-page .site-footer { display: none; }

.novel-carousel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.novel-list {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  overflow: hidden;
  touch-action: pan-y;
}

.novel-list > li {
  position: absolute;
  top: 0;
  left: 50%;
  width: min(58vw, 780px);
  height: 100%;
  min-width: 0;
  transition: transform .55s ease, opacity .55s ease;
  transform: translateX(-50%) scale(.7);
  opacity: 0;
  pointer-events: none;
}

.novel-list > li[data-position="0"] {
  z-index: 2;
  transform: translateX(-50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.novel-list > li[data-position="-1"] {
  z-index: 1;
  transform: translateX(-133%) scale(.84);
  opacity: .72;
  pointer-events: auto;
}

.novel-list > li[data-position="1"] {
  z-index: 1;
  transform: translateX(33%) scale(.84);
  opacity: .72;
  pointer-events: auto;
}

.novel-list .roast-card {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(10px, 1.6dvh, 18px);
  overflow: hidden;
}

.novel-list .roast-shot {
  flex: 1;
  min-height: 0;
  margin: 0 0 8px;
}

.novel-list .roast-shot img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
}

.novel-list .log-meta { gap: 6px; line-height: 1.35; }
.novel-detail {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}
.novel-detail strong { color: var(--espresso); font-size: 12px; }
.novel-model {
  border: 0;
  padding: 0;
  background: none;
  color: var(--espresso);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.novel-model:focus-visible, .prompt-close:focus-visible {
  outline: 2px solid var(--espresso);
  outline-offset: 3px;
}
.prompt-overlay:not([hidden]) {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(16px, 3vw, 32px);
  border-radius: inherit;
  background: var(--card);
  color: var(--espresso);
  box-shadow: inset 0 0 0 1px var(--line);
}
.prompt-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.prompt-heading strong { font-family: var(--serif); font-size: 20px; }
.prompt-close {
  width: 32px;
  height: 32px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--espresso);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.prompt-text {
  flex: 1;
  min-height: 0;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--sans);
  font-size: clamp(13px, 1.4vw, 16px);
  line-height: 1.9;
}
.novel-list h3 { margin: 5px 0; font-size: clamp(17px, 2vw, 21px); }
.novel-list p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.novel-list .actions { margin-top: auto; }

.novel-list > li:not([data-position="0"]) .roast-card {
  cursor: pointer;
}
.novel-list > li:not([data-position="0"]) .log-meta,
.novel-list > li:not([data-position="0"]) p,
.novel-list > li:not([data-position="0"]) .actions {
  display: none;
}
.novel-list > li:not([data-position="0"]) h3 {
  margin: 0;
  text-align: center;
}

.novel-controls:not([hidden]) {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  margin-top: 8px;
}

.novel-arrow,
.novel-dot,
.novel-pause {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--espresso);
  cursor: pointer;
}

.novel-arrow {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 20px;
}

.novel-position {
  min-width: 38px;
  text-align: center;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.novel-dots { display: flex; gap: 8px; }
.novel-dot { width: 10px; height: 10px; padding: 0; border-radius: 50%; }
.novel-dot[aria-current="true"] { background: var(--espresso); }
.novel-pause { border-radius: 999px; padding: 5px 12px; font-size: 12px; }

.novel-arrow:focus-visible,
.novel-dot:focus-visible,
.novel-pause:focus-visible,
.novel-list:focus-visible {
  outline: 3px solid var(--espresso);
  outline-offset: 3px;
}

.novel-back {
  flex: none;
  margin: 4px 0 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
}
.novel-back a { color: var(--espresso); text-underline-offset: 4px; }

@media (max-width: 700px) {
  .novel-list > li { width: 78vw; }
  .novel-list > li[data-position="-1"] { transform: translateX(-116%) scale(.82); }
  .novel-list > li[data-position="1"] { transform: translateX(16%) scale(.82); }
  .novel-page .section-title { margin: 0 48px 8px; }
  .novel-page .section-title .en { font-size: 17px; }
  .novel-list p { font-size: 13px; -webkit-line-clamp: 2; line-clamp: 2; }
  .novel-controls:not([hidden]) { gap: 8px; }
  .novel-pause { padding-inline: 8px; }
}

@media (max-height: 560px) {
  body.novel-page .log.roastery { padding-top: 42px; padding-bottom: 4px; }
  .novel-page .section-title { margin-bottom: 4px; }
  .novel-page .section-title .en { font-size: 16px; }
  .novel-list .roast-card { padding: 8px; }
  .novel-list p { -webkit-line-clamp: 1; line-clamp: 1; }
  .novel-controls:not([hidden]) { min-height: 38px; margin-top: 2px; }
  .novel-arrow { width: 32px; height: 32px; }
  .novel-back { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .novel-list > li { transition: none; }
}
