/* App shell — kanju.ai inspired */
.ly-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .ly-app {
    margin-left: var(--ly-rail-w);
  }

  html.ly-tv .ly-app {
    margin-left: 200px;
  }
}

.ly-app__main {
  flex: 1;
  width: min(100% - 24px, var(--ly-container));
  margin-inline: auto;
  padding-bottom: calc(var(--ly-tabbar-h) + 20px);
}

@media (min-width: 1024px) {
  .ly-app__main {
    padding-bottom: 32px;
  }
}

/* Left icon rail — kanju.ai collapsed style */
.ly-rail {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--ly-rail-w);
  z-index: 120;
  background: var(--ly-bg);
  border-right: 1px solid var(--ly-border);
  flex-direction: column;
  align-items: center;
  padding: 16px 8px;
  gap: 12px;
  overflow-y: auto;
  scrollbar-width: none;
}

.ly-rail::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .ly-rail {
    display: flex;
  }

  body.ly-site:not(.ly-home) {
    margin-left: var(--ly-rail-w);
  }

  html.ly-tv body.ly-site:not(.ly-home) {
    margin-left: 200px;
  }
}

html.ly-tv .ly-rail {
  display: flex;
  width: 200px;
  align-items: stretch;
  padding: 24px 12px;
}

.ly-rail a,
.ly-rail__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.6);
  background: var(--ly-bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

html.ly-light .ly-rail a,
html.ly-light .ly-rail__btn {
  color: var(--ly-muted);
  border-color: var(--ly-border);
}

html.ly-tv .ly-rail a,
html.ly-tv .ly-rail .ly-rail__btn {
  width: auto;
  height: auto;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 14px;
  font-size: 14px;
}

.ly-rail a:hover,
.ly-rail a.is-active,
.ly-rail__btn:hover,
.ly-rail__btn.is-active {
  color: var(--ly-accent);
  border-color: var(--ly-accent);
  background: var(--ly-bg-elevated);
}

.ly-rail a:focus,
.ly-rail a:focus-visible,
.ly-rail__btn:focus,
.ly-rail__btn:focus-visible {
  outline: none;
  border-color: var(--ly-accent);
}

.ly-rail__home {
  overflow: hidden;
  background: transparent;
  padding: 0;
}

.ly-rail__home img {
  width: 40px;
  height: 40px;
  display: block;
  object-fit: cover;
}

.ly-rail__icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ly-rail__icon--md {
  width: 20px;
  height: 20px;
}

.ly-rail__sep {
  display: block;
  width: 28px;
  height: 1px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
}

html.ly-light .ly-rail__sep {
  background: var(--ly-border);
}

.ly-rail__notice {
  position: relative;
  letter-spacing: 0.12em;
}

.ly-rail__badge {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ly-accent);
  box-shadow: 0 0 0 2px var(--ly-bg);
}

html.ly-light .ly-rail__moon,
html:not(.ly-light) .ly-rail__sun {
  display: block;
}

html.ly-light .ly-rail__sun,
html:not(.ly-light) .ly-rail__moon {
  display: none;
}

.ly-rail-drawer {
  position: fixed;
  inset: 0;
  z-index: 140;
}

.ly-rail-drawer[hidden] {
  display: none !important;
}

body.ly-rail-open {
  overflow: hidden;
}

.ly-rail-drawer__scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.ly-rail-drawer__panel {
  position: absolute;
  inset: 0 auto 0 0;
  width: min(82vw, 320px);
  background: rgb(37, 38, 43);
  border-right: 1px solid var(--ly-border);
  box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html.ly-light .ly-rail-drawer__panel {
  background: var(--ly-bg-elevated);
}

.ly-rail-drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--ly-border);
}

.ly-rail-drawer__who {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ly-rail-drawer__avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--ly-accent);
  background: var(--ly-primary);
  color: var(--ly-accent);
  font-weight: 700;
  box-shadow: 0 0 0 3px var(--ly-accent-dim);
}

.ly-rail-drawer__who-text {
  min-width: 0;
}

