/* Re:Vault — universal theme. All colors are CSS variables so the theme is fully
   user-tweakable. Dark by default; [data-theme="light"] flips the tokens. */
:root {
	--accent: #e9c46a;
	--accent-2: #bf953f;
	--font: Verdana, Geneva, Tahoma, sans-serif;
	--fs: 13px;
	--icon: 17px;
	--ctrl: 34px;

	--bg: #000;
	--surface: #0c0c0c;
	--surface-2: #161616;
	--line: #1c1c1c;
	--fg: #ededed;
	--fg-2: #cfcfcf;
	--muted: #8a8a8a;
	--muted-2: #9a9a9a;
	--danger: #ff6b6b;
	--radius: 8px;
}
:root[data-theme="light"] {
	--bg: #f5f5f6;
	--surface: #ffffff;
	--surface-2: #ececee;
	--line: #dcdce0;
	--fg: #16181d;
	--fg-2: #33363d;
	--muted: #5b5e66;
	--muted-2: #4a4d54;
}
:root[data-density="compact"] { --fs: 12px; --ctrl: 30px; }
:root[data-animations="off"] * { transition: none !important; animation-duration: 0.001s !important; }
/* respect the OS reduced-motion preference (kills transitions; keeps the loading
   feedback animations, just slower) */
@media (prefers-reduced-motion: reduce) {
	:root:not([data-animations="off"]) * { transition-duration: 0.01ms !important; }
	.rv-spin { animation-duration: 1.3s !important; }
	.rv-pipe span { animation-duration: 2.4s !important; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); overflow: hidden; }
