/* ---------- the home screen's widgets (social/widgets.js) ---------- */
/* With widgets, the home screen scrolls by itself (the page doesn't): the search first, as before, then the widgets. */
#main-ui.has-widgets { box-sizing: border-box; width: 100%; max-width: none; height: 100vh; height: 100dvh; overflow-x: hidden; overflow-y: auto; padding: max(96px, calc(50dvh - 280px)) 16px 0; scrollbar-width: thin; overscroll-behavior: contain; }
#main-ui.has-widgets > :not(#home-widgets):not(footer) { max-width: 760px; margin-left: auto; margin-right: auto; }
#main-ui.has-widgets > footer { position: static; display: block; margin: 30px 0 18px; text-align: center; }
#home-widgets { position: relative; width: min(1040px, 100%); margin: 64px auto 10px; text-align: left; animation: fadeUp 0.7s var(--ease) both; }
.hw-top { display: flex; align-items: center; gap: 10px; margin: 0 4px 12px; }
.hw-title { display: inline-flex; align-items: center; gap: 8px; font: 500 0.7rem var(--font-mono); letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-muted); }
.hw-title .material-symbols-outlined { font-size: 1.05rem; color: var(--accent-cyan); }
.hw-grow { flex: 1; }
.hw-edit { display: inline-flex; align-items: center; gap: 5px; padding: 6px 13px; border-radius: calc(99px * var(--round, 1)); border: 1px solid var(--line-strong); background: var(--glass); color: var(--text-muted); font: 600 0.76rem var(--font-ui); cursor: pointer; }
.hw-edit:hover { color: var(--text-main); border-color: rgba(var(--accent-rgb), 0.5); }
.hw-edit .material-symbols-outlined { font-size: 1rem; }
#home-widgets.editing .hw-edit { background: var(--text-main); color: var(--bg-base); border-color: transparent; }

.hw-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 158px; grid-auto-flow: dense; gap: 14px; }
.hw { position: relative; min-width: 0; border-radius: calc(22px * var(--round, 1)); background: var(--glass-strong); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0, 0, 0, calc(0.35 * var(--shadow-k, 1))), inset 0 1px 0 rgba(var(--ink-rgb), 0.05); backdrop-filter: var(--blur-heavy); -webkit-backdrop-filter: var(--blur-heavy); overflow: hidden; transition: border-color 0.25s, opacity 0.18s, transform 0.18s; }
.hw:hover { border-color: var(--line-strong); }
.hw-w { grid-column: span 2; }
.hw-t { grid-row: span 2; }
.hw-l { grid-column: span 2; grid-row: span 2; }
.hw.out { opacity: 0; transform: scale(0.9); }
.hw-body { position: absolute; inset: 0; padding: 14px 16px; display: flex; flex-direction: column; min-height: 0; }
.hw-h { display: flex; align-items: center; gap: 7px; flex: none; margin-bottom: 8px; font: 600 0.72rem var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.hw-h > .material-symbols-outlined { font-size: 1rem; color: var(--accent-cyan); }
.hw-h > span:not(.material-symbols-outlined) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-n { flex: none !important; padding: 1px 8px; border-radius: 99px; background: rgba(var(--ink-rgb), 0.08); font-size: 0.66rem; letter-spacing: 0.04em; text-transform: none; }
.hw-n.hot { background: rgba(255, 63, 120, 0.2); color: #ff8fb0; }
.hw-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; color: var(--text-muted); font-size: 0.8rem; min-height: 0; }
.hw-empty > .material-symbols-outlined { font-size: 1.6rem; opacity: 0.7; }
.hw-empty p { margin: 0; line-height: 1.35; }
.hw-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: calc(99px * var(--round, 1)); border: 1px solid rgba(var(--accent-rgb), 0.35); background: rgba(var(--accent-rgb), 0.1); color: var(--text-main); font: 600 0.76rem var(--font-ui); cursor: pointer; white-space: nowrap; }
.hw-btn:hover { background: rgba(var(--accent-rgb), 0.2); }
.hw-btn .material-symbols-outlined { font-size: 1rem; }
.hw-btn.sm { padding: 4px 10px; font-size: 0.72rem; }

