/* Shubh Ventures v1.05 — performance profile, mobile SHUBHI, brand polish.
   Loaded after every other sv-* stylesheet so these rules win. */

/* ================================================================ 1. PERFORMANCE
   Blur filters on animated layers force a full repaint every frame — that is what heated phones and
   made iPhones drop the tab. The sphere blobs are already soft radial gradients, so the blur is gone
   everywhere; the colours are kept by widening the gradient instead. */
.sh-sphere i, #shubhi-orb .sh-sphere i:not(.gloss):not(.core) { filter: none !important; mix-blend-mode: normal !important; }
.sh-sphere .b1 { background: radial-gradient(circle, rgba(34, 211, 238, .95) 0%, rgba(34, 211, 238, .35) 38%, rgba(34, 211, 238, 0) 70%) !important; }
.sh-sphere .b2 { background: radial-gradient(circle, rgba(168, 85, 247, .95) 0%, rgba(168, 85, 247, .35) 38%, rgba(168, 85, 247, 0) 70%) !important; }
.sh-sphere .b3 { background: radial-gradient(circle, rgba(236, 72, 153, .9) 0%, rgba(236, 72, 153, .3) 38%, rgba(236, 72, 153, 0) 70%) !important; }
#shubhi-panel .sh-aurora { filter: none !important; }
/* nothing animates in a background tab */
html.sv-hidden *, html.sv-hidden *::before, html.sv-hidden *::after { animation-play-state: paused !important; }
/* idle orb: completely still (it breathes only while SHUBHI is active or hovered) */
html[data-shubhi="idle"] .sh-sphere i, html:not([data-shubhi]) .sh-sphere i { animation-play-state: paused !important; }
html[data-shubhi="idle"] #shubhi-panel:not(.open) ~ #shubhi-orb .sh-sphere i { animation: none !important; }

