#naruka-bookshop-immersive .bk-shelves {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  max-width: 47%;
  display: grid;
  overflow: hidden;
  color: var(--bk-gold);
  background: linear-gradient(145deg, #604732, #3c2a1d);
  border: 1px solid #b49a6d;
  border-radius: 4px;
  box-shadow: 1px 3px 8px var(--bk-shadow);
}

#naruka-bookshop-immersive .bk-shelves :is(a, button) {
  position: static;
  display: block;
  width: 100%;
  max-width: none;
  min-height: 44px;
  padding: 7px 12px;
  text-align: left;
  line-height: 1.35;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: inherit;
  text-decoration: none;
}

#naruka-bookshop-immersive .bk-shelves a { border-top: 1px solid #aa8d596b; }
#naruka-bookshop-immersive .bk-shelves :is(a, button):hover { background: #dcb98023; }
#naruka-bookshop-immersive .bk-shelves :is(a, button):focus-visible { outline: 2px solid #f5d494; outline-offset: -3px; }
#naruka-bookshop-immersive .bk-shelves strong { display: block; font-size: 14px; }
#naruka-bookshop-immersive .bk-shelves span { display: block; color: #e3caa3; font-size: 11px; }
#naruka-bookshop-immersive .bk-shelf-update:not([hidden]) {
  display: inline-block;
  margin-inline-start: 5px;
  padding: 0 3px;
  border: 1px solid #a6724d;
  border-radius: 2px;
  background: #f0d7a8;
  color: #533420;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  vertical-align: 1px;
  white-space: nowrap;
}

html:has(.ms-shelf) { scrollbar-gutter: stable; }
html:has(.ms-shelf:modal) { overflow: hidden; }

