/* =====================================================================
   Feather 3 — smoother look, motion, the Feather Orb and FeatherAI
   ===================================================================== */
html, body { text-rendering: optimizeLegibility; }
@property --aurora-a { syntax: '<angle>'; inherits: true; initial-value: 0deg; }
:root { --aurora: conic-gradient(from var(--aurora-a, 0deg), #22d3ee, #6366f1, #a855f7, #ec4899, #f59e0b, #22d3ee); }
@keyframes auroraSpin { to { --aurora-a: 360deg; } }

/* Boot: soft aurora bloom behind the logo */
#boot::before { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(99, 102, 241, .35), rgba(34, 211, 238, .12) 40%, transparent 70%); filter: blur(30px); animation: bootGlow 2.4s ease-in-out infinite alternate; }
@keyframes bootGlow { from { transform: scale(.85); opacity: .6; } to { transform: scale(1.1); opacity: 1; } }
.boot-logo, .boot-name, .boot-spinner { position: relative; }
.boot-name span { background: linear-gradient(90deg, #22d3ee, #818cf8, #c084fc, #22d3ee); background-size: 300% 100%; -webkit-background-clip: text; animation: shimmer 3s linear infinite; }
@keyframes shimmer { to { background-position: 300% 0; } }

/* Windows: crisper edges, accent-tinted focus, rounded controls */
.window { border-color: rgba(255, 255, 255, .10); }
.window.active { border-color: rgba(255, 255, 255, .16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 0 0 1px rgba(var(--accent-rgb), .10), 0 32px 90px rgba(0, 0, 0, .55), 0 8px 24px rgba(0, 0, 0, .35); }
.window.flipping { will-change: transform; }
.window.flipping .w-body { pointer-events: none; }
.w-btns { gap: 2px; padding-right: 6px; align-items: center; }
.wb { width: 40px; height: 30px; border-radius: 9px; transition: background .18s ease, color .18s ease; }
.wb.close, .window.maximized .wb.close { border-top-right-radius: 9px; }
.wb.close:hover { background: #e5484d; color: #fff; }
.window .titlebar .w-title { font-weight: 500; letter-spacing: .1px; }
/* pointer-following specular light */
.window::after, .tb-dock::after, .tb-tray::after, .flyout::after, .menu::after, .dialog::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s ease;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .07), transparent 45%);
}
.window::after { -webkit-mask-image: linear-gradient(#000 0 42px, rgba(0, 0, 0, .16) 42px); }
.lit::after { opacity: 1; }
.window.dragging::after { opacity: 0; }

/* Buttons & inputs: gentler transitions everywhere */
.f-btn, .pill, .sm-app, .sm-item, .qs-tile, .tray-group, .tray-clock, .tray-bell, .menu button { transition: background .18s ease, transform .25s var(--spring-bouncy, var(--spring)), box-shadow .2s ease, filter .18s ease; }
.f-input, .ai-input, .orb-input { transition: border-color .2s ease, background .2s ease, box-shadow .2s ease; }
.f-input:focus { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .18); }
.sm-app:hover { transform: translateY(-2px); }

/* Start menu: tiles cascade in */
#startmenu.open .sm-app { animation: tileIn .45s var(--spring-ease, var(--ease)) both; }
#startmenu.open .sm-app:nth-child(1) { animation-delay: .02s } #startmenu.open .sm-app:nth-child(2) { animation-delay: .04s } #startmenu.open .sm-app:nth-child(3) { animation-delay: .06s }
#startmenu.open .sm-app:nth-child(4) { animation-delay: .08s } #startmenu.open .sm-app:nth-child(5) { animation-delay: .10s } #startmenu.open .sm-app:nth-child(6) { animation-delay: .12s }
#startmenu.open .sm-app:nth-child(n+7) { animation-delay: .14s }
@keyframes tileIn { from { opacity: 0; transform: translateY(12px) scale(.94); } }

/* Toasts & dialogs ride springs too */
.toast { transition: transform var(--spring-bouncy-dur, .45s) var(--spring-bouncy, var(--spring)), opacity .3s; }
.dialog { animation: dlgIn var(--spring-dur, .3s) var(--spring-ease, var(--ease)); }
@keyframes dlgIn { from { opacity: 0; transform: scale(.92) translateY(10px); } }

/* ---------- Taskbar orb ---------- */
.orb-core { position: relative; width: 26px; height: 26px; border-radius: 50%; display: block; background: radial-gradient(circle at 35% 30%, #fff 0, rgba(255, 255, 255, .6) 12%, transparent 30%), var(--aurora); animation: auroraSpin 6s linear infinite; box-shadow: 0 0 14px rgba(129, 140, 248, .55), inset 0 0 6px rgba(255, 255, 255, .35); transition: transform .4s var(--spring-bouncy, var(--spring)), box-shadow .4s, filter .4s; }
.orb-core i { position: absolute; inset: -5px; border-radius: 50%; border: 1px solid rgba(165, 180, 252, .45); opacity: 0; }
.orb-btn:hover .orb-core { transform: scale(1.12); box-shadow: 0 0 22px rgba(129, 140, 248, .8), inset 0 0 6px rgba(255, 255, 255, .35); }
body:not(.ai-ready) .orb-core { filter: saturate(.35) brightness(.85); }
body.ai-thinking .orb-core { animation-duration: 1.4s; }
body.ai-thinking .orb-core i { animation: ripple 1.6s ease-out infinite; }
body.ai-thinking .orb-core i:nth-child(2) { animation-delay: .5s; }
body.ai-thinking .orb-core i:nth-child(3) { animation-delay: 1s; }
@keyframes ripple { from { transform: scale(.7); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }

/* ---------- Feather Orb overlay ---------- */
#orb { position: fixed; inset: 0; z-index: 9500; display: flex; justify-content: center; align-items: flex-start; padding-top: 17vh; }
.orb-aura { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 30%, rgba(30, 27, 75, .45), rgba(0, 0, 0, .35) 70%); opacity: 0; transition: opacity .25s ease; }
#orb.open .orb-aura { opacity: 1; }
.orb-panel { position: relative; width: min(720px, 92vw); border-radius: 26px; padding: 6px; --glass: rgba(18, 20, 30, .80); opacity: 0; transform: translateY(-14px) scale(.96); transition: opacity .2s ease, transform var(--spring-dur, .35s) var(--spring-ease, var(--ease)); }
#orb.open .orb-panel { opacity: 1; transform: none; }
.orb-panel::after { content: ""; position: absolute; inset: -1.5px; border-radius: 27px; padding: 1.5px; background: var(--aurora); animation: auroraSpin 5s linear infinite; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; opacity: .85; }
.orb-panel::before { opacity: .35; }
.orb-row { display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 14px; }
.orb-mini { position: relative; width: 30px; height: 30px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0, rgba(255, 255, 255, .55) 12%, transparent 32%), var(--aurora); animation: auroraSpin 4s linear infinite; box-shadow: 0 0 20px rgba(129, 140, 248, .6); }
body.ai-thinking .orb-mini { animation-duration: 1s; }
.orb-input { flex: 1; height: 44px; background: none; border: 0; outline: none; font-size: 20px; font-weight: 400; color: #fff; letter-spacing: .1px; }
.orb-input::placeholder { color: rgba(235, 240, 250, .38); }
.orb-row kbd { font: 11px var(--font); color: var(--text-3); border: 1px solid rgba(255, 255, 255, .14); border-radius: 6px; padding: 3px 7px; }
.orb-hint { height: 0; overflow: hidden; padding: 0 22px; font-size: 13px; color: var(--text-2); transition: height .2s var(--ease), padding .2s var(--ease); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.orb-hint.on { height: 30px; padding-bottom: 6px; }
.orb-hint em { font-style: normal; color: var(--text-3); }
.orb-k { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: rgba(var(--accent-rgb), .35); color: #fff; font-size: 11px; margin-right: 6px; }
.orb-out { max-height: 52vh; overflow-y: auto; padding: 0 14px 12px; border-top: 1px solid rgba(255, 255, 255, .07); }
.orb-sec { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); margin: 14px 8px 8px; }
.orb-ex { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.orb-ex button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-align: left; font-size: 13px; color: var(--text-2); transition: background .15s, color .15s, transform .25s var(--spring-bouncy, var(--spring)); }
.orb-ex button:hover { background: rgba(255, 255, 255, .07); color: var(--text); transform: translateX(2px); }
.orb-ex .li { width: 15px; height: 15px; color: #a5b4fc; flex: none; }
.orb-foot { display: flex; align-items: center; gap: 8px; margin: 12px 8px 2px; font-size: 11.5px; color: var(--text-3); }
.orb-answer { padding: 4px 10px 6px; animation: pop .25s var(--ease); }
.orb-answer .ai-md { font-size: 14.5px; line-height: 1.6; user-select: text; }
.orb-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; align-items: center; }
.orb-acts .pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; }
.orb-acts .pill .li { width: 14px; height: 14px; }
.orb-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; background: rgba(34, 197, 94, .14); color: #86efac; font-size: 12px; }
.orb-chip .li { width: 13px; height: 13px; }

/* status dots shared by the Orb, FeatherAI and Settings */
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; flex: none; display: inline-block; }
.ai-dot.big { width: 12px; height: 12px; }
.ai-dot.ready { background: #22c55e; box-shadow: 0 0 10px rgba(34, 197, 94, .7); }
.ai-dot.starting { background: #eab308; animation: hint 1.2s ease-in-out infinite; }
.ai-dot.error, .ai-dot.missing { background: #ef4444; }

/* ---------- FeatherAI app ---------- */
.featherai { display: flex; height: 100%; background: linear-gradient(180deg, rgba(99, 102, 241, .05), transparent 30%); }
.ai-side { width: 240px; flex: none; display: flex; flex-direction: column; gap: 10px; padding: 14px 10px 12px; border-right: 1px solid rgba(255, 255, 255, .06); background: rgba(0, 0, 0, .12); }
.f-btn.ai-new { display: flex; align-items: center; justify-content: center; gap: 8px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #6366f1, #a855f7); border: 0; }
.ai-new .li { width: 16px; height: 16px; }
.ai-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.ai-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-align: left; color: var(--text-2); transition: background .15s, color .15s; }
.ai-item:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.ai-item.active { background: rgba(var(--accent-rgb), .18); color: var(--text); }
.ai-item span .li { width: 15px; height: 15px; display: block; }
.ai-item b { font-weight: 400; font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ai-privacy { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; color: var(--text-3); padding: 10px 8px 0; border-top: 1px solid rgba(255, 255, 255, .06); line-height: 1.4; }
.ai-privacy .li { width: 14px; height: 14px; flex: none; margin-top: 1px; color: #86efac; }
.ai-main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.ai-head { height: 44px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.ai-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.ai-scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.ai-thread { max-width: 780px; margin: 0 auto; padding: 22px 24px 30px; display: flex; flex-direction: column; gap: 18px; }
.ai-msg { display: flex; gap: 12px; animation: msgIn .4s var(--spring-ease, var(--ease)) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } }
.ai-msg.user { justify-content: flex-end; }
.ai-av { width: 30px; height: 30px; flex: none; margin-top: 2px; }
.ai-av svg { width: 100%; height: 100%; }
.ai-msg.streaming .ai-av { animation: avPulse 1.4s ease-in-out infinite; }
@keyframes avPulse { 50% { transform: scale(1.08); filter: drop-shadow(0 0 8px rgba(168, 85, 247, .7)); } }
.ai-bub { min-width: 0; max-width: 100%; }
.ai-msg.user .ai-bub { max-width: 78%; background: linear-gradient(135deg, rgba(var(--accent-rgb), .9), rgba(139, 92, 246, .85)); padding: 10px 15px; border-radius: 18px 18px 6px 18px; box-shadow: 0 4px 16px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .2); }
.ai-msg.user .ai-md { white-space: pre-wrap; color: #fff; }
.ai-msg.bot .ai-bub { flex: 1; padding-top: 4px; }
.ai-md { font-size: 14.5px; line-height: 1.65; color: var(--text); user-select: text; word-wrap: break-word; }
.ai-md p { margin: 0 0 10px; } .ai-md p:last-child { margin-bottom: 0; }
.ai-md h3, .ai-md h4, .ai-md h5, .ai-md h6 { margin: 14px 0 6px; font-size: 15px; }
.ai-md ul, .ai-md ol { margin: 4px 0 10px; padding-left: 22px; }
.ai-md li { margin: 3px 0; }
.ai-md code { font-family: var(--mono); font-size: 12.5px; background: rgba(255, 255, 255, .09); padding: 1px 6px; border-radius: 5px; }
.ai-md a { color: #93c5fd; text-decoration: underline; text-underline-offset: 2px; }
.ai-code { margin: 10px 0; border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .38); border: 1px solid rgba(255, 255, 255, .08); }
.ai-code-h { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 6px 14px; font-size: 11.5px; color: var(--text-3); background: rgba(255, 255, 255, .04); }
.ai-code-h button { font-size: 11.5px; padding: 3px 9px; border-radius: 6px; color: var(--text-2); }
.ai-code-h button:hover { background: rgba(255, 255, 255, .1); }
.ai-code pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.ai-code code { background: none; padding: 0; font-size: 12.5px; line-height: 1.55; }
.ai-caret { display: inline-block; width: 8px; height: 16px; margin-left: 2px; vertical-align: -3px; border-radius: 2px; background: linear-gradient(180deg, #22d3ee, #a855f7); animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.ai-typing { display: inline-flex; gap: 5px; padding: 6px 0; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: #a5b4fc; animation: typing 1.2s ease-in-out infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; } .ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
.ai-acts { display: flex; align-items: center; gap: 2px; margin-top: 8px; opacity: 0; transition: opacity .2s; }
.ai-msg:hover .ai-acts, .ai-msg:last-child .ai-acts { opacity: 1; }
.ai-acts button { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); transition: background .15s, color .15s; }
.ai-acts button:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.ai-acts button .li, .ai-acts button svg { width: 15px; height: 15px; }
.ai-acts small { margin-left: 8px; font-size: 11px; color: var(--text-3); }
.ai-att { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; padding: 3px 8px 3px 4px; margin-bottom: 6px; border-radius: 8px; background: rgba(255, 255, 255, .16); color: #fff; }
.ai-att svg { width: 16px; height: 16px; }
.ai-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8vh 10px 0; animation: msgIn .5s var(--spring-ease, var(--ease)) both; }
.ai-empty h2 { margin: 26px 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -.3px; }
.ai-empty p { margin: 0 0 26px; color: var(--text-2); font-size: 13.5px; }
.ai-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(520px, 100%); }
.ai-chip { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; text-align: left; font-size: 13px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .07); transition: background .18s, transform .3s var(--spring-bouncy, var(--spring)), border-color .18s; }
.ai-chip:hover { background: rgba(255, 255, 255, .09); border-color: rgba(165, 180, 252, .35); transform: translateY(-2px); }
.ai-chip .li { width: 15px; height: 15px; color: #a5b4fc; }
.ai-orb-big { position: relative; width: 88px; height: 88px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 28%, #fff 0, rgba(255, 255, 255, .55) 9%, transparent 26%), var(--aurora); animation: auroraSpin 7s linear infinite; box-shadow: 0 0 50px rgba(129, 140, 248, .55), inset 0 0 18px rgba(255, 255, 255, .25); }
.ai-orb-big i { position: absolute; inset: -10px; border-radius: 50%; border: 1px solid rgba(165, 180, 252, .3); animation: ripple 3s ease-out infinite; }
.ai-orb-big i:nth-child(2) { animation-delay: 1s; } .ai-orb-big i:nth-child(3) { animation-delay: 2s; }
.ai-composer { flex: none; padding: 0 24px 14px; max-width: 828px; width: 100%; margin: 0 auto; }
.ai-ctx { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px 6px; padding: 5px 6px 5px 8px; border-radius: 10px; background: rgba(255, 255, 255, .07); font-size: 12px; }
.ai-ctx svg { width: 16px; height: 16px; }
.ai-ctx b { font-weight: 500; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-ctx button { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; }
.ai-ctx button:hover { background: rgba(255, 255, 255, .12); }
.ai-ctx button .li { width: 12px; height: 12px; }
.ai-box { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 16px; border-radius: 20px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); transition: border-color .2s, box-shadow .2s, background .2s; }
.ai-box:focus-within { border-color: rgba(165, 180, 252, .5); background: rgba(255, 255, 255, .08); box-shadow: 0 0 0 4px rgba(129, 140, 248, .12); }
.ai-input { flex: 1; resize: none; background: none; border: 0; outline: none; color: var(--text); font-size: 14.5px; line-height: 1.5; padding: 7px 0; max-height: 180px; }
.ai-input::placeholder { color: var(--text-3); }
.ai-send { width: 38px; height: 38px; flex: none; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(135deg, #6366f1, #a855f7); color: #fff; box-shadow: 0 4px 14px rgba(99, 102, 241, .4); transition: transform .3s var(--spring-bouncy, var(--spring)), filter .2s, opacity .2s; }
.ai-send:hover { transform: scale(1.06); filter: brightness(1.1); }
.ai-send:active { transform: scale(.92); }
.ai-send:disabled { opacity: .35; box-shadow: none; }
.ai-send.stop { background: rgba(255, 255, 255, .14); box-shadow: none; }
.ai-send .li { width: 17px; height: 17px; }
.ai-hint { text-align: center; font-size: 11px; color: var(--text-3); margin-top: 8px; }
.ai-tps { color: #86efac; }
.nt-tool.nt-ai { color: #c4b5fd; }
.ai-hero { align-items: center; }
.ai-hero .ai-orb-big { margin: 0 10px; width: 96px; height: 96px; }
.ai-hero p { color: var(--text-2); }

/* ---------- Performance ---------- */
body.perf-lite { --blur: 16px; }
body.perf-lite.liquid-on .liquid, body.perf-lite.liquid-on .liquid-strong { backdrop-filter: blur(16px) saturate(160%); }
body.perf-lite .window { backdrop-filter: blur(18px) saturate(140%); }
body.perf-lite .window:not(.active) { backdrop-filter: none; background: rgba(26, 28, 35, .97); }
body.perf-lite .window::after, body.perf-lite .tb-dock::after, body.perf-lite .flyout::after { display: none; }
body.perf-lite #boot::before { animation: none; }
.fps { position: fixed; top: 10px; right: 12px; z-index: 99998; pointer-events: none; padding: 6px 10px; border-radius: 10px; background: rgba(10, 12, 18, .72); border: 1px solid rgba(255, 255, 255, .1); font: 12px var(--mono); color: var(--text-2); display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.fps b { font-size: 16px; color: #fff; }
.fps small { font-size: 10px; color: var(--text-3); }
.fps.good b { color: #4ade80; } .fps.ok b { color: #facc15; } .fps.bad b { color: #f87171; }
@media (prefers-reduced-motion: reduce) { .orb-core, .orb-mini, .orb-panel::after, .boot-name span, .ai-orb-big { animation: none !important; } }

.term-ai { white-space: pre-wrap; color: #c4b5fd; padding: 2px 0 6px; }
