* { margin: 0; padding: 0; box-sizing: border-box; font-family: Arial, sans-serif; }

:root{
  /* Academic base */
  --bg: #ffffff;
  --text: #111111;
  --muted: rgba(17,17,17,0.85);

  /* Oromo-inspired accents (red + black) */
  --black: #0b0b0b;
  --red: #b30000;
  --redHover: #8f0000;

  /* Surfaces */
  --card: #ffffff;
  --card2: #fafafa;
  --border: rgba(0,0,0,0.12);
  --shadow: 0 10px 24px rgba(0,0,0,0.08);

  --radius: 16px;
  --radiusSm: 12px;
}

body{
  background: var(--bg);
  color: var(--text);
}

/* Links */
a{ color: var(--red); text-decoration: none; }
a:hover{ color: var(--redHover); }

/* ===== Edge-to-edge container ===== */
.container{
  max-width: none;
  margin: 0;
  padding: 14px 18px;
}

/* ===== Clean topbar: title left, copyright right ===== */
.topbar{
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--black);
  color: #fff;
  padding: 14px 18px;
  border-bottom: 3px solid var(--red);

  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
}

.mini-copy{
  position: static; /* no absolute */
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  font-weight: 500;
}

.copy-year {
  color: #c40000;   /* your brand red */
}

.copy-name {
  color: #ffffff;   /* white */
}

.title-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.brand h1{ margin:0; font-size: 1.7rem; color:#fff; }
.tagline{ margin-top: 6px; color: rgba(255,255,255,0.92); }

.subtle{ color: var(--muted); font-size: 0.95rem; }
.muted{ color: var(--muted); }

/* Nav pills (white background, red/black styling) */
.nav{
  display:flex;
  gap: 10px;
  overflow-x:auto;
  padding: 12px 0;
  position: sticky;
  top: 72px;
  z-index: 55;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-link{
  white-space: nowrap;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--black);
  font-weight: 700;
  font-size: 0.95rem;
  background: #fff;
}

.nav-link:hover{
  border-color: rgba(179,0,0,0.35);
  color: var(--red);
}

/* Cards */
.card{
  margin-top: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

h2{ margin: 0 0 10px; font-size: 1.15rem; color: var(--black); }
h1, h3 { color: var(--black); }

/* Forms */
input, select, textarea, button { width: 100%; font-size: 1rem; box-sizing: border-box; }

input, select, textarea{
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radiusSm);
  padding: 12px;
  outline: none;
}

input:focus, select:focus, textarea:focus{
  border-color: rgba(179,0,0,0.45);
  box-shadow: 0 0 0 3px rgba(179,0,0,0.12);
}

textarea{
  min-height: 120px;
  resize: vertical;
  line-height: 1.35;
}

/* Primary buttons (red) */
button{
  padding: 12px 14px;
  border-radius: var(--radiusSm);
  border: none;
  cursor: pointer;
  background: var(--red);
  color: #fff;
  font-weight: 800;
}
button:hover{ background: var(--redHover); }

/* Disabled buttons */
button:disabled,
.btn[aria-disabled="true"]{
  opacity: 0.60;
  cursor: not-allowed;
}

/* Link-buttons */
.btn{
  display:inline-block;
  padding: 12px 14px;
  border-radius: var(--radiusSm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--black);
  text-decoration:none;
  font-weight: 800;
  text-align:center;
}
.btn:hover{
  border-color: rgba(179,0,0,0.30);
  color: var(--red);
}

.btn.primary{
  background: var(--red);
  color: #fff;
  border-color: rgba(179,0,0,0.25);
}
.btn.primary:hover{ background: var(--redHover); color:#fff; }

/* Danger style: keep your original behavior */
.btn.danger, .danger{
  background: #fff;
  color: var(--black);
  border: 1px solid rgba(0,0,0,0.18);
}
.btn.danger:hover{ border-color: rgba(179,0,0,0.35); color: var(--red); }

/* Helpers */
.row{ display:flex; gap: 10px; align-items:center; }
.row > *{ flex: 1; }

.quick-actions{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 12px;
}

/* Result box (academic: clean with red left bar) */
.result-box{
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--radius);
  border-left: 4px solid var(--red);
  background: #fff;
  border: 1px solid var(--border);
}

/* Chips */
.chips{ display:flex; flex-wrap:wrap; gap:8px; margin-top: 10px; }
.chip{
  display:inline-flex;
  align-items:center;
  width:auto;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 16px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  color: var(--black);
  cursor:pointer;
  user-select:none;
}
.chip:hover{
  background: #eee;
}

.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0, 0, 0, 0);
  white-space:nowrap;
  border:0;
}

