:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #141414;
  --panel-2: #202020;
  --line: rgba(255, 255, 255, 0.16);
  --text: #f6f6f6;
  --muted: #b9b9b9;
  --dim: #7f7f7f;
  --red: #10d68a;
  --red-dark: #075c70;
  --green: #46d369;
  --blue: #28c7ff;
  --emerald: #10d68a;
  --warn: #f0b95a;
  --bad: #ff7a7a;
  --terminal: #78ff8a;
  --tile-cover-height: clamp(300px, calc(100vh - 430px), 390px);
  --browse-cover-height: clamp(340px, calc(100vh - 390px), 455px);
  font-family: "Clear Sans", "Source Sans 3", "Inter", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
a {
  touch-action: manipulation;
}

.kiosk-shell {
  position: relative;
  min-height: 100vh;
  padding: 26px 38px 112px;
  background:
    radial-gradient(circle at 82% 16%, rgba(16, 214, 138, 0.17), transparent 28%),
    radial-gradient(circle at 62% 8%, rgba(40, 199, 255, 0.1), transparent 22%),
    linear-gradient(115deg, #050505 0%, #101010 54%, #191919 100%);
}

.scan-capture {
  position: fixed;
  left: -100vw;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.top-rail {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.brand-lockup > div {
  display: grid;
  justify-items: start;
  gap: 2px;
}

.brand-mark {
  display: block;
  width: 58px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(120, 255, 224, 0.32);
  border-radius: 8px;
  background: rgba(9, 26, 28, 0.64);
  overflow: hidden;
  box-shadow: 0 0 22px rgba(16, 214, 138, 0.12);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eyebrow,
.source-line {
  margin: 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.action-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(120, 255, 224, 0.22);
  border-top-color: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(16, 214, 138, 0.3);
  animation: action-spin 0.7s linear infinite;
}

@keyframes action-spin {
  to { transform: rotate(360deg); }
}

.mode-toggle {
  display: flex;
  gap: 8px;
  margin-right: auto;
  padding: 6px;
  border: 1px solid rgba(120, 255, 224, 0.24);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.mode-toggle button {
  min-width: 110px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 950;
  text-transform: uppercase;
}

.mode-toggle button.active {
  border-color: rgba(120, 255, 224, 0.52);
  background: rgba(16, 214, 138, 0.16);
  color: var(--text);
}

.status-pill {
  min-width: 88px;
  padding: 8px 11px;
  border: 1px solid rgba(70, 211, 105, 0.5);
  border-radius: 4px;
  color: var(--green);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill[data-mode="busy"],
.status-pill[data-mode="warn"] {
  border-color: rgba(240, 185, 90, 0.55);
  color: var(--warn);
}

.status-pill[data-mode="error"] {
  border-color: rgba(255, 122, 122, 0.55);
  color: var(--bad);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-weight: 900;
}

.admin-entry {
  width: 18px;
  height: 18px;
  margin-top: 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  opacity: 0.42;
}

.admin-entry:focus-visible,
.admin-entry:hover {
  border-color: rgba(40, 199, 255, 0.5);
  opacity: 1;
}

.stage {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 148px);
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: calc(100vh - 168px);
  text-align: center;
  color: var(--muted);
}

.empty-terminal {
  width: min(360px, 70vw);
  padding: 18px;
  border: 2px solid rgba(120, 255, 138, 0.44);
  border-radius: 6px;
  background: #071007;
  box-shadow: 0 0 44px rgba(70, 211, 105, 0.18), inset 0 0 34px rgba(120, 255, 138, 0.08);
}

.terminal-bar {
  height: 12px;
  margin-bottom: 18px;
  background: repeating-linear-gradient(90deg, var(--terminal) 0 18px, transparent 18px 28px);
  opacity: 0.72;
}

.terminal-shelves {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.terminal-shelves span {
  height: 98px;
  image-rendering: pixelated;
  background:
    linear-gradient(90deg, transparent 0 16%, #071007 16% 22%, transparent 22% 48%, #071007 48% 54%, transparent 54%),
    linear-gradient(var(--terminal), var(--terminal));
  opacity: 0.86;
}

.empty-state h2 {
  margin: 30px 0 10px;
  color: var(--text);
  font-size: clamp(48px, 7vw, 84px);
  line-height: 0.95;
  font-weight: 900;
}

.empty-state p {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.35;
}

.book-view {
  position: relative;
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  gap: clamp(34px, 4vw, 68px);
  align-items: center;
  min-height: calc(100vh - 168px);
  padding-bottom: 88px;
  overflow: hidden;
}

.detail-watermark {
  position: absolute;
  top: -50%;
  right: -18vw;
  bottom: -50%;
  z-index: 0;
  width: min(104vw, 1640px);
  background: url("/assets/tomewatermark.jpeg") center right / contain no-repeat;
  opacity: 0.1;
  pointer-events: none;
  filter: drop-shadow(0 0 48px rgba(16, 214, 138, 0.16));
}

.cover-column {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  align-content: center;
}

.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.72);
}

.cover-note {
  min-height: 36px;
  margin: 0;
  color: #d7f8ef;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.3;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

.cover-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
}

.cover-tools span {
  color: rgba(215, 248, 239, 0.84);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cover-tools button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(120, 255, 224, 0.34);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #d7f8ef;
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cover-tools button:active {
  transform: translateY(1px);
}

.cover-nav {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 66px;
  border: 1px solid rgba(16, 214, 138, 0.62);
  border-radius: 7px;
  background: rgba(2, 26, 28, 0.86);
  color: var(--text);
  transform: translateY(-50%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.58), 0 0 18px rgba(16, 214, 138, 0.28);
}

.cover-nav::before {
  content: "";
  width: 16px;
  height: 16px;
  border-color: currentColor;
  border-style: solid;
}

.cover-prev {
  left: 8px;
}

.cover-prev::before {
  border-width: 0 0 4px 4px;
  transform: rotate(45deg);
}

.cover-next {
  right: 8px;
}

.cover-next::before {
  border-width: 4px 4px 0 0;
  transform: rotate(45deg);
}

.cover-first {
  position: absolute;
  left: 50%;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 54px;
  height: 42px;
  border: 1px solid rgba(40, 199, 255, 0.66);
  border-radius: 7px;
  background: rgba(2, 26, 28, 0.9);
  color: var(--text);
  transform: translateX(-50%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.58), 0 0 18px rgba(40, 199, 255, 0.28);
}

.cover-first::before,
.cover-first::after {
  content: "";
  position: absolute;
}

.cover-first::before {
  left: 16px;
  width: 4px;
  height: 18px;
  background: currentColor;
}

.cover-first::after {
  width: 15px;
  height: 15px;
  border-color: currentColor;
  border-style: solid;
  border-width: 0 0 4px 4px;
  transform: translateX(4px) rotate(45deg);
}

.cover-primary {
  position: absolute;
  left: 50%;
  top: 10px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(120, 255, 224, 0.66);
  border-radius: 7px;
  background: rgba(2, 26, 28, 0.9);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  transform: translateX(-50%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.58), 0 0 18px rgba(16, 214, 138, 0.28);
}

.poster img,
.tile-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.32);
}

.poster.no-cover img {
  display: none;
}

.poster img.loading-cover {
  opacity: 0;
}

.cover-artwork-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 28%, rgba(120, 255, 224, 0.18), transparent 35%),
    linear-gradient(145deg, rgba(9, 26, 28, 0.97), rgba(9, 15, 17, 0.99));
  color: rgba(229, 255, 247, 0.86);
  text-align: center;
}

.poster.cover-loading .cover-artwork-loading {
  display: grid;
}

.poster.cover-loading img {
  opacity: 0;
}

.cover-artwork-loading b {
  color: #f4fffb;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.cover-artwork-loading em {
  color: rgba(120, 255, 224, 0.82);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.artwork-progress {
  position: relative;
  width: min(72%, 210px);
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(120, 255, 224, 0.5);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 0 24px rgba(16, 214, 138, 0.16);
}

.artwork-progress span {
  position: absolute;
  inset: 1px auto 1px 1px;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(40, 199, 255, 0.2), rgba(120, 255, 224, 0.96), rgba(16, 214, 138, 0.7));
  box-shadow: 0 0 18px rgba(16, 214, 138, 0.5);
  animation: artwork-progress 1.05s ease-in-out infinite;
}

@keyframes artwork-progress {
  0% { transform: translateX(-115%); }
  100% { transform: translateX(245%); }
}

.book-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  max-width: min(1320px, calc(100vw - 470px));
}

.topline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.source-line {
  color: var(--green);
}

.series-button {
  padding: 10px 13px;
  border: 1px solid rgba(70, 211, 105, 0.45);
  border-radius: 4px;
  background: rgba(70, 211, 105, 0.12);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
}

.book-copy h2 {
  margin-bottom: 14px;
  max-width: 1240px;
  font-size: clamp(48px, 6.4vw, 106px);
  line-height: 0.88;
  font-weight: 900;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
}

.subtitle,
.authors {
  max-width: 1120px;
  color: var(--muted);
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.2;
}

.subtitle {
  color: #d8f7ef;
  font-weight: 800;
}

.authors {
  margin-bottom: 18px;
  color: var(--text);
  font-weight: 800;
}

.authors button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(40, 199, 255, 0.58);
  text-underline-offset: 5px;
}

