Files
launcher/web/style.css
T
Claude 3f64b32df8 Snap widgets to whole rows and let apps fill the cells beside them
Home rows now share one height (an app tile's) and widgets span whole rows of
it, so they line up with the apps. The grid packs densely, so apps fill free
cells next to a widget instead of leaving holes. Resizing snaps to whole rows.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NYASJ6JNxhYwNNJK7ypK2V
2026-10-22 02:17:11 +00:00

149 lines
11 KiB
CSS

/* Home screen layout; the components come from ui.css. The page is transparent so the
system wallpaper shows through the WebView. MainActivity sets --inset-top and
--inset-bottom to the status and navigation bar (and keyboard) heights. */
:root {
--top: var(--inset-top, env(safe-area-inset-top, 0px));
--bottom: var(--inset-bottom, env(safe-area-inset-bottom, 0px));
--shadow-text: 0 1px 4px rgb(0 0 0 / .6);
}
html, body { background: transparent; }
html.demo { background: linear-gradient(160deg, #1e293b, #4c1d95 55%, #0f172a) fixed; }
body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: transparent;
user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
overscroll-behavior: none; }
#app { max-width: 560px; margin: 0 auto; }
/* ---- home */
.home { min-height: 100vh; box-sizing: border-box;
padding: calc(var(--top) + 2.5rem) 16px calc(var(--bottom) + 2rem); }
.pull { position: fixed; top: calc(var(--top) + .4rem); left: 50%; transform: translateX(-50%);
width: 3rem; height: 1.25rem; padding: 0; border: 0; background: none; cursor: pointer; }
.pull::before { content: ""; display: block; width: 2.25rem; height: .3rem; margin: auto;
border-radius: 999px; background: rgb(255 255 255 / .45); }
.panel { display: flex; gap: .5rem; margin: 0 auto 2rem; padding: .5rem; max-width: 22rem;
border-radius: 1.25rem; background: rgb(255 255 255 / .12); border: 1px solid rgb(255 255 255 / .16);
backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.panel-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: .6rem;
min-height: 3rem; padding: .5rem 1rem; border: 0; border-radius: .9rem;
background: rgb(255 255 255 / .1); color: #fff; font: inherit; font-weight: 500;
cursor: pointer; text-shadow: 0 1px 4px rgb(0 0 0 / .35); }
.panel-btn:hover, .panel-btn:active { background: rgb(255 255 255 / .22); }
.windows-glyph { position: relative; width: 1.1rem; height: 1.1rem; }
.windows-glyph::before, .windows-glyph::after { content: ""; position: absolute; border: 2px solid currentColor;
border-radius: .25rem; box-sizing: border-box; }
.windows-glyph::before { inset: 0 .3rem .3rem 0; opacity: .6; }
.windows-glyph::after { inset: .3rem 0 0 .3rem; background: rgb(255 255 255 / .15); }
.slots, .apps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem .5rem;
grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Home rows are all one height, so a widget spans whole rows of app tiles, and apps
fill the cells beside a widget rather than leaving holes (dense packing). Keep
--cell and the gap in sync with widget_rows in app.py. */
.slots { grid-auto-rows: 5.5rem; grid-auto-flow: row dense; }
@media (min-width: 480px) { .slots, .apps { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem;
padding: .35rem .15rem; border-radius: calc(var(--radius) + 4px); cursor: pointer; }
.tile:active { background: rgb(255 255 255 / .12); }
.icon { width: 3.25rem; height: 3.25rem; object-fit: contain; pointer-events: none;
filter: drop-shadow(0 2px 4px rgb(0 0 0 / .3)); }
.icon.missing { border-radius: 999px; background: rgb(255 255 255 / .18); object-position: -999px 0; }
.name { max-width: 100%; font-size: .75rem; line-height: 1.2; text-align: center;
text-shadow: var(--shadow-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A widget takes whole rows. On a phone the native widget view covers the slot;
the label only shows while the slot is not live (or in a desktop browser). */
.widget-slot { grid-column: 1 / -1; display: grid; place-items: center; box-sizing: border-box;
border-radius: 1.25rem; background: rgb(255 255 255 / .1);
border: 1px dashed rgb(255 255 255 / .3); }
.widget-label { font-size: .875rem; opacity: .75; text-shadow: var(--shadow-text); }
/* A live widget sits bare on the wallpaper; the frame only comes back while it is picked
up or resized (or while its native view is away, e.g. another widget is being resized). */
.widget-slot[data-wid]:not(.lifted):not(.resizing) { background: none; border-color: transparent; }
/* A widget being resized: handles sit just outside its right and bottom edges, where the
native widget view doesn't cover them; the bottom one sits in the gap below the row. */
.widget-slot { position: relative; }
.widget-slot.resizing { z-index: 2; outline: 2px solid rgb(255 255 255 / .85);
outline-offset: 3px; transition: none; }
.resize-handle { position: absolute; z-index: 2; touch-action: none; cursor: nwse-resize; }
.resize-handle::after { content: ""; position: absolute; border-radius: 999px; background: #fff;
box-shadow: 0 1px 6px rgb(0 0 0 / .45); }
.resize-handle[data-edge="r"] { top: 0; bottom: 0; right: -16px; width: 16px; cursor: ew-resize; }
.resize-handle[data-edge="r"]::after { top: 50%; left: 6px; width: 6px; height: 2.5rem; transform: translateY(-50%); }
.resize-handle[data-edge="b"] { left: 0; right: 0; bottom: -1.25rem; height: 1.25rem; cursor: ns-resize; }
.resize-handle[data-edge="b"]::after { left: 50%; top: 7px; width: 2.5rem; height: 6px; transform: translateX(-50%); }
.resize-handle[data-edge="rb"] { right: -16px; bottom: -1.25rem; width: 2.75rem; height: 1.25rem; }
.resize-handle[data-edge="rb"]::after { right: 4px; top: 3px; width: 14px; height: 14px; border-radius: 4px; }
.resize-bar { position: fixed; left: 50%; bottom: calc(var(--bottom) + 1rem); z-index: 15; transform: translateX(-50%);
display: flex; align-items: center; gap: .5rem; padding: .4rem .4rem .4rem 1rem; border-radius: 999px;
background: rgb(0 0 0 / .8); color: #fff; font-size: .875rem; white-space: nowrap;
animation: ui-fade .15s; }
.resize-bar .btn.ghost { color: #fff; }
.resize-bar .btn.ghost:hover { background: rgb(255 255 255 / .12); color: #fff; }
/* A slot picked up by a long press, while it is dragged (index.html moves it). */
.slots > li { transition: transform .15s ease-out; }
.slots > .lifted { z-index: 1; transform: scale(1.12); background: rgb(255 255 255 / .16);
box-shadow: 0 8px 24px rgb(0 0 0 / .35); }
.slots.dragging > li:not(.lifted) { opacity: .8; }
.slots.dragging .tile:active { background: none; }
.hint, .empty { text-align: center; opacity: .85; text-shadow: var(--shadow-text); }
.hint { margin-top: 30vh; padding: 0 2rem; font-size: .9rem; line-height: 1.5; }
/* ---- drawer: slides down over the home screen */
.drawer { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
padding: calc(var(--top) + 1rem) 16px 0; background: rgb(10 10 14 / .72);
backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
animation: drop .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes drop { from { transform: translateY(-100%); } to { transform: none; } }
.drawer-head { display: flex; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.drawer-head .input { flex: 1; height: 2.75rem; border-radius: 999px; padding: 0 1.25rem; font-size: 1rem;
background: rgb(255 255 255 / .1); border-color: rgb(255 255 255 / .15); color: #fff; }
.drawer-head .input::placeholder { color: rgb(255 255 255 / .6); }
.drawer-head .input::-webkit-search-cancel-button { filter: invert(1); }
.drawer-head .btn.ghost { color: #fff; }
.drawer-head .btn.ghost:hover { background: rgb(255 255 255 / .12); color: #fff; }
.drawer-note { margin: 0 0 1rem; font-size: .875rem; opacity: .8; text-align: center; }
.drawer .apps { flex: 1; overflow-y: auto; align-content: start;
padding-bottom: calc(var(--bottom) + 1.5rem); overscroll-behavior: contain; }
.drawer .empty { flex: 1; }
.picking .tile::after { content: ""; position: absolute; top: .1rem; right: .6rem; width: 1.25rem; height: 1.25rem;
border-radius: 999px; border: 2px solid #fff; box-sizing: border-box;
background: rgb(0 0 0 / .35); }
.picking .tile.on::after { content: "✓"; display: grid; place-items: center; font-size: .75rem; font-weight: 700;
background: #fff; color: #111; }
/* ---- sheets (long-press menus, widget picker) */
.sheet-overlay { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .45); animation: ui-fade .15s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 560px; margin: 0 auto;
max-height: 70vh; overflow-y: auto; box-sizing: border-box;
padding: .75rem 1rem calc(var(--bottom) + 1rem); border-radius: 1.25rem 1.25rem 0 0;
background: var(--popover); color: var(--popover-foreground);
animation: rise .2s cubic-bezier(.2, .8, .2, 1); }
.sheet::before { content: ""; display: block; width: 2.25rem; height: .3rem; margin: 0 auto .75rem;
border-radius: 999px; background: var(--border); }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
.sheet-title { margin: 0 .5rem .5rem; font-size: 1rem; font-weight: 600; }
.sheet-item { display: block; width: 100%; padding: .85rem .5rem; border: 0; border-radius: var(--radius);
background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.sheet-item:hover, .sheet-item:active { background: var(--accent); }
.sheet .empty { text-shadow: none; color: var(--muted-foreground); }
.widget-list { list-style: none; margin: 0; padding: 0; display: grid; }
.widget-list li { display: flex; align-items: center; gap: .75rem; padding: .5rem; border-radius: var(--radius);
cursor: pointer; }
.widget-list li:hover, .widget-list li:active { background: var(--accent); }
.widget-list .icon { width: 2.5rem; height: 2.5rem; filter: none; }
.widget-name { display: grid; }
.widget-name small { color: var(--muted-foreground); font-size: .8rem; }
.widget-search { width: 100%; margin-bottom: .5rem; }
.notice, #toast { position: fixed; left: 50%; bottom: calc(var(--bottom) + 2rem); z-index: 30;
transform: translateX(-50%); padding: .5rem 1rem; border-radius: 999px;
background: rgb(0 0 0 / .8); color: #fff; font-size: .875rem; white-space: nowrap;
pointer-events: none; animation: ui-fade .15s; }
#toast { opacity: 0; transition: opacity .2s; animation: none; }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .drawer, .sheet { animation: none; } }