/* clock */
.hw-clock { flex: 1; display: grid; grid-template-columns: auto 1fr; align-content: center; column-gap: 6px; }
.hw-time { font: 800 clamp(1.9rem, 3.2vw, 2.6rem) var(--font-display); letter-spacing: 0.01em; line-height: 1; background: var(--grad-text); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hw-sec { align-self: end; font: 500 0.8rem var(--font-mono); color: var(--accent-cyan); padding-bottom: 4px; }
.hw-date { grid-column: 1 / -1; margin-top: 8px; font-size: 0.82rem; color: var(--text-muted); }
.hw-time { white-space: nowrap; }
.hw-s .hw-time { font-size: clamp(1.45rem, 2.3vw, 1.95rem); }
.hw-w .hw-time { font-size: clamp(2.4rem, 5vw, 3.4rem); }

/* weather */
.hw-weather { flex: 1; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-content: center; }
.hw-wnow { display: flex; align-items: center; gap: 6px; }
.hw-wnow > .material-symbols-outlined { font-size: 2.4rem; color: #ffd76b; }
.hw-wnow b { font: 800 2rem var(--font-display); line-height: 1; }
.hw-wnow small { font: 600 0.8rem var(--font-ui); color: var(--text-muted); vertical-align: top; }
.hw-wtext { display: flex; flex-direction: column; justify-content: center; min-width: 0; font-size: 0.8rem; }
.hw-wtext b { font-size: 0.9rem; }
.hw-wtext span { display: flex; align-items: center; gap: 3px; color: var(--text-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hw-wtext span .material-symbols-outlined { font-size: 0.9rem; }
.hw-wtext small { color: var(--text-muted); }
.hw-s .hw-weather { grid-template-columns: 1fr; }
.hw-days { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.hw-day { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; border-radius: calc(12px * var(--round, 1)); background: rgba(var(--ink-rgb), 0.05); font-size: 0.76rem; }
.hw-day small { color: var(--text-muted); }
.hw-day .material-symbols-outlined { font-size: 1.2rem; color: #ffd76b; }
.hw-day i { font-style: normal; color: var(--text-muted); }
.hw-geo { display: flex; gap: 8px; margin: 8px 0; }
.hw-geo input { flex: 1; }
.hw-geo-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.hw-geo-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(var(--ink-rgb), 0.05); cursor: pointer; }
.qs-modal .hw-geo-item input { width: auto; flex: none; padding: 0; }
.hw-geo-item small { display: block; color: var(--text-muted); font-size: 0.76rem; }
.hw-row, .hw-field { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--text-muted); }
.hw-field { flex-direction: column; align-items: stretch; margin-bottom: 10px; }
.hw-row select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: rgba(var(--shade-rgb), 0.4); color: var(--text-main); }

/* sticky note */
.hw-t-note { background: color-mix(in oklab, var(--glass-strong) 70%, transparent); }
.hw-note { position: absolute; inset: 0; background: color-mix(in oklab, var(--note) 22%, transparent); border-top: 4px solid var(--note); }
.hw-note textarea { width: 100%; height: 100%; padding: 12px 14px 22px; border: none; background: none; resize: none; outline: none; color: var(--text-main); font: 500 0.9rem/1.45 var(--font-ui); }
.hw-note textarea::placeholder { color: var(--text-muted); }
.hw-note-c { position: absolute; right: 10px; bottom: 9px; width: 14px; height: 14px; padding: 0; border-radius: 50%; border: 2px solid rgba(var(--ink-rgb), 0.35); background: var(--note); cursor: pointer; }

/* countdown */
.hw-count { flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.hw-count b { font: 800 2.6rem var(--font-display); line-height: 1; color: var(--accent-cyan); }
.hw-count b .material-symbols-outlined { font-size: 2.4rem; }
.hw-count span { font-size: 0.76rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }
.hw-count strong { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-count small { font-size: 0.74rem; color: var(--text-muted); }
.hw-w .hw-count { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-content: center; }
.hw-w .hw-count b { grid-row: span 3; font-size: 3.6rem; align-self: center; }

/* posters and game covers */
.hw-posters, .hw-games { flex: 1; min-height: 0; display: grid; gap: 8px; }
.hw-posters.n1 { grid-template-columns: 1fr; }
.hw-posters.n3 { grid-template-columns: repeat(3, 1fr); }
.hw-posters.n6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.hw-poster, .hw-game { position: relative; min-width: 0; min-height: 0; padding: 0; border: none; border-radius: calc(12px * var(--round, 1)); overflow: hidden; background: rgba(var(--ink-rgb), 0.06); cursor: pointer; color: #fff; text-align: left; transition: transform 0.2s var(--ease); }
.hw-poster:hover, .hw-game:hover { transform: translateY(-2px); }
.hw-poster img, .hw-game img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hw-poster span, .hw-game span { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.85)); font-size: 0.72rem; font-weight: 600; line-height: 1.2; overflow: hidden; }
.hw-poster b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-poster small { opacity: 0.8; }
.hw-games.n4 { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.hw-games.n4 .hw-game span { display: none; }
.hw-games.n5 { grid-template-columns: repeat(5, 1fr); }
.hw-games.n10 { grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(2, 1fr); }
.hw-games .hw-game span { white-space: nowrap; text-overflow: ellipsis; }
.hw-tabs { display: inline-flex; flex: none !important; gap: 2px; padding: 2px; border-radius: 99px; background: rgba(var(--ink-rgb), 0.06); text-transform: none; letter-spacing: 0; }
.hw-tabs button { display: inline-flex; align-items: center; padding: 2px 9px; border: none; border-radius: 99px; background: none; color: var(--text-muted); font: 600 0.68rem var(--font-ui); cursor: pointer; }
.hw-tabs button.on { background: var(--text-main); color: var(--bg-base); }
.hw-tabs .material-symbols-outlined { font-size: 0.9rem; }

/* music and the song of the day */
.hw-music { flex: 1; display: flex; align-items: center; gap: 14px; min-height: 0; min-width: 0; }
.hw-art { position: relative; flex: none; height: 100%; max-height: 108px; aspect-ratio: 1; padding: 0; border: none; border-radius: calc(14px * var(--round, 1)); overflow: hidden; background: rgba(var(--ink-rgb), 0.08); color: var(--text-muted); cursor: pointer; display: grid; place-items: center; }
.hw-art img { width: 100%; height: 100%; object-fit: cover; }
.hw-art i { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.35); color: #fff; opacity: 0; transition: opacity 0.2s; font-style: normal; }
.hw-art:hover i { opacity: 1; }
.hw-art i .material-symbols-outlined { font-size: 2rem; }
.hw-mtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hw-mtext b { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-mtext small { color: var(--text-muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-mctl { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.hw-mctl button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: none; border-radius: 50%; background: rgba(var(--ink-rgb), 0.07); color: var(--text-main); cursor: pointer; }
.hw-mctl button.big { width: 42px; height: 42px; background: var(--text-main); color: var(--bg-base); }
.hw-s .hw-music { flex-direction: column; align-items: stretch; gap: 6px; }
.hw-s .hw-art { height: 56px; width: 56px; }
.hw-s .hw-mctl { margin-top: 2px; }

/* people (friends, chats) */
.hw-people { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.hw-person { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: calc(12px * var(--round, 1)); cursor: pointer; min-width: 0; }
.hw-person:hover { background: rgba(var(--ink-rgb), 0.06); }
.hw-person > span:not(.qs-avatar) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hw-person b { font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-person small { font-size: 0.72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hw-person.unread b { color: var(--text-main); }
.hw-person.unread small { color: var(--text-main); font-weight: 600; }
.hw-badge { flex: none; min-width: 18px; padding: 1px 5px; border-radius: 99px; background: #ff3f78; color: #fff; font: 700 0.66rem var(--font-ui); text-align: center; font-style: normal; }
.hw-more { align-self: flex-start; margin: 2px 6px; padding: 0; border: none; background: none; color: var(--accent-cyan); font: 600 0.74rem var(--font-ui); cursor: pointer; }
.hw-party { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px; }
.hw-faces { display: flex; }
.hw-faces > span { margin-right: -8px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg-base); opacity: 0.55; }
.hw-faces > span.on { opacity: 1; }
.hw-party p { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 0.78rem; color: var(--text-muted); }
.hw-party p .material-symbols-outlined { font-size: 0.95rem; color: #ffd76b; }

/* game of the day */
.hw-gday { flex: 1; display: flex; gap: 12px; align-items: center; min-height: 0; }
.hw-gday-pic { position: relative; flex: none; height: 100%; aspect-ratio: 1; padding: 0; border: none; border-radius: calc(14px * var(--round, 1)); overflow: hidden; background: rgba(var(--ink-rgb), 0.06); cursor: pointer; }
.hw-gday-pic img { width: 100%; height: 100%; object-fit: cover; }
.hw-gday-t { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.hw-gday-t b { font-size: 0.92rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hw-s .hw-gday-pic { display: none; }
.hw-t .hw-gday { flex-direction: column; align-items: stretch; }
.hw-t .hw-gday-pic { height: auto; width: 100%; }

/* picture frame */
.hw-frame { position: absolute; inset: 0; }
.hw-frame img { width: 100%; height: 100%; object-fit: cover; }

/* editing: arrange, resize, remove */
.hw-tools { position: absolute; inset: 0; display: none; align-items: flex-start; justify-content: flex-end; gap: 4px; padding: 8px; background: rgba(var(--shade-rgb), 0.25); cursor: grab; touch-action: none; }
.hw-tools button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: none; border-radius: 50%; background: var(--text-main); color: var(--bg-base); cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }
.hw-tools button[data-hw="remove"] { background: #ff3f78; color: #fff; }
.hw-tools .material-symbols-outlined { font-size: 1.05rem; }
.hw-grab { margin-right: auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(var(--ink-rgb), 0.12); color: var(--text-main); }
#home-widgets.editing .hw-tools { display: flex; }
#home-widgets.editing .hw[data-wid] { animation: hwWiggle 0.5s ease-in-out infinite alternate; }
#home-widgets.editing .hw[data-wid]:nth-child(2n) { animation-delay: -0.25s; }
@keyframes hwWiggle { from { transform: rotate(-0.6deg); } to { transform: rotate(0.6deg); } }
html[data-fancy="low"] #home-widgets.editing .hw[data-wid] { animation: none; }
.hw-dragging { opacity: 0.3; }
.hw-ghost { position: fixed; left: 0; top: 0; z-index: 9000; pointer-events: none; opacity: 0.95; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.hw-ghost .hw-tools { display: flex; }
.hw-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 2px dashed var(--line-strong); background: none; color: var(--text-muted); font: 600 0.82rem var(--font-ui); cursor: pointer; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
.hw-add:hover { color: var(--text-main); border-color: var(--accent-cyan); }
.hw-add .material-symbols-outlined { font-size: 1.8rem; }
.hw-gal-h { margin: 14px 0 8px; font: 700 0.72rem var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.hw-gal-h:first-child { margin-top: 0; }
.hw-gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.hw-gal-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: calc(14px * var(--round, 1)); border: 1px solid var(--line); background: rgba(var(--ink-rgb), 0.04); color: var(--text-main); text-align: left; cursor: pointer; }
.hw-gal-item:hover { border-color: rgba(var(--accent-rgb), 0.5); background: rgba(var(--accent-rgb), 0.08); }
.hw-gal-item > .material-symbols-outlined { flex: none; padding: 6px; border-radius: 10px; background: rgba(var(--accent-rgb), 0.14); color: var(--accent-cyan); }
.hw-gal-item b { display: block; font-size: 0.86rem; }
.hw-gal-item small { display: block; margin-top: 2px; font-size: 0.74rem; color: var(--text-muted); line-height: 1.35; }
.hw-toast { position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%); padding: 8px 14px; border-radius: 12px; background: var(--text-main); color: var(--bg-base); font: 600 0.8rem var(--font-ui); white-space: nowrap; z-index: 2; transition: opacity 0.3s; }
.hw-toast.out { opacity: 0; }

@media (max-width: 900px) {
    .hw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 148px; gap: 10px; }
    #home-widgets { margin-top: 40px; }
    .hw-s .hw-sec { display: none; }
    #main-ui.has-widgets { padding-top: max(80px, calc(50dvh - 300px)); }
}
@media (max-width: 380px) {
    .hw-body { padding: 12px; }
    .hw-time { font-size: 1.7rem; }
}
html[data-fancy="low"] .hw { backdrop-filter: none; -webkit-backdrop-filter: none; }

/* Your sites: an icon and the site's name on each tile */
.hw-sites { flex: 1; min-height: 0; display: grid; gap: 8px; grid-template-columns: repeat(5, 1fr); }
.hw-sites.n4 { grid-template-columns: repeat(2, 1fr); }
.hw-sites.n10 { grid-template-rows: repeat(2, 1fr); }
.hw-site { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px 4px; border-radius: calc(12px * var(--round, 1));
    background: rgba(var(--accent-rgb), 0.06); border: 1px solid var(--line); color: var(--text-main); font: 500 0.72rem var(--font-body, inherit); cursor: pointer; }
.hw-site:hover, .hw-site:focus-visible { background: rgba(var(--accent-rgb), 0.14); border-color: rgba(var(--accent-rgb), 0.4); }
.hw-site img { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; }
.hw-site span { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 760px) { .hw-site { font-size: 0.66rem; padding: 6px 2px; } .hw-site img { width: 24px; height: 24px; } }
