.ltma-standalone,
.ltma-standalone body,
.ltma-app {
  touch-action: manipulation;
}

.ltma-app-name {
  display: inline-flex;
  align-items: center;
  padding: 0;
}

.ltma-header-logo {
  display: block;
  width: auto;
  height: 46px;
}

.ltma-account-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.ltma-account-button.has-handle svg {
  display: none;
}

.ltma-account-button [data-ltma-account-initial] {
  font-weight: 700;
}

.ltma-font-overlay {
  position: fixed;
  z-index: 110;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #0009;
}

.ltma-font-overlay[hidden] {
  display: none;
}

.ltma-font-dialog {
  width: min(320px, 100%);
  padding: 22px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 30px 100px #0006;
}

.ltma-font-dialog h2 {
  margin: 0 32px 18px 0;
  font-size: 20px;
}

.ltma-font-dialog label,
.ltma-font-dialog select {
  display: block;
  width: 100%;
}

.ltma-font-dialog select {
  margin-top: 7px;
  padding: 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}

.ltma-font-close {
  float: right;
  padding: 0;
  color: var(--ink);
  border: 0;
  background: transparent;
  font-size: 26px;
}

.ltma-story-info-dialog {
  font-size: 13px;
  line-height: 1.4;
}

.ltma-story-info-dialog h2 {
  font-size: 18px;
}

.ltma-story-info-dialog dt {
  margin-top: 10px;
  font-weight: 700;
}

.ltma-story-info-dialog dd {
  margin: 3px 0 0;
  line-height: 1.5;
}

.ltma-info-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}

.ltma-info-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 5px 7px 5px 9px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  line-height: 1.2;
  white-space: nowrap;
}

.ltma-info-tag button {
  display: grid;
  width: 22px;
  height: 22px;
  flex: none;
  place-items: center;
  padding: 0;
  color: var(--accent);
  border: 0;
  background: transparent;
}

.ltma-info-tag > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 799px) {
  .ltma-nav {
    grid-template-columns: repeat(var(--ltma-tab-count, 5), minmax(0, 64px));
    justify-content: center;
    padding-right: max(22px, env(safe-area-inset-right));
    padding-left: max(22px, env(safe-area-inset-left));
  }
}

.ltma-nav:empty {
  display: none;
}

[data-ltma-discover][data-view="home"] .ltma-favorites-page,
[data-ltma-discover][data-view="favorites"] section:not(.ltma-favorites-page) {
  display: none;
}

/* Every bottom-navigation destination owns one page. */
[data-ltma-discover] > section {
  display: none !important;
}

[data-ltma-discover][data-view="home"] > .ltma-home-page,
[data-ltma-discover][data-view="search"] > .ltma-search-page,
[data-ltma-discover][data-view="tbr"] > .ltma-to-be-read-page,
[data-ltma-discover][data-view="favorites"] > .ltma-favorites-page,
[data-ltma-discover][data-view="library"] > .ltma-library-page,
[data-ltma-discover][data-view="discover"] > .ltma-recommendations-page,
[data-ltma-discover][data-view="audio"] > .ltma-recommendations-page,
[data-ltma-discover][data-view="history"] > .ltma-history-page,
[data-ltma-discover][data-view="mp3"] > .ltma-mp3-page,
[data-ltma-discover][data-view="tags"] > .ltma-favorite-tags-page {
  display: block !important;
}

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

.ltma-mp3-list {
  display: grid;
  gap: 12px;
}

.ltma-mp3-track {
  display: flex;
  width: 100%;
  min-height: 68px;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  text-align: left;
  font: 750 15px/1.35 Inter, ui-sans-serif, system-ui, sans-serif;
}

.ltma-mp3-track svg {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  fill: var(--accent);
}

.ltma-mp3-track > span {
  display: grid;
  gap: 4px;
}

.ltma-mp3-track strong { font: inherit; }

.ltma-mp3-track small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
}

.ltma-mp3-player {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(72px + env(safe-area-inset-top)) 24px calc(32px + env(safe-area-inset-bottom));
  color: #fff;
  background: #121016;
}

.ltma-mp3-player[hidden] { display: none; }

.ltma-mp3-player > div {
  width: min(100%, 680px);
  text-align: center;
}

.ltma-mp3-player h2 {
  position: absolute;
  right: 22px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  left: 22px;
  margin: 0;
  overflow: hidden;
  color: rgba(255,255,255,.5);
  font: 500 9px/1.3 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ltma-mp3-duration {
  margin: 0 0 18px;
  color: rgba(255,255,255,.72);
  font: 600 14px/1.4 Inter, ui-sans-serif, system-ui, sans-serif;
}

.ltma-mp3-player audio { width: 100%; }

.ltma-mp3-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 18px;
  width: 48px;
  height: 48px;
  padding: 0;
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  font-size: 34px;
  line-height: 1;
}

.ltma-search-results {
  min-height: 120px;
}

.ltma-home-page > .ltma-section-head:not(:first-child) {
  margin-top: 28px;
}