/* Global premium audio button */
.audio-btn{
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(139, 0, 0, 0.2);
  background: linear-gradient(180deg, #d11616 0%, #b30000 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(179, 0, 0, 0.26);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .18s ease, filter .18s ease;
  vertical-align: middle;
}

.audio-btn:hover{
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 8px 18px rgba(179, 0, 0, 0.32);
}

.audio-btn:active{
  transform: translateY(0);
  filter: brightness(0.97);
}

.audio-btn:focus-visible{
  outline: 2px solid rgba(179, 0, 0, 0.24);
  outline-offset: 2px;
}

.audio-btn.sm{
  width: 30px;
  height: 30px;
  box-shadow: 0 4px 10px rgba(179, 0, 0, 0.23);
}

.audio-btn .audio-icon{
  width: 15px;
  height: 15px;
  display: inline-block;
  position: relative;
}

.audio-btn .audio-icon::before{
  content: "";
  position: absolute;
  left: 3px;
  top: 2px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid #fff;
}

.audio-btn.is-playing{
  background: linear-gradient(180deg, #db2020 0%, #8e0000 100%);
  box-shadow: 0 0 0 0 rgba(179, 0, 0, 0.45), 0 8px 20px rgba(179, 0, 0, 0.4);
  animation: audioPulse 1.2s ease-out infinite;
}

.audio-btn.is-playing .audio-icon::before{
  left: 2px;
  top: 2px;
  width: 3px;
  height: 10px;
  border: 0;
  background: #fff;
  box-shadow: 6px 0 0 #fff;
}

.audio-row{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.audio-row .audio-btn{
  flex: 0 0 auto;
}

@keyframes audioPulse{
  0%{
    box-shadow: 0 0 0 0 rgba(179, 0, 0, 0.4), 0 8px 20px rgba(179, 0, 0, 0.34);
  }
  70%{
    box-shadow: 0 0 0 10px rgba(179, 0, 0, 0), 0 10px 24px rgba(179, 0, 0, 0.34);
  }
  100%{
    box-shadow: 0 0 0 0 rgba(179, 0, 0, 0), 0 8px 20px rgba(179, 0, 0, 0.34);
  }
}

/* Word list rows */
.word-list{ margin-top: 10px; display:flex; flex-direction:column; gap: 8px; }
.word-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}

/* Translator bottom action bar */
.bottom-bar{
  position: sticky;
  bottom: 0;
  z-index: 60;
  margin-top: 12px;
  padding: 10px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 -10px 24px rgba(0,0,0,0.06);
}
.bottom-actions{ display:flex; gap: 10px; }
.bottom-actions > *{ flex: 1; }

.small-actions{ display:flex; gap: 10px; margin-top: 10px; flex-wrap:wrap; }
.small-actions > *{ flex: 1; }

/* Admin layout grid */
.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}
@media (min-width: 860px){
  .grid{ grid-template-columns: 1fr 1fr; }
}

/* Footer */
.footer{
  margin-top: 18px;
  text-align:center;
  color: rgba(0,0,0,0.55);
  padding: 18px 0;
  font-size: 14px;
}

/* Mobile tweaks */
@media (min-width: 800px){
  .container{ padding: 18px; }
  .nav{ top: 78px; }
}

/* =======================================================
   NEW: File submission / multi-section forms improvements
======================================================= */

/* Make section titles (h3) look consistent inside cards */
h3{
  margin: 0 0 10px;
  font-size: 1.05rem;
}

/* Make labels consistent */
label{
  font-weight: 700;
  color: var(--black);
}

/* File input styling */
input[type="file"]{
  background: #fff;
  border: 1px dashed rgba(0,0,0,0.22);
  border-radius: var(--radiusSm);
  padding: 12px;
}

/* Code examples (CSV format blocks) */
code{
  display: inline-block;
  padding: 4px 8px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.12);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92rem;
  margin-top: 4px;
}