.ms-shelf {
  --ms-ink: #3c2b20;
  --ms-muted: #6b513a;
  --ms-rule: #ab8b5369;
  --ms-accent: #405649;
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: min(960px, calc(100% - 44px));
  max-width: none;
  max-height: calc(100dvh - 52px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  color: var(--ms-ink);
  background: #f0e2c4;
  border: 1px solid #a08355;
  border-radius: 7px 8px 6px 7px;
  box-shadow: 0 5px 0 -2px #97744b, 0 28px 72px #1a100bc9;
  font: 16px/1.7 "Naruka Mincho", "Yu Mincho", "Hiragino Mincho ProN", serif;
}

.ms-shelf *, .ms-shelf *::before, .ms-shelf *::after { box-sizing: border-box; }
.ms-shelf [hidden] { display: none !important; }
.ms-shelf::-webkit-scrollbar { display: none; }
.ms-shelf::backdrop { background: #281a1194; backdrop-filter: blur(2px); }
.ms-shelf[open] { animation: ms-open .22s cubic-bezier(.2,.65,.2,1) both; }
.ms-shelf a { color: inherit; touch-action: manipulation; }
.ms-shelf a:focus-visible { outline: 2px solid #675632; outline-offset: 3px; }
.ms-shelf :is(h1, h2, p) { margin: 0; }

.ms-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 28px;
  background: #e9d7b2;
  box-shadow: 0 1px 0 var(--ms-rule), 0 4px 10px #44301410;
}

.ms-header p {
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--ms-muted);
}

.ms-header h1 { font-size: clamp(22px, 3.1vw, 32px); line-height: 1.35; letter-spacing: .05em; }
.ms-header h1:focus, .ms-paper h2:focus { outline: none; }
.ms-close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--ms-rule);
  border-radius: 3px;
  white-space: nowrap;
  text-decoration: none;
  font-size: 14px;
}
.ms-close span { font-size: 20px; line-height: 1; }
.ms-close:hover, .ms-back:hover { background: #aa87481c; }

.ms-layout {
  display: grid;
  grid-template-columns: minmax(0, .76fr) minmax(0, 1.24fr);
  min-height: 485px;
  background: radial-gradient(ellipse at 0 90%, #956a331c, transparent 64%), #f0e2c4;
}

.ms-index {
  padding: 22px 22px 24px 28px;
  border-right: 1px solid var(--ms-rule);
  background: #6b471609;
}
.ms-index h2 { font-size: 18px; font-weight: 600; }
.ms-index > p { margin-top: 2px; color: var(--ms-muted); font-size: 13px; }
.ms-index ol { margin: 14px 0 0; padding: 0; list-style: none; }
.ms-index li + li { margin-top: 10px; }

.ms-slip {
  position: relative;
  display: block;
  min-height: 88px;
  scroll-margin-top: 98px;
  padding: 10px 33px 10px 12px;
  background: linear-gradient(110deg, #f6ebd1, #f1e3c2);
  border: 1px solid #af955e8a;
  border-left: 3px solid #bba070;
  border-radius: 2px;
  box-shadow: 0 2px 4px #4d34171c;
  text-decoration: none;
  transition: transform .16s ease-out, background-color .16s ease-out, box-shadow .16s ease-out;
}
.ms-slip:is(:hover, :focus-visible, [aria-current]) {
  transform: translateX(3px);
  box-shadow: 0 3px 8px #4d341736;
  border-left-color: var(--ms-accent);
}
.ms-slip[aria-current] { background: #faf1db; }
.ms-slip-category { display: block; color: var(--ms-muted); font-size: 11px; letter-spacing: .055em; }
.ms-slip strong { display: block; margin-top: 2px; font-size: 16px; line-height: 1.35; }
.ms-hook { display: block; margin-top: 3px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.ms-neighbor { display: block; margin-top: 4px; color: var(--ms-accent); font-size: 12px; }
.ms-slip-arrow { position: absolute; top: 50%; right: 13px; translate: 0 -50%; font-size: 24px; color: var(--ms-muted); }

.ms-cover {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 14px;
  min-width: 0;
  margin: 24px 27px 26px 25px;
  padding: 28px;
  text-align: center;
  border: 1px solid var(--ms-rule);
  background: radial-gradient(ellipse at 50% 35%, #fcf3dd, #ead9b5);
  box-shadow: 3px 3px 0 -1px #d6bc8b, 4px 4px 0 -1px #b79a63, 5px 8px 15px #5b3b221f;
}
.ms-cover::before { content: ""; position: absolute; inset: 9px; border: 1px solid #a385544b; pointer-events: none; }
.ms-cover p { font-size: clamp(25px, 4.2vw, 45px); font-weight: 600; letter-spacing: .1em; line-height: 1.4; }
.ms-cover small { color: var(--ms-muted); font-size: 14px; }
.ms-cover-mark {
  width: 36px;
  height: 27px;
  border: solid #8f7349;
  border-width: 1px 1px 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent 47%, #8f734978 48% 52%, transparent 53%);
  transform: rotate(-8deg);
}

.ms-paper {
  min-width: 0;
  margin: 18px 24px 23px 22px;
  padding: 14px 22px 20px;
  border: 1px solid var(--ms-rule);
  border-radius: 2px;
  background: radial-gradient(ellipse at 110% 90%, #ab793419, transparent 65%), #f9edd3;
  box-shadow: 3px 3px 0 -1px #d6bc8b, 4px 4px 0 -1px #b79a63, 5px 7px 13px #5b3b221e;
}
.ms-paper:not([hidden]) { animation: ms-draw .24s cubic-bezier(.18,.68,.26,1) both; }
.ms-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 6px;
  margin-left: -6px;
  color: var(--ms-muted);
  font-size: 13px;
  text-underline-offset: 4px;
}
.ms-paper h2 { font-size: clamp(19px, 2.4vw, 26px); line-height: 1.45; }

.ms-books {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0;
  border: 1px solid var(--ms-rule);
}
.ms-books > div { min-width: 0; padding: 9px 11px; }
.ms-books > div + div { border-left: 1px solid var(--ms-rule); background: #52634b13; }
.ms-books span, .ms-books small { display: block; color: var(--ms-muted); font-size: 11px; }
.ms-books strong { display: block; margin: 2px 0; line-height: 1.45; font-size: 15px; overflow-wrap: anywhere; }
.ms-paper .ms-reason { font-size: 15px; line-height: 1.85; overflow-wrap: anywhere; }
.ms-note {
  margin: 14px 0 10px;
  padding: 6px 0 5px 12px;
  border-left: 2px solid #87673d;
  font-size: 15px;
  line-height: 1.8;
}
.ms-note footer { margin-top: 3px; text-align: right; font-size: 11px; color: var(--ms-muted); }
.ms-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ms-sample, .ms-purchase {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  max-width: 100%;
  padding: 6px 12px;
  border: 1px solid #52634b95;
  border-radius: 3px;
  background: #e6e6cd;
  color: #2b4637 !important;
  font-size: 14px;
  text-decoration: none;
}
.ms-sample:hover { background: #dce2c6; text-decoration: underline; text-underline-offset: 4px; }
.ms-shelf .ms-purchase { background: #f6e6c7; color: var(--ms-ink) !important; border-color: #9a7d52; }
.ms-shelf .ms-purchase:hover { background: #ecdbb9; text-decoration: underline; text-underline-offset: 4px; }
.ms-paper .ms-disclosure { margin-top: 8px; color: var(--ms-muted); font-size: 11px; line-height: 1.6; }
.ms-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@keyframes ms-open {
  from { opacity: 0; transform: translateY(9px) scale(.992); }
  to { opacity: 1; transform: none; }
}
@keyframes ms-draw {
  from { opacity: .15; transform: translateX(-12px) rotate(-.7deg); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 700px) {
  .ms-shelf { width: calc(100% - 20px); max-height: calc(100dvh - 24px); }
  .ms-header { padding: 11px 14px; }
  .ms-header p { font-size: 10px; }
  .ms-close { padding-inline: 8px; font-size: 12px; }
  .ms-layout { display: block; min-height: 0; }
  .ms-index { padding: 13px 14px 17px; border-right: 0; }
  .ms-index ol { margin-top: 10px; }
  .ms-index li + li { margin-top: 8px; }
  .ms-slip { min-height: 80px; padding-top: 7px; padding-bottom: 8px; }
  .ms-cover, .ms-layout[data-ms-detail="true"] .ms-index { display: none; }
  .ms-paper { margin: 0; padding: 5px 15px 17px; border: 0; border-radius: 0; box-shadow: none; }
  .ms-back { min-height: 44px; }
  .ms-books { margin: 10px 0 11px; }
  .ms-books > div { padding: 7px; }
  .ms-books strong { font-size: 14px; }
  .ms-paper .ms-reason, .ms-note { font-size: 14px; }
}

@media (max-width: 540px) {
  #naruka-bookshop-immersive .bk-shelves { top: 8px; right: 8px; }
  #naruka-bookshop-immersive .bk-shelves :is(a, button) { padding: 5px 8px; }
  #naruka-bookshop-immersive .bk-shelves strong { font-size: 12px; }
  #naruka-bookshop-immersive .bk-shelves span { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ms-shelf[open], .ms-paper:not([hidden]) { animation: none; }
  .ms-slip { transition: none; }
  .ms-slip:is(:hover, :focus-visible, [aria-current]) { transform: none; }
}

@media (max-width: 700px) and (orientation: portrait) {
  #naruka-bookshop-immersive .bk-shelves {
    top: auto;
    bottom: max(86px, calc(env(safe-area-inset-bottom) + 76px));
  }
}
