/* Discovery: story-led type navigation, utility sorting, and a continuous sheet. */
.homeView .main { min-height:0; }
.homeView .discoveryView { --discovery-paper:var(--bg); --discovery-card:var(--panel); --discovery-rose:var(--accent); position:relative; display:flex; flex-direction:column; min-height:0; padding:0 16px; overflow:hidden; background:var(--discovery-paper); }
[data-theme="light"] .homeView .discoveryView { --discovery-paper:#faf7f5; --discovery-card:#fffdfc; --text:#30282c; --dim:#786b71; }
.discoveryView button { cursor:pointer; }
.discoveryView button:disabled { cursor:default; opacity:.5; }
.discoveryView button:focus-visible,.discoveryView input:focus-visible,.discoveryView select:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.discoveryHero { position:relative; flex-shrink:0; min-height:0; overflow:hidden; border-radius:14px; background:var(--panel2); touch-action:none; transition:height 330ms cubic-bezier(.2,.75,.25,1); }
.discoveryHeroArt { display:block; width:100%; height:100%; object-fit:cover; object-position:50% 38%; user-select:none; pointer-events:none; }
.discoveryHeroShade { position:absolute; inset:0; pointer-events:none; background:linear-gradient(90deg,#21151d9c,transparent 75%),linear-gradient(0deg,#21151d66,transparent 85%); }
.discoveryHeroCopy { position:absolute; left:34px; right:24px; bottom:24px; color:#fff; }
.discoveryType { display:inline-flex; align-items:center; width:max-content; padding:4px 12px; border-radius:18px; font-size:11px; line-height:1.3; background:#f7e1eaed; color:#803651; letter-spacing:.4px; }
.discoveryType.world { color:#344f74; background:#e6eef6ed; }
.discoveryHeroCopy h1 { font-family:var(--reading-font,SimSun,serif); font-size:clamp(28px,3.2vw,46px); font-weight:600; line-height:1.25; margin:9px 0; letter-spacing:1px; text-shadow:0 2px 16px #0003; }
.discoveryHeroCopy p { margin:0 0 16px; color:#fffdf7; font-size:15px; }
.discoveryPrimary { display:inline-flex; align-items:center; justify-content:center; gap:18px; border:0; border-radius:26px; min-height:44px; padding:10px 22px; background:var(--discovery-rose,var(--accent)); color:var(--on-accent,#fff); white-space:nowrap; font-family:var(--reading-font,SimSun,serif); font-size:16px; }
.discoveryPrimary .uiIcon { width:19px; height:19px; flex-shrink:0; }
.heroExpand { position:absolute; right:14px; top:14px; display:flex; gap:8px; align-items:center; min-height:40px; padding:6px 14px; color:#fff; background:#251c2a60; border:1px solid #fff5; border-radius:24px; backdrop-filter:blur(12px); font-size:12px; }
.heroExpand .uiIcon { width:18px; height:18px; }
.heroReactions { position:absolute; right:24px; bottom:24px; display:flex; gap:12px; }
.heroReactions button { border:0; width:44px; height:44px; background:#251c2a30; border-radius:50%; color:#fff; }
.heroReactions .uiIcon { width:25px; height:25px; }
.discoverySheet { display:flex; flex-direction:column; flex:1; min-height:0; position:relative; z-index:1; background:var(--discovery-paper); }
.discoveryHandle { display:flex; align-items:center; justify-content:center; flex-shrink:0; height:20px; cursor:ns-resize; touch-action:none; }
.discoveryHandle > span { width:40px; height:4px; border-radius:4px; background:var(--line); }
.discoveryToolbar { display:flex; gap:16px; align-items:center; padding:0 12px 5px; flex-shrink:0; }
.discoveryTypes { display:flex; align-items:center; gap:24px; min-width:0; }
.discoveryTypes button { position:relative; border:0; background:none; padding:8px 6px 13px; min-height:44px; font-family:var(--reading-font,SimSun,serif); font-size:20px; color:var(--dim); white-space:nowrap; }
.discoveryTypes button.active { color:var(--accent); font-weight:700; }
.discoveryTypes button.active::after { position:absolute; content:''; left:4px; right:4px; bottom:4px; height:2px; background:currentColor; border-radius:2px; }
.discoverySort { display:flex; position:relative; align-items:center; margin-left:auto; color:var(--dim); background:var(--discovery-card); border:1px solid var(--line); border-radius:18px; }
.discoverySort select { appearance:none; width:auto; min-height:34px; font-size:13px; border:0; border-radius:18px; margin:0; padding:7px 30px 7px 14px; color:inherit; background:transparent; cursor:pointer; }
.discoverySort select option { background:var(--panel); color:var(--text); }
.discoverySort .uiIcon { position:absolute; right:10px; width:13px; height:13px; pointer-events:none; }
.discoveryLayoutControls { display:flex; gap:0; }
.discoveryToolbar .discoverySearchToggle { display:none; }
.discoveryLayoutControls .iconBtn { width:38px; min-height:44px; color:var(--dim); }
.discoverySearch { display:flex; align-items:center; flex-shrink:0; gap:8px; min-height:36px; margin:0 12px 12px; padding:0 12px; border:1px solid var(--line); border-radius:22px; background:var(--discovery-card); color:var(--dim); }
.discoverySearch > .uiIcon { width:16px; height:16px; flex-shrink:0; }
.discoverySearch input { min-height:34px; width:100%; min-width:0; padding:6px 0; border:0; border-radius:0; color:var(--text); background:transparent; font-size:13px; }
.discoverySearch .iconBtn { width:28px; min-height:32px; }
.discoveryList { min-height:0; overflow-y:auto; overscroll-behavior-y:contain; scrollbar-width:thin; scrollbar-color:var(--line) transparent; padding:0 6px 24px; }
.discoveryGrid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; align-items:start; }
.discoveryCard { min-width:0; overflow:hidden; border:1px solid var(--line); border-radius:13px; background:var(--discovery-card); box-shadow:0 4px 16px #31212b03; }
.discoveryCover { display:block; position:relative; padding:0; width:100%; border:0; background:var(--panel2); aspect-ratio:1.88; overflow:hidden; }
.discoveryCover img { width:100%; height:100%; display:block; object-fit:cover; object-position:50% 35%; transition:transform .25s; }
.discoveryCover:hover img { transform:scale(1.035); }
.discoveryCover .discoveryType { position:absolute; top:10px; left:10px; padding:3px 10px; }
.discoveryCardBody { padding:9px 12px 10px; }
.discoveryTitle { display:block; width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; border:0; padding:0; color:var(--text); background:none; font-family:var(--reading-font,SimSun,serif); font-size:19px; font-weight:700; line-height:1.5; }
.discoveryCardBody > p { margin:3px 0 7px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--dim); font-size:12px; line-height:1.5; }
.discoveryCardActions { display:flex; align-items:center; gap:2px; }
.discoveryCardActions .discoveryPrimary { margin-right:auto; min-height:34px; padding:7px 13px; gap:12px; font-size:13px; }
.discoveryCardActions .discoveryPrimary .uiIcon { width:14px; height:14px; }
.discoveryReaction { display:grid; place-items:center; width:34px; min-height:38px; flex-shrink:0; padding:5px; color:var(--dim); background:none; border:0; }
.discoveryReaction .uiIcon { width:20px; height:20px; }
.discoveryReaction.selected,.heroReactions .selected { color:var(--accent); }
.discoveryReaction.selected svg,.heroReactions .selected svg { fill:currentColor; }
.discoveryContinue { display:flex; align-items:center; gap:4px; margin:3px 0 -2px auto; padding:5px 0; min-height:32px; color:var(--accent); border:0; background:none; font-size:11px; }
.discoveryContinue .uiIcon { width:13px; height:13px; }
.discoveryMore { padding:22px 0 4px; text-align:center; }
.discoveryMore > p { color:var(--danger); }
.discoveryMore .btnGhost { display:inline-flex; align-items:center; gap:10px; }
.discoveryEmpty { padding:30px 16px; text-align:center; color:var(--dim); }
.discoveryEmpty > img { width:100px; height:100px; object-fit:contain; }
.discoveryEmpty p { margin-bottom:16px; }
.discoverySkeleton { height:220px; border-radius:13px; background:var(--panel2); animation:discoveryPulse 1.5s infinite alternate; }
.discoveryHeroPlaceholder { height:100%; background:var(--panel2); }
.isDragging .discoveryHero { transition:none; }
.isDragging { user-select:none; }
.discoveryNotice { position:absolute; z-index:15; bottom:28px; left:50%; transform:translateX(-50%); max-width:85%; width:max-content; padding:10px 18px; border-radius:24px; color:#fff; background:#30282ceb; box-shadow:0 4px 20px #0002; font-size:13px; text-align:center; pointer-events:none; }
.discoveryFeed { --discovery-rose:var(--accent); position:fixed; inset:0; margin:0; padding:0; border:0; border-radius:0; max-width:none; max-height:none; width:100vw; height:100dvh; background:#19191f; color:#fff; overflow:hidden; }
.discoveryFeed::backdrop { background:#19191f; }
.discoveryFeedStage { position:relative; height:100%; width:100%; overflow:hidden; touch-action:none; }
.discoveryFeedArt { position:absolute; width:100%; height:100%; object-fit:cover; object-position:50% 35%; animation:discoveryReveal .3s ease; user-select:none; -webkit-user-drag:none; }
.discoveryFeedShade { position:absolute; inset:0; pointer-events:none; background:linear-gradient(0deg,#11131cf2 0%,#11131c99 15%,transparent 57%,#11131c38 85%,#11131c73); }
.discoveryFeedHeader { position:absolute; top:0; left:0; right:0; display:flex; align-items:center; justify-content:space-between; padding:calc(16px + env(safe-area-inset-top)) 24px 12px; gap:16px; }
.feedClose { display:flex; align-items:center; gap:7px; border:0; padding:8px 0; min-height:44px; font-size:16px; background:transparent; color:#fff; white-space:nowrap; }
.feedClose .uiIcon { width:24px; height:24px; }
.discoveryFeed .discoveryTypes { gap:28px; }
.discoveryFeed .discoveryTypes button { color:#ffffffe6; font-size:20px; }
.discoveryFeed .discoveryTypes button.active { color:#fff; }
.discoveryFeed .discoveryTypes button.active::after { background:#e4a0b7; }
.discoveryFeedHeader > .iconBtn { color:#fff; width:44px; height:44px; }
.discoveryFeedRail { position:absolute; right:24px; bottom:310px; display:flex; flex-direction:column; gap:18px; align-items:center; }
.discoveryFeedRail button { display:flex; flex-direction:column; align-items:center; gap:4px; min-width:46px; min-height:48px; background:none; border:0; padding:0; color:#fff; text-shadow:0 1px 5px #0006; font-size:12px; }
.discoveryFeedRail button > .uiIcon { width:32px; height:32px; stroke-width:1.6; filter:drop-shadow(0 1px 3px #0004); }
.discoveryFeedRail button.selected { color:#ed9db9; }
.discoveryFeedRail button.selected > svg { fill:currentColor; }
.discoveryFeedRail .feedAuthor { width:46px; height:46px; min-height:46px; overflow:hidden; border:2px solid #fff; border-radius:50%; padding:0; margin-bottom:4px; }
.feedAuthor img { width:100%; height:100%; object-fit:cover; }
.discoveryFeedCopy { position:absolute; left:24px; bottom:100px; right:90px; }
.discoveryFeedCopy h2 { font-family:var(--reading-font,SimSun,serif); font-size:clamp(30px,5vw,52px); font-weight:600; margin:12px 0 10px; line-height:1.25; letter-spacing:1px; text-wrap:balance; }
.discoveryFeedCopy .discoveryType { padding:5px 14px; font-size:12px; }
.feedSubtitle { font-size:14px; color:#fffc; margin:0 0 12px; }
.feedSummary { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin:0 0 24px; max-width:650px; font-family:var(--reading-font,SimSun,serif); font-size:16px; line-height:1.7; color:#fffd; }
.feedEntryActions { display:flex; align-items:center; gap:12px; }
.feedEntryActions .discoveryPrimary { min-height:50px; font-size:20px; gap:28px; padding:12px 30px; }
.feedDetails { border:1px solid #fffa; background:#fff1; backdrop-filter:blur(12px); color:#fff; border-radius:28px; min-height:50px; padding:12px 26px; font-family:var(--reading-font,SimSun,serif); font-size:17px; white-space:nowrap; }
.feedContinue { display:flex; align-items:center; gap:4px; min-height:36px; margin:12px 0 0 auto; padding:4px 0; color:#fff; background:none; border:0; font-size:13px; }
.feedContinue .uiIcon { width:15px; height:15px; }
.discoveryFeedPaging { position:absolute; bottom:calc(18px + env(safe-area-inset-bottom)); left:24px; right:24px; display:flex; gap:16px; justify-content:center; align-items:center; color:#fffb; font-size:12px; }
.discoveryFeedPaging button { display:grid; place-items:center; width:44px; height:44px; background:#fff1; color:#fff; border:1px solid #fff3; border-radius:50%; }
.discoveryFeedPaging .uiIcon { width:23px; height:23px; }
.discoveryFeedError { position:absolute; top:100px; left:50%; transform:translateX(-50%); max-width:90%; padding:10px 16px; background:#1e1924e8; border-radius:16px; font-size:13px; }
.discoveryFeedError button { border:0; background:none; color:#f0b4c9; margin-left:10px; min-height:32px; }
.discoveryFeed .discoveryNotice { bottom:80px; }
@keyframes discoveryReveal { from{opacity:.7} to{opacity:1} }
@keyframes discoveryPulse { to{opacity:.5} }
@media(min-width:921px) {
  .discoveryView .discoverySearch { position:absolute; top:21px; right:195px; width:230px; margin:0; }
  .discoveryToolbar { padding-right:10px; gap:18px; }
  .discoverySort { margin-left:auto; }
  .discoveryView .discoveryToolbar .discoverySort { margin-right:0; }
  .discoveryView .discoveryToolbar { padding-bottom:12px; }
  .discoveryView .discoveryTypes { padding-right:250px; }
  .discoveryFeedCopy { left:max(7vw,40px); right:120px; bottom:110px; }
  .discoveryFeedArt { object-position:50% 35%; }
  .discoveryFeedRail { right:50px; bottom:220px; }
}
@media(min-width:921px) and (max-width:1279px) {
  .discoveryGrid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .discoveryView .discoverySearch { position:static; width:auto; margin:0 12px 12px; }
  .discoveryView .discoveryTypes { padding-right:0; }
}
@media(max-width:920px) {
  .homeView { height:100dvh; }
  .homeView .discoveryView { padding:0; }
  .discoveryHero { border-radius:0; }
  .discoveryHeroCopy { left:20px; right:20px; bottom:22px; }
  .discoveryHeroCopy h1 { font-size:clamp(26px,6.6vw,38px); margin:5px 0; }
  .discoveryHeroCopy p { font-size:12px; margin:0 0 10px; }
  .discoveryHeroCopy .discoveryPrimary { min-height:44px; padding:8px 18px; font-size:15px; }
  .heroExpand { right:12px; top:12px; width:38px; min-height:38px; padding:8px; justify-content:center; border-radius:50%; }
  .heroExpand span { display:none; }
  .heroReactions { right:14px; bottom:24px; gap:4px; }
  .discovery-expanded .discoveryHeroCopy { bottom:34px; right:100px; }
  .discovery-expanded .discoveryHeroCopy h1 { font-size:32px; }
  .discovery-expanded .discoveryHeroArt { object-position:50% 34%; }
  .discoverySheet { border-radius:22px 22px 0 0; margin-top:-12px; }
  .discovery-list .discoverySheet { margin-top:0; }
  .discoveryHandle { height:18px; }
  .discoveryToolbar { padding:0 14px 3px; gap:6px; }
  .discoveryTypes { gap:16px; }
  .discoveryTypes button { font-size:19px; padding:5px 3px 11px; }
  .discoveryLayoutControls .iconBtn { width:30px; min-height:44px; padding:5px; }
  .discoveryLayoutControls .uiIcon { width:18px; height:18px; }
  .discoverySort select { min-height:32px; font-size:12px; padding:6px 25px 6px 10px; }
  .discoverySort .uiIcon { right:7px; width:12px; height:12px; }
  .discoveryToolbar .discoverySearchToggle { display:grid; place-items:center; width:30px; min-height:44px; color:var(--dim); flex-shrink:0; padding:5px; }
  .discoverySearchToggle .uiIcon { width:19px; height:19px; }
  .discoverySearch { display:none; margin:0 14px 10px; min-height:36px; }
  .discoverySearch.searchVisible { display:flex; }
  .discoverySearch input { min-height:30px; font-size:12px; padding:4px 0; }
  .discoveryList { padding:0 14px 24px; scrollbar-width:none; }
  .discoveryList::-webkit-scrollbar { display:none; }
  .discoveryGrid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .discoveryCard { border-radius:11px; }
  .discoveryCover { aspect-ratio:1.48; }
  .discoveryCover .discoveryType { top:auto; bottom:8px; left:8px; padding:3px 8px; font-size:10px; }
  .discoveryCardBody { padding:7px 8px 6px; }
  .discoveryTitle { font-size:16px; line-height:1.4; }
  .discoveryCardBody > p { display:none; }
  .discoveryCardActions { margin-top:4px; gap:0; }
  .discoveryCardActions .discoveryPrimary { min-height:44px; padding:6px 10px; gap:6px; font-size:11px; }
  .discoveryCardActions .discoveryPrimary .uiIcon { width:12px; height:12px; }
  .discoveryReaction { width:32px; min-height:44px; padding:5px; }
  .discoveryReaction .uiIcon { width:18px; height:18px; }
  .discoverySkeleton { height:190px; }
  .discoveryFeedHeader { padding:calc(12px + env(safe-area-inset-top)) 18px 10px; gap:10px; }
  .discoveryFeedHeader .discoveryTypes { gap:16px; }
  .discoveryFeed .discoveryTypes button { font-size:17px; }
  .discoveryFeedHeader > .iconBtn { width:32px; min-width:32px; }
  .feedClose { font-size:14px; gap:4px; }
  .feedClose .uiIcon { width:20px; height:20px; }
  .discoveryFeedRail { right:16px; bottom:290px; gap:16px; }
  .discoveryFeedRail button > .uiIcon { width:30px; height:30px; }
  .discoveryFeedCopy { left:22px; right:22px; bottom:100px; }
  .discoveryFeedCopy h2 { font-size:clamp(30px,8vw,42px); padding-right:44px; margin:10px 0 8px; }
  .discoveryFeedCopy .discoveryType { font-size:11px; padding:4px 12px; }
  .feedSubtitle { font-size:12px; padding-right:44px; margin-bottom:10px; }
  .feedSummary { font-size:14px; margin-bottom:18px; padding-right:44px; }
  .feedEntryActions { gap:10px; }
  .feedEntryActions .discoveryPrimary { flex:1.3; min-height:48px; font-size:18px; gap:18px; padding:10px 18px; }
  .feedDetails { flex:1; min-height:48px; font-size:15px; padding:10px 14px; }
  .discoveryFeedPaging { left:22px; right:22px; bottom:calc(14px + env(safe-area-inset-bottom)); gap:14px; }
}
@media(max-width:360px) {
  .discoveryTypes { gap:8px; }
  .discoveryToolbar { gap:4px; padding-left:10px; padding-right:10px; }
  .discoveryTypes button { font-size:17px; }
  .discoveryLayoutControls .iconBtn { width:26px; }
  .discoveryToolbar .discoverySearchToggle { width:26px; }
  .discoveryList { padding-left:10px; padding-right:10px; }
  .discoveryCardBody { padding:6px; }
  .discoveryTitle { font-size:15px; }
  .discoveryReaction { width:26px; padding:3px; }
  .discoveryCardActions .discoveryPrimary { padding:6px 7px; gap:2px; font-size:10px; }
  .discoveryFeedHeader { padding-left:12px; padding-right:12px; }
  .discoveryFeedHeader .discoveryTypes { gap:9px; }
  .discoveryFeedCopy { left:16px; right:16px; }
  .discoveryFeedCopy h2 { font-size:28px; }
}
@media(max-height:680px) {
  .discoveryFeedCopy { bottom:80px; }
  .discoveryFeedCopy h2 { font-size:28px; margin:8px 0; }
  .feedSummary { -webkit-line-clamp:1; margin-bottom:12px; }
  .feedSubtitle { margin-bottom:8px; }
  .discoveryFeedRail { bottom:240px; gap:10px; }
  .discoveryFeedRail button > .uiIcon { width:25px; height:25px; }
}
@media(prefers-reduced-motion:reduce) {
  .discoveryHero,.discoveryCover img,.discoveryFeedArt { animation:none; transition:none; }
  .discoverySkeleton { animation:none; }
}
