* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--label); font-family: var(--ios-font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
main { padding: env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 110px); max-width: 640px; margin: 0 auto; }
.view { animation: viewIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }

.largehead { display: flex; align-items: flex-end; justify-content: space-between; padding: 18px 4px 10px; }
.eyebrow { margin: 0 0 2px; font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--label-2); }
.large-title { margin: 0; font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.02em; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, #2f6bff, #8b3dff); margin-bottom: 4px; }
.avatar svg { width: 21px; height: 21px; stroke-width: 1.9; }
.bicon { width: 31px; height: 31px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--c); flex: none; }
.bicon svg { width: 19px; height: 19px; stroke-width: 1.9; }

.navbar {
  position: fixed; inset: 0 0 auto; z-index: 20; height: calc(env(safe-area-inset-top) + 44px);
  padding-top: env(safe-area-inset-top); display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 600; background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  border-bottom: .5px solid var(--sep); opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.navbar.show { opacity: 1; transform: none; }

.section-h { margin: 26px 4px 8px; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.footnote { margin: 10px 18px 0; font-size: 13px; line-height: 1.45; color: var(--label-2); }

/* ---------- Grouped inset list ---------- */
.group { background: var(--bg-elev); border-radius: var(--r-card); overflow: hidden; }
.group.pad { padding: 6px; }
.row { position: relative; display: flex; align-items: center; gap: 13px; width: 100%; min-height: 52px; padding: 9px 14px; text-align: left; transition: background .15s; }
.row:not(.static):active { background: var(--fill); }
.row + .row::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; border-top: .5px solid var(--sep); }
.row-t { flex: 1; min-width: 0; font-size: 17px; line-height: 1.25; display: flex; flex-direction: column; }
.row-t small { font-size: 13px; color: var(--label-2); margin-top: 1px; }
.row .chev { width: 16px; height: 16px; color: var(--label-3); stroke-width: 2.4; }
.row .chev.ext { width: 17px; height: 17px; stroke-width: 2; }
.sq { width: 31px; height: 31px; border-radius: 8px; display: grid; place-items: center; background: var(--c); color: #fff; flex: none; }
.sq svg { width: 19px; height: 19px; stroke-width: 2; }
.sq.num { font: 700 16px/1 var(--ios-rounded); }
.badge { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--fill); color: var(--label-2); }
.badge.tint { background: var(--tint-soft); color: var(--tint); }

/* ---------- Continue hero ---------- */
.hero {
  position: relative; display: block; margin-top: 6px; padding: 18px 18px 16px; border-radius: 26px; overflow: hidden; color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.22), transparent 55%),
    linear-gradient(135deg, #2f6bff 0%, #5a4bff 55%, #8b3dff 100%);
  box-shadow: 0 14px 34px rgba(64, 80, 255, .35);
  transition: transform .2s;
}
.hero:active { transform: scale(.98); }
.hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 190px; height: 190px; border-radius: 50%; border: 28px solid rgba(255,255,255,.08); }
.hero-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.hero-title { margin: 6px 0 2px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.hero-sub { font-size: 15px; opacity: .85; }
.hero-row { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; position: relative; z-index: 1; }
.hero-cta { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 99px; background: rgba(255,255,255,.95); color: #2a3cff; font-weight: 600; font-size: 15px; }
.hero-cta svg { width: 15px; height: 15px; stroke-width: 2.6; }
.hero-alt { font-size: 14px; font-weight: 600; opacity: .9; padding: 8px 4px; }
.hero.empty { background: linear-gradient(135deg, #1d2b55, #33275e); box-shadow: none; }
html[data-theme="light"] .hero.empty { background: linear-gradient(135deg, #3b6cff, #6a5cff); }
.sem-dots { display: flex; gap: 5px; margin-top: 12px; position: relative; z-index: 1; }
.sem-dots i { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.25); }
.sem-dots i.on { background: #fff; }

/* ---------- Recents ---------- */
.recents { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.recents::-webkit-scrollbar { display: none; }
.recent { scroll-snap-align: start; flex: none; width: 150px; padding: 12px; border-radius: 18px; background: var(--bg-elev); display: flex; flex-direction: column; gap: 8px; transition: transform .15s; }
.recent:active { transform: scale(.97); }
.recent .sq { width: 28px; height: 28px; border-radius: 8px; }
.recent b { font-size: 15px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recent span { font-size: 12px; color: var(--label-2); }
.recents-empty { padding: 14px 16px; border-radius: 18px; background: var(--bg-elev); color: var(--label-2); font-size: 15px; width: 100%; }

/* ---------- Widgets ---------- */
.widgets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.widget { position: relative; display: flex; flex-direction: column; min-height: 118px; padding: 14px; border-radius: var(--r-card); background: var(--bg-elev); overflow: hidden; transition: transform .15s; }
.widget:active { transform: scale(.97); }
.widget::before { content: ""; position: absolute; inset: auto -30% -60% auto; width: 140px; height: 140px; border-radius: 50%; background: var(--c); opacity: .14; filter: blur(10px); }
.w-wide { grid-column: span 2; }
.w-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--c); margin-bottom: auto; }
.w-ico svg { width: 20px; height: 20px; stroke-width: 2; }
.w-title { margin-top: 12px; font-size: 17px; font-weight: 600; }
.w-sub { font-size: 13px; color: var(--label-2); margin-top: 1px; }
.w-wide { display: grid; grid-template-columns: 40px 1fr; column-gap: 12px; align-content: center; min-height: 78px; }
.w-wide .w-ico { grid-row: span 2; margin: 0; width: 40px; height: 40px; border-radius: 12px; align-self: center; }
.w-wide .w-title { margin: 0; align-self: end; }
.w-wide .w-sub { margin: 0; align-self: start; }

/* ---------- Feature card (Papers) ---------- */
.feature { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-card); background: var(--bg-elev); margin-top: 4px; }
.feature:active { background: var(--fill); }
.feature-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, #ff6a3d, #ff2d55); flex: none; }
.feature-ico svg { width: 28px; height: 28px; }
.feature-body { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.feature-t { font-size: 17px; font-weight: 600; }
.feature-s { font-size: 14px; color: var(--label-2); line-height: 1.35; }
.feature .chev { width: 16px; height: 16px; color: var(--label-3); stroke-width: 2.4; }

/* ---------- Search ---------- */
.searchbar { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border-radius: 12px; background: var(--fill); color: var(--label-2); margin: 2px 0 4px; }
.searchbar svg { width: 18px; height: 18px; }
.searchbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--label); font: 17px var(--ios-font); }
.searchbar input::placeholder { color: var(--label-2); }
.searchbar input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- Segmented ---------- */
.segmented { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); padding: 2px; border-radius: 10px; background: var(--fill); }
.segmented button { position: relative; z-index: 1; height: 32px; border-radius: 8px; font-size: 14px; font-weight: 500; transition: background .2s, box-shadow .2s; }
.segmented button.on { background: var(--bg-elev-2); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); font-weight: 600; }
html[data-theme="light"] .segmented button.on { background: #fff; }
html:not([data-theme="light"]) .segmented button.on { background: #636366; }

/* ---------- Tab bar (floating glass capsule) ---------- */
.tabbar {
  position: fixed; z-index: 30; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 10px); transform: translateX(-50%);
  width: min(calc(100% - 32px), 420px); height: 62px; display: grid; grid-template-columns: repeat(4, 1fr); padding: 4px;
  border-radius: 999px; background: var(--glass);
  -webkit-backdrop-filter: saturate(190%) blur(26px); backdrop-filter: saturate(190%) blur(26px);
  box-shadow: var(--shadow-float), inset 0 0 0 .5px var(--glass-edge), inset 0 1px 0 var(--glass-shine);
}
.tabbar button { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--label); font-size: 10.5px; font-weight: 600; transition: color .25s; }
.tabbar button svg { width: 25px; height: 25px; stroke-width: 1.7; }
.tabbar button.on { color: var(--tint); }
.tabbar button.on svg { stroke-width: 2.1; }
.tab-pill { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 4); border-radius: 999px; background: var(--fill); transition: transform .38s cubic-bezier(.3,1.35,.5,1); }

/* ---------- Sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); animation: fade .25s; }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 20px); border-radius: 28px 28px 0 0; background: var(--bg);
  animation: sheetUp .38s cubic-bezier(.2,.9,.25,1); max-width: 640px; margin: 0 auto;
}
html[data-theme="light"] .sheet { background: #f2f2f7; }
html:not([data-theme="light"]) .sheet { background: #1c1c1e; }
html:not([data-theme="light"]) .sheet .group { background: #2c2c2e; }
.sheet.closing { animation: sheetDown .25s ease-in forwards; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--label-3); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 4px 2px 14px; }
.sheet-head .bicon { width: 52px; height: 52px; border-radius: 14px; }
.sheet-head .bicon svg { width: 30px; height: 30px; }
.sheet-head h3 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.sheet-head p { margin: 2px 0 0; font-size: 14px; color: var(--label-2); }
.sheet-head .x { margin-left: auto; width: 30px; height: 30px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; color: var(--label-2); align-self: flex-start; }
.sheet-head .x svg { width: 16px; height: 16px; stroke-width: 2.6; }
.sem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sem-btn { position: relative; aspect-ratio: 1; border-radius: 18px; background: var(--bg-elev); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; transition: transform .12s; }
html:not([data-theme="light"]) .sheet .sem-btn { background: #2c2c2e; }
.sem-btn:active { transform: scale(.94); }
.sem-btn b { font: 700 24px/1 var(--ios-rounded); }
.sem-btn span { font-size: 11px; color: var(--label-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.sem-btn.app { opacity: .45; }
.sem-btn.app::after { content: "Android"; position: absolute; bottom: 7px; font-size: 9px; font-weight: 700; color: var(--orange); letter-spacing: .02em; }
.sem-btn.app span { display: none; }
.sem-btn.cur { background: var(--tint) !important; color: #fff; }
.sem-btn.cur span { color: rgba(255,255,255,.8); }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px; border-radius: 14px; font-size: 17px; font-weight: 600; margin-top: 14px; }
.btn svg { width: 18px; height: 18px; stroke-width: 2.2; }
.btn.primary { background: var(--tint); color: #fff; }
.btn.plain { background: var(--tint-soft); color: var(--tint); }
.sheet-label { margin: 18px 4px 8px; font-size: 13px; color: var(--label-2); text-transform: uppercase; letter-spacing: .03em; }
.sheet .group { background: var(--bg-elev); }
.pick-list { max-height: 44dvh; overflow-y: auto; }
.row.sel { color: var(--tint); }
.row .tick { width: 18px; height: 18px; color: var(--tint); stroke-width: 2.6; }

@keyframes fade { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Liquid Glass ---------- */
.tabbar { border-radius: 999px; }
.tab-pill {
  background: var(--lg-drop) !important;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.5), inset 0 -1px 2px rgba(0,0,0,.12), 0 2px 10px rgba(0,0,0,.18);
  transition: transform .5s cubic-bezier(.3,1.45,.45,1);
}
.tab-pill.moving { animation: squish .5s cubic-bezier(.3,1.2,.4,1); }
@keyframes squish { 0% { scale: 1 1; } 35% { scale: 1.22 .86; } 70% { scale: .96 1.04; } 100% { scale: 1 1; } }
.tabbar button:active svg { transform: scale(.88); transition: transform .12s; }
.sheet { border-radius: 30px 30px 0 0; }
html:not([data-theme="light"]) .sheet, html[data-theme="light"] .sheet { background: var(--lg-fill) !important; }
html:not([data-theme="light"]) .sheet { background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.03)), rgba(28,28,32,.78) !important; }
html[data-theme="light"] .sheet { background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(242,242,247,.86)) !important; }
/* Large-title nav fades content under a soft progressive blur instead of a hard bar. */
.navbar { background: transparent; border-bottom: 0; }
.navbar::before {
  content: ""; position: absolute; inset: 0 0 -24px; z-index: -1;
  -webkit-backdrop-filter: blur(14px) saturate(180%); backdrop-filter: blur(14px) saturate(180%);
  background: linear-gradient(var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 60%, transparent);
  -webkit-mask: linear-gradient(#000 55%, transparent); mask: linear-gradient(#000 55%, transparent);
}
.avatar { box-shadow: inset 0 1px 1px rgba(255,255,255,.5), 0 4px 14px rgba(70,80,255,.35); }

/* ---------- Holiday card ---------- */
.holiday-card { display: block; border-radius: 26px; background: var(--bg-elev); padding: 16px; transition: transform .15s; position: relative; overflow: hidden; }
.holiday-card:active { transform: scale(.985); }
.holiday-card::before { content: ""; position: absolute; right: -50px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: var(--red); opacity: .12; filter: blur(30px); pointer-events: none; }
.hc-loading { color: var(--label-2); font-size: 15px; padding: 6px 2px; }
.hc-top { display: flex; gap: 14px; align-items: flex-start; position: relative; }
.hc-tile { flex: none; width: 62px; border-radius: 16px; overflow: hidden; text-align: center; background: var(--bg-elev-2); box-shadow: inset 0 0 0 .5px var(--sep); }
html[data-theme="light"] .hc-tile { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.08), inset 0 0 0 .5px var(--sep); }
.hc-tile span { display: block; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 0 3px; }
.hc-tile b { display: block; font: 700 30px/1.15 var(--ios-rounded); padding: 4px 0 6px; }
.hc-main { flex: 1; min-width: 0; }
.hc-kicker { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--red); }
.hc-title { font-size: 21px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; margin-top: 2px; }
.hc-hi { font-size: 14px; color: var(--label-2); margin-top: 2px; }
.hc-when { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; font-size: 13px; color: var(--label-2); }
.hc-badge { padding: 3px 10px; border-radius: 99px; background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); font-weight: 700; }
.hc-list { margin-top: 14px; border-top: .5px solid var(--sep); position: relative; }
.hc-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
.hc-row + .hc-row { border-top: .5px solid var(--sep); }
.hc-d { width: 62px; flex: none; display: flex; align-items: baseline; justify-content: center; gap: 4px; color: var(--label-2); font-size: 13px; font-weight: 600; text-transform: uppercase; }
.hc-d b { font: 700 19px var(--ios-rounded); color: var(--label); }
.hc-n { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; display: flex; flex-direction: column; }
.hc-n small { font-size: 12.5px; color: var(--label-2); font-weight: 400; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-foot { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 6px; padding-top: 12px; border-top: .5px solid var(--sep); color: var(--tint); font-size: 15px; font-weight: 600; position: relative; }
.hc-foot svg { width: 14px; height: 14px; stroke-width: 2.6; }
.sem-btn.partial span { display: none; }
.sem-btn.partial::after { content: "List only"; position: absolute; bottom: 7px; font-size: 9px; font-weight: 700; color: var(--label-2); }