.ly-rail-drawer__who-text p {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ly-rail-drawer__who-text span {
  display: block;
  color: var(--ly-muted);
  font-size: 12px;
}

.ly-rail-drawer__tools {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ly-rail-drawer__tools .ly-rail__btn {
  width: 32px;
  height: 32px;
}

.ly-rail-drawer__warn {
  margin: 12px 16px 0;
  padding: 8px 10px;
  border: 1px solid rgba(250, 204, 21, 0.45);
  border-radius: 8px;
  color: #facc15;
  font-size: 12px;
  line-height: 1.5;
}

.ly-rail-drawer__actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 16px 0;
}

.ly-rail-drawer__actions button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(24, 24, 27, 0.6);
  color: var(--ly-muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.ly-rail-drawer__actions button:hover {
  color: var(--ly-accent);
  border-color: var(--ly-accent);
}

.ly-rail-drawer__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 16px 0;
}

.ly-rail-drawer__stats a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(24, 24, 27, 0.6);
  color: var(--ly-text);
  font-size: 13px;
}

.ly-rail-drawer__stats b {
  font-size: 16px;
  color: var(--ly-accent);
}

.ly-rail-drawer__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: none;
}

.ly-rail-drawer__body::-webkit-scrollbar {
  display: none;
}

.ly-drawer-sec__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ly-muted);
}

.ly-drawer-sec__head span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ly-drawer-sec__head span .ly-rail__icon {
  color: var(--ly-accent);
}

.ly-drawer-sec__head a {
  color: var(--ly-accent);
  font-weight: 500;
}

.ly-drawer-empty {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ly-muted);
  font-size: 13px;
}

.ly-drawer-item {
  display: flex;
  gap: 8px;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: inherit;
}

.ly-drawer-item:hover {
  border-color: var(--ly-accent);
  background: var(--ly-accent-dim);
}

.ly-drawer-item img,
.ly-drawer-item__ph {
  width: 48px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--ly-bg-card);
  flex-shrink: 0;
}

.ly-drawer-item strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.ly-drawer-item em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 12px;
  color: var(--ly-muted);
}

.ly-rail-drawer__foot {
  padding: 12px;
  border-top: 1px solid var(--ly-border);
}

.ly-rail-drawer__login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--ly-accent);
  background: var(--ly-accent);
  color: #052e1f;
  font-size: 14px;
  font-weight: 800;
}

.ly-rail-drawer__login:hover {
  background: var(--ly-accent-hover);
}

.ly-rail-drawer__login .ly-rail__icon {
  stroke: currentColor;
}

.ly-rail-sheet-qr {
  display: block;
  width: 200px;
  height: 200px;
  margin: 8px auto 12px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.ly-rail-sheet-note {
  margin: 0;
  font-size: 13px;
  color: var(--ly-muted);
  line-height: 1.6;
}

.ly-prefs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ly-prefs button,
.ly-prefs a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--ly-border);
  background: var(--ly-bg-elevated);
  color: var(--ly-text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.ly-prefs button.is-active,
.ly-prefs a:hover {
  border-color: var(--ly-accent);
  color: var(--ly-accent);
}

/* Header — inner pages */
.ly-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--ly-header-h);
  background: rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ly-border);
}

.ly-home .ly-header {
  display: none;
}

.ly-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ly-header__nav {
  display: none;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  -webkit-overflow-scrolling: touch;
}

.ly-header__nav::-webkit-scrollbar {
  height: 3px;
}

.ly-header__nav::-webkit-scrollbar-track {
  background: transparent;
}

.ly-header__nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.ly-header__nav::-webkit-scrollbar-thumb:hover {
  background: rgba(52, 211, 153, 0.45);
}

.ly-header__nav::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.ly-header__nav a {
  padding: 6px 10px;
  border-radius: var(--ly-radius-pill);
  color: var(--ly-muted);
  font-size: 13px;
  white-space: nowrap;
}

.ly-header__nav a:hover,
.ly-header__nav a.is-active {
  color: var(--ly-accent);
  background: var(--ly-accent-dim);
}

.ly-header__search {
  display: none;
  flex: 1;
  max-width: 420px;
}

.ly-header__search input {
  width: 100%;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--ly-radius-pill);
  border: 1px solid var(--ly-border);
  background: var(--ly-bg-input);
  color: var(--ly-text);
}

.ly-header__search input::placeholder {
  color: var(--ly-muted);
}

@media (min-width: 1024px) {
  .ly-header__nav,
  .ly-header__search {
    display: flex;
  }
}

/* Legacy sidebar hidden — replaced by rail */
.ly-sidebar {
  display: none !important;
}

.ly-layout-split {
  display: block;
}

/* Floating bottom tabbar */
.ly-tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  z-index: 110;
  width: min(calc(100% - 24px), 420px);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  background: rgba(24, 24, 27, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--ly-border);
  border-radius: var(--ly-radius-pill);
  box-shadow: var(--ly-shadow-pill);
}

@media (min-width: 768px) {
  .ly-tabbar {
    display: none;
  }
}

/* Keep tabbar usable on phones + small tablets (rail starts at 768) */
.ly-tabbar.ly-only-mobile {
  display: none;
}

@media (max-width: 767px) {
  .ly-tabbar.ly-only-mobile {
    display: flex;
  }
}

.ly-tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  color: var(--ly-muted);
  min-height: 44px;
  border-radius: var(--ly-radius-pill);
  transition: color 0.15s;
}

.ly-tabbar a.is-active {
  color: var(--ly-accent);
}

.ly-tabbar__mid {
  flex: 0 0 auto;
  margin: 0 4px;
}

.ly-tabbar__mid a,
.ly-tabbar__mid .ly-share-open {
  width: 48px;
  height: 48px;
  background: var(--ly-accent);
  color: #052e1f;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 4px 16px var(--ly-accent-glow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.ly-tabbar__mid a:hover,
.ly-tabbar__mid .ly-share-open:hover {
  background: var(--ly-accent-hover);
}

/* Share sheet */
.ly-share-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ly-share-sheet[hidden] {
  display: none !important;
}

.ly-share-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.ly-share-sheet__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  margin: 0 12px 12px;
  padding: 18px 16px 20px;
  border-radius: var(--ly-radius-lg);
  background: var(--ly-bg-card);
  border: 1px solid var(--ly-border);
  box-shadow: var(--ly-shadow-pill);
}

.ly-share-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ly-share-sheet__head h2 {
  margin: 0;
  font-size: 16px;
}

.ly-share-sheet__close {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--ly-muted);
  font-size: 24px;
  cursor: pointer;
}

.ly-share-sheet__desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ly-muted);
}

.ly-share-sheet__label {
  display: block;
  font-size: 12px;
  color: var(--ly-muted);
  margin-bottom: 6px;
}

.ly-share-sheet__input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--ly-radius);
  border: 1px solid var(--ly-border);
  background: var(--ly-bg-elevated);
  color: var(--ly-text);
  font-size: 13px;
  margin-bottom: 12px;
}

.ly-share-sheet__actions {
  display: flex;
  gap: 8px;
}

.ly-share-sheet__actions .ly-btn {
  flex: 1;
}

.ly-share-sheet__tip {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ly-accent);
  text-align: center;
}

body.ly-share-open {
  overflow: hidden;
}

/* Footer */
.ly-footer {
  padding: 32px 0 100px;
  color: var(--ly-muted);
  font-size: 12px;
  border-top: 1px solid var(--ly-border);
}

@media (min-width: 768px) {
  .ly-footer {
    padding-bottom: 32px;
  }

  .ly-home .ly-footer {
    margin-left: var(--ly-rail-w);
  }

  html.ly-tv .ly-home .ly-footer {
    margin-left: 200px;
  }
}

.ly-footer .ly-container {
  width: min(100% - 24px, var(--ly-container));
  margin-inline: auto;
}

.ly-footer p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 8px;
}

.ly-footer a {
  color: var(--ly-muted);
  margin-right: 0;
}

.ly-footer a:hover {
  color: var(--ly-accent);
}

/* TV focus */
html.ly-tv .ly-card:focus-visible,
html.ly-tv .ly-btn:focus-visible,
html.ly-tv a.ly-focusable:focus-visible {
  outline: none;
  box-shadow: var(--ly-focus-ring);
  transform: scale(1.02);
}

.ly-ad-slot {
  margin-block: 12px;
}

.ly-ad-slot--sticky-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--ly-tabbar-h) + 8px);
  z-index: 105;
}

@media (min-width: 768px) {
  .ly-ad-slot--sticky-bottom {
    bottom: 0;
  }
}

html.ly-tv .ly-ad-slot--sticky-bottom,
html.ly-tv .ly-ad-float {
  display: none !important;
}

.ly-ad-float {
  position: fixed;
  top: 120px;
  width: 120px;
  z-index: 80;
}

.ly-ad-float--left { left: calc(var(--ly-rail-w) + 8px); }
.ly-ad-float--right { right: 8px; }

@media (max-width: 1023px) {
  .ly-ad-float { display: none; }
}

.ly-detail-split {
  display: grid;
  gap: 20px;
}

@media (min-width: 1024px) {
  .ly-detail-split {
    grid-template-columns: 1fr 300px;
  }
}

.ly-player-wrap {
  background: #000;
  border-radius: var(--ly-radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.ly-player-wrap iframe,
.ly-player-wrap .MacPlayer,
.ly-player-wrap video {
  width: 100% !important;
  height: 100% !important;
}