.ltma-home-continue,
.ltma-home-to-be-read,
.ltma-home-recent {
  display: grid;
  gap: 12px;
}

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

.ltma-stat-added {
  grid-column: 1 / -1;
}

.ltma-stat-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.ltma-stat-card > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 32px;
  line-height: 1;
}

.ltma-stat-card h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 800;
}

.ltma-stat-card ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ltma-stat-card li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.ltma-stat-card li strong {
  color: var(--muted);
}

.ltma-stat-link {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  color: var(--accent);
  border: 0;
  background: transparent;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}


.ltma-see-all {
  padding: 6px 0;
  color: var(--accent);
  border: 0;
  background: transparent;
  cursor: pointer;
}

.ltma-library-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ltma-library-menu button {
  display: grid;
  min-height: 120px;
  place-items: center;
  gap: 8px;
  padding: 18px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  cursor: pointer;
}

.ltma-library-menu svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

@media (min-width: 800px) {
  .ltma-home-to-be-read,
  .ltma-home-recent {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 800px) {
  .ltma-nav {
    grid-template-rows: repeat(var(--ltma-tab-count, 7), 72px);
  }
}

.tag-row {
  content-visibility: auto;
  contain-intrinsic-size: 48px;
}

.ltma-additional-tags-head {
  margin-top: 28px;
}

.ltma-tag-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.ltma-tag-group .tag-row:last-child {
  border-bottom: 0;
}

@media (min-width: 800px) {
  .ltma-nav {
    grid-template-rows: repeat(var(--ltma-tab-count, 6), 72px);
  }
}

[data-ltma-reader-content] > .page-head,
[data-ltma-reader-content] > .story-list {
  width: min(1100px, 100%);
  margin-right: auto;
  margin-left: auto;
  padding-right: clamp(14px, 3vw, 32px);
  padding-left: clamp(14px, 3vw, 32px);
}

[data-ltma-reader-content] > .story-list {
  padding-bottom: 80px;
}

.ltma-app.is-list-page .ltma-reader-bar {
  display: none;
}

.ltma-app.is-list-page [data-ltma-reader-content] {
  padding-top: 0;
}

.download-status {
  position: absolute;
  right: 52px;
  bottom: 17px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
  white-space: nowrap;
}

.download-icon.is-preparing {
  opacity: 0.65;
}

.ltma-reader-fullscreen {
  margin-left: auto;
}

.ltma-reader-bar button {
  display: grid;
  place-items: center;
  align-self: center;
}

.ltma-info-button svg,
.story-card [data-a="info"] svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.story-card [data-a="tbr"] svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.story-card .story-metadata {
  width: 100%;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ltma-to-be-read-stories {
  display: grid;
  gap: 12px;
}

@media (min-width: 800px) {
  .ltma-to-be-read-stories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.ltma-reader-fullscreen .ltma-fullscreen-exit {
  display: none;
}

.ltma-app.is-reader-fullscreen .ltma-header,
.ltma-app.is-reader-fullscreen .ltma-nav {
  display: none;
}

.ltma-app.is-reader-fullscreen .ltma-reader {
  inset: 0;
}

.ltma-app.is-reader-fullscreen .ltma-reader-bar {
  padding-top: max(8px, env(safe-area-inset-top));
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
  transition: opacity 150ms ease, transform 150ms ease;
}

.ltma-app.is-reader-fullscreen [data-ltma-reader-content] {
  padding-top: max(12px, env(safe-area-inset-top));
}

.ltma-app.is-reader-fullscreen.is-reader-toolbar-visible .ltma-reader-bar {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.ltma-app.is-reader-fullscreen .ltma-fullscreen-enter {
  display: none;
}

.ltma-app.is-reader-fullscreen .ltma-fullscreen-exit {
  display: block;
}

@media (min-width: 800px) {
  .ltma-app.is-reader-fullscreen .ltma-reader {
    left: 0;
  }
}

.story-card .story-author,
.story-card p,
.story-card small {
  font-size: 16.5px;
  line-height: 1.4;
}

.story-card small {
  position: static;
  display: block;
  width: calc(100% - 40px);
  max-width: none;
  margin: 10px 0 0;
  padding-top: 8px;
  font-size: 10px;
  line-height: 1.3;
}

.ltma-profile-gate {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.ltma-profile-gate[hidden] {
  display: none;
}

.ltma-profile-gate-card {
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  text-align: center;
}

.ltma-profile-gate-card h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 7vw, 42px);
}

.ltma-profile-gate-card input {
  width: 100%;
  padding: 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 18px;
  text-align: center;
  letter-spacing: .08em;
}

.ltma-profile-gate-card button {
  padding: 13px 18px;
  color: #fff;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.ltma-profile-gate-card button:disabled {
  opacity: .6;
}

.ltma-profile-gate-card .ltma-account-status {
  min-height: 1.5em;
  margin: 0;
  color: var(--muted);
}

.ltma-profile-gate-card .ltma-account-status.is-error {
  color: #c33;
}