.authors button + button::before {
  content: ", ";
  color: var(--text);
  text-decoration: none;
}

.facts,
.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 24px;
}

.fact {
  display: inline-flex;
  gap: 7px;
  align-items: baseline;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
}

.fact span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.fact strong {
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.description {
  max-width: 1180px;
  color: #e4e4e4;
  font-size: clamp(18px, 1.52vw, 22px);
  line-height: 1.36;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.tags button {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.grid-view {
  padding-top: clamp(22px, 4vh, 46px);
  padding-bottom: 24px;
}

.grid-heading h2 {
  margin: 8px 0 12px;
  max-width: min(1500px, calc(100vw - 72px));
  font-size: clamp(38px, 5vw, 66px);
  line-height: 0.95;
}

.grid-heading h2 span {
  color: var(--blue);
  font-size: 0.56em;
  font-weight: 900;
  white-space: nowrap;
}

.browse-view {
  display: grid;
  grid-template-columns: minmax(340px, 0.86fr) minmax(560px, 1.72fr);
  gap: clamp(24px, 3.4vw, 54px);
  align-items: start;
  padding-top: clamp(16px, 3.2vh, 42px);
  padding-bottom: 92px;
}

.browse-feature {
  display: grid;
  gap: 24px;
}

.browse-feature h2 {
  margin: 8px 0 0;
  font-size: clamp(42px, 5vw, 72px);
  line-height: 0.95;
}

.browse-pick-shell {
  position: relative;
  display: grid;
  place-items: center;
  width: min(648px, 100%);
  min-height: calc(var(--browse-cover-height) + 106px);
  margin-top: 14px;
  overflow: visible;
}

.browse-pick-card {
  display: grid;
  grid-template-rows: var(--browse-cover-height) auto auto auto auto;
  gap: 8px;
  width: min(360px, 64vw);
  padding: 10px 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #000;
  color: var(--text);
  text-align: left;
  font: inherit;
  scroll-snap-align: center;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.46);
}

.browse-pick-card .tile-cover {
  height: var(--browse-cover-height);
}

.browse-pick-card strong,
.browse-pick-card span,
.browse-pick-card em {
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
}

.browse-pick-card > strong {
  display: -webkit-box;
  color: var(--text);
  font-size: 22px;
  line-height: 1.08;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.browse-pick-card > span,
.browse-pick-card > em {
  display: -webkit-box;
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.browse-peek {
  position: absolute;
  top: 0;
  width: 142px;
  height: var(--browse-cover-height);
  overflow: hidden;
  opacity: 0.42;
  filter: saturate(0.86);
  pointer-events: none;
}

.browse-peek-prev {
  left: 10px;
  border-radius: 0 7px 7px 0;
}

.browse-peek-next {
  right: 10px;
  border-radius: 7px 0 0 7px;
}

.browse-peek span,
.browse-peek img,
.browse-peek .cover-fallback {
  display: block;
  width: 264px;
  height: 100%;
}

.browse-peek-prev span {
  transform: translateX(-122px);
}

.browse-peek-next span {
  transform: translateX(0);
}

.browse-peek img {
  object-fit: contain;
  background: rgba(0, 0, 0, 0.32);
}

.browse-nav {
  position: absolute;
  top: calc(var(--browse-cover-height) / 2);
  z-index: 2;
  width: 54px;
  height: 82px;
  transform: translateY(-50%);
  border: 1px solid rgba(120, 255, 224, 0.48);
  border-radius: 10px;
  background: rgba(0, 30, 24, 0.72);
}

.browse-prev { left: 6px; }
.browse-next { right: 6px; }

.browse-prev::before,
.browse-next::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  border-top: 5px solid #fff;
  border-right: 5px solid #fff;
}

.browse-prev::before { transform: translate(-35%, -50%) rotate(-135deg); }
.browse-next::before { transform: translate(-65%, -50%) rotate(45deg); }

.browse-links {
  display: grid;
  gap: 24px;
  padding-top: 28px;
}

.browse-links h3 {
  margin: 0 0 14px;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.browse-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.browse-chip-grid button {
  min-height: 56px;
  padding: 0 20px;
  border: 1px solid rgba(120, 255, 224, 0.36);
  border-radius: 12px;
  background: rgba(16, 214, 138, 0.1);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 950;
}

#browseSeries.browse-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 16px;
}

.browse-series-card {
  display: grid;
  gap: 12px;
  min-height: 206px;
  padding: 16px;
  border: 1px solid rgba(120, 255, 224, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.browse-series-main {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
}

.browse-series-main strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
  line-height: 1.1;
}

.browse-series-main span {
  display: -webkit-box;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.browse-series-covers {
  display: flex;
  gap: 12px;
  overflow: hidden;
}

.browse-series-covers button {
  flex: 0 0 108px;
  width: 108px;
  height: 162px;
  min-height: 162px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.browse-series-covers img {
  display: block;
  width: 100%;
  height: 162px;
  object-fit: contain;
}

.browse-series-covers .cover-fallback {
  width: 108px;
  height: 162px;
  min-height: 162px;
}

.search-view {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(330px, 48vh);
  background:
    radial-gradient(circle at 78% 12%, rgba(16, 214, 138, 0.18), transparent 28%),
    linear-gradient(115deg, rgba(5, 5, 5, 0.98), rgba(15, 18, 18, 0.99));
  color: var(--text);
}

.search-view.keyboard-minimized {
  grid-template-rows: minmax(0, 1fr) 76px;
}

.search-main {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 0;
  padding: 30px 38px 18px;
}

.search-header,
.search-results-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.search-header h2 {
  margin: 4px 0 0;
  font-size: clamp(42px, 6vh, 72px);
  line-height: 0.95;
}

.search-query-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  margin-top: 18px;
}

.search-query-display {
  min-height: 76px;
  padding: 16px 20px;
  border: 1px solid rgba(120, 255, 224, 0.35);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  font-size: clamp(30px, 4vh, 52px);
  font-weight: 900;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-query-display.empty {
  color: rgba(255, 255, 255, 0.38);
}

.search-clear-button,
.search-layout-button,
.search-keyboard button {
  min-height: 68px;
  border: 1px solid rgba(120, 255, 224, 0.36);
  border-radius: 8px;
  background: rgba(16, 214, 138, 0.13);
  color: var(--text);
  font: inherit;
  font-size: 18px;
  font-weight: 950;
  text-transform: uppercase;
}

.search-clear-button {
  min-width: 132px;
}

.search-clear-button:disabled {
  opacity: 0.42;
}

.search-results-topline {
  margin-top: 14px;
}

.search-results-topline p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  font-weight: 750;
}

.search-layout-button {
  min-width: 112px;
  min-height: 48px;
}

.search-results {
  min-height: 0;
  margin-top: 16px;
  padding: 2px 4px 18px;
  overflow: auto;
  scrollbar-width: none;
}

.search-results::-webkit-scrollbar {
  display: none;
}

.search-results-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(230px, 17vw, 310px);
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
  align-content: start;
}

.search-result-card {
  display: grid;
  grid-template-rows: clamp(230px, 30vh, 330px) minmax(118px, auto);
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  scroll-snap-align: start;
}

.search-results-grid .search-result-card {
  grid-template-rows: 250px minmax(116px, auto);
}

.search-result-cover {
  position: relative;
  display: block;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  background: var(--panel-2);
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.search-result-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.search-result-cover .cover-fallback {
  height: 100%;
}

.search-result-cover small {
  position: absolute;
  top: 10px;
  left: 10px;
  max-width: calc(100% - 20px);
}

.search-result-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.search-result-copy strong,
.search-result-copy span,
.search-result-copy em,
.search-result-copy .tile-series-link {
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
}

.search-result-copy strong {
  display: -webkit-box;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.12;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-copy span,
.search-result-copy em {
  display: -webkit-box;
  color: var(--muted);
  font-size: 15px;
  font-style: normal;
  line-height: 1.2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-keyboard {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px 28px 20px;
  border-top: 1px solid rgba(120, 255, 224, 0.28);
  background: rgba(3, 12, 13, 0.96);
  box-shadow: 0 -16px 60px rgba(0, 0, 0, 0.42);
}

.keyboard-minimized .search-keyboard {
  grid-template-rows: 0 auto;
}

.keyboard-minimized .search-keyboard-rows {
  display: none;
}

.search-keyboard-rows {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.search-key-row {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 10px;
}

.search-key-row:nth-child(2) {
  padding-inline: 4.5%;
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

.search-key-row:nth-child(3) {
  padding-inline: 4.5%;
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

.search-key-row-wide {
  grid-template-columns: 1.2fr 2.4fr 1.2fr;
  padding-inline: 9%;
}

.search-keyboard button {
  min-width: 0;
  min-height: clamp(58px, 8vh, 88px);
  font-size: clamp(18px, 2.1vh, 27px);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}

.search-keyboard button:active,
.search-clear-button:active,
.search-layout-button:active {
  transform: translateY(1px);
  background: rgba(16, 214, 138, 0.24);
}

.search-keyboard-actions {
  display: flex;
  justify-content: center;
}

.search-keyboard-actions button {
  min-width: 240px;
  min-height: 48px;
  font-size: 14px;
}

.grid-summary {
  max-width: 720px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.35;
}

.carousel-shell {
  position: relative;
}

.book-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(210px, 15vw, 260px);
  gap: 20px;
  max-height: calc(100vh - 300px);
  min-height: 410px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 4px 18px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.book-grid::-webkit-scrollbar {
  display: none;
}

.grid-empty {
  grid-column: 1 / -1;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 22px;
  font-weight: 800;
}

.book-tile {
  display: grid;
  grid-template-rows: var(--tile-cover-height) auto auto auto auto;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  scroll-snap-align: start;
}

.tile-cover {
  position: relative;
  display: block;
  height: var(--tile-cover-height);
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  background: var(--panel-2);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
}

.tile-cover small,
.search-result-cover small {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 42px;
  max-width: calc(100% - 20px);
  padding: 7px 11px;
  border: 1px solid rgba(120, 255, 224, 0.92);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(3, 36, 40, 0.96), rgba(4, 86, 80, 0.94));
  color: #f5fffb;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.82),
    0 0 22px rgba(16, 214, 138, 0.46),
    0 8px 22px rgba(0, 0, 0, 0.62);
  text-shadow: 0 1px 2px #000;
}

.tile-cover small b,
.search-result-cover small b {
  color: #74ffd6;
  font-size: 26px;
  line-height: 1;
  white-space: nowrap;
}

.tile-cover small span,
.search-result-cover small span {
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-cover small.series-badge-name,
.search-result-cover small.series-badge-name {
  min-height: 0;
  padding: 9px 11px;
}

.tile-cover small.series-badge-name span,
.search-result-cover small.series-badge-name span {
  max-width: 100%;
}

.cover-fallback {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  height: 100%;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 28%, rgba(120, 255, 224, 0.15), transparent 34%),
    linear-gradient(145deg, rgba(9, 26, 28, 0.96), rgba(9, 15, 17, 0.98));
  color: rgba(229, 255, 247, 0.78);
  text-align: center;
}

.cover-fallback-detail {
  display: none;
}

.poster.no-cover .cover-fallback-detail {
  display: grid;
}

.cover-mark {
  position: relative;
  display: block;
  width: min(76%, 170px);
  aspect-ratio: 1 / 1.08;
  background: url("/assets/tomewatermark.jpeg") center / contain no-repeat;
  opacity: 0.3;
  filter: drop-shadow(0 0 28px rgba(16, 214, 138, 0.2));
}

.cover-fallback b {
  color: #f4fffb;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.cover-fallback em {
  color: rgba(120, 255, 224, 0.74);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.cover-fallback-mini {
  width: 44px;
  height: 66px;
  min-height: 66px;
  gap: 2px;
  padding: 5px;
  border-radius: 6px;
}

.cover-fallback-mini .cover-mark {
  width: 32px;
}

.cover-fallback-mini b,
.cover-fallback-mini em {
  display: none;
}

.book-tile strong,
.book-tile span,
.book-tile em,
.tile-series-link {
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
}

.book-tile strong {
  display: -webkit-box;
  font-size: 16px;
  line-height: 1.15;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.book-tile span,
.book-tile em {
  display: -webkit-box;
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.book-tile .cover-fallback,
.cache-row .cover-fallback,
.admin-book-result .cover-fallback {
  color: rgba(229, 255, 247, 0.78);
}

.book-tile .cover-fallback {
  white-space: normal;
}

.book-tile .cover-mark,
.book-tile .cover-mark span {
  overflow: visible;
  color: inherit;
  font-size: inherit;
  text-overflow: clip;
  white-space: normal;
}

.book-tile .cover-fallback b {
  color: #f4fffb;
  font-size: 24px;
}

.book-tile .cover-fallback em {
  color: rgba(120, 255, 224, 0.74);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.cache-row .cover-mark span,
.admin-book-result .cover-mark span {
  display: block;
  min-width: 0;
}

.tile-series-link {
  display: -webkit-box;
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #72f5d0;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(40, 199, 255, 0.58);
  text-underline-offset: 4px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.carousel-button {
  position: absolute;
  top: 42%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 58px;
  height: 92px;
  border: 1px solid rgba(16, 214, 138, 0.45);
  border-radius: 8px;
  background: rgba(2, 26, 28, 0.82);
  color: var(--text);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.52);
}

.carousel-button::before {
  content: "";
  width: 22px;
  height: 22px;
  border-color: currentColor;
  border-style: solid;
}

.carousel-prev {
  left: 8px;
}

.carousel-prev::before {
  border-width: 0 0 5px 5px;
  transform: rotate(45deg);
}

.carousel-next {
  right: 8px;
}

.carousel-next::before {
  border-width: 5px 5px 0 0;
  transform: rotate(45deg);
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 52% 42%, rgba(16, 214, 138, 0.12), transparent 32%),
    rgba(5, 5, 5, 0.78);
  backdrop-filter: blur(7px);
}

.loader-screen {
  position: relative;
  width: min(560px, 82vw);
  min-height: 330px;
  padding: 26px;
  border: 1px solid rgba(120, 255, 224, 0.56);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(8, 29, 30, 0.98), rgba(4, 12, 14, 0.98));
  color: var(--terminal);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 0 70px rgba(16, 214, 138, 0.24),
    0 30px 110px rgba(0, 0, 0, 0.72);
}

.scanline {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(transparent 0 46%, rgba(120, 255, 224, 0.16) 50%, transparent 54%);
  mix-blend-mode: screen;
  pointer-events: none;
  animation: scanline 1.55s linear infinite;
}

.loader-grid {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background:
    linear-gradient(rgba(120, 255, 224, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 255, 224, 0.11) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}

.loader-screen pre {
  position: relative;
  z-index: 1;
  margin: 0 0 24px;
  font: 900 20px/1.2 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(120, 255, 224, 0.38);
}

.loader-visual {
  position: relative;
  z-index: 1;
  height: 180px;
}

.loader-visual:not(.loader-books) {
  display: none;
}

.loader-cards-mode .loader-books,
.loader-barcode-mode .loader-books,
.loader-pages-mode .loader-books,
.loader-orbit-mode .loader-books,
.loader-stamp-mode .loader-books,
.loader-ladder-mode .loader-books,
.loader-scanner-mode .loader-books,
.loader-constellation-mode .loader-books,
.loader-typewriter-mode .loader-books,
.loader-portal-mode .loader-books,
.loader-stack-mode .loader-books {
  display: none;
}

.loader-cards-mode .loader-cards,
.loader-barcode-mode .loader-barcode,
.loader-pages-mode .loader-pages,
.loader-orbit-mode .loader-orbit,
.loader-stamp-mode .loader-stamp,
.loader-ladder-mode .loader-ladder,
.loader-scanner-mode .loader-scanner,
.loader-constellation-mode .loader-constellation,
.loader-typewriter-mode .loader-typewriter,
.loader-portal-mode .loader-portal,
.loader-stack-mode .loader-stack,
.loader-shelves-mode .loader-books {
  display: grid;
}

.loader-books {
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.loader-books span {
  align-self: end;
  height: 132px;
  border: 1px solid rgba(120, 255, 224, 0.36);
  border-radius: 3px 3px 1px 1px;
  background:
    linear-gradient(90deg, transparent 0 38%, rgba(4, 12, 14, 0.72) 38% 48%, transparent 48%),
    linear-gradient(var(--terminal), var(--terminal));
  image-rendering: pixelated;
  box-shadow: 0 0 22px rgba(120, 255, 224, 0.14);
  animation: bookPulse 0.95s ease-in-out infinite alternate;
}

.loader-books span:nth-child(2n) {
  animation-delay: 0.18s;
}

.loader-books span:nth-child(3n) {
  animation-delay: 0.32s;
}

.loader-cards {
  grid-template-columns: 1fr;
  align-content: center;
  gap: 12px;
}

.loader-cards span {
  position: relative;
  height: 46px;
  border: 1px solid rgba(120, 255, 224, 0.42);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(120, 255, 224, 0.18) 0 20%, transparent 20%),
    rgba(255, 255, 255, 0.035);
  overflow: hidden;
  animation: cardLift 1.25s ease-in-out infinite;
}

.loader-cards span::before,
.loader-cards span::after {
  content: "";
  position: absolute;
  left: 31%;
  height: 4px;
  border-radius: 999px;
  background: rgba(120, 255, 224, 0.56);
}

.loader-cards span::before {
  top: 14px;
  width: 46%;
}

.loader-cards span::after {
  top: 26px;
  width: 29%;
}

.loader-cards span:nth-child(2) {
  animation-delay: 0.16s;
}

.loader-cards span:nth-child(3) {
  animation-delay: 0.32s;
}

.loader-barcode {
  grid-template-columns: 10px 22px 8px 34px 14px 24px 8px 18px;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
  padding: 14px 0;
}

.loader-barcode span {
  display: block;
  border-radius: 999px;
  background: var(--terminal);
  opacity: 0.42;
  box-shadow: 0 0 26px rgba(120, 255, 224, 0.18);
  animation: barcodeDecode 1.05s ease-in-out infinite alternate;
}

.loader-barcode span:nth-child(2n) {
  animation-delay: 0.14s;
}

.loader-barcode span:nth-child(3n) {
  animation-delay: 0.28s;
}

.loader-pages {
  display: none;
  perspective: 680px;
  place-items: center;
}

.loader-pages::before {
  content: "";
  position: absolute;
  width: 188px;
  height: 126px;
  border: 1px solid rgba(120, 255, 224, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(120, 255, 224, 0.42) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    rgba(255, 255, 255, 0.035);
  box-shadow: 0 0 30px rgba(120, 255, 224, 0.12);
}

.loader-pages span {
  position: absolute;
  width: 91px;
  height: 116px;
  border: 1px solid rgba(120, 255, 224, 0.52);
  border-radius: 0 7px 7px 0;
  background:
    repeating-linear-gradient(180deg, transparent 0 14px, rgba(120, 255, 224, 0.28) 14px 16px),
    rgba(7, 24, 25, 0.98);
  transform-origin: left center;
  transform: translateX(46px) rotateY(0deg);
  animation: pageFlip 1.55s ease-in-out infinite;
}

.loader-pages span:nth-child(2) {
  animation-delay: 0.22s;
}

.loader-pages span:nth-child(3) {
  animation-delay: 0.44s;
}

.loader-pages span:nth-child(4) {
  animation-delay: 0.66s;
}

.loader-orbit {
  display: none;
  place-items: center;
}

.loader-orbit::before {
  content: "";
  position: absolute;
  width: 176px;
  height: 176px;
  border: 1px solid rgba(120, 255, 224, 0.26);
  border-radius: 50%;
  box-shadow: 0 0 34px rgba(40, 199, 255, 0.14) inset;
}

.loader-orbit span {
  position: absolute;
  width: 28px;
  height: 42px;
  border: 1px solid rgba(120, 255, 224, 0.62);
  border-radius: 4px 4px 2px 2px;
  background:
    linear-gradient(90deg, transparent 0 39%, currentColor 39% 49%, transparent 49%),
    rgba(255, 255, 255, 0.04);
  color: rgba(120, 255, 224, 0.72);
  transform-origin: 14px 108px;
  animation: titleOrbit 2.4s linear infinite;
}

.loader-orbit span:nth-child(2) {
  animation-delay: -0.48s;
}

.loader-orbit span:nth-child(3) {
  animation-delay: -0.96s;
}

.loader-orbit span:nth-child(4) {
  animation-delay: -1.44s;
}

.loader-orbit span:nth-child(5) {
  animation-delay: -1.92s;
}

.loader-stamp {
  display: none;
  place-items: center;
}

.loader-stamp span {
  position: absolute;
  border: 1px solid rgba(120, 255, 224, 0.44);
  border-radius: 8px;
}

.loader-stamp span:nth-child(1) {
  width: 214px;
  height: 124px;
  background:
    linear-gradient(90deg, rgba(120, 255, 224, 0.18) 0 22%, transparent 22%),
    repeating-linear-gradient(180deg, transparent 0 20px, rgba(120, 255, 224, 0.18) 20px 22px),
    rgba(255, 255, 255, 0.035);
}

.loader-stamp span:nth-child(2) {
  width: 104px;
  height: 44px;
  border-width: 3px;
  border-color: rgba(120, 255, 224, 0.72);
  border-radius: 6px;
  transform: rotate(-8deg) scale(1.08);
  opacity: 0;
  animation: stampDrop 1.35s ease-in-out infinite;
}

.loader-stamp span:nth-child(3) {
  width: 84px;
  height: 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(120, 255, 224, 0.62);
  transform: translateY(54px);
  animation: stampGlow 1.35s ease-in-out infinite;
}

.loader-ladder {
  display: none;
  grid-template-columns: repeat(6, 24px);
  place-content: center;
  gap: 10px;
}

.loader-ladder span {
  height: 128px;
  border: 1px solid rgba(120, 255, 224, 0.44);
  background: repeating-linear-gradient(180deg, rgba(120, 255, 224, 0.52) 0 6px, transparent 6px 18px);
  animation: ladderRead 1.45s ease-in-out infinite;
}

.loader-ladder span:nth-child(2n) { animation-delay: 0.16s; }
.loader-ladder span:nth-child(3n) { animation-delay: 0.32s; }

.loader-scanner {
  display: none;
  place-items: center;
}

.loader-scanner span:nth-child(1) {
  width: 232px;
  height: 132px;
  border: 1px solid rgba(120, 255, 224, 0.38);
  border-radius: 8px;
  background: repeating-linear-gradient(90deg, transparent 0 15px, rgba(120, 255, 224, 0.18) 15px 17px);
}

.loader-scanner span:nth-child(2) {
  position: absolute;
  width: 4px;
  height: 132px;
  border-radius: 999px;
  background: rgba(120, 255, 224, 0.92);
  box-shadow: 0 0 28px rgba(120, 255, 224, 0.8);
  animation: scanSweep 1.7s ease-in-out infinite;
}

.loader-scanner span:nth-child(3),
.loader-scanner span:nth-child(4) {
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: rgba(120, 255, 224, 0.62);
}

.loader-scanner span:nth-child(3) { transform: translate(-112px, -62px); border-top: 3px solid; border-left: 3px solid; }
.loader-scanner span:nth-child(4) { transform: translate(112px, 62px); border-right: 3px solid; border-bottom: 3px solid; }

.loader-constellation {
  display: none;
  place-items: center;
}

.loader-constellation::before {
  content: "";
  position: absolute;
  width: 224px;
  height: 116px;
  background:
    linear-gradient(28deg, transparent 0 18%, rgba(120, 255, 224, 0.34) 18% 19%, transparent 19% 48%, rgba(120, 255, 224, 0.34) 48% 49%, transparent 49%),
    linear-gradient(148deg, transparent 0 28%, rgba(120, 255, 224, 0.24) 28% 29%, transparent 29%);
}

.loader-constellation span {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(120, 255, 224, 0.86);
  box-shadow: 0 0 18px rgba(120, 255, 224, 0.72);
  animation: starPulse 1.6s ease-in-out infinite;
}

.loader-constellation span:nth-child(1) { transform: translate(-106px, 46px); }
.loader-constellation span:nth-child(2) { transform: translate(-62px, -34px); animation-delay: 0.12s; }
.loader-constellation span:nth-child(3) { transform: translate(-8px, 18px); animation-delay: 0.24s; }
.loader-constellation span:nth-child(4) { transform: translate(52px, -42px); animation-delay: 0.36s; }
.loader-constellation span:nth-child(5) { transform: translate(98px, 36px); animation-delay: 0.48s; }
.loader-constellation span:nth-child(6) { transform: translate(8px, -58px); animation-delay: 0.6s; }

.loader-typewriter {
  display: none;
  grid-template-columns: repeat(5, 34px);
  place-content: center;
  gap: 12px;
}

.loader-typewriter span {
  height: 34px;
  border: 1px solid rgba(120, 255, 224, 0.48);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  animation: keyTap 1.15s ease-in-out infinite;
}

.loader-typewriter span:nth-child(2) { animation-delay: 0.1s; }
.loader-typewriter span:nth-child(3) { animation-delay: 0.2s; }
.loader-typewriter span:nth-child(4) { animation-delay: 0.3s; }
.loader-typewriter span:nth-child(5) { animation-delay: 0.4s; }

.loader-portal {
  display: none;
  place-items: center;
}

.loader-portal span {
  position: absolute;
  border: 2px solid rgba(120, 255, 224, 0.42);
  border-radius: 50%;
  animation: portalSpin 2.3s linear infinite;
}

.loader-portal span:nth-child(1) { width: 184px; height: 118px; }
.loader-portal span:nth-child(2) { width: 134px; height: 184px; animation-direction: reverse; }
.loader-portal span:nth-child(3) { width: 46px; height: 46px; background: rgba(120, 255, 224, 0.16); box-shadow: 0 0 34px rgba(120, 255, 224, 0.3); }

.loader-stack {
  display: none;
  place-items: center;
}

.loader-stack span {
  position: absolute;
  width: 176px;
  height: 28px;
  border: 1px solid rgba(120, 255, 224, 0.42);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(calc((var(--stack-i) - 2) * 32px));
  animation: stackShuffle 1.65s ease-in-out infinite;
}

.loader-stack span:nth-child(1) { --stack-i: 0; }
.loader-stack span:nth-child(2) { --stack-i: 1; animation-delay: 0.08s; }
.loader-stack span:nth-child(3) { --stack-i: 2; animation-delay: 0.16s; }
.loader-stack span:nth-child(4) { --stack-i: 3; animation-delay: 0.24s; }
.loader-stack span:nth-child(5) { --stack-i: 4; animation-delay: 0.32s; }

.loader-caption {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  color: rgba(120, 255, 224, 0.62);
  font: 900 11px/1 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 104px);
  gap: 12px;
  transform: translateX(-50%);
}

.nav-button {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 3px;
  height: 56px;
  padding: 8px 8px 5px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, #252525, #0d0d0d);
  color: var(--text);
  font: inherit;
  font-weight: 900;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5), inset 0 1px rgba(255, 255, 255, 0.14);
}

.nav-button::before {
  display: block;
  color: var(--text);
  content: "";
}

.nav-button span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-restart::before {
  width: 22px;
  height: 22px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(-35deg);
}

.nav-back::before {
  width: 17px;
  height: 17px;
  margin-top: 3px;
  border-left: 4px solid currentColor;
  border-bottom: 4px solid currentColor;
  transform: rotate(45deg);
}

.nav-forward::before {
  width: 17px;
  height: 17px;
  margin-top: 3px;
  border-right: 4px solid currentColor;
  border-top: 4px solid currentColor;
  transform: rotate(45deg);
}

.nav-button:not(:disabled) {
  border-color: rgba(16, 214, 138, 0.72);
  box-shadow: 0 0 0 1px rgba(16, 214, 138, 0.28), 0 16px 40px rgba(0, 0, 0, 0.56), inset 0 1px rgba(255, 255, 255, 0.16);
}

.nav-button:disabled {
  color: rgba(255, 255, 255, 0.34);
  background: linear-gradient(180deg, #171717, #080808);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.nav-button:disabled::before,
.nav-button:disabled span {
  color: rgba(255, 255, 255, 0.28);
}

.details-modal {
  width: min(680px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  color: var(--text);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.78);
}

.admin-code-modal,
.admin-modal {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(16, 20, 20, 0.94);
  color: var(--text);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(18px);
}

.admin-code-modal::backdrop,
.admin-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.admin-code-box {
  display: grid;
  gap: 12px;
  width: min(340px, calc(100vw - 52px));
}

.admin-code-box h2,
.admin-header h2,
.admin-section h3 {
  margin-bottom: 0;
}

.admin-code-box input,
.admin-search-row input {
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.admin-error {
  min-height: 18px;
  margin: 0;
  color: var(--bad);
  font-size: 13px;
  font-weight: 800;
}

.admin-actions,
.admin-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.admin-search-row[aria-busy="true"] button,
.admin-search-row button[aria-busy="true"] {
  opacity: 0.65;
}

.browse-admin-grid {
  display: grid;
  gap: 12px;
}

.admin-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  font-size: 15px;
  font-weight: 900;
}

.admin-actions button,
.admin-search-row button,
.admin-row button {
  padding: 10px 14px;
  border: 1px solid rgba(120, 255, 224, 0.36);
  border-radius: 999px;
  background: rgba(16, 214, 138, 0.1);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.admin-modal {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 78% 14%, rgba(16, 214, 138, 0.16), transparent 30%),
    linear-gradient(120deg, rgba(8, 13, 15, 0.98), rgba(18, 24, 25, 0.98));
}

.admin-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  height: 100vh;
  padding: 28px 34px 34px;
  overflow: hidden;
}

.admin-header {
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 0;
  background: transparent;
}

.admin-header h2 {
  font-size: clamp(36px, 4vw, 58px);
  line-height: 0.95;
}

.admin-exit-button,
.admin-soft-button {
  min-height: 54px;
  padding: 0 22px;
  border: 1px solid rgba(120, 255, 224, 0.42);
  border-radius: 999px;
  background: rgba(16, 214, 138, 0.12);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 900;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.admin-tab {
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.admin-tab.active {
  border-color: rgba(120, 255, 224, 0.62);
  background: rgba(16, 214, 138, 0.16);
  color: #f4fffb;
  box-shadow: 0 0 26px rgba(16, 214, 138, 0.12);
}

.admin-subtabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-subtabs button {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.admin-subtabs button.active {
  border-color: rgba(120, 255, 224, 0.58);
  background: rgba(16, 214, 138, 0.14);
  color: var(--text);
}

.admin-subpanel {
  display: grid;
  gap: 10px;
}

.admin-section {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

.admin-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.audio-calibration {
  display: grid;
  gap: 14px;
  max-width: 860px;
}

.audio-meter {
  display: grid;
  gap: 5px;
  min-height: 104px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.065);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.07);
}

.audio-meter span,
.audio-slider-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.audio-meter strong {
  color: #72f5d0;
  font-size: 30px;
  line-height: 1;
}

.audio-meter small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.audio-slider-row {
  display: grid;
  gap: 10px;
}

.audio-slider-row input {
  width: 100%;
  accent-color: #10d68a;
}

.audio-level-buttons,
.audio-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.audio-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.audio-level-buttons button,
.audio-actions button {
  min-height: 52px;
  padding: 10px 14px;
  border: 1px solid rgba(120, 255, 224, 0.36);
  border-radius: 999px;
  background: rgba(16, 214, 138, 0.1);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
}

.audio-level-buttons button:disabled,
.audio-actions button:disabled {
  opacity: 0.5;
}

.dashboard-stat,
.dashboard-card {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.065);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.07);
}

.dashboard-stat {
  display: grid;
  gap: 3px;
  min-height: 118px;
  padding: 18px;
}

.dashboard-stat strong {
  color: #72f5d0;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1;
}

.dashboard-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.dashboard-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.dashboard-card h4 {
  margin: 0;
  font-size: 19px;
}

.dashboard-list {
  display: grid;
  gap: 10px;
}

.dashboard-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-list strong {
  color: #f4fffb;
  font-size: 16px;
}

.dashboard-list span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.admin-results,
.admin-list {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.cache-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cache-stat {
  display: grid;
  gap: 2px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
}

.cache-stat strong {
  color: #72f5d0;
  font-size: 28px;
}

.cache-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cache-records {
  max-height: none;
  overflow: auto;
}

.cache-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
  font: inherit;
}

.cache-row img,
.cache-row > span:first-child {
  width: 44px;
  height: 66px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.09);
}

.cache-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.cache-row strong,
.cache-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cache-row small {
  color: var(--muted);
  font-size: 12px;
}

.cache-detail {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  color: #d7f8ef;
  font-size: 12px;
}

.admin-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-row strong,
.admin-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row small {
  color: var(--muted);
  font-size: 12px;
}

.admin-book-result {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.admin-book-result img {
  width: 44px;
  height: 66px;
  border-radius: 4px;
  object-fit: cover;
}

.age-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.age-controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  font-weight: 900;
}

.details-modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.modal-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.modal-topline h2 {
  margin-bottom: 0;
  font-size: 30px;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
}

.refresh-button {
  width: 100%;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(16, 214, 138, 0.66);
  border-radius: 6px;
  background: rgba(16, 214, 138, 0.14);
  color: var(--text);
  font: inherit;
  font-weight: 900;
  text-transform: uppercase;
}

.refresh-button:disabled {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--dim);
}

.preview-actions a {
  padding: 10px 14px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 900;
}

.preview-actions a:first-child {
  background: var(--text);
  color: #050505;
}

.recent-scans {
  display: grid;
  gap: 10px;
}

.recent-item {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid transparent;
  border-left: 3px solid var(--blue);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  text-align: left;
  font: inherit;
}

.recent-item span,
.recent-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item span {
  font-weight: 800;
}

.recent-item small,
.muted {
  color: var(--dim);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

@keyframes scanline {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(100%);
  }
}

@keyframes bookPulse {
  from {
    transform: translateY(0);
    opacity: 0.56;
  }
  to {
    transform: translateY(-8px);
    opacity: 1;
  }
}

@keyframes cardLift {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.48;
  }
  50% {
    transform: translateX(18px);
    opacity: 1;
  }
}

@keyframes barcodeDecode {
  from {
    transform: scaleY(0.54);
    opacity: 0.38;
  }
  to {
    transform: scaleY(1);
    opacity: 0.96;
  }
}

@keyframes pageFlip {
  0% {
    transform: translateX(46px) rotateY(0deg);
    opacity: 0.22;
  }
  45% {
    opacity: 1;
  }
  100% {
    transform: translateX(46px) rotateY(-165deg);
    opacity: 0.28;
  }
}

@keyframes titleOrbit {
  from {
    transform: rotate(0deg) translateY(-108px) rotate(0deg);
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
  to {
    transform: rotate(360deg) translateY(-108px) rotate(-360deg);
    opacity: 0.35;
  }
}

@keyframes stampDrop {
  0%,
  100% {
    transform: translateY(-52px) rotate(-8deg) scale(1.08);
    opacity: 0;
  }
  34% {
    transform: translateY(0) rotate(-8deg) scale(1);
    opacity: 1;
  }
  62% {
    transform: translateY(0) rotate(-8deg) scale(1);
    opacity: 0.78;
  }
}

@keyframes stampGlow {
  0%,
  100% {
    opacity: 0.16;
    transform: translateY(54px) scaleX(0.6);
  }
  42%,
  64% {
    opacity: 0.8;
    transform: translateY(54px) scaleX(1);
  }
}

@keyframes ladderRead {
  0%,
  100% {
    transform: translateY(12px);
    opacity: 0.34;
  }
  50% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

@keyframes scanSweep {
  0%,
  100% {
    transform: translateX(-108px);
  }
  50% {
    transform: translateX(108px);
  }
}

@keyframes starPulse {
  0%,
  100% {
    opacity: 0.32;
    scale: 0.78;
  }
  50% {
    opacity: 1;
    scale: 1.16;
  }
}

@keyframes keyTap {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: none;
  }
  42% {
    transform: translateY(10px);
    box-shadow: 0 0 20px rgba(120, 255, 224, 0.32);
  }
}

@keyframes portalSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes stackShuffle {
  0%,
  100% {
    transform: translateY(calc((var(--stack-i) - 2) * 32px)) translateX(0);
  }
  45% {
    transform: translateY(calc((var(--stack-i) - 2) * 32px)) translateX(18px);
  }
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .kiosk-shell {
    padding: 24px 22px 96px;
  }

  .book-view {
    grid-template-columns: 1fr;
    align-items: start;
    padding-top: 32px;
  }

  .admin-shell {
    padding: 20px;
  }

  .admin-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-stats,
  .dashboard-grid,
  .cache-stats {
    grid-template-columns: 1fr;
  }

  .poster {
    max-width: 250px;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-nav {
    grid-template-columns: repeat(3, minmax(92px, 1fr));
    width: calc(100vw - 28px);
  }
}