/* Optional: a soft divider if you want it in templates */
.divider{
  height: 1px;
  background: rgba(0,0,0,0.10);
  margin: 14px 0;
}

/* =======================================================
   NEW: Recorder UI (mic / preview / trim)
======================================================= */

.trim{
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card2);
}

.trim label{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  font-weight: 700;
  margin-right: 10px;
}

.trim input[type="number"]{
  width: 110px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
}

audio{
  width: 100%;
  margin-top: 6px;
}

/* Make tiny mic buttons in list not huge */
.word-row .btn[style*="padding:6px"]{
  width: auto;
}

/* Compact buttons inside mixed rows */
.word-row button,
.word-row .btn{
  width: auto;
}

/* Status text spacing */
[data-status-for]{
  min-height: 18px;
  display: inline-block;
}

/* Recording state (we used .danger class in JS) */
button.danger{
  border: 1px solid rgba(179,0,0,0.35);
  background: #fff;
  color: var(--red);
}
button.danger:hover{
  background: #fff;
  color: var(--redHover);
  border-color: rgba(179,0,0,0.55);
}

/* Responsive: recorder controls stack nicely */
@media (max-width: 560px){
  .row{ flex-direction: column; align-items: stretch; }
  .small-actions > *{ flex: unset; }
  .trim label{ display:flex; margin-top: 8px; }
  .trim input[type="number"]{ width: 100%; }
}

/* =======================================================
   iPhone set_up additions: native-like transitions + reduce motion
======================================================= */

a, button, .chip {
  transition: transform 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
}

a:active, button:active, .chip:active {
  transform: scale(0.98);
  opacity: 0.92;
}

.card {
  animation: fadeUp 180ms ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  a, button, .chip, .card {
    transition: none !important;
    animation: none !important;
  }
}

/* =======================================================
   LEFT SIDEBAR LAYOUT (final)
   Use in HTML:
   <div class="app-shell">
     <aside class="side-menu">...</aside>
     <main class="main-panel">...</main>
   </div>
======================================================= */

.app-shell{
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 14px;
}

/* left panel scroll */
.side-menu{
  position: sticky;
  top: 110px; /* under topbar */
  max-height: calc(100vh - 130px);
  overflow: auto;

  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}

/* link cards */
.side-link{
  display:flex;
  align-items:center;
  gap: 12px;

  min-height: 48px;      /* ✅ touch size */
  padding: 14px 18px;    /* litt bredere */
  margin: 12px 0;        /* spacing mellom */

  border: 1px solid rgba(0,0,0,0.14);
  border-radius: 14px;
  background: #fff;

  color: var(--black);
  font-weight: 800;
  text-decoration: none;
}
.side-link:hover{
  border-color: rgba(179,0,0,0.35);
  color: var(--red);
}

.side-link.active{
  border-color: rgba(179,0,0,0.40);
  color: var(--red);
}

/* right side */
.main-panel{ min-width: 0; }

/* Mobile: stack */
@media (max-width: 900px){
  .app-shell{ grid-template-columns: 1fr; }
  .side-menu{ position: relative; top: 0; max-height: none; }
}
/* ===== Topbar polish ===== */

/* Make title + tagline look sharper */
.topbar .brand h1{
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.2px;
  text-rendering: geometricPrecision;
}

.topbar .tagline{
  color: rgba(255,255,255,0.80);
  font-size: 0.98rem;
  line-height: 1.35;
  margin-top: 6px;
}

/* Right side spacing: move copyright slightly left from button */
.topbar-right{
  display:flex;
  align-items:flex-start;
  gap: 16px;                 /* more space between copyright and button */
}

/* Copyright styling: red year + white name, both bold */
.mini-copy{
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.4px;
  font-weight: 800;          /* bold both */
}

.copy-year{
  color: var(--red);         /* red year */
  font-weight: 900;
}

.copy-name{
  color: #fff;               /* white Gadaa */
  font-weight: 900;
}

/* Smaller but nicer install button, red */
.btn.install-mini{
  width: auto;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 900;
  line-height: 1;
  background: var(--red);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 10px 22px rgba(0,0,0,0.22);
}