/* ---- lite mode (phones, tablets, low-memory PCs, "Performance saver") */
html.sv-lite *, html.sv-lite *::before, html.sv-lite *::after {
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
}
html.sv-lite .glass, html.sv-lite header.glass, html.sv-lite aside .glass { background-color: var(--surface, #fff) !important; }
html.sv-lite.dark .glass, html.sv-lite[data-theme="dark"] .glass { background-color: var(--surface, #151a2b) !important; }
html.sv-lite #shubhi-panel { --p-bg: #ffffff; }
html.sv-lite.dark #shubhi-panel, html.sv-lite[data-theme="dark"] #shubhi-panel { --p-bg: #1b1f2e; }
/* ambient / decorative infinite animations off (spinners and SHUBHI's active states stay) */
html.sv-lite .sv-aurora, html.sv-lite .sv-aurora *, html.sv-lite #sv-login-hero *, html.sv-lite .u-orb, html.sv-lite [class*="float"],
html.sv-lite main .card { animation: none !important; }
html.sv-lite #sv-login-hero .orb, html.sv-lite #sv-login-hero [class*="blur"], html.sv-lite .sv-login [class*="blur-"] { filter: none !important; }
html.sv-lite .sh-sphere .b1, html.sv-lite .sh-sphere .b2, html.sv-lite .sh-sphere .b3 { animation-duration: 14s !important; }
html.sv-lite[data-shubhi="idle"] .sh-sphere i { animation: none !important; }
html.sv-lite .u-ripple { display: none !important; }
html.sv-lite * { scroll-behavior: auto !important; }
/* the edge glow on lite devices: two bands only (top + bottom), no per-frame JS */
html.sv-lite #shubhi-ring .e.l, html.sv-lite #shubhi-ring .e.r { display: none; }
html.sv-lite #shubhi-ring .e { transition: none; }
html.sv-lite #shubhi-ring.on .e.t, html.sv-lite #shubhi-ring.on .e.b { transform: scaleY(.9); }
html.sv-lite #shubhi-ring[data-s="listening"] .e.t, html.sv-lite #shubhi-ring[data-s="speaking"] .e.b { animation: sv-breathe 1.6s ease-in-out infinite; }
@keyframes sv-breathe { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }

/* ================================================================ 2. MOBILE LAYOUT */
@media (max-width: 1023px) {
  /* bottom navigation respects the iPhone home bar */
  .glass.fixed.inset-x-0.bottom-0.z-30 { padding-bottom: env(safe-area-inset-bottom, 0px); }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important; }
  /* version chip never sits on top of the nav */
  #u-version { display: none !important; }
  /* SHUBHI button floats above the bottom nav, not on "More" */
  #shubhi-orb { right: 14px !important; bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important; width: 52px !important; height: 52px !important;
    box-shadow: 0 10px 24px -8px rgba(79, 70, 229, .55), 0 0 0 3px rgba(255, 255, 255, .9) !important; }
  html.dark #shubhi-orb, html[data-theme="dark"] #shubhi-orb { box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .6), 0 0 0 3px rgba(20, 24, 38, .95) !important; }
}
/* iOS zooms into any input under 16px — stop that */
@media (max-width: 767px) {
  input:not([type=checkbox]):not([type=radio]), textarea, select, .svs-btn { font-size: 16px !important; }
}

/* ---- SHUBHI as a full-height bottom sheet on phones */
@media (max-width: 767px) {
  #shubhi-panel {
    left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important; width: 100% !important; max-width: none !important;
    height: calc(var(--sv-vh, 1vh) * 100 - 56px) !important; max-height: none !important;
    border-radius: 22px 22px 0 0 !important; border-left: 0 !important; border-right: 0 !important; border-bottom: 0 !important;
    transform: translateY(100%) !important; transform-origin: 50% 100% !important; opacity: 1 !important; visibility: hidden;
    transition: transform .32s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .32s !important;
    padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -18px 50px -12px rgba(15, 23, 42, .35) !important;
  }
  #shubhi-panel.open { transform: none !important; visibility: visible; transition: transform .32s cubic-bezier(.2, .8, .2, 1) !important; }
  #shubhi-panel::before { content: ''; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: rgba(100, 116, 139, .35); z-index: 3; }
  html.shubhi-open body { overflow: hidden; }
  html.shubhi-open #shubhi-orb { opacity: 0; pointer-events: none; transform: scale(.6); }
  html.shubhi-open::after { content: ''; position: fixed; inset: 0; z-index: 2147482999; background: rgba(2, 6, 23, .45); }
  #shubhi-panel .sh-head { padding: 18px 10px 6px 14px; gap: 9px; }
  #shubhi-panel .sh-head .sh-sphere.sm { width: 32px; height: 32px; }
  #shubhi-panel .sh-title b { font-size: 14.5px; }
  #shubhi-panel .sh-title small { font-size: 11px; }
  #shubhi-panel .sh-state { display: none; }
  #shubhi-panel .sh-ic { width: 38px; height: 38px; }
  #shubhi-panel .sh-viz { height: 54px; margin: 0 12px; }
  #shubhi-panel .sh-log { padding: 8px 12px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  #shubhi-panel .sh-msg { font-size: 15px; max-width: 92%; }
  /* suggestion chips: one swipeable row */
  #shubhi-panel .sh-chips { flex-wrap: nowrap !important; overflow-x: auto; overflow-y: hidden; padding: 6px 12px 8px !important; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #shubhi-panel .sh-chips::-webkit-scrollbar { display: none; }
  #shubhi-panel .sh-chips > * { flex: none; white-space: nowrap; font-size: 13.5px; padding: 8px 13px; }
  /* big thumb-friendly input bar */
  #shubhi-panel .sh-bar { margin: 0 10px 8px !important; padding: 6px !important; gap: 8px; border-radius: 18px; }
  #shubhi-panel .sh-bar input { font-size: 16px !important; min-height: 44px; }
  #shubhi-panel .sh-mic { width: 50px !important; height: 50px !important; flex: none; }
  #shubhi-panel .sh-mic svg { width: 22px; height: 22px; }
  #shubhi-panel .sh-send { width: 44px !important; height: 44px !important; flex: none; }
  #shubhi-panel .sh-foot { padding: 4px 14px 8px; font-size: 11px; }
  #shubhi-panel .sh-foot .sh-ver { display: none; }
  /* SHUBHI settings page on phones */
  #shubhi-settings .ss-head { flex-direction: column; align-items: stretch !important; gap: 12px; }
  #shubhi-settings .ss-open { width: 100%; justify-content: center; min-height: 46px; }
  #shubhi-settings .ss-status { grid-template-columns: 1fr 1fr !important; }
  #shubhi-settings .ss-row { flex-direction: column; align-items: stretch !important; gap: 8px; }
  #shubhi-settings .ss-row:has(.ss-sw) { flex-direction: row; align-items: center !important; }
  #shubhi-settings .ss-ctl { width: 100%; display: flex; gap: 8px; }
  #shubhi-settings .ss-ctl > * { flex: 1; }
}

/* ================================================================ 3. BRAND MARK (sidebar + mobile header) */
img.u-logo-mark, aside img[data-u-logo], header img[data-u-logo] {
  background: linear-gradient(145deg, #ffffff, #eef2ff) !important; padding: 3px !important; border-radius: 11px !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 4px 12px -4px rgba(49, 46, 129, .35), 0 0 0 1px rgba(99, 102, 241, .18) !important;
  object-fit: contain !important;
}
html.dark img.u-logo-mark, html[data-theme="dark"] img.u-logo-mark { background: linear-gradient(145deg, #ffffff, #e0e7ff) !important; box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .6), 0 0 0 1px rgba(165, 180, 252, .25) !important; }
.sv-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.sv-brand-text b { font-weight: 800; font-size: 13.5px; letter-spacing: .14em; white-space: nowrap;
  background: linear-gradient(90deg, var(--t-strong, #0f172a), var(--accent, #4f46e5)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sv-brand-text small { margin-top: 3px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
html.dark .sv-brand-text b, html[data-theme="dark"] .sv-brand-text b { background: linear-gradient(90deg, #fff, #c7d2fe); -webkit-background-clip: text; background-clip: text; }

/* sparkle icon for the SHUBHI nav item */
a.nav-link[href="/shubhi"] svg { color: #8b5cf6; }

/* ================================================================ 4. THEME MANAGER (history, favourites, surprise) */
#sv-studio .tm-tools{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:14px;padding:10px;border:1px solid var(--border);border-radius:var(--radius-card);background:var(--surface-elevated);box-shadow:var(--shadow-1)}
#sv-studio .tm-sp{flex:1}
#sv-studio .tm-sm{display:flex;gap:6px;flex-wrap:wrap}
#sv-studio .tm-btn{display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 12px;border-radius:var(--radius-ctl);border:1px solid var(--border);background:var(--surface);color:var(--text);font:600 12.5px var(--sv-font);cursor:pointer;transition:background .15s,border-color .15s,transform .15s}
#sv-studio .tm-btn:hover:not(:disabled){border-color:var(--accent);transform:translateY(-1px)}
#sv-studio .tm-btn:disabled{opacity:.45;cursor:not-allowed}
#sv-studio .tm-btn em{font-style:normal;font-size:11px;padding:0 6px;border-radius:99px;background:var(--accent-soft,rgba(37,99,235,.12));color:var(--accent)}
#sv-studio .tm-btn.on{background:var(--accent);color:#fff;border-color:var(--accent)}
#sv-studio .tm-surprise{background:linear-gradient(135deg,#7c3aed,#2563eb 55%,#06b6d4);color:#fff;border:0;box-shadow:0 6px 18px -8px rgba(76,29,149,.6)}
#sv-studio .tm-surprise:hover:not(:disabled){filter:brightness(1.08)}
#sv-studio .tm-cols{display:grid;gap:18px;grid-template-columns:1fr 1fr;margin-bottom:18px}
@media (max-width:900px){#sv-studio .tm-cols{grid-template-columns:1fr}}
#sv-studio .tm-list{max-height:280px;overflow:auto;padding:8px 10px;display:grid;gap:6px}
#sv-studio .tm-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:12px;border:1px solid transparent;transition:background .15s}
#sv-studio .tm-item:hover{background:var(--surface);border-color:var(--border)}
#sv-studio .tm-item.live{background:var(--surface);border-color:var(--border)}
#sv-studio .tm-sw{display:flex;border-radius:8px;overflow:hidden;border:1px solid var(--border);flex:none}
#sv-studio .tm-sw i{width:12px;height:26px;display:block}
#sv-studio .tm-meta{flex:1;min-width:0}
#sv-studio .tm-meta b{display:block;font:600 13px var(--sv-font);color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#sv-studio .tm-meta small{font-size:11.5px;color:var(--muted)}
#sv-studio .tm-live{font:700 10px var(--sv-font);padding:2px 7px;border-radius:99px;background:var(--green-bg);color:var(--c-success);margin-left:4px;vertical-align:1px}
#sv-studio .tm-mini{height:28px;padding:0 10px;border-radius:9px;border:1px solid var(--border);background:transparent;color:var(--text);font:600 12px var(--sv-font);cursor:pointer}
#sv-studio .tm-mini.acc{background:var(--accent);border-color:var(--accent);color:#fff}
#sv-studio .tm-mini.x{width:28px;padding:0;font-size:16px;color:var(--muted)}
#sv-studio .tm-mini.x:hover{color:var(--c-danger);border-color:var(--c-danger)}
#sv-studio .tm-empty{margin:6px 4px;font-size:12.5px;color:var(--muted);line-height:1.5}
html.sv-mobile #sv-studio .tm-tools{position:sticky;top:60px;z-index:5}
html.sv-mobile #sv-studio .tm-sp{display:none}
html.sv-mobile #sv-studio .tm-btn{height:38px;flex:1 1 auto;justify-content:center}

/* ================================================================ 5. MOBILE SIGN-IN (compact brand, hero + bottom sheet) */
@media (max-width: 1023px) {
  html.sv-route-login .sv-login img.u-logo-login { width: 48px !important; height: 48px !important; max-width: none; padding: 4px !important; border-radius: 14px !important; animation: none !important; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .5) !important; }
  html.sv-route-login .sv-login .mb-6.flex.flex-col.items-center { flex-direction: row !important; align-items: center !important; text-align: left !important; gap: 12px; }
  html.sv-route-login .sv-login .mb-6.flex.flex-col.items-center > h1 { margin-top: 0 !important; }
  html.sv-route-login .sv-login img.u-logo-login + * { margin-top: 0 !important; }
  .svm-brandtext { display: flex; flex-direction: column; min-width: 0; }
}
@media (max-width: 640px) {
  html.sv-route-login, html.sv-route-login body { background: #0b1b4d; }
  html.sv-route-login .sv-login { padding: 0 !important; align-items: stretch !important; justify-content: flex-start !important; min-height: 100vh; min-height: 100dvh;
    background: radial-gradient(420px 260px at 100% 0%, rgba(56, 189, 248, .45), transparent 70%), linear-gradient(165deg, #0a1640 0%, #1d3fb8 55%, #2563eb 100%) !important; }
  html.theme-dark.sv-route-login .sv-login { background: radial-gradient(420px 260px at 100% 0%, rgba(56, 189, 248, .25), transparent 70%), linear-gradient(165deg, #050a1c 0%, #0f1f5c 60%, #1e3a8a 100%) !important; }
  html.sv-route-login .sv-login > .pointer-events-none { display: none !important; }
  html.sv-route-login .sv-login::before { content: ""; position: absolute; right: -60px; top: 20px; width: 260px; height: 260px; background: url(/assets/sv-mark-v105.webp) center/contain no-repeat; opacity: .10; pointer-events: none; }
  html.sv-route-login .sv-login > .relative.w-full.max-w-sm { max-width: none !important; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
  html.sv-route-login .sv-login .mb-6.flex.flex-col.items-center { margin: 0 !important; padding: calc(22px + env(safe-area-inset-top, 0px)) 22px 0; }
  html.sv-route-login .sv-login .svm-brandtext h1 { margin: 0 !important; color: #fff !important; font-size: 13.5px !important; letter-spacing: .2em !important; line-height: 1.2; }
  html.sv-route-login .sv-login .svm-brandtext p { color: rgba(226, 236, 255, .78) !important; font-size: 12px !important; margin-top: 2px; }
  .svm-hero { padding: 34px 22px 26px; color: #fff; position: relative; }
  .svm-hero h2 { margin: 0; font: 700 30px/1.12 var(--sv-font, system-ui); letter-spacing: -.02em; }
  .svm-hero p { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: rgba(226, 236, 255, .82); max-width: 320px; }
  .svm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
  .svm-chips span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 99px; font: 600 11.5px var(--sv-font, system-ui); color: #fff; background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .18); }
  .svm-chips svg { opacity: .9; }
  html.sv-route-login .sv-login-card { flex: 1; margin: 0 !important; border-radius: 28px 28px 0 0 !important; border: 0 !important; padding: 26px 22px calc(22px + env(safe-area-inset-bottom, 0px)) !important;
    background: var(--surface-elevated, #fff) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; box-shadow: 0 -18px 40px -24px rgba(2, 6, 23, .55) !important; display: flex; flex-direction: column; }
  html.sv-route-login .sv-login-card > form, html.sv-route-login .sv-login-card > div { width: 100%; }
  html.sv-route-login .sv-login-card h2 { font-size: 20px !important; }
  html.sv-route-login .sv-login-card input { height: 52px !important; font-size: 16px !important; border-radius: 14px !important; }
  html.sv-route-login .sv-login-card button[type=submit] { height: 52px !important; border-radius: 14px !important; font-size: 16px !important; font-weight: 600 !important; }
  .svm-foot { margin-top: auto; padding-top: 22px; text-align: center; font-size: 11.5px; color: var(--muted, #64748b); }
  html.sv-route-login #u-version, html.sv-route-login #shubhi-orb { display: none !important; }
}
@media (min-width: 641px) { .svm-hero, .svm-foot { display: none !important; } }
/* saver mode: blurred orbs become cheap static gradients instead of hard circles */
html.sv-lite #sv-login-hero .orb { display: none !important; }
html.sv-lite #sv-login-hero { background: radial-gradient(420px 320px at 95% 0%, rgba(56, 189, 248, .42), transparent 70%), radial-gradient(380px 300px at 0% 100%, rgba(129, 140, 248, .45), transparent 70%), linear-gradient(150deg, var(--sv-hero-a, #0b1733) 0%, var(--sv-hero-b, #12306b) 55%, var(--accent) 130%) !important; }