body { font-family: var(--font); font-size: var(--fs); color: var(--fg-2); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
::selection { background: #2a2a2a; color: #fff; }
input::placeholder { color: var(--muted); }
@keyframes rvspin { to { transform: rotate(360deg); } }

button { cursor: pointer; font-family: inherit; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button[disabled] { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
a { color: var(--accent); }

.rv-root { display: flex; flex-direction: column; height: 100vh; width: 100vw; background: var(--bg); overflow: hidden; user-select: none; -webkit-user-select: none; }

/* tab strip */
.rv-tabstrip { display: flex; align-items: flex-end; height: 36px; background: var(--bg); border-bottom: 1px solid var(--line); }
.rv-brand { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 10px 0 10px; font-size: var(--fs); font-weight: 600; color: var(--fg); flex: none; }
.rv-brand #rv-logo { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; flex: none; } /* reserve space so the JS-injected logo can't shift the brand row */
.rv-brand svg { width: 19px; height: 19px; flex: none; }
.rv-conn { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; margin-left: 2px; }
.rv-conn[data-state="ok"] { background: #27c093; }
.rv-conn[data-state="down"] { background: var(--danger); }
.rv-conn[data-state="connecting"] { background: var(--accent); }
.rv-conn[data-state="offline"] { background: #6a6a6a; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08); }
.rv-tabs { display: flex; align-items: flex-end; flex: 0 1 auto; overflow: hidden; min-width: 120px; } /* reserve one tab's width so the New-tab button doesn't shift when the first tab hydrates */
/* minimal active tab: no top border, just a stronger background fill */
.rv-tab { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 8px 0 12px; max-width: 200px; min-width: 120px; cursor: pointer; font-size: var(--fs); color: var(--muted); background: transparent; border-radius: 7px 7px 0 0; }
.rv-tab:hover { background: var(--surface-2); color: var(--fg-2); }
.rv-tab.active { color: var(--fg); background: var(--surface); }
.rv-tab-favicon { width: 16px; height: 16px; flex: none; background-size: contain; background-repeat: no-repeat; background-position: center; border-radius: 3px; }
.rv-tab-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-tab-close { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: 0; background: transparent; border-radius: 4px; flex: none; color: var(--muted); }
.rv-tab-close:hover { background: var(--surface-2); color: var(--fg); }
.rv-newtab { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin: 0 4px 3px 5px; border: 0; background: transparent; border-radius: 6px; flex: none; }
.rv-newtab svg { width: var(--icon); height: var(--icon); }
.rv-newtab:hover { background: var(--surface); }
.rv-spacer { flex: 1; }

/* nav bar */
.rv-navbar { display: flex; align-items: center; gap: 2px; height: 44px; background: var(--bg); border-bottom: 1px solid var(--line); padding: 0 8px; }
.rv-nav { display: flex; align-items: center; justify-content: center; width: var(--ctrl); height: var(--ctrl); border: 0; background: transparent; border-radius: 6px; flex: none; color: var(--muted-2); }
.rv-nav svg { width: var(--icon); height: var(--icon); }
.rv-nav:hover { background: var(--surface); }
.rv-nav:active { background: var(--surface-2); }
.rv-nav[disabled] { opacity: 0.35; }
.rv-nav[disabled]:hover { background: transparent; }
.rv-omnibox { flex: 1; display: flex; align-items: center; height: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; gap: 9px; margin: 0 6px; cursor: text; }
.rv-omnibox > svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.rv-omnibox input { flex: 1; height: 100%; border: 0; background: transparent; outline: none; color: var(--fg); font-family: inherit; font-size: var(--fs); user-select: text; -webkit-user-select: text; }
.rv-spin { width: 14px; height: 14px; border: 1.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: rvspin 0.7s linear infinite; flex: none; }

/* content */
.rv-content { position: relative; flex: 1; background: var(--bg); }
/* dark (not white) background so a navigating iframe never flashes white */
.rv-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
.rv-frame[hidden] { display: none; }

/* start screen */
.rv-start { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; background: var(--bg); padding: 24px; }
.rv-clock { font-size: 58px; color: var(--fg); font-variant-numeric: tabular-nums; letter-spacing: 1px; width: 100%; text-align: center; } /* full-width box so the ticking time can't resize/re-center (CLS) */
.rv-shortcuts { display: flex; gap: 28px; }
.rv-shortcut { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rv-shortcut-btn { display: flex; align-items: center; justify-content: center; width: 66px; height: 66px; border: 1px solid var(--line); background: var(--bg); border-radius: 50%; cursor: pointer; color: var(--accent); }
.rv-shortcut-btn svg { width: 26px; height: 26px; }
.rv-shortcut-btn:hover { border-color: var(--accent-2); }
.rv-shortcut-btn:active { border-color: var(--accent); }
.rv-shortcut span { font-size: var(--fs); color: var(--fg-2); }
.rv-ad { min-height: 0; width: min(728px, 92%); display: flex; justify-content: center; }
.rv-ad ins { display: block; }

/* folder view */
.rv-folder { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.rv-folder-head { display: flex; align-items: center; gap: 10px; padding: 18px 24px 12px; flex: none; border-bottom: 1px solid var(--line); }
.rv-folder-head svg { width: 21px; height: 21px; flex: none; color: var(--accent); }
.rv-folder-title { font-size: 18px; font-weight: 600; color: var(--fg); letter-spacing: 0.3px; }
.rv-folder-search { margin-left: auto; height: 32px; width: clamp(160px, 30vw, 320px); border: 1px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 13px; outline: none; user-select: text; -webkit-user-select: text; }
.rv-folder-search:focus { border-color: var(--accent); }
.rv-folder-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: var(--fs); text-align: center; padding: 20px; }
/* grid-auto-rows:max-content keeps each row at its cards' content height — without
   it, overflow:hidden cards get an automatic min-size of 0 and the rows collapse
   to slivers (whole grid scrolls / shrinks them away). */
.rv-grid { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); grid-auto-rows: max-content; gap: 16px; padding: 18px 24px 26px; align-content: start; }
.rv-card { display: flex; flex-direction: column; cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); overflow: hidden; transition: transform 0.12s ease, border-color 0.12s ease; }
.rv-card:hover { border-color: var(--accent-2); transform: translateY(-2px); }
.rv-card:active { transform: translateY(0); }
/* square image area, image shown whole (not cropped) — used by Books + Worksheets */
.rv-card-imgwrap { position: relative; aspect-ratio: 1 / 1; width: 100%; flex: none; background: linear-gradient(135deg, #1a1813, #0b0b0b); overflow: hidden; }
.rv-card-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; padding: 6%; }
.rv-card-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; font-size: 12px; line-height: 1.3; color: var(--muted-2); }
.rv-card-title { padding: 10px 12px; font-size: var(--fs); color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* error overlay */
.rv-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.rv-err-card { max-width: 440px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rv-err-icon { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); }
.rv-err-title { font-size: 19px; color: var(--fg); font-weight: 600; }
.rv-err-msg { color: var(--muted-2); line-height: 1.5; }
.rv-err-actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }

/* buttons */
.rv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 7px; font-size: var(--fs); }
.rv-btn:hover { border-color: var(--accent-2); }
.rv-btn-primary { background: var(--accent); color: #1a1500; border-color: var(--accent); font-weight: 600; }
.rv-btn-primary:hover { background: var(--accent-2); }
.rv-btn-danger { color: var(--danger); border-color: #3a1f1f; }

/* scrollbars */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--accent-2); }

/* toolbar star */
.rv-star.active { color: var(--accent); }
.rv-star.active svg path { fill: var(--accent); }

/* bookmarks bar */
.rv-bookmarksbar { display: flex; align-items: center; gap: 3px; height: 34px; padding: 0 8px; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; scrollbar-width: none; }
.rv-bookmarksbar::-webkit-scrollbar { height: 0; }
.rv-bm-item { height: 25px; max-width: 180px; padding: 0 9px; border: 0; background: transparent; color: var(--fg-2); border-radius: 5px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.rv-bm-item:hover { background: var(--surface); color: var(--fg); }
.rv-bm-empty { color: var(--muted); font-size: 12px; padding: 0 8px; }

/* start-screen dashboard — anchored to the top so any post-load content settle
   extends downward (no re-centering layout shift) */
.rv-start { overflow: auto; justify-content: flex-start; padding: clamp(28px, 9vh, 90px) 24px 36px; }
.rv-start-inner { display: flex; flex-direction: column; align-items: center; gap: 20px; width: 100%; max-width: 720px; margin: 0 auto; }
.rv-greeting { font-size: 15px; color: var(--muted-2); min-height: 19px; }
.rv-clock { font-size: clamp(40px, 7vw, 56px); margin-bottom: -6px; }
.rv-date { font-size: 14px; color: var(--muted); margin-top: -6px; min-height: 18px; }
.rv-startsearch { display: flex; align-items: center; gap: 9px; width: min(560px, 92%); height: 44px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 0 17px; }
.rv-startsearch svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.rv-startsearch input { flex: 1; height: 100%; border: 0; background: transparent; outline: none; color: var(--fg); font: inherit; font-size: 14px; user-select: text; -webkit-user-select: text; }
.rv-startsearch:focus-within { border-color: var(--accent); }
.rv-shortcuts { flex-wrap: wrap; justify-content: center; gap: 20px 26px; min-height: 92px; align-content: center; }
.rv-recents { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 680px; }
.rv-recent { display: inline-flex; align-items: center; height: 30px; max-width: 220px; border: 1px solid var(--line); background: var(--surface); border-radius: 15px; overflow: hidden; }
.rv-recent:hover { border-color: var(--accent-2); }
.rv-recent-go { max-width: 180px; height: 100%; padding: 0 6px 0 12px; border: 0; background: transparent; color: var(--fg-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-recent:hover .rv-recent-go { color: var(--fg); }
.rv-recent-x { display: flex; align-items: center; justify-content: center; width: 22px; height: 100%; border: 0; background: transparent; color: var(--muted); flex: none; }
.rv-recent-x:hover { color: var(--danger); }

/* folder category chips + clear */
.rv-folder-clear { height: 32px; padding: 0 12px; border: 1px solid #3a1f1f; background: var(--bg); color: var(--danger); border-radius: 7px; font-size: 12px; flex: none; }
.rv-folder-clear:hover { background: var(--surface); }
.rv-folder-cats { display: flex; gap: 8px; flex-wrap: wrap; padding: 11px 24px; border-bottom: 1px solid var(--line); flex: none; }
.rv-chip { height: 28px; padding: 0 13px; border: 1px solid var(--line); background: var(--bg); color: var(--muted-2); border-radius: 14px; font-size: 12px; white-space: nowrap; }
.rv-chip:hover { border-color: var(--accent-2); color: var(--fg-2); }
.rv-chip.active { background: var(--accent); color: #1a1500; border-color: var(--accent); font-weight: 600; }

/* tile fallback for missing icons */
.rv-tile, .rv-tile-sm { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.rv-tile { font-size: 18px; }
.rv-tile-sm { font-size: 11px; }

/* card variants */
.rv-grid[data-style="app"] { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); }
.rv-grid[data-style="tool"] { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.rv-grid[data-style="link"] { grid-template-columns: 1fr; gap: 8px; }
.rv-card-app { align-items: center; text-align: center; padding: 16px 8px 13px; gap: 10px; }
.rv-card-app .rv-card-title { padding: 0; white-space: normal; max-width: 100%; }
.rv-app-icon { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; border-radius: 12px; overflow: hidden; background: var(--surface-2); flex: none; }
.rv-app-icon img { width: 38px; height: 38px; object-fit: contain; }
.rv-card-tool { padding: 16px; gap: 9px; }
.rv-tool-icon { width: 32px; height: 32px; color: var(--accent); }
.rv-tool-icon svg { width: 100%; height: 100%; }
.rv-card-tool .rv-card-title { padding: 0; font-weight: 600; color: var(--fg); white-space: normal; }
.rv-card-blurb { font-size: 12px; color: var(--muted); white-space: normal; line-height: 1.35; }
.rv-card-link { flex-direction: row; align-items: center; gap: 12px; padding: 9px 12px; }
.rv-card-link:hover { transform: none; }
.rv-link-fav { width: 26px; height: 26px; flex: none; border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.rv-link-fav img { width: 20px; height: 20px; }
.rv-link-text { flex: 1; min-width: 0; }
.rv-link-title { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-link-url { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-link-remove { width: 26px; height: 26px; border: 0; background: transparent; color: var(--muted); border-radius: 5px; flex: none; display: flex; align-items: center; justify-content: center; }
.rv-link-remove:hover { background: var(--surface-2); color: var(--fg); }

/* command palette */
.rv-palette { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.5); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.rv-palette-box { width: min(620px, 94%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); overflow: hidden; display: flex; flex-direction: column; max-height: 70vh; }
.rv-palette-input { height: 50px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); font: inherit; font-size: 16px; padding: 0 18px; outline: none; user-select: text; -webkit-user-select: text; }
.rv-palette-list { overflow: auto; }
.rv-palette-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; }
.rv-palette-item.sel { background: var(--surface-2); }
.rv-palette-title { color: var(--fg); flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-palette-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.rv-palette-kind { margin-left: auto; color: var(--muted-2); font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; flex: none; }

/* find-in-page bar */
.rv-findbar { position: fixed; top: 8px; right: 16px; z-index: 1000; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 5px 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); }
.rv-findbar input { height: 28px; width: 200px; border: 0; background: transparent; color: var(--fg); outline: none; font: inherit; padding: 0 6px; user-select: text; -webkit-user-select: text; }
.rv-find-btn { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted-2); border-radius: 5px; }
.rv-find-btn:hover { background: var(--surface-2); color: var(--fg); }

/* favorite ★ on book + app cards */
.rv-card { position: relative; }
.rv-fav-star { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 7px; background: rgba(0, 0, 0, 0.45); color: #fff; opacity: 0.55; transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease; z-index: 2; }
.rv-fav-star svg { width: 16px; height: 16px; }
.rv-card:hover .rv-fav-star, .rv-fav-star.on { opacity: 1; }
.rv-fav-star:hover { background: rgba(0, 0, 0, 0.7); }
.rv-fav-star.on { color: var(--accent); }
.rv-fav-star.on svg path { fill: var(--accent); }
.rv-card-app .rv-fav-star { top: 5px; right: 5px; background: var(--surface-2); }
.rv-card-app .rv-fav-star:hover { background: var(--line); }

/* favorites: a small book cover thumb inside a link row */
.rv-link-cover { width: 42px; height: 30px; border-radius: 5px; overflow: hidden; position: relative; background: linear-gradient(135deg, #1a1813, #0b0b0b); flex: none; }
.rv-link-cover .rv-card-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; padding: 0; }
.rv-link-cover .rv-card-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; color: var(--muted-2); padding: 2px; text-align: center; }

/* pagination */
.rv-pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px 24px 14px; flex: none; border-top: 1px solid var(--line); }
.rv-pager-btn { height: 32px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 7px; font-size: 13px; }
.rv-pager-btn:hover:not([disabled]) { border-color: var(--accent-2); }
.rv-pager-btn[disabled] { opacity: 0.4; }
.rv-pager-ind { color: var(--muted); font-size: 12px; }

/* loading overlay + pipeline bar (covers the iframe white-flash) */
.rv-loader { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.rv-loader[data-on="1"] { opacity: 1; pointer-events: auto; transition: opacity 0.25s ease 0.14s; } /* delayed fade-in → fast pages never flash it */
.rv-loader-card { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.rv-loader-row { display: flex; align-items: center; gap: 14px; }
.rv-loader-label { color: var(--muted-2); font-size: 13px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-loader-skip { height: 28px; padding: 0 13px; border: 1px solid var(--line); background: var(--surface); color: var(--fg-2); border-radius: 7px; font-size: 12px; }
.rv-loader-skip:hover { border-color: var(--accent-2); color: var(--fg); }
.rv-pipe { width: 260px; max-width: 70vw; height: 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; position: relative; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4); }
.rv-pipe span { position: absolute; top: 0; bottom: 0; left: -28px; right: -28px; background-image: radial-gradient(circle 4px at 14px 50%, var(--accent) 0 4px, transparent 5px); background-size: 28px 100%; background-repeat: repeat-x; animation: rvpipe 0.75s linear infinite; will-change: transform; }
@keyframes rvpipe { from { transform: translateX(0); } to { transform: translateX(28px); } }
@media (prefers-reduced-motion: reduce) { .rv-pipe span { animation-duration: 2.4s; } }

/* collapsible top chrome + pull tab */
.rv-root.collapsed .rv-tabstrip,
.rv-root.collapsed .rv-navbar,
.rv-root.collapsed .rv-bookmarksbar { display: none; }
.rv-pulltab { position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; justify-content: center; width: 56px; height: 15px; padding: 0; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; background: var(--surface); color: var(--muted-2); opacity: 0.75; transition: opacity 0.15s ease, height 0.15s ease, color 0.15s ease, background 0.15s ease; }
.rv-pulltab svg { width: 15px; height: 15px; }
.rv-pulltab:hover { opacity: 1; height: 20px; color: var(--fg); background: var(--surface-2); }

/* optional hiding of the top-left branding + status dot (Appearance settings) */
[data-brand="off"] .rv-brand #rv-logo,
[data-brand="off"] .rv-brand-name { display: none; }
[data-status="off"] .rv-conn { display: none; }
[data-brand="off"] .rv-brand { padding-left: 8px; }
[data-brand="off"][data-status="off"] .rv-brand { display: none; }

/* font-preview dropdown: each option renders in its own face */
.rv-font-select option { font-size: 15px; padding: 3px 4px; }

/* off-screen image cards skip layout/paint (paginated grids stay light) */
.rv-grid[data-style="image"] .rv-card { content-visibility: auto; contain-intrinsic-size: auto 226px; }

/* tab context menu (right-click / long-press) */
.rv-ctxmenu { position: fixed; z-index: 200; min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 5px; box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; }
.rv-ctxitem { display: flex; align-items: center; height: 30px; padding: 0 10px; border: 0; background: transparent; color: var(--fg-2); border-radius: 6px; font-size: 13px; text-align: left; }
.rv-ctxitem:hover:not([disabled]) { background: var(--surface-2); color: var(--fg); }
.rv-ctxitem[disabled] { opacity: 0.4; }
.rv-ctxsep { height: 1px; background: var(--line); margin: 4px 6px; }

/* pinned tabs */
.rv-tab.pinned { min-width: auto; max-width: 132px; padding-right: 12px; gap: 5px; }
.rv-tab-pin { display: flex; align-items: center; color: var(--accent); flex: none; }

/* bigger hit targets on touchscreens (Chromebooks) */
@media (pointer: coarse) {
	.rv-nav, .rv-newtab { width: 40px; height: 40px; }
	.rv-tab-close { width: 26px; height: 26px; }
	.rv-shortcut-btn { width: 72px; height: 72px; }
}

/* Reserve the start-screen shortcut grid's wrapped height per width band so the
   grid — and the ad below it — don't shift down when the dashboard hydrates after
   first paint. A container pinned at min-height stays put when its content fits. */
@media (max-width: 399px) { .rv-shortcuts { min-height: 318px; } } /* 3 rows (incl. 360px) */
@media (min-width: 400px) and (max-width: 665px) { .rv-shortcuts { min-height: 206px; } } /* 2 rows */

/* address-bar / search autocomplete dropdown */
.rv-suggest { position: fixed; z-index: 300; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 5px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); max-height: 52vh; overflow-y: auto; }
.rv-suggest-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 7px; cursor: pointer; color: var(--fg-2); font-size: 13px; }
.rv-suggest-item.sel { background: var(--surface-2); color: var(--fg); }
.rv-suggest-ic { display: flex; flex: none; width: 16px; height: 16px; color: var(--muted-2); }
.rv-suggest-ic svg { width: 16px; height: 16px; }
.rv-suggest-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-suggest-label b { color: var(--fg); font-weight: 600; }
.rv-suggest-sub { flex: none; color: var(--muted-2); font-size: 11px; margin-left: 8px; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* boot-failure recovery screen */
.rv-fatal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.rv-fatal-card { display: flex; flex-direction: column; align-items: center; gap: 13px; text-align: center; max-width: 390px; }
.rv-fatal-card svg { width: 48px; height: 48px; color: var(--accent); }
.rv-fatal-card h1 { color: var(--fg); font-size: 20px; }
.rv-fatal-card p { color: var(--muted-2); font-size: 14px; line-height: 1.5; }
.rv-fatal-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }

/* --- auto-update toast (app/update.js) ----------------------------------- */
.rv-update { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 14px); z-index: 10000; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 28px); padding: 9px 9px 9px 15px; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); font-size: var(--fs); opacity: 0; pointer-events: none; transition: opacity 0.22s ease, transform 0.22s ease; }
.rv-update.rv-update-in { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.rv-update-msg { color: var(--fg); }
.rv-update-reload { height: 30px; padding: 0 14px; border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: #1a1500; font: inherit; font-weight: 600; cursor: pointer; flex: none; }
.rv-update-reload:hover { filter: brightness(1.06); }
.rv-update-x { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; flex: none; font-size: 12px; }
.rv-update-x:hover { color: var(--fg); background: var(--line); }

[hidden] { display: none !important; }