.btn.install-mini:hover{
  background: var(--redHover);
  color: #fff;
}

/* Optional: keep button from being too big on small screens */
@media (max-width: 520px){
  .btn.install-mini{ padding: 9px 12px; font-size: 0.9rem; }
  .mini-copy{ font-size: 10px; }
}
/* =========================================
   ANDROID ONLY: Make side-menu mobile pretty
   (does NOT affect iPhone/desktop)
========================================= */

/* Only when screen is small AND on Android */
@media (max-width: 900px){
  .is-android .side-menu{
    /* make it a compact top nav instead of tall sidebar */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    padding: 10px;
    margin-top: 12px;

    position: relative; /* keep your mobile behavior */
    top: 0;
    max-height: none;
    overflow: visible;

    border-radius: 16px;
  }

  .is-android .side-menu .side-link{
    /* chip style */
    display: inline-flex;
    align-items: center;
    gap: 6px;

    width: auto;          /* IMPORTANT: not full width */
    margin: 0;            /* remove the big vertical spacing */
    padding: 10px 12px;
    min-height: 40px;     /* good touch target */

    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
  }
}  

/* FORCE accessible topbar copyright */
header.topbar .mini-copy{
  color: rgba(255,255,255,0.92);
}

header.topbar .copy-year{
  background: var(--red);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 900;
  display: inline-block;
  line-height: 1.3;
  margin-right: 6px;
}

header.topbar .copy-name{
  color: #ffffff;
  font-weight: 900;
}
/* Mobile navigation: make menu look like Android "chips/grid" */
@media (max-width: 640px) {
  /* Layout becomes single column */
  .layout {
    display: block;
  }

  /* Turn the side menu into a grid */
  .side-menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
  }

  /* Links become chip-like buttons */
  .side-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 12px 10px;
    border-radius: 14px;

    text-align: center;
    font-weight: 600;
    white-space: nowrap;

    /* keep your existing button/card styles if you have them */
  }

  /* If some labels are long, let them wrap nicely */
  .side-link {
    white-space: normal;
    line-height: 1.15;
  }
}

