/*! PhotoSwipe main CSS by Dmytro Semenov | photoswipe.com */

.pswp {
  --pswp-bg: #000;
  --pswp-placeholder-bg: #222;
  

  --pswp-root-z-index: 100000;
  
  --pswp-preloader-color: rgba(79, 79, 79, 0.4);
  --pswp-preloader-color-secondary: rgba(255, 255, 255, 0.9);
  
  /* defined via js:
  --pswp-transition-duration: 333ms; */
  
  --pswp-icon-color: #fff;
  --pswp-icon-color-secondary: #4f4f4f;
  --pswp-icon-stroke-color: #4f4f4f;
  --pswp-icon-stroke-width: 2px;

  --pswp-error-text-color: var(--pswp-icon-color);
}

/*
	Styles for basic PhotoSwipe (pswp) functionality (sliding area, open/close transitions)
*/

.pswp {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: var(--pswp-root-z-index);
	display: none;
	touch-action: none;
	outline: 0;
	opacity: 0.003;
	contain: layout style size;
	-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* Prevents focus outline on the root element,
  (it may be focused initially) */

.pswp:focus {
  outline: 0;
}

.pswp * {
  box-sizing: border-box;
}

.pswp img {
  max-width: none;
}

.pswp--open {
	display: block;
}

.pswp,
.pswp__bg {
	transform: translateZ(0);
	will-change: opacity;
}

.pswp__bg {
  opacity: 0.005;
	background: var(--pswp-bg);
}

.pswp,
.pswp__scroll-wrap {
	overflow: hidden;
}

.pswp__scroll-wrap,
.pswp__bg,
.pswp__container,
.pswp__item,
.pswp__content,
.pswp__img,
.pswp__zoom-wrap {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.pswp__img,
.pswp__zoom-wrap {
	width: auto;
	height: auto;
}

.pswp--click-to-zoom.pswp--zoom-allowed .pswp__img {
	cursor: -webkit-zoom-in;
	cursor: -moz-zoom-in;
	cursor: zoom-in;
}

.pswp--click-to-zoom.pswp--zoomed-in .pswp__img {
	cursor: move;
	cursor: -webkit-grab;
	cursor: -moz-grab;
	cursor: grab;
}

.pswp--click-to-zoom.pswp--zoomed-in .pswp__img:active {
  cursor: -webkit-grabbing;
  cursor: -moz-grabbing;
  cursor: grabbing;
}

/* :active to override grabbing cursor */

.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img,
.pswp--no-mouse-drag.pswp--zoomed-in .pswp__img:active,
.pswp__img {
	cursor: -webkit-zoom-out;
	cursor: -moz-zoom-out;
	cursor: zoom-out;
}

/* Prevent selection and tap highlights */

.pswp__container,
.pswp__img,
.pswp__button,
.pswp__counter {
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

.pswp__item {
	/* z-index for fade transition */
	z-index: 1;
	overflow: hidden;
}

.pswp__hidden {
	display: none !important;
}

/* Allow to click through pswp__content element, but not its children */

.pswp__content {
  pointer-events: none;
}

.pswp__content > * {
  pointer-events: auto;
}

/*

  PhotoSwipe UI

*/

/*
	Error message appears when image is not loaded
	(JS option errorMsg controls markup)
*/

.pswp__error-msg-container {
  display: grid;
}

.pswp__error-msg {
	margin: auto;
	font-size: 1em;
	line-height: 1;
	color: var(--pswp-error-text-color);
}

/*
class pswp__hide-on-close is applied to elements that
should hide (for example fade out) when PhotoSwipe is closed
and show (for example fade in) when PhotoSwipe is opened
 */

.pswp .pswp__hide-on-close {
	opacity: 0.005;
	will-change: opacity;
	transition: opacity var(--pswp-transition-duration) cubic-bezier(0.4, 0, 0.22, 1);
	z-index: 10; /* always overlap slide content */
	pointer-events: none; /* hidden elements should not be clickable */
}

/* class pswp--ui-visible is added when opening or closing transition starts */

.pswp--ui-visible .pswp__hide-on-close {
	opacity: 1;
	pointer-events: auto;
}

/* <button> styles, including css reset */

.pswp__button {
	position: relative;
	display: block;
	width: 50px;
	height: 60px;
	padding: 0;
	margin: 0;
	overflow: hidden;
	cursor: pointer;
	background: none;
	border: 0;
	box-shadow: none;
	opacity: 0.85;
	-webkit-appearance: none;
	-webkit-touch-callout: none;
}

.pswp__button:hover,
.pswp__button:active,
.pswp__button:focus {
  transition: none;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  opacity: 1;
}

.pswp__button:disabled {
  opacity: 0.3;
  cursor: auto;
}

.pswp__icn {
  fill: var(--pswp-icon-color);
  color: var(--pswp-icon-color-secondary);
}

.pswp__icn {
  position: absolute;
  top: 14px;
  left: 9px;
  width: 32px;
  height: 32px;
  overflow: hidden;
  pointer-events: none;
}

.pswp__icn-shadow {
  stroke: var(--pswp-icon-stroke-color);
  stroke-width: var(--pswp-icon-stroke-width);
  fill: none;
}

.pswp__icn:focus {
	outline: 0;
}

/*
	div element that matches size of large image,
	large image loads on top of it,
	used when msrc is not provided
*/

div.pswp__img--placeholder,
.pswp__img--with-bg {
	background: var(--pswp-placeholder-bg);
}

.pswp__top-bar {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 60px;
	display: flex;
  flex-direction: row;
  justify-content: flex-end;
	z-index: 10;

	/* allow events to pass through top bar itself */
	pointer-events: none !important;
}

.pswp__top-bar > * {
  pointer-events: auto;
  /* this makes transition significantly more smooth,
     even though inner elements are not animated */
  will-change: opacity;
}

/*

  Close button

*/

.pswp__button--close {
  margin-right: 6px;
}

/*

  Arrow buttons

*/

.pswp__button--arrow {
  position: absolute;
  top: 0;
  width: 75px;
  height: 100px;
  top: 50%;
  margin-top: -50px;
}

.pswp__button--arrow:disabled {
  display: none;
  cursor: default;
}

.pswp__button--arrow .pswp__icn {
  top: 50%;
  margin-top: -30px;
  width: 60px;
  height: 60px;
  background: none;
  border-radius: 0;
}

.pswp--one-slide .pswp__button--arrow {
  display: none;
}

/* hide arrows on touch screens */

.pswp--touch .pswp__button--arrow {
  visibility: hidden;
}

/* show arrows only after mouse was used */

.pswp--has_mouse .pswp__button--arrow {
  visibility: visible;
}

.pswp__button--arrow--prev {
  right: auto;
  left: 0px;
}

.pswp__button--arrow--next {
  right: 0px;
}

.pswp__button--arrow--next .pswp__icn {
  left: auto;
  right: 14px;
  /* flip horizontally */
  transform: scale(-1, 1);
}

/*

  Zoom button

*/

.pswp__button--zoom {
  display: none;
}

.pswp--zoom-allowed .pswp__button--zoom {
  display: block;
}

/* "+" => "-" */

.pswp--zoomed-in .pswp__zoom-icn-bar-v {
  display: none;
}

/*

  Loading indicator

*/

.pswp__preloader {
  position: relative;
  overflow: hidden;
  width: 50px;
  height: 60px;
  margin-right: auto;
}

.pswp__preloader .pswp__icn {
  opacity: 0;
  transition: opacity 0.2s linear;
  animation: pswp-clockwise 600ms linear infinite;
}

.pswp__preloader--active .pswp__icn {
  opacity: 0.85;
}

@keyframes pswp-clockwise {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/*

  "1 of 10" counter

*/

.pswp__counter {
  height: 30px;
  margin-top: 15px;
  margin-inline-start: 20px;
  font-size: 14px;
  line-height: 30px;
  color: var(--pswp-icon-color);
  text-shadow: 1px 1px 3px var(--pswp-icon-color-secondary);
  opacity: 0.85;
}

.pswp--one-slide .pswp__counter {
  display: none;
}

@font-face {
    font-family: 'OpenSans Regular';
    src: url('./font/OpenSans-Regular.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'OpenSans SemiBold';
    src: url('./font/OpenSans-SemiBold.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Merriweather';
    src: url('./font/Merriweather-VariableFont.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Roboto';
    src: url('./font/Roboto-Regular.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Caudex';
    src: url('./font/Caudex-Regular.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Langar';
    src: url('./font/Langar-Regular.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'Caveat';
    src: url('./font/Caveat-Regular.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'RedditSans';
    src: url('./font/RedditSans-VariableFont_wght.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'BionicFast Sans';
    src: url('./font/BionicFast-Sans.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'BionicFast Serif';
    src: url('./font/BionicFast-Serif.ttf') format('truetype');
    font-display: swap;
}

@font-face {
    font-family: 'BionicFastSans Dotted';
    src: url('./font/BionicFast-Sans_Dotted.ttf') format('truetype');
    font-display: swap;
}

/**
 * Highlight Overlay Styles
 * CSS variables for highlight colors and styles
 * Synchronized with HighlightStyle enum in GreyParrot.Reader.Contracts.Client.Models
 */

@layer base {
    :root {
        /* Highlight Colors - Tailwind-compatible */
        --highlight-color-blue: #3b82f6;
        --highlight-color-yellow: #fbbf24;
        --highlight-color-green: #10b981;
        --highlight-color-red: #ef4444;
        --highlight-color-purple: #8b5cf6;
        --highlight-color-purple-dark: #7c3aed;
        --highlight-color-orange: #f97316;
        --highlight-color-gray: #6b7280;

        /* Highlight Overlay Styles */
        --highlight-overlay-blue-underline: border-bottom: 2px solid var(--highlight-color-blue);
        --highlight-overlay-yellow-highlight: border: 2px solid var(--highlight-color-yellow); 
        --highlight-overlay-green-dotted: border-bottom: 2px dotted var(--highlight-color-green);
        --highlight-overlay-red-wavy: border-bottom: 2px solid var(--highlight-color-red); 
        --highlight-overlay-purple-bold: background-color: rgba(139, 92, 246, 0.2); 
        --highlight-overlay-orange-dashed: border-bottom: 2px dashed var(--highlight-color-orange);

        /* Highlight Preview Styles (for style selector) */
        --highlight-preview-blue-underline: color: var(--highlight-color-blue); 
        --highlight-preview-yellow-highlight: background-color: rgba(254, 240, 138, 0.5); 
        --highlight-preview-green-dotted: color: var(--highlight-color-green); 
        --highlight-preview-red-wavy: color: var(--highlight-color-red);
        --highlight-preview-purple-bold: background-color: rgba(139, 92, 246, 0.5); 
        --highlight-preview-orange-dashed: color: var(--highlight-color-orange); 
    }
}

/*
 * SmartBoundary injection styles
 * These styles must apply inside isolated document contexts (iframes, shadow DOM).
 * This file is:
 *   1. @imported in _smart-boundary.css (main CSS bundle)
 *   2. Injected at runtime into iframes via ?raw import in book-reader.ts
 */

.gp-pr--inTextTranslation-translation {
    color: var(--InTextTranslationStyle-color) !important;
    font-style: var(--InTextTranslationStyle-fontStyle) !important;
    font-weight: var(--InTextTranslationStyle-fontWeight) !important; /* important because italic = -100 to normal weight */
    text-decoration: var(--InTextTranslationStyle-textDecoration) !important;
}

.gp-pr--inTextTranslation-text {
    color: var(--InTextTranslationTextStyle-color) !important;
    font-style: var(--InTextTranslationTextStyle-fontStyle) !important;
    font-weight: var(--InTextTranslationTextStyle-fontWeight) !important; /* important because italic = -100 to normal weight */
    text-decoration: var(--InTextTranslationTextStyle-textDecoration) !important;
}

.gp-pr--paragraphTranslation-text {
    color: var(--ParagraphTranslationStyle-color) !important;
    font-style: var(--ParagraphTranslationStyle-fontStyle) !important;
    font-weight: var(--ParagraphTranslationStyle-fontWeight) !important;
    text-decoration: var(--ParagraphTranslationStyle-textDecoration) !important;
    clear: both;
}

/* Image: aspect ratio fix + clickable for lightbox */

img {
    cursor: pointer;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

.greyParrot-underline {
    text-decoration: underline !important
}

/* Old - to check */

.grey-parrot-tooltip.e-tooltip-wrap.e-popup {
    background-color: var(--color-sf-content-bg-color);
    border: 1px solid #111827
}

.e-tooltip-wrap .e-tip-content {
    color: var(--neutral-foreground-rest);
    overflow: visible
}

/* Note separator with rounded notch */

.note-separator-container {
    margin: 12px 0;
    width: 100%;
    height: 10px;
}

.note-separator {
    width: 100%;
    height: 100%;
}

.grey-parrot-tooltip.e-toolbar {
    background: transparent !important;
    border: 0 none !important;
    box-shadow: none !important;
}

/* Note selector container */

.note-selector-container {
    margin-bottom: 8px;
}

.note-selector-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.note-count {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.note-indicators {
    display: flex;
    gap: 4px;
    flex: 1;
}

.note-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 150ms;
    opacity: 0.6;
}

.note-indicator:hover {
        opacity: 1;
        transform: scale(1.1);
    }

.note-indicator.selected {
        opacity: 1;
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    }

.note-dropdown {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--neutral-foreground-rest);
    cursor: pointer;
    transition: all 150ms;
}

.note-dropdown:hover {
        background-color: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.2);
    }

.note-dropdown:focus {
        outline: none;
        border-color: #3b82f6;
        background-color: rgba(59, 130, 246, 0.1);
    }

/* ClassicBookReaderLayout — height chain for book reader iframe */

/* TopBarLayout content area → flex column */

.book-reader-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Syncfusion SfTooltip wrapper (injected by SmartBoundary's GpTooltip) → propagate flex.
   Uses descendant selector because a wrapper div sits between .book-reader-layout and .e-control. */

.book-reader-layout .e-control {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* SmartBoundary content div → fill and flex */

.book-reader-boundary {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
}

/* SmartStyleBoundary outer wrapper (div.relative.isolate) → fill and flex */

.book-reader-boundary > div {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* SmartStyleBoundary article (.read-presenter) → fill and flex */

.book-reader-style-inner {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* SmartContent wrapper div (position:relative, holds ContentRef) → fill and flex */

.book-reader-style-inner > div {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* In scrolled modes, padding moves from article into iframe body so the scrollbar
   sits flush against the window edge. JS adds this class dynamically. */

.book-reader-no-article-padding {
    padding: 0 !important;
}

/* Reader container — target for epub.js rendition.
   padding-bottom reserves space for the floating bottom toolbar (TopBarLayout).
   --bottomToolbar-height cascades from TopBarLayout's article element. */

#greyparrot-book-reader {
    flex-grow: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    padding-bottom: var(--bottomToolbar-height, 0px);
    box-sizing: border-box;
}

/* Vertical paged mode (readingMode=1): hidden in UI due to epub.js limitation —
   epub.js can't block user scroll while keeping text selection.
   Falls back to scrolled behavior. Will be implemented properly in Phase 2 (custom renderer). */

#greyparrot-book-reader.book-reader-vertical-paged,
/* Vertical continuous mode: allow native vertical scrolling with scrollbar */
#greyparrot-book-reader.book-reader-scrolled {
    overflow: visible;
}

/* epub.js sets viewport-container { height:100% }, but percentage heights
   don't resolve when the parent's height comes only from flex layout.
   Absolute positioning with inset:0 gives a definite size regardless. */

#greyparrot-book-reader > .viewport-container {
    position: absolute !important;
    inset: 0 !important;
    height: auto !important;
}

/* -- Bottom toolbar (compact, mobile-first) -- */

/* Compact nav buttons — reduce default Syncfusion button sizing */

.reader-nav-btn.e-btn {
    min-width: 32px;
    padding: 4px 6px;
}

/* Progress indicator — stacked chapter text + progress bar, fixed height to match nav buttons */

.reader-progress-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 2px 6px;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
    gap: 2px;
}

.reader-progress-btn:hover {
    opacity: 0.7;
}

/* Thin progress bar track */

.reader-progress-bar {
    width: 50px;
    height: 3px;
    border-radius: 9999px;
    background: #e5e7eb; /* gray-200 */
    overflow: hidden;
}

/* Progress bar fill */

.reader-progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background: #6b7280; /* gray-500 */
    transition: width 0.3s ease;
}

/* ClassicBookReaderLayout v2 — height chain for custom iframe (no epub.js) */

/* Propagate flex through SmartBoundary / SmartStyleBoundary wrapper chain.
   All intermediate wrappers need: flex column, grow, min-height:0. */

.book-reader-layout,
.book-reader-layout .e-control,
.book-reader-boundary,
.book-reader-boundary > div,
.book-reader-style-inner,
.book-reader-style-inner > div {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
}

/* SmartBoundary content div needs full width */

.book-reader-boundary {
    width: 100%;
}

/* Reader container — target for the custom iframe.
   padding-bottom reserves space for the floating bottom toolbar (TopBarLayout).
   --bottomToolbar-height cascades from TopBarLayout's article element. */

#greyparrot-book-reader {
    flex: 1 1 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
    padding-bottom: var(--bottomToolbar-height, 0px);
    box-sizing: border-box;
}

/* Iframe fills the reader container */

#greyparrot-book-reader > iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Vertical continuous mode: allow native vertical scrolling */

#greyparrot-book-reader.mode-vertical-continuous {
    overflow: visible;
}

/* In scrolled modes, padding moves from article into iframe body so the scrollbar
   sits flush against the window edge. JS adds this class dynamically. */

.book-reader-no-article-padding {
    padding: 0 !important;
}

/* -- Bottom toolbar (compact, mobile-first) -- */

/* Compact nav buttons — reduce default Syncfusion button sizing */

.reader-nav-btn.e-btn {
    min-width: 32px;
    padding: 4px 6px;
}

/* Progress indicator — stacked chapter text + progress bar, fixed height to match nav buttons */

.reader-progress-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 2px 6px;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
    gap: 2px;
}

.reader-progress-btn:hover {
    opacity: 0.7;
}

/* Thin progress bar track */

.reader-progress-bar {
    width: 50px;
    height: 3px;
    border-radius: 9999px;
    background: #e5e7eb; /* gray-200 */
    overflow: hidden;
}

/* Progress bar fill */

.reader-progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background: #6b7280; /* gray-500 */
    transition: width 0.3s ease;
}

/* Ink Reader Layout — interactive fiction game reader */

.ink-reader-root {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* ===== Scroll container ===== */

.ink-reader-scroll-container {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex: 1 1 0;
    min-height: 0;
    /* scroll-behavior controlled via JS scrollTo({ behavior }) for instant vs smooth */
    /* Hide scrollbar but keep scroll functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.ink-reader-scroll-container::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

/* Inner content wrapper — centers and constrains width */

.ink-reader-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem 1rem 40vh; /* Bottom padding pushes current paragraph to top area */
    width: 100%;
    margin: 0 auto;
}

/* Prose width mode — comfortable reading width */

.ink-reader-content.ink-prose-width {
        max-width: 65ch;
    }

/* ===== Options button — subtle, immersive ===== */

.ink-options-btn {
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 20;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #9ca3af;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.3s ease, background 0.3s ease, color 0.3s ease;
}

.ink-options-btn:hover,
    .ink-options-btn:active {
        opacity: 1;
        background: rgba(255, 255, 255, 0.7);
        color: #374151;
    }

/* ===== Story steps ===== */

.ink-story-step {
    transition: opacity 0.5s ease;
    padding: 0.5rem 0;
}

/* Past steps — dimmed by default */

.ink-step-past {
    opacity: 0.4;
    transition: opacity 0.5s ease;
}

/* Undim when scrolled into view (IntersectionObserver) */

.ink-step-past.ink-step-visible {
        opacity: 0.75;
    }

/* Current step — full opacity, subtle left accent (line outside text to keep text aligned with history) */

.ink-step-current {
    opacity: 1;
    position: relative;
    animation: ink-fade-in 0.4s ease;
}

.ink-step-current::before {
        content: '';
        position: absolute;
        left: -0.75rem;
        top: 0;
        bottom: 0;
        width: 2px;
        background: #d1d5db;
    }

@keyframes ink-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Step separator between past steps */

.ink-step-separator {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 0.25rem 0;
    opacity: 0.35;
}

/* ===== Chosen choice indicator (past steps) ===== */

.ink-chosen-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-left: 2px solid #9ca3af;
    color: #6b7280;
    font-style: italic;
    font-size: 0.9em;
    line-height: 1.5;
}

.ink-chosen-choice i {
        flex-shrink: 0;
        margin-top: 0.25em;
        font-size: 0.65em;
        opacity: 0.6;
    }

/* ===== Choices container ===== */

.ink-choices-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

/* Choices fade-in after typewriter */

.ink-choices-container.ink-choices-reveal {
        animation: ink-choices-fade-in 0.5s ease;
    }

@keyframes ink-choices-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ink-choice-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    min-height: 48px;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease, padding 0.35s ease, margin 0.35s ease, border-width 0.35s ease;
    max-height: 200px;
    overflow: hidden;
}

.ink-choice-text {
    flex: 1;
    user-select: text;
    line-height: 1.5;
}

/* SmartHtml wraps text in <p> — strip margins inside choice and chosen-choice containers */

.ink-choice-text p,
    .ink-chosen-choice p {
        margin: 0;
        padding: 0;
    }

/* Circle icon button for choosing */

.ink-choice-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #374151;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.1s;
}

.ink-choice-btn:hover {
        background: #1f2937;
    }

.ink-choice-btn:active {
        transform: scale(0.95);
    }

.ink-choice-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

/* Choice animation: hide non-chosen */

.ink-choice-hiding {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    border-width: 0;
    overflow: hidden;
}

/* Choice animation: chosen transforms to past indicator */

.ink-choice-chosen {
    border-color: #9ca3af;
    border-left-width: 3px;
    background: #f9fafb;
}

/* ===== Story end ===== */

.ink-story-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1.5rem;
    text-align: center;
    font-style: italic;
    color: #6b7280;
}

.ink-story-end span {
        font-size: 1.25rem;
        letter-spacing: 0.1em;
    }

/* ===== Hide history mode — only current step visible ===== */

.ink-hide-history .ink-step-past {
    display: none;
}

/* ===== Ink tag: CLEAR separator ===== */

.ink-clear-separator {
    border: none;
    border-top: 2px dashed #d1d5db;
    margin: 1rem 0;
}

/* ===== Typewriter effect ===== */

/* CSS-level hiding before JS typewriter takes over (prevents FOUC on slow devices) */

.ink-typewriter-pending :is(p, li, h1, h2, h3, h4, h5, h6) {
    clip-path: polygon(0 0, 0 0, 0 0, 0 0);
}

.ink-typewriter-cursor::after {
    content: '▎';
    animation: ink-blink 0.7s step-end infinite;
    color: #6b7280;
    font-weight: 300;
}

@keyframes ink-blink {
    50% {
        opacity: 0;
    }
}

/* ===== Ensure SmartBoundary/SmartStyleBoundary fill the flex layout ===== */

.ink-reader-boundary {
    height: 100vh;
}

.ink-reader-boundary,
    .ink-reader-boundary > div {
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
    }

.ink-reader-style-inner {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
}