#feature-sheet-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

#feature-sheet-modal.is-open {
  opacity: 1;
  pointer-events: all;
}

.fsm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 30, 0.95);
  cursor: pointer;
}

.fsm-book-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 1;
  width: 92vw;
  max-width: 1400px;
  max-height: 95vh;
  padding: 0 8px;
  filter: drop-shadow(0 40px 60px rgba(0, 0, 0, 0.7));
}

.fsm-book {
  display: flex;
  width: 100%;
  aspect-ratio: 2 / 1.414;
  max-height: 82vh;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  background: #111;
  flex-shrink: 0;
  overflow: hidden;
}

.fsm-zoom-container {
  display: flex;
  width: 100%;
  max-width: 1400px;
  max-height: 82vh;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  scrollbar-color: rgba(201, 168, 76, 0.3) transparent;
  scrollbar-width: thin;
}

.fsm-zoom-container::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.fsm-zoom-container::-webkit-scrollbar-track {
  background: transparent;
}

.fsm-zoom-container::-webkit-scrollbar-thumb {
  border-radius: 2px;
  background: rgba(201, 168, 76, 0.3);
}

#fsm-book {
  flex-shrink: 0;
  transform-origin: center top;
  transition: transform 0.2s ease;
}

.fsm-page {
  position: relative;
  width: 50%;
  height: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.fsm-page--left {
  box-shadow:
    inset -8px 0 20px rgba(0, 0, 0, 0.5),
    inset -2px 0 6px rgba(0, 0, 0, 0.6);
}

.mir-card[data-href] {
  cursor: pointer;
}

.mir-card[data-href]:hover .mir-card-img img {
  transform: scale(1.03);
  transition: transform 0.4s ease;
}

.fsm-page--right {
  box-shadow:
    inset 8px 0 20px rgba(0, 0, 0, 0.5),
    inset 2px 0 6px rgba(0, 0, 0, 0.6);
}

.fsm-page--left {
  cursor: w-resize;
}

.fsm-page--right {
  cursor: e-resize;
}

.fsm-page--left.fsm-page--disabled,
.fsm-page--right.fsm-page--disabled {
  cursor: default;
}

.fsm-page--right::after {
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  background: linear-gradient(
    225deg,
    rgba(255, 255, 255, 0.04) 50%,
    rgba(0, 0, 0, 0.12) 65%,
    transparent 85%
  );
  box-shadow: -1px -1px 6px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  position: absolute;
  content: "";
  transition: width 0.4s ease, height 0.4s ease, box-shadow 0.4s ease;
}

.fsm-page--right:hover::after {
  width: 40px;
  height: 40px;
  box-shadow: -3px -3px 10px rgba(0, 0, 0, 0.2);
}

.fsm-page--left::after {
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  background: linear-gradient(
    315deg,
    rgba(255, 255, 255, 0.04) 50%,
    rgba(0, 0, 0, 0.12) 65%,
    transparent 85%
  );
  box-shadow: 1px -1px 6px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  position: absolute;
  content: "";
  transition: width 0.4s ease, height 0.4s ease, box-shadow 0.4s ease;
}

.fsm-page--left:hover::after {
  width: 40px;
  height: 40px;
  box-shadow: 3px -3px 10px rgba(0, 0, 0, 0.2);
}

.fsm-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
  background: #111;
}

/* Forward turn - right page slides out left, left page becomes new left */
@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-8%); opacity: 0; }
}

@keyframes slideInRight {
  from { transform: translateX(8%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Backward turn - left page slides out right */
@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(8%); opacity: 0; }
}

@keyframes slideInLeft {
  from { transform: translateX(-8%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.fsm-page--exit-left {
  animation: slideOutLeft 350ms ease-in-out forwards;
}

.fsm-page--enter-right {
  animation: slideInRight 350ms ease-in-out forwards;
}

.fsm-page--exit-right {
  animation: slideOutRight 350ms ease-in-out forwards;
}

.fsm-page--enter-left {
  animation: slideInLeft 350ms ease-in-out forwards;
}

.fsm-arrow {
  position: absolute;
  top: 42%;
  z-index: 2;
  padding: 0 12px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  font-size: 72px;
  line-height: 1;
  user-select: none;
  transform: translateY(-50%);
  transition: color 0.2s;
}

.fsm-arrow:hover,
.fsm-arrow:focus-visible {
  color: #c9a84c;
  outline: none;
}

.fsm-arrow--prev {
  right: calc(100% + 4px);
}

.fsm-arrow--next {
  left: calc(100% + 4px);
}

.fsm-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 8px 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 40px;
  background: rgba(20, 20, 30, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.fsm-tool {
  display: flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: none;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.fsm-tool:hover,
.fsm-tool:focus-visible {
  background: rgba(201, 168, 76, 0.1);
  color: #c9a84c;
  outline: none;
}

.fsm-tool-divider {
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: rgba(255, 255, 255, 0.12);
}

.fsm-page-counter {
  font-family: "Montserrat", sans-serif;
  min-width: 72px;
  padding: 0 8px;
  color: #c9a84c;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: center;
}

.fsm-close {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 10000;
  padding: 0;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 36px;
  line-height: 1;
}

.fsm-close:hover,
.fsm-close:focus-visible {
  color: #c9a84c;
  outline: none;
}

@media (max-width: 767px) {
  .fsm-book-wrapper {
    width: 100vw;
    padding: 0;
    gap: 8px;
  }

  .fsm-zoom-container {
    width: 100vw;
    max-width: 100vw;
    max-height: calc(100dvh - 100px);
    overflow: auto;
    justify-content: center;
    align-items: flex-start;
  }

  .fsm-book {
    display: flex;
    flex-direction: row;
    width: 100vw;
    height: auto;
    max-height: calc(100dvh - 100px);
    aspect-ratio: unset;
    overflow: hidden;
    flex-shrink: 0;
  }

  .fsm-page {
    width: 50%;
    flex: 0 0 50%;
    height: auto;
    min-height: 0;
    transform: none;
  }

  .fsm-page img {
    width: 100%;
    height: auto;
    max-height: calc(100dvh - 100px);
    object-fit: contain;
    object-position: center;
  }

  .fsm-page--left {
    display: block !important;
    visibility: visible !important;
  }

  .fsm-arrow {
    position: fixed;
    top: 50%;
    font-size: 40px;
    padding: 0 4px;
    z-index: 10001;
  }

  .fsm-arrow--prev {
    right: auto;
    left: 2px;
  }

  .fsm-arrow--next {
    left: auto;
    right: 2px;
  }
}