/* iOS Safari safe-area padding (prevents weird bottom spacing) */
@supports (padding: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
/* Mobile: make side-menu look like chips on ALL phones (Android + iPhone) */
@media (max-width: 900px){
  .side-menu{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    padding: 10px;
    margin-top: 12px;

    position: relative;
    top: 0;
    max-height: none;
    overflow: visible;

    border-radius: 16px;
  }

  .side-menu .side-link{
    display: inline-flex;
    align-items: center;
    gap: 6px;

    width: auto;
    margin: 0;
    padding: 10px 12px;
    min-height: 40px;

    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
  }
}

/* Minimal app-like PDF reader */
.pdf-reader-minimal{
  margin: 0;
  padding: 0;
  background: #0f0f10;
  color: #fff;
}

.pdf-reader-minimal .reader-app-shell{
  margin: 0;
  padding: 0;
  min-height: calc(100dvh - 72px);
}

.pdf-reader-minimal .reader-inline-message{
  margin: 10px;
}

.pdf-reader-minimal .reader-surface{
  margin: 0;
  padding: 0;
  width: 100%;
  height: calc(100dvh - 72px);
  overflow: hidden;
  background: #111;
}

.pdf-reader-minimal .reader-frame-minimal{
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  background: #111;
}

.pdf-reader-minimal .reader-bottom-bar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(16, 16, 16, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
}

.pdf-reader-minimal .reader-bottom-bar .btn{
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
}

.pdf-reader-minimal .reader-open-link{
  grid-column: 1 / -1;
  font-size: 0.88rem;
  line-height: 1.2;
  text-align: center;
  color: #f2f2f2;
  text-decoration: underline;
}

.pdf-reader-minimal .reader-deterrent{
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

/* Native-app style PDF.js reader */
.pdf-reader-native{
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #f5f2ea 0%, #efe8dc 100%);
  color: #1a1a1a;
}

.pdf-reader-native .native-reader-shell{
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 12px 12px;
}

.pdf-reader-native .native-inline-message{
  margin: 0 0 10px;
}

.pdf-reader-native .native-reader-stage{
  position: relative;
  width: 100%;
  min-height: clamp(420px, 72vh, 980px);
  margin: 0;
  padding: 10px 10px 18px;
  overflow: hidden;
  border: 1px solid rgba(55, 44, 28, 0.16);
  border-radius: 16px;
  background: linear-gradient(180deg, #dfd6c7 0%, #d7cbb9 100%);
  box-shadow: 0 16px 32px rgba(35, 26, 15, 0.18);
}

.pdf-reader-native .native-pdf-loading,
.pdf-reader-native .native-pdf-error{
  position: absolute;
  top: 8px;
  left: 18px;
  right: 18px;
  z-index: 2;
  text-align: center;
  font-size: 0.9rem;
  color: #1f1a14;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(60, 49, 32, 0.16);
  border-radius: 10px;
  padding: 6px 8px;
}

.pdf-reader-native .native-canvas-wrap{
  width: 100%;
  min-height: clamp(390px, 68vh, 920px);
  max-height: clamp(420px, 72vh, 960px);
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  touch-action: pan-y;
  padding: 26px 14px 14px;
}

.pdf-reader-native .native-pdf-canvas{
  display: block;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 14px 30px rgba(36, 29, 20, 0.24);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.pdf-reader-native .native-reader-bottom{
  width: 100%;
  margin-top: 10px;
  margin-bottom: 0;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  border: 1px solid rgba(55, 44, 28, 0.16);
  border-radius: 12px;
  background: rgba(255, 252, 246, 0.96);
  backdrop-filter: blur(4px);
  box-shadow: 0 10px 22px rgba(34, 27, 18, 0.12);
}

.pdf-reader-native .native-reader-bottom-row{
  display: grid;
  grid-template-columns: minmax(126px, auto) minmax(96px, auto) 1fr minmax(96px, auto);
  align-items: center;
  gap: 8px;
}

.pdf-reader-native .native-back-btn{
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 10px;
  background: #ffffff;
  color: #1b1b1b;
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1;
  text-align: center;
  text-decoration: none;
}

.pdf-reader-native .native-nav-btn{
  min-height: 40px;
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 10px;
  background: #ffffff;
  color: #1b1b1b;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.pdf-reader-native .native-back-btn:hover,
.pdf-reader-native .native-nav-btn:hover{
  border-color: rgba(179, 0, 0, 0.35);
  color: #8f0000;
}

.pdf-reader-native .native-nav-btn:disabled{
  opacity: 0.35;
  cursor: not-allowed;
}

.pdf-reader-native .native-page-chip{
  min-height: 40px;
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  background: #ffffff;
  color: #1a1a1a;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.1px;
  padding: 10px 12px;
  text-align: center;
  cursor: default;
}

.pdf-reader-native .control-label-compact{
  display: none;
}

.pdf-reader-native .native-reader-fallback{
  margin-top: 7px;
  text-align: center;
}

.pdf-reader-native .native-reader-fallback a{
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.8rem;
  text-decoration: underline;
}

.pdf-reader-native .native-noscript-fallback{
  margin: 12px;
  text-align: center;
  color: rgba(0, 0, 0, 0.76);
}

.pdf-reader-native .reader-deterrent{
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

@media (min-width: 901px){
  .pdf-reader-native .native-reader-shell{
    padding: 18px 16px 14px;
  }

  .pdf-reader-native .native-reader-stage{
    min-height: clamp(520px, 74vh, 980px);
  }
}

@media (max-width: 520px){
  .pdf-reader-native .native-reader-shell{
    padding: 10px 8px 10px;
  }

  .pdf-reader-native .native-reader-stage{
    min-height: clamp(360px, 68vh, 760px);
    padding: 8px 8px 14px;
  }

  .pdf-reader-native .native-canvas-wrap{
    min-height: clamp(330px, 62vh, 700px);
    max-height: clamp(360px, 66vh, 740px);
    padding: 22px 6px 10px;
  }

  .pdf-reader-native .native-reader-bottom-row{
    grid-template-columns: 1fr 1fr;
  }

  .pdf-reader-native .native-back-btn{
    grid-column: 1 / -1;
  }

  .pdf-reader-native .native-page-chip{
    grid-column: 1 / -1;
    font-size: 0.86rem;
    padding: 9px 10px;
  }
}

@media (max-width: 768px){
  .pdf-reader-native .native-reader-shell{
    padding: 6px 6px 5px;
  }

  .pdf-reader-native .native-reader-stage{
    min-height: clamp(410px, 80dvh, 900px);
    padding: 5px 5px 6px;
  }

  .pdf-reader-native .native-canvas-wrap{
    min-height: clamp(390px, 74dvh, 860px);
    max-height: clamp(420px, 78dvh, 900px);
    padding: 16px 2px 2px;
    touch-action: pan-x pan-y;
  }

  .pdf-reader-native .native-reader-bottom{
    margin-top: 6px;
    padding: 5px 5px calc(5px + env(safe-area-inset-bottom, 0px));
    border-radius: 10px;
  }

  .pdf-reader-native .native-reader-bottom-row{
    grid-template-columns: minmax(70px, auto) 34px 1fr 34px;
    gap: 6px;
  }

  .pdf-reader-native .native-nav-btn{
    min-height: 34px;
    height: 34px;
    width: 34px;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    font-weight: 700;
  }

  .pdf-reader-native .native-back-btn{
    min-height: 34px;
    height: 34px;
    width: auto;
    min-width: 70px;
    padding: 0 8px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    line-height: 1;
    font-weight: 700;
  }

  .pdf-reader-native .native-back-btn,
  .pdf-reader-native .native-page-chip{
    grid-column: auto;
  }

  .pdf-reader-native .native-nav-btn .control-label-full{
    display: none;
  }

  .pdf-reader-native .control-label-compact{
    display: inline;
    font-size: 1rem;
    line-height: 1;
  }

  .pdf-reader-native .native-library-btn .control-label-compact{
    display: none;
  }

  .pdf-reader-native .native-library-btn .control-label-full{
    display: inline;
  }

  .pdf-reader-native .native-page-chip{
    min-height: 34px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }
}

@media (min-width: 901px){
  .pdf-reader-minimal .reader-app-shell{
    min-height: calc(100vh - 76px);
  }

  .pdf-reader-minimal .reader-surface{
    height: calc(100vh - 76px);
  }

  .pdf-reader-minimal .reader-bottom-bar{
    position: sticky;
    top: calc(100vh - 76px);
    max-width: 980px;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
  }
}

/* Library Store */
.library-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.library-item{
  border: 1px solid var(--border);
  border-radius: var(--radiusSm);
  background: #fff;
  padding: 12px;
}

.book-card{
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  background: linear-gradient(180deg, #ffffff 0%, #fcfcfc 100%);
  transition:
    transform .16s ease,
    box-shadow .2s ease,
    border-color .2s ease,
    background-color .2s ease;
}

.book-card::after{
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #0b0b0b 0 50%, #b30000 50% 100%);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .18s ease;
}

.book-card:hover{
  background: linear-gradient(180deg, #ffffff 0%, #fffafa 100%);
  border-color: rgba(179,0,0,0.34);
  box-shadow: 0 12px 22px rgba(0,0,0,0.10), 0 0 0 1px rgba(179,0,0,0.10);
  transform: translateY(-1px);
}

.book-card:focus-within{
  border-color: rgba(179,0,0,0.52);
  box-shadow: 0 12px 22px rgba(0,0,0,0.10), 0 0 0 2px rgba(179,0,0,0.16);
  background: linear-gradient(180deg, #ffffff 0%, #fff5f5 100%);
}

.book-card:active{
  background: linear-gradient(180deg, #ffffff 0%, #fff3f3 100%);
  border-color: rgba(179,0,0,0.55);
  box-shadow: 0 6px 12px rgba(0,0,0,0.08), 0 0 0 2px rgba(179,0,0,0.18);
  transform: translateY(1px);
}

.book-card:hover::after,
.book-card:focus-within::after,
.book-card:active::after,
.book-card.active-touch::after{
  transform: scaleX(1);
}

.book-card:active .book-badge,
.book-card.active-touch .book-badge{
  border-color: rgba(179,0,0,0.4);
}

.book-card.active-touch{
  background: linear-gradient(180deg, #ffffff 0%, #fff3f3 100%);
  border-color: rgba(179,0,0,0.55);
  box-shadow: 0 8px 16px rgba(0,0,0,0.10), 0 0 0 2px rgba(179,0,0,0.18);
  transform: translateY(1px);
}

.library-summary{
  margin-top: 8px;
  line-height: 1.45;
}

.library-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.library-category-chips{
  margin-top: 6px;
}

.library-category-chips .chip{
  text-decoration: none;
}

.library-category-chips .chip.active{
  background: var(--red);
  border-color: rgba(179,0,0,0.35);
  color: #fff;
}

.reader-frame{
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--border);
  border-radius: var(--radiusSm);
  background: #fff;
}

.book-hero{
  background: linear-gradient(180deg, #ffffff 0%, #fcfcfc 100%);
}

.book-hero-grid{
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 16px;
  align-items: start;
}

.book-cover-wrap{
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.book-cover{
  width: 100%;
  max-width: 240px;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 14px 26px rgba(0,0,0,0.12);
}

.book-cover-fallback{
  width: 220px;
  height: 300px;
  border-radius: 14px;
  border: 1px dashed rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: #fff;
}

.book-meta h2{
  margin-bottom: 8px;
}

.book-badges{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.book-badge{
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid rgba(0,0,0,0.12);
}

.book-badge.free{
  color: #fff;
  background: linear-gradient(180deg, #cc0000 0%, #940000 100%);
  border-color: rgba(148,0,0,0.5);
}

.book-badge.language{
  color: #1c1c1c;
  background: #f5f5f5;
}

.btn-read-strong{
  min-width: 150px;
  box-shadow: 0 8px 16px rgba(148,0,0,0.28);
}

.reader-shell{
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfb 100%);
}

.reader-toolbar{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.reader-toolbar-left{
  display: flex;
  align-items: center;
  gap: 12px;
}

.reader-toolbar-right{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.reader-title-wrap{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.reader-title{
  margin: 0;
}

.reader-stage{
  max-width: 980px;
  margin: 0 auto;
  padding: 10px;
  border-radius: 14px;
  background: #f7f7f7;
  border: 1px solid rgba(0,0,0,0.08);
}

.reader-frame-premium{
  min-height: 78vh;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}

.reader-actions{
  justify-content: center;
}

.reader-deterrent{
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.pdfjs-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pdfjs-toolbar-group{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pdf-page-indicator{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  font-weight: 800;
  font-size: 14px;
}

.pdfjs-stage{
  padding: 8px;
}

.pdfjs-loading,
.pdfjs-error{
  text-align: center;
  margin-bottom: 8px;
}

.pdf-canvas-wrap{
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: calc(100vh - 280px);
  height: calc(100dvh - 280px);
  overflow: auto;
  touch-action: pan-y pinch-zoom;
  border-radius: 12px;
  background: #ececec;
  border: 1px solid rgba(0,0,0,0.10);
}

.pdf-canvas{
  display: block;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.14);
  margin: 8px auto;
}

/* PDF reader mobile helpers (scoped to reader page only) */
.mobile-reader-nav{
  display: none;
}

.mobile-embed-fallback{
  display: none;
}

.mobile-back-library{
  display: none;
}

@media (max-width: 900px){
  .pdf-reader-page .container{
    padding: 6px 8px;
  }

  .pdf-reader-page .topbar{
    position: static;
    padding: 8px 10px;
    border-bottom-width: 2px;
  }

  .pdf-reader-page .brand h1{
    font-size: 1.18rem;
  }

  .pdf-reader-page .tagline{
    display: none;
  }

  .pdf-reader-page .app-shell{
    gap: 6px;
    margin-top: 6px;
  }

  .pdf-reader-page .mobile-reader-nav{
    display: none;
  }

  .pdf-reader-page .mobile-menu-toggle{
    width: 100%;
    text-align: center;
  }

  .pdf-reader-page .side-menu{
    display: none;
    position: static;
    top: 0;
    max-height: none;
    overflow: visible;
    margin-top: 0;
  }

  .pdf-reader-page .side-menu.mobile-open{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .pdf-reader-page .reader-header-shell{
    display: none;
  }

  .pdf-reader-page .reader-shell{
    padding: 8px;
    margin-top: 6px;
  }

  .pdf-reader-page .reader-toolbar{
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
  }

  .pdf-reader-page .reader-toolbar-left{
    flex-wrap: wrap;
  }

  .pdf-reader-page .reader-toolbar-right{
    width: 100%;
  }

  .pdf-reader-page .reader-toolbar-right .btn,
  .pdf-reader-page .reader-toolbar-left .btn{
    flex: 1 1 180px;
    text-align: center;
  }

  .pdf-reader-page .mobile-back-library{
    display: inline-block;
  }

  .pdf-reader-page .reader-title-wrap{
    width: 100%;
  }

  .pdf-reader-page .reader-stage{
    max-width: none;
    margin: 0;
    padding: 2px;
  }

  .pdf-reader-page .pdfjs-toolbar{
    align-items: stretch;
    margin-bottom: 6px;
    gap: 6px;
  }

  .pdf-reader-page .pdfjs-toolbar .btn{
    flex: 1 1 130px;
    text-align: center;
    padding: 10px 12px;
  }

  .pdf-reader-page .pdfjs-toolbar-group{
    width: 100%;
  }

  .pdf-reader-page .pdf-zoom-controls{
    display: none;
  }

  .pdf-reader-page .pdf-page-indicator{
    flex: 1 1 auto;
    min-height: 38px;
    padding: 6px 8px;
  }

  .pdf-reader-page .pdf-canvas-wrap{
    min-height: calc(100vh - 185px);
    height: calc(100dvh - 185px);
    border-radius: 8px;
    margin-top: 0;
  }

  .pdf-reader-page .pdf-canvas{
    max-width: 100%;
    height: auto;
  }

  .pdf-reader-page .mobile-embed-fallback{
    display: block;
    margin-top: 6px;
    text-align: center;
    font-size: 0.88rem;
  }
}

@media (max-width: 900px){
  .book-hero-grid{
    grid-template-columns: 1fr;
  }

  .book-cover-wrap{
    justify-content: flex-start;
  }
}

/* =======================================================
   PREMIUM SIDEBAR OVERRIDE (shared, high-priority)
======================================================= */
.side-menu{
  background: #fff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

.side-link{
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  width: 100%;
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.12);
  background: linear-gradient(180deg, #ffffff 0%, #fcfcfc 100%);
  color: #101010;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 6px 14px rgba(0,0,0,0.06);
  transition:
    transform .14s ease,
    box-shadow .18s ease,
    border-color .18s ease,
    color .18s ease,
    background-color .18s ease;
  overflow: hidden;
}

.side-link::after{
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #0b0b0b 0 50%, #b30000 50% 100%);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .18s ease;
}

.side-link:hover{
  color: #8f0000;
  border-color: rgba(179,0,0,0.34);
  box-shadow: 0 12px 22px rgba(0,0,0,0.10);
  transform: translateY(-1px);
}

.side-link:hover::after,
.side-link:focus-visible::after,
.side-link:active::after,
.side-link.current::after{
  transform: scaleX(1);
}

.side-link:active{
  transform: translateY(2px);
  box-shadow: 0 3px 7px rgba(0,0,0,0.10);
}

.side-link:focus-visible{
  outline: 2px solid rgba(179,0,0,0.60);
  outline-offset: 2px;
  border-color: rgba(179,0,0,0.55);
}

.side-link.current,
.side-link.active{
  color: #0b0b0b;
  border-color: rgba(179,0,0,0.55);
  background: linear-gradient(180deg, #fffafa 0%, #fff4f4 100%);
  box-shadow:
    0 14px 24px rgba(0,0,0,0.10),
    inset 0 0 0 1px rgba(179,0,0,0.18);
}

/* Mobile sidebar keeps chip layout but premium interactions */
@media (max-width: 900px){
  .side-menu{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border-radius: 16px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
  }

  .side-menu .side-link{
    width: auto;
    margin: 0;
    min-height: 40px;
    padding: 10px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 5px 12px rgba(0,0,0,0.07);
  }
}

.pdf-reader-native .native-inline-message{
  border-radius: 16px;
}

