/* LIVINKERALA News — the public reader app. Same look as the LK Desk Queue. */
:root {
  --red: #E1232B; --red-dark: #B9161D; --yellow: #FFD23F;
  --bg: #F4F4F6; --card: #FFFFFF; --ink: #1D1D1F; --muted: #6E6E73; --line: #E3E3E8;
  --safe-b: env(safe-area-inset-bottom); --safe-t: env(safe-area-inset-top);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111113; --card: #1C1C1F; --ink: #F2F2F4; --muted: #9A9AA2; --line: #2E2E33; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Malayalam", "Malayalam Sangam MN", sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: contain; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.red { color: var(--red); font-weight: 700; text-decoration: none; }
svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

#app { max-width: 640px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(8px + var(--safe-t)) 14px 6px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 6; }
.logo { height: 34px; width: auto; display: block; }
.logo.big { height: 64px; }
.top-btns { display: flex; gap: 8px; }
.ibtn { width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 0; }
.ibtn .ico { width: 21px; height: 21px; }
#btnSound .off { display: none; color: var(--muted); }
#btnSound.muted .on { display: none; } #btnSound.muted .off { display: block; }

.cats { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px; scrollbar-width: none; flex: none; }
.cats::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 38px; padding: 0 16px; border-radius: 19px; border: none; background: var(--card); color: var(--ink);
  font-weight: 700; font-size: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.chip.on { background: var(--red); color: #fff; box-shadow: none; }

.main { flex: 1; display: flex; flex-direction: column; padding: 0 12px calc(14px + var(--safe-b)); position: relative; }
.deck-wrap { position: relative; }
.deck { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; position: relative; margin: 4px auto 0;
  width: min(100%, calc((100vh - 400px) / 1.25)); width: min(100%, calc((100dvh - 400px) / 1.25)); min-width: 240px; }
.swipe { position: absolute; left: 0; right: 0; top: 0; background: var(--card); border-radius: 22px; overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.08), 0 14px 30px rgba(0,0,0,.10);
  transform: translateY(calc(var(--depth, 0) * 12px)) scale(calc(1 - var(--depth, 0) * .04));
  transition: transform .25s ease; touch-action: pan-y; cursor: grab; z-index: calc(10 - var(--depth, 0)); }
.swipe.is-top { position: relative; }
.swipe:not(.is-top) { pointer-events: none; }
.swipe.from-right { animation: inRight .22s ease; }
.swipe.from-left { animation: inLeft .22s ease; }
@keyframes inRight { from { transform: translateX(40%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes inLeft { from { transform: translateX(-40%); opacity: 0; } to { transform: none; opacity: 1; } }
.sw-poster { position: relative; aspect-ratio: 4 / 5; background: var(--line); }
.sw-poster img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; -webkit-user-drag: none; }
.sw-body { padding: 10px 14px 12px; }
.meta { display: flex; gap: 8px; align-items: center; font-size: 13px; overflow: hidden; white-space: nowrap; }
.pill { background: var(--yellow); color: var(--red-dark); font-weight: 700; padding: 3px 10px; border-radius: 999px; flex: none; }
.sw-src { overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.sw-head { margin: 6px 0 2px; font-weight: 700; font-size: 17px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sw-cap { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }

.deck-nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 16px 0 0; font-size: 14px; }
.nav { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 24px; line-height: 1; padding: 0; }
.nav[disabled] { opacity: .3; }
.count { min-width: 74px; text-align: center; font-weight: 600; }
.actions { display: flex; justify-content: center; gap: 14px; margin: 10px 0 4px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: none; padding: 0; font-size: 12px; font-weight: 600; color: var(--muted); width: 70px; }
.round { width: 58px; height: 58px; border-radius: 50%; background: var(--card); box-shadow: 0 3px 12px rgba(0,0,0,.14); display: flex; align-items: center; justify-content: center; }
.round svg { width: 24px; height: 24px; }
.act:active .round { transform: scale(.94); }
.round.save { color: #3478F6; } .round.share { background: var(--red); color: #fff; } .round.read { color: var(--ink); }
.hint { text-align: center; font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.new-pill { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); z-index: 20; border: none; background: var(--red); color: #fff;
  font-weight: 700; font-size: 14px; padding: 9px 16px; border-radius: 999px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-back { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sheet-card { position: relative; background: var(--card); border-radius: 24px 24px 0 0; padding: 8px 18px calc(18px + var(--safe-b));
  max-height: 86vh; overflow-y: auto; width: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px;
  animation: up .22s ease; }
@keyframes up { from { transform: translateY(30%); opacity: .4; } to { transform: none; opacity: 1; } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); align-self: center; }
.read-head { margin: 0; font-size: 21px; line-height: 1.35; }
.read-text { font-size: 16px; line-height: 1.65; white-space: pre-line; }
.read-tags { margin: 0; color: #3478F6; font-size: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { height: 50px; border-radius: 14px; border: none; background: var(--red); color: #fff; font-weight: 700; font-size: 15px; width: 100%; }
.btn.ghost { background: var(--bg); color: var(--ink); }
.sheet-title { margin: 0; font-weight: 700; font-size: 17px; text-align: center; }
.share-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sh { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; text-decoration: none; color: var(--ink); }
.sh-i { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; }
.sh-i svg { width: 24px; height: 24px; }
.sh-i.wa { background: #1f8f4e; } .sh-i.fb { background: #2f5fd0; } .sh-i.tw { background: #111; } .sh-i.tg { background: #2a8bc9; }

/* about */
.page { position: fixed; inset: 0; z-index: 45; background: var(--bg); overflow-y: auto; }
.page-top { display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 14px 8px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; }
.page-top h1 { margin: 0; font-size: 18px; }
.page-body { max-width: 640px; margin: 0 auto; padding: 14px 14px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--card); border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.card.center { align-items: center; text-align: center; }
.card.list { padding: 0; gap: 0; }
.li { min-height: 54px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; text-decoration: none;
  font-size: 15px; font-weight: 600; border: none; background: none; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.li:last-child { border-bottom: none; }
.li span { color: var(--muted); }
.card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; }
.ver { text-align: center; font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 60; background: #1f1f22; color: #fff;
  padding: 11px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; text-align: center; }
.sound-chip { position: fixed; right: 14px; bottom: calc(18px + var(--safe-b)); z-index: 30; border: none; background: var(--card); color: var(--ink);
  font-weight: 700; font-size: 13px; padding: 9px 14px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }

