/* ===========================================================
   Nightshelf — style.css
   A lamplit reading-room look, with a light "daytime" theme
   toggle. All app chrome uses CSS variables so switching
   [data-theme] on <html> swaps the whole palette instantly.
   =========================================================== */

:root{
  --bg:            #12142A;
  --bg-deep:       #0C0E20;
  --panel:         #1B1E3D;
  --card:          #21254A;
  --card-hover:    #292E58;
  --border:        rgba(242, 239, 230, 0.10);
  --border-strong: rgba(242, 239, 230, 0.22);

  --ink:           #F3EFE4;
  --ink-muted:     #A3A6CC;
  --ink-faint:     #6E71A0;

  --amber:         #E8A33D;
  --amber-soft:    #F2C572;
  --amber-deep:    #B87A22;

  --page:          #F7F1E1;
  --page-shadow:   #E4D9BC;
  --page-ink:      #2B2419;

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius-lg: 18px;
  --radius-md: 12px;

  --reading-scale: 1;
}

/* ---------- Light theme override ---------- */
[data-theme="light"]{
  --bg:            #F3EEE1;
  --bg-deep:       #EAE2CE;
  --panel:         #FFFDF7;
  --card:          #FFFFFF;
  --card-hover:    #FBF4E2;
  --border:        rgba(43, 36, 22, 0.10);
  --border-strong: rgba(43, 36, 22, 0.22);

  --ink:           #241E12;
  --ink-muted:     #5B5136;
  --ink-faint:     #8A7F62;

  --amber:         #C97C2B;
  --amber-soft:    #A8621C;
  --amber-deep:    #8C5416;

  --page:          #FFFDF6;
  --page-shadow:   #E4D9BC;
  --page-ink:      #2B2419;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }

body{
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(232,163,61,0.10), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* A faint animated grain over everything — reads as "printed paper",
   and quietly defeats flat colour-matched re-shoots of the screen. */
body::before{
  content: "";
  position: fixed; inset: 0; z-index: 2;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

input, textarea{ -webkit-user-select: text; user-select: text; }
img{ -webkit-user-drag: none; user-drag: none; }

::selection{ background: var(--amber); color: #1A1305; }
a{ color: var(--amber-soft); text-decoration: none; }

::-webkit-scrollbar{ width: 10px; height: 10px; }
::-webkit-scrollbar-track{ background: var(--bg-deep); }
::-webkit-scrollbar-thumb{ background: var(--panel); border-radius: 10px; border: 2px solid var(--bg-deep); }

/* =========================================================
   App chrome
   ========================================================= */
.ns-navbar{
  background: linear-gradient(180deg, var(--bg-deep), transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  padding: 0.9rem 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.ns-disclaimer{
  text-align: center;
  font-family: var(--sans);
  font-size: 0.74rem;
  font-style: italic;
  color: var(--ink-faint);
  background: var(--bg-deep);
  border-bottom: 1px dashed var(--border);
  padding: 0.5rem 1rem;
  position: relative;
  z-index: 19;
}
.ns-disclaimer strong{ font-style: normal; font-weight: 600; color: var(--ink-muted); }

.ns-brand{
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  letter-spacing: 0.02em;
}
.ns-brand img{ width: 30px; height: 30px; border-radius: 50%; }

.ns-tagline{
  color: var(--ink-faint);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ns-icon-btn{
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink-muted);
  border-radius: 999px;
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}
.ns-icon-btn svg{ display: block; transition: transform 0.4s cubic-bezier(.2,.8,.2,1); }
.ns-icon-btn:hover{ color: var(--ink); border-color: var(--amber); background: rgba(232,163,61,0.08); }
.ns-icon-btn:hover svg{ transform: rotate(18deg) scale(1.08); }
.ns-icon-btn:active svg{ transform: rotate(-10deg) scale(0.9); }

.ns-back-btn{
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink-muted);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}
.ns-back-btn svg{ display: block; transition: transform 0.2s ease; }
.ns-back-btn:hover{ color: var(--ink); border-color: var(--amber); background: rgba(232,163,61,0.08); }
.ns-back-btn:hover svg{ transform: translateX(-2px); }

.ns-install-btn{
  background: rgba(232,163,61,0.1);
  border: 1px solid rgba(232,163,61,0.4);
  color: var(--amber-soft);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}
.ns-install-btn svg{ display: block; }
.ns-install-btn:hover{ background: var(--amber); color: #1A1305; border-color: var(--amber); }
.ns-install-btn .label{ white-space: nowrap; }
@media (max-width: 575.98px){ .ns-install-btn .label{ display: none; } }

main{ padding-bottom: 5rem; }

.ns-view{ display: none; }
.ns-view.active{ display: block; animation: fadeUp 0.4s ease; }

@keyframes fadeUp{ from{ opacity: 0; transform: translateY(10px);} to{ opacity: 1; transform: translateY(0);} }
@media (prefers-reduced-motion: reduce){
  .ns-view.active{ animation: none; }
  .ns-col, .ns-episode-card{ opacity: 1 !important; transform: none !important; animation: none !important; }
  .ns-page.ns-flip-next, .ns-page.ns-flip-prev{ animation: none !important; }
  .ns-hero-motes{ display: none; }
  .ns-loading .spinner{ animation: spin 0.9s linear infinite !important; }
  * { scroll-behavior: auto !important; }
}

/* =========================================================
   Search box
   ========================================================= */
.ns-search-wrap{
  max-width: 420px;
  margin: 0 auto 0.5rem;
  position: relative;
}
.ns-search-wrap input{
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.6rem 1.1rem 0.6rem 2.4rem;
  font-size: 0.92rem;
}
.ns-search-wrap input::placeholder{ color: var(--ink-faint); }
.ns-search-wrap input:focus{
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232,163,61,0.15);
}
.ns-search-wrap .icon{
  position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); pointer-events: none;
  display: inline-flex;
}
.ns-no-results{
  text-align: center;
  color: var(--ink-faint);
  padding: 2.5rem 1rem;
  font-family: var(--serif);
  font-style: italic;
  display: none;
}

/* =========================================================
   Continue Reading strip
   ========================================================= */
.ns-continue{
  display: none;
  background: linear-gradient(120deg, var(--panel), var(--card));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  margin: 0 0 2rem;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.ns-continue:hover{ transform: translateY(-2px); border-color: var(--amber); }
.ns-continue img{
  width: 52px; height: 52px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.ns-continue .meta{ flex: 1; min-width: 0; }
.ns-continue .label{
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 0.15rem;
}
.ns-continue .title{ font-family: var(--serif); font-weight: 600; color: var(--ink); }
.ns-continue .sub{ font-size: 0.8rem; color: var(--ink-faint); }
.ns-continue .go{ color: var(--amber); font-size: 1.3rem; flex-shrink: 0; }

/* =========================================================
   Landing — the shelf
   ========================================================= */
.ns-hero{ padding: 2.4rem 0 1.4rem; text-align: center; position: relative; }
.ns-hero h1{ font-family: var(--serif); font-size: clamp(2rem, 5vw, 3rem); font-weight: 600; margin-bottom: 0.5rem; position: relative; }
.ns-hero p{ color: var(--ink-muted); font-size: 1.02rem; max-width: 520px; margin: 0 auto 1.6rem; position: relative; }

/* Slow drifting light motes behind the hero — a lamplit-room touch */
.ns-hero-motes{ position: absolute; inset: -1rem 0 auto 0; height: 220px; overflow: hidden; pointer-events: none; z-index: 0; }
.ns-hero-motes span{
  position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%;
  background: var(--amber-soft); opacity: 0; filter: blur(0.5px);
  animation: moteRise 9s ease-in infinite;
}
.ns-hero-motes span:nth-child(1){ left: 8%;  animation-delay: 0s;   }
.ns-hero-motes span:nth-child(2){ left: 28%; animation-delay: 1.8s; }
.ns-hero-motes span:nth-child(3){ left: 50%; animation-delay: 3.6s; }
.ns-hero-motes span:nth-child(4){ left: 72%; animation-delay: 5.4s; }
.ns-hero-motes span:nth-child(5){ left: 90%; animation-delay: 7.2s; }
@keyframes moteRise{
  0%{ transform: translate(0, 0); opacity: 0; }
  15%{ opacity: 0.55; }
  100%{ transform: translate(12px, -200px); opacity: 0; }
}

.ns-shelf-label{
  font-family: var(--serif); font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-faint); margin: 2rem 0 1rem; display: flex; align-items: center; gap: 0.75rem;
}
.ns-shelf-label::after{ content: ""; flex: 1; height: 1px; background: var(--border); }

.ns-book-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1.6rem 1.4rem;
  padding-bottom: 1.5rem;
}

.ns-book{
  cursor: pointer;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 7 / 10;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35), 0 2px 0 rgba(255,255,255,0.03) inset;
  transform: perspective(600px) rotateY(0deg);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), box-shadow 0.35s ease;
  border: 1px solid var(--border-strong);
}
.ns-book img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.ns-book::before{
  content: "";
  position: absolute; top: 3px; bottom: 3px; right: -6px; width: 8px;
  background: repeating-linear-gradient(180deg, #EDE6D2, #EDE6D2 2px, #D9CFAE 2px, #D9CFAE 4px);
  border-radius: 0 3px 3px 0;
  box-shadow: 2px 0 4px rgba(0,0,0,0.3);
  z-index: -1;
}
.ns-book:hover{
  transform: perspective(600px) rotateY(-8deg) translateY(-4px);
  box-shadow: -10px 16px 28px rgba(0,0,0,0.45), 0 0 26px rgba(232,163,61,0.22);
}

.ns-col{ opacity: 0; transform: translateY(16px); }
.ns-col.ns-book-in{ animation: bookIn 0.55s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes bookIn{ to{ opacity: 1; transform: translateY(0); } }
.ns-book .corner-fold{
  position: absolute; right: 0; bottom: 0; width: 0; height: 0;
  border-style: solid; border-width: 0 0 34px 34px;
  border-color: transparent transparent rgba(247,241,225,0.92) transparent;
  filter: drop-shadow(-2px -2px 3px rgba(0,0,0,0.3));
  transition: border-width 0.25s ease;
}
.ns-book:hover .corner-fold{ border-width: 0 0 46px 46px; }

.ns-book-meta{ margin-top: 0.65rem; }
.ns-book-meta .title{ font-family: var(--serif); font-weight: 600; font-size: 0.98rem; color: var(--ink); line-height: 1.25; }
.ns-book-meta .genre{ font-size: 0.74rem; color: var(--amber); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 0.15rem; }

/* =========================================================
   Story detail — table of contents
   ========================================================= */
.ns-story-header{ display: flex; gap: 2rem; padding: 2.2rem 0 1rem; flex-wrap: wrap; }
.ns-story-header .cover-wrap{ flex: 0 0 auto; width: 190px; }
.ns-story-header .cover-wrap img{
  width: 100%; border-radius: var(--radius-md); box-shadow: 0 14px 30px rgba(0,0,0,0.4); border: 1px solid var(--border-strong);
}
.ns-story-header .info{ flex: 1 1 320px; min-width: 260px; align-self: center; }
.ns-story-header .genre-tag{
  display: inline-block; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--amber); border: 1px solid var(--amber); border-radius: 999px; padding: 0.2rem 0.7rem; margin-bottom: 0.7rem;
}
.ns-story-header h2{ font-family: var(--serif); font-size: clamp(1.6rem, 3.6vw, 2.3rem); font-weight: 600; margin-bottom: 0.3rem; }
.ns-story-header .author{ color: var(--ink-faint); font-size: 0.88rem; margin-bottom: 0.9rem; }
.ns-story-header .desc{ color: var(--ink-muted); line-height: 1.65; max-width: 560px; }

.ns-episode-list{ display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.3rem; margin-top: 1.8rem; }

.ns-episode-card{
  cursor: pointer; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  opacity: 0; transform: translateY(16px);
}
.ns-episode-card.ns-in{ animation: bookIn 0.55s cubic-bezier(.2,.8,.2,1) forwards; }
.ns-episode-card:hover{ transform: translateY(-4px); background: var(--card-hover); border-color: var(--border-strong); box-shadow: 0 14px 26px rgba(0,0,0,0.28); }
.ns-episode-card .thumb{ aspect-ratio: 16/10; overflow: hidden; position: relative; }
.ns-episode-card .thumb img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.ns-episode-card .num{
  position: absolute; top: 10px; left: 10px; background: rgba(12,14,32,0.78); color: var(--amber-soft);
  font-family: var(--serif); font-size: 0.8rem; padding: 0.15rem 0.55rem; border-radius: 999px; border: 1px solid rgba(232,163,61,0.4);
}
.ns-episode-card .body{ padding: 0.85rem 1rem 1.05rem; }
.ns-episode-card .title{ font-family: var(--serif); font-weight: 600; font-size: 1rem; color: var(--ink); }
.ns-episode-card .excerpt{ color: var(--ink-faint); font-size: 0.8rem; margin-top: 0.3rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ns-episode-card .read-badge{
  display: inline-block; margin-top: 0.4rem; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--amber-deep);
}
.ns-episode-card .pages-tag{
  display: inline-block; margin-top: 0.4rem; margin-right: 0.5rem; font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-faint); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.05rem 0.5rem;
}

/* =========================================================
   Reader — the open page
   ========================================================= */
.ns-progress-bar{
  position: sticky; top: 0; left: 0; width: 100%; height: 3px;
  background: var(--border); z-index: 25;
}
.ns-progress-bar-fill{
  height: 100%; width: 0%; background: linear-gradient(90deg, var(--amber-deep), var(--amber-soft));
  transition: width 0.1s linear;
}

.ns-reader-wrap{ padding-top: 1.6rem; }

.ns-reader-topbar{
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap;
}
.ns-reader-topbar .crumb{ color: var(--ink-faint); font-size: 0.82rem; }
.ns-reader-topbar .crumb strong{ color: var(--ink-muted); }

.ns-progress-dots{ display: flex; gap: 0.4rem; }
.ns-progress-dots .dot{ width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); transition: background 0.2s ease, transform 0.2s ease; }
.ns-progress-dots .dot.current{ background: var(--amber); transform: scale(1.35); }
.ns-progress-dots .dot.read{ background: var(--amber-deep); }

.ns-font-controls{
  display: inline-flex; align-items: center; gap: 0.35rem; background: var(--panel);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.25rem;
}
.ns-font-controls button{
  border: none; background: transparent; color: var(--ink-muted); width: 28px; height: 28px; border-radius: 50%;
  font-family: var(--serif); font-weight: 600; font-size: 0.85rem;
}
.ns-font-controls button.active,
.ns-font-controls button:hover{ background: var(--amber); color: #1A1305; }

.ns-page{
  background: linear-gradient(180deg, var(--page), var(--page-shadow));
  color: var(--page-ink);
  border-radius: var(--radius-lg);
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem clamp(1.4rem, 5vw, 4.2rem);
  box-shadow: 0 24px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(0,0,0,0.06);
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
}
.ns-page::before{
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 40px;
  background: linear-gradient(90deg, rgba(0,0,0,0.10), transparent);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  pointer-events: none;
  z-index: 1;
}
/* Faint tiled "Nightshelf" watermark — traceable if the page is ever
   photographed or screen-captured, since blocking capture outright
   isn't something a web page can actually do. */
.ns-page::after{
  content: ""; position: absolute; inset: -10%; pointer-events: none; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='150'%3E%3Ctext x='0' y='90' font-family='Georgia, serif' font-size='22' fill='%232B2419' fill-opacity='0.045' transform='rotate(-18 0 90)'%3ENightshelf%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
}

@keyframes pageFlipNext{ from{ opacity: 0.2; transform: rotateY(6deg) scale(0.985); } to{ opacity: 1; transform: none; } }
@keyframes pageFlipPrev{ from{ opacity: 0.2; transform: rotateY(-6deg) scale(0.985); } to{ opacity: 1; transform: none; } }
.ns-page.ns-flip-next{ animation: pageFlipNext 0.4s cubic-bezier(.2,.8,.2,1); }
.ns-page.ns-flip-prev{ animation: pageFlipPrev 0.4s cubic-bezier(.2,.8,.2,1); }

.ns-page-badge{
  position: absolute; top: 16px; right: 18px; z-index: 2;
  font-family: var(--serif); font-size: 0.72rem; letter-spacing: 0.04em;
  color: var(--amber-deep); background: rgba(232,163,61,0.16);
  border: 1px solid rgba(184,122,34,0.35); border-radius: 999px; padding: 0.2rem 0.7rem;
}

.ns-page .ep-cover{ width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; margin-bottom: 1.6rem; box-shadow: 0 8px 20px rgba(0,0,0,0.2); }

.ns-page .kicker{ font-family: var(--serif); font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--amber-deep); margin-bottom: 0.4rem; }
.ns-page h3{ font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 600; margin-bottom: 1.4rem; color: #1E1810; }

.ns-page .story-text{ font-size: calc(1rem * var(--reading-scale)); }
.ns-page .story-text p{ font-family: var(--serif); font-size: 1.14em; line-height: 1.85; margin-bottom: 1.2rem; color: var(--page-ink); }
.ns-page .story-text p:first-of-type::first-letter{
  font-family: var(--serif); font-size: 3.4rem; font-weight: 600; float: left; line-height: 0.8;
  padding: 0.1rem 0.35rem 0 0; color: var(--amber-deep);
}
.ns-page .page-continues{
  text-align: center; font-family: var(--sans); font-size: 0.76rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--amber-deep); opacity: 0.8; margin-top: 0.6rem;
}
.ns-copy-note{
  max-width: 760px; margin: 0.9rem auto 0; text-align: center;
  font-size: 0.72rem; color: var(--ink-faint); letter-spacing: 0.02em;
}

.ns-reader-nav{ max-width: 760px; margin: 1.6rem auto 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.ns-nav-btn{
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--ink); border-radius: 999px;
  padding: 0.65rem 1.3rem; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 0.5rem; transition: all 0.2s ease;
  max-width: 42%;
}
.ns-nav-btn span.label{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ns-nav-btn:hover:not(:disabled){ background: var(--amber); color: #1A1305; border-color: var(--amber); }
.ns-nav-btn:disabled{ opacity: 0.35; cursor: not-allowed; }
.ns-nav-btn.invisible{ visibility: hidden; }

/* =========================================================
   Utility
   ========================================================= */
.ns-loading{ text-align: center; padding: 4rem 1rem; color: var(--ink-faint); }
.ns-loading .spinner{
  width: 34px; height: 34px; border: 3px solid var(--border-strong); border-top-color: var(--amber); border-radius: 50%; margin: 0 auto 1rem;
  animation: spin 0.9s linear infinite, flicker 1.6s ease-in-out infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }
@keyframes flicker{ 0%, 100%{ box-shadow: 0 0 6px rgba(232,163,61,0.35); } 50%{ box-shadow: 0 0 18px rgba(232,163,61,0.7); } }

.ns-error{ max-width: 560px; margin: 3rem auto; text-align: center; color: var(--ink-muted); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); padding: 2rem; }
.ns-error h4{ font-family: var(--serif); color: var(--ink); margin-bottom: 0.6rem; }

footer.ns-footer{ text-align: center; color: var(--ink-faint); font-size: 0.78rem; padding: 2rem 0 1rem; border-top: 1px solid var(--border); margin-top: 3rem; }

/* =========================================================
   Content protection UI — toast + focus-loss privacy shield
   ========================================================= */
.ns-toast{
  position: fixed; left: 50%; bottom: 26px; z-index: 70;
  transform: translate(-50%, 14px);
  background: var(--panel); color: var(--ink); border: 1px solid var(--border-strong);
  padding: 0.6rem 1.15rem; border-radius: 999px; font-size: 0.84rem;
  box-shadow: 0 14px 32px rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 90vw; text-align: center;
}
.ns-toast.show{ opacity: 1; transform: translate(-50%, 0); }

#nsPrivacyShield{
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 7, 18, 0.82);
  backdrop-filter: blur(22px) saturate(60%);
  -webkit-backdrop-filter: blur(22px) saturate(60%);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
#nsPrivacyShield.active{ opacity: 1; }
#nsPrivacyShield .mark{
  font-family: var(--serif); font-weight: 600; letter-spacing: 0.06em;
  color: var(--amber-soft); font-size: 1.15rem; opacity: 0.85;
}

@media print{
  body > *{ visibility: hidden !important; }
  body::after{
    content: "Printing is disabled for this content.";
    visibility: visible; position: fixed; inset: 0; display: flex;
    align-items: center; justify-content: center; font-family: sans-serif; font-size: 1.2rem;
  }
}

@media (max-width: 575.98px){
  .ns-page{ padding: 2.2rem 1.2rem; border-radius: 14px; }
  .ns-story-header{ flex-direction: column; align-items: center; text-align: center; }
  .ns-story-header .cover-wrap{ width: 150px; }
  .ns-reader-nav{ padding: 0 0.25rem; }
  .ns-nav-btn{ padding: 0.6rem 0.9rem; font-size: 0.82rem; max-width: 46%; }
  .ns-reader-topbar{ flex-direction: column; align-items: flex-start; }
}
