/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --chrome:        #dee3ea;
  --chrome-2:      #eef1f5;
  --surface:       #ffffff;
  --surface-2:     #f5f6f9;
  --surface-3:     #e9ebf0;
  --text:          #1c1f24;
  --text-dim:      #5d646f;
  --text-faint:    #868d99;
  --border:        #d3d8e0;
  --border-soft:   #e4e7ed;
  --accent:        #2563eb;
  --accent-soft:   #dbe7fe;
  --danger:        #d64545;
  --ok:            #1a9a5f;
  --tab-active:    #ffffff;
  --shadow-sm:     0 1px 2px rgba(16,20,28,.08);
  --shadow-md:     0 6px 20px rgba(16,20,28,.12);
  --shadow-lg:     0 16px 48px rgba(16,20,28,.20);
  --radius:        9px;
  --tabh:          36px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"], :root[data-theme="system"] { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --chrome:#202126; --chrome-2:#282a30; --surface:#1b1c20; --surface-2:#26282e; --surface-3:#32343b;
    --text:#e8eaed; --text-dim:#a5abb6; --text-faint:#7c828d; --border:#3a3d45; --border-soft:#2f3138;
    --accent:#5b9dff; --accent-soft:#1e3358; --tab-active:#35373e;
    --shadow-sm:0 1px 2px rgba(0,0,0,.4); --shadow-md:0 6px 20px rgba(0,0,0,.45); --shadow-lg:0 16px 48px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --chrome:#202126; --chrome-2:#282a30; --surface:#1b1c20; --surface-2:#26282e; --surface-3:#32343b;
  --text:#e8eaed; --text-dim:#a5abb6; --text-faint:#7c828d; --border:#3a3d45; --border-soft:#2f3138;
  --accent:#5b9dff; --accent-soft:#1e3358; --tab-active:#35373e;
  --shadow-sm:0 1px 2px rgba(0,0,0,.4); --shadow-md:0 6px 20px rgba(0,0,0,.45); --shadow-lg:0 16px 48px rgba(0,0,0,.6);
}
:root[data-theme="light"] { color-scheme: light; }

/* Private windows get their own chrome, like every other browser. */
.app.is-private { --chrome:#2b2340; --chrome-2:#352b4e; --tab-active:#433660; --text:#e9e6f5; --text-dim:#b3aacb; --border:#4a3f69; }

/* Author display rules beat the UA's [hidden] rule, so restate it here. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; color: var(--text);
  background: var(--chrome); overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
.ic { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9;
      stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

button { font: inherit; color: inherit; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent;
  cursor: pointer; color: var(--text-dim); transition: background .12s, color .12s;
}
.icon-btn:hover:not(:disabled) { background: rgba(127,127,127,.16); color: var(--text); }
.icon-btn:active:not(:disabled) { background: rgba(127,127,127,.26); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn .dot {
  position: absolute; top: 5px; right: 5px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent); border: 1.5px solid var(--chrome);
}
.btn {
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 13px; transition: background .12s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* ── Tab strip ─────────────────────────────────────────────────────────── */
.tabstrip {
  display: flex; align-items: flex-end; gap: 2px; padding: 6px 8px 0;
  background: var(--chrome); flex: none; user-select: none;
}
.tabs { display: flex; align-items: flex-end; gap: 2px; overflow: hidden; flex: 0 1 auto; }
.tab {
  display: flex; align-items: center; gap: 8px; height: var(--tabh);
  min-width: 52px; max-width: 220px; flex: 1 1 200px;
  padding: 0 8px 0 11px; border-radius: 9px 9px 0 0;
  background: transparent; cursor: default; position: relative; overflow: hidden;
  transition: background .12s;
}
.tab:hover { background: rgba(127,127,127,.16); }
.tab.active { background: var(--tab-active); box-shadow: var(--shadow-sm); }
.tab.active::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 2px; background: transparent;
}
.tab.dragging { opacity: .55; }
.tab.pinned { flex: 0 0 44px; min-width: 44px; max-width: 44px; padding: 0; justify-content: center; }
.tab.pinned .tab-title, .tab.pinned .tab-close { display: none; }
.tab-fav {
  width: 16px; height: 16px; flex: none; border-radius: 3px; object-fit: contain;
  background: var(--surface-3);
}
.tab-fav.blank { background: var(--surface-3); }
.tab-title {
  flex: 1; font-size: 12.5px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--text);
}
.tab.active .tab-title { font-weight: 550; }
.tab-close {
  width: 20px; height: 20px; border: 0; border-radius: 5px; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--text-dim); opacity: 0;
  transition: opacity .12s, background .12s;
}
.tab-close .ic { width: 13px; height: 13px; stroke-width: 2.2; }
.tab:hover .tab-close, .tab.active .tab-close { opacity: 1; }
/* No hover on touch screens: show every close button, and make it finger-sized. */
@media (hover: none) {
  .tab-close { opacity: 1; width: 26px; height: 26px; }
  .tab-close .ic { width: 15px; height: 15px; }
  .tab { padding-right: 4px; }
}
.tab-close:hover { background: rgba(127,127,127,.28); color: var(--text); }
.tab-spinner {
  width: 14px; height: 14px; flex: none; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tab-priv { color: var(--accent); }
.tab-new { width: 30px; height: 30px; margin-bottom: 3px; border: 0; border-radius: 7px;
  background: transparent; cursor: pointer; color: var(--text-dim); display: grid; place-items: center; }
.tab-new:hover { background: rgba(127,127,127,.16); color: var(--text); }
.strip-spacer { flex: 1 1 auto; min-width: 8px; }
.window-tools { display: flex; gap: 2px; padding-bottom: 3px; }

/* ── Toolbar ───────────────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: var(--chrome-2); flex: none;
}
.nav-group, .tool-group { display: flex; align-items: center; gap: 1px; flex: none; }
.omnibox-wrap { flex: 1 1 auto; position: relative; min-width: 0; }
.omnibox {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 6px 0 11px;
  background: var(--surface); border: 1px solid transparent; border-radius: 17px;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.omnibox:hover { background: var(--surface-2); }
.omnibox.focused {
  background: var(--surface); border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}
.omni-icon { display: grid; place-items: center; color: var(--text-faint); flex: none; }
.omni-icon.secure { color: var(--ok); }
.omni-icon.insecure { color: var(--danger); }
#urlInput {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 13.5px; color: var(--text);
}
#urlInput::placeholder { color: var(--text-faint); }
.omni-btn {
  width: 26px; height: 26px; border: 0; border-radius: 7px; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--text-dim); flex: none;
}
.omni-btn:hover { background: rgba(127,127,127,.18); color: var(--text); }
.omni-btn.on { color: var(--accent); }
.omni-btn.on .ic { fill: color-mix(in srgb, var(--accent) 30%, transparent); }
.omni-badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; flex: none;
  border-radius: 11px; background: var(--surface-3); color: var(--text-dim); font-size: 11px;
}
.omni-badge .ic { width: 13px; height: 13px; }

.suggestions {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: 60vh; overflow-y: auto;
}
.sug {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px; cursor: pointer; font-size: 13.5px;
}
.sug:hover, .sug.sel { background: var(--surface-2); }
.sug .ic { color: var(--text-faint); }
.sug-main { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-sub { color: var(--text-faint); font-size: 12px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.sug-kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); flex: none; }

/* ── Bookmarks bar ─────────────────────────────────────────────────────── */
.bookmarks-bar {
  display: flex; align-items: center; gap: 2px; padding: 3px 10px 5px;
  background: var(--chrome-2); flex: none; overflow-x: auto; scrollbar-width: none;
}
.bookmarks-bar::-webkit-scrollbar { display: none; }
.bookmarks-bar:empty { display: none; }
.bm {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 7px;
  font-size: 12.5px; cursor: pointer; white-space: nowrap; border: 0; background: transparent;
  max-width: 190px; color: var(--text);
}
.bm:hover { background: rgba(127,127,127,.16); }
.bm img { width: 15px; height: 15px; border-radius: 3px; flex: none; }
.bm span { overflow: hidden; text-overflow: ellipsis; }
.bm-empty { font-size: 12px; color: var(--text-faint); padding: 4px 6px; }

/* ── App bar ───────────────────────────────────────────────────────────── */
/* An app view shows only this: enough to get back and to reload, nothing more. */
.appbar {
  display: flex; align-items: center; gap: 9px; padding: 0 8px 0 6px; height: 40px;
  background: var(--chrome); flex: none; user-select: none;
  border-bottom: 1px solid var(--border-soft);
}
.appbar-fav { width: 18px; height: 18px; border-radius: 4px; flex: none; }
.appbar-title {
  font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text);
}
.appbar-tools { display: flex; gap: 1px; flex: none; }

/* Mode switching: the launcher and app views hide the browser's own furniture. */
.app.mode-launcher .tabstrip,
.app.mode-launcher .toolbar,
.app.mode-launcher .bookmarks-bar,
.app.mode-app .tabstrip,
.app.mode-app .toolbar,
.app.mode-app .bookmarks-bar { display: none; }
.app.mode-launcher .appbar { display: none; }

/* ── Content ───────────────────────────────────────────────────────────── */
.content { position: relative; flex: 1 1 auto; background: var(--surface); overflow: hidden; }
.frames { position: absolute; inset: 0; }
.frames iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff;
  display: none;
}
.frames iframe.active { display: block; }
.app.force-dark .frames iframe.active {
  filter: invert(1) hue-rotate(180deg);
  background: #111;
}
.progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 20; background: transparent; }
.progress i {
  display: block; height: 100%; width: 30%; background: var(--accent);
  animation: load 1.1s ease-in-out infinite;
}
@keyframes load { 0% { margin-left: -32%; } 100% { margin-left: 102%; } }

/* Start page */
.startpage { position: absolute; inset: 0; overflow-y: auto; background: var(--surface); }

/* Which face of the start page is showing */
#launcherView, #browserStart { display: none; }
.app.mode-launcher #launcherView { display: flex; }
#browserStart { place-items: start center; }
.app.mode-browser #browserStart, .app.mode-app #browserStart { display: grid; }

/* ── Launcher ──────────────────────────────────────────────────────────── */
/* Header and footer stay put; only the cards scroll. */
.app.mode-launcher .startpage { overflow: hidden; }
.launcher {
  flex-direction: column; height: 100%; width: 100%;
  background:
    radial-gradient(1100px 520px at 50% -10%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    var(--surface);
}
.lc-top {
  display: flex; align-items: center; gap: 16px; padding: 14px 22px; flex: none;
  border-bottom: 1px solid var(--border-soft);
}
.lc-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--accent); }
.lc-mark { width: 26px; height: 26px; flex: none; }
.lc-word { font-size: 17px; letter-spacing: .06em; white-space: nowrap; }
.lc-word b { font-weight: 750; color: var(--accent); }
.lc-word i { font-style: normal; font-weight: 600; color: var(--text); }
.lc-heading {
  font-size: 13px; font-weight: 650; letter-spacing: .16em; color: var(--text-dim);
  flex: none; text-transform: uppercase;
}
.lc-right { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: flex-end; }
.lc-clock { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.lc-avatar {
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--surface-3); color: var(--text); font-size: 12.5px; font-weight: 650;
  letter-spacing: .02em;
}
.lc-avatar:hover { filter: brightness(1.12); }

.lc-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px 22px; gap: 6px;
}
.lc-welcome { margin: 0; font-size: 30px; font-weight: 650; letter-spacing: -.02em; text-align: center; }
.lc-sub { margin: 0 0 34px; font-size: 16px; color: var(--text-dim); text-align: center; }

/* Dates: Hijri first, Gregorian beneath it. */
.lc-dates { text-align: center; margin: -6px 0 30px; }
.lc-hijri { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: .01em; }
.lc-hijri[hidden] { display: none; }
.lc-greg { font-size: 13px; color: var(--text-faint); margin-top: 3px; }

.lc-cards {
  display: grid; gap: 18px; width: 100%; max-width: 880px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.lc-card {
  --tint: var(--accent);
  position: relative; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 26px 16px; min-height: 168px;
  border: 1px solid color-mix(in srgb, var(--tint) 55%, transparent);
  border-radius: 16px; cursor: pointer; text-align: center;
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--tint) 16%, transparent), transparent 72%),
    var(--surface-2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tint) 12%, transparent),
              0 10px 34px color-mix(in srgb, var(--tint) 14%, transparent);
  transition: transform .14s ease, box-shadow .16s ease, border-color .16s ease;
}
.lc-card:hover, .lc-card:focus-visible {
  transform: translateY(-3px); outline: none;
  border-color: color-mix(in srgb, var(--tint) 85%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tint) 30%, transparent),
              0 16px 46px color-mix(in srgb, var(--tint) 26%, transparent);
}
.lc-card-ico {
  width: 76px; height: 76px; border-radius: 20px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tint) 15%, transparent);
  color: var(--tint); overflow: hidden;
}
.lc-card-ico img { width: 46px; height: 46px; object-fit: contain; }
.lc-card-ico .ic { width: 42px; height: 42px; stroke-width: 1.6; }
.lc-card-ico .letter { font-size: 30px; font-weight: 700; color: var(--tint); }
.lc-card-name {
  font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text); word-break: break-word;
}
.lc-card-x {
  position: absolute; top: 9px; right: 9px; width: 24px; height: 24px; border: 0;
  border-radius: 50%; background: var(--surface-3); color: var(--text-dim);
  cursor: pointer; opacity: 0; display: grid; place-items: center; font-size: 15px; line-height: 1;
}
.lc-card:hover .lc-card-x { opacity: 1; }
.lc-card.lc-add {
  border-style: dashed; border-color: var(--border);
  background: transparent; box-shadow: none;
}
.lc-card.lc-add .lc-card-ico { background: var(--surface-2); color: var(--text-faint); }
.lc-card.lc-add .lc-card-name { color: var(--text-faint); }

.lc-foot {
  display: flex; align-items: center; gap: 14px; padding: 10px 18px; flex: none;
  border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--text-faint);
}
.lc-status { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-foot-tools { display: flex; gap: 2px; flex: none; }

@media (max-width: 620px) {
  .lc-heading { display: none; }
  .lc-welcome { font-size: 24px; }
  .lc-sub { font-size: 14px; margin-bottom: 26px; }
  /* Dates: Hijri first, Gregorian beneath it. */
.lc-dates { text-align: center; margin: -6px 0 30px; }
.lc-hijri { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: .01em; }
.lc-hijri[hidden] { display: none; }
.lc-greg { font-size: 13px; color: var(--text-faint); margin-top: 3px; }

.lc-cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
  .lc-card { min-height: 150px; padding: 22px 12px; gap: 12px; }
  .lc-card-ico { width: 58px; height: 58px; border-radius: 16px; }
  .lc-card-ico img { width: 34px; height: 34px; }
  .lc-card-name { font-size: 12.5px; }
  .lc-clock { display: none; }
}

.start-inner { width: min(760px, 90vw); padding: 9vh 0 60px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--accent); }
.brand-mark { width: 54px; height: 54px; }
.brand h1 { margin: 0; font-size: 27px; font-weight: 600; letter-spacing: -.02em; color: var(--text); }
.start-search {
  display: flex; align-items: center; gap: 10px; margin: 28px 0 40px; padding: 0 18px;
  height: 50px; border-radius: 25px; background: var(--surface-2);
  border: 1px solid var(--border-soft); box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s;
}
.start-search:focus-within { border-color: var(--accent); box-shadow: var(--shadow-md); }
.start-search .ic { color: var(--text-faint); width: 19px; height: 19px; }
#startInput { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--text); }
.dial { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.dial-item {
  display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 16px 8px;
  border-radius: 12px; cursor: pointer; text-decoration: none; color: var(--text);
  border: 1px solid transparent; transition: background .12s, border-color .12s; position: relative;
}
.dial-item:hover { background: var(--surface-2); border-color: var(--border-soft); }
.dial-ico {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-3); font-size: 17px; font-weight: 600; color: var(--text-dim); overflow: hidden;
}
.dial-ico img { width: 100%; height: 100%; object-fit: contain; }
.dial-name { font-size: 12px; text-align: center; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.dial-x {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border: 0; border-radius: 50%;
  background: var(--surface-3); color: var(--text-dim); cursor: pointer; opacity: 0;
  display: grid; place-items: center; font-size: 14px; line-height: 1;
}
.dial-item:hover .dial-x { opacity: 1; }
.start-hint { text-align: center; color: var(--text-faint); font-size: 12.5px; margin-top: 28px; }

/* The tile that adds a new app */
.dial-add .dial-ico { background: transparent; border: 1.5px dashed var(--border); color: var(--text-faint); }
.dial-add:hover .dial-ico { border-color: var(--accent); color: var(--accent); }
.dial-add .dial-name { color: var(--text-faint); }

/* Frequently visited, offered as chips you can promote into apps */
.suggested { margin-top: 34px; }
.suggested:empty { display: none; }
.suggest-label {
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); text-align: center; margin-bottom: 12px;
}
.suggest-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.suggest-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 16px;
  border: 1px solid var(--border-soft); background: var(--surface-2); cursor: pointer;
  font-size: 12.5px; color: var(--text); max-width: 210px;
}
.suggest-chip:hover { background: var(--surface-3); }
.suggest-chip img { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.suggest-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.install-wrap { display: flex; justify-content: center; margin-top: 22px; flex: none; }
.install-wrap:empty { display: none; }

/* Reader */
.reader { position: absolute; inset: 0; background: var(--surface); overflow-y: auto; z-index: 12; }
.reader-bar {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 18px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border-soft); z-index: 2;
}
.reader-controls { display: flex; gap: 4px; }
.reader-body {
  max-width: 46rem; margin: 0 auto; padding: 40px 26px 100px;
  font-size: var(--reader-size, 18px); line-height: 1.72;
}
.reader-body h1 { font-size: 1.85em; line-height: 1.22; margin: 0 0 12px; letter-spacing: -.02em; }
.reader-body .reader-meta { color: var(--text-faint); font-size: .78em; margin-bottom: 30px;
  padding-bottom: 18px; border-bottom: 1px solid var(--border-soft); }
.reader-body img, .reader-body video { max-width: 100%; height: auto; border-radius: 8px; }
.reader-body p { margin: 0 0 1.15em; }
.reader-body a { color: var(--accent); }
.reader-body pre { overflow-x: auto; background: var(--surface-2); padding: 14px; border-radius: 8px; font-size: .85em; }
.reader-body blockquote { margin: 0 0 1.15em; padding-left: 16px; border-left: 3px solid var(--border);
  color: var(--text-dim); }

/* Find bar */
.findbar {
  position: absolute; top: 12px; right: 18px; z-index: 30; display: flex; align-items: center; gap: 6px;
  padding: 6px 8px 6px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; box-shadow: var(--shadow-md);
}
.findbar .ic { color: var(--text-faint); }
#findInput { border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px;
  width: 190px; color: var(--text); }
.find-count { font-size: 12px; color: var(--text-faint); min-width: 44px; text-align: right; }

/* Status bar */
.statusbar {
  position: absolute; left: 0; bottom: 0; z-index: 15; max-width: 70%;
  padding: 3px 12px 4px; font-size: 11.5px; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--border-soft); border-left: 0; border-bottom: 0;
  border-radius: 0 7px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Panels ────────────────────────────────────────────────────────────── */
.panel-scrim { position: fixed; inset: 0; background: rgba(10,12,16,.28); z-index: 70; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 100vw); z-index: 71;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slide-in .18s ease;
}
@keyframes slide-in { from { transform: translateX(22px); opacity: .4; } }
.panel-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 20px;
  border-bottom: 1px solid var(--border-soft); flex: none;
}
.panel-head h2 { margin: 0; font-size: 15.5px; font-weight: 600; flex: 1; }
.panel-actions { display: flex; gap: 6px; }
.panel-search {
  display: flex; align-items: center; gap: 9px; margin: 12px 16px; padding: 0 12px; height: 34px;
  background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 9px; flex: none;
}
.panel-search .ic { color: var(--text-faint); }
#panelSearch { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; color: var(--text); }
.panel-body { flex: 1; overflow-y: auto; padding: 6px 10px 24px; }

.row {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px;
  cursor: pointer; position: relative;
}
.row:hover { background: var(--surface-2); }
.row img.fav { width: 17px; height: 17px; border-radius: 4px; flex: none; background: var(--surface-3); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 2px; opacity: 0; flex: none; }
.row:hover .row-actions { opacity: 1; }
.group-label {
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-faint); padding: 16px 11px 6px;
}
.empty { text-align: center; color: var(--text-faint); padding: 60px 20px; font-size: 13px; }
.empty .ic { width: 34px; height: 34px; opacity: .4; margin-bottom: 12px; }

/* Settings */
.setting { padding: 15px 11px; border-bottom: 1px solid var(--border-soft); }
.setting:last-child { border-bottom: 0; }
.setting-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.setting-label { font-size: 13.5px; font-weight: 550; }
.setting-desc { font-size: 12px; color: var(--text-faint); margin-top: 3px; line-height: 1.5; }
.setting select, .setting input[type=text] {
  width: 100%; margin-top: 9px; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); font: inherit; font-size: 13px; color: var(--text);
}
.switch { position: relative; width: 38px; height: 21px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch i {
  position: absolute; inset: 0; border-radius: 11px; background: var(--surface-3);
  transition: background .15s; pointer-events: none;
}
.switch i::after {
  content: ''; position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s;
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(17px); }

/* ── Menus ─────────────────────────────────────────────────────────────── */
.menu {
  position: fixed; z-index: 90; min-width: 236px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 13.5px;
}
.menu-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 11px; border-radius: 8px; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item .ic { color: var(--text-dim); }
.menu-item .key { margin-left: auto; font-size: 11.5px; color: var(--text-faint); }
.menu-item.disabled { opacity: .4; pointer-events: none; }
.menu-sep { height: 1px; background: var(--border-soft); margin: 5px 8px; }
.menu-zoom { display: flex; align-items: center; gap: 8px; padding: 6px 11px; }
.menu-zoom .zval { flex: 1; text-align: center; font-size: 13px; }

/* ── Sign in ───────────────────────────────────────────────────────────── */
.signin {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 460px at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
    var(--surface);
}
.signin-card {
  width: min(380px, 100%); padding: 30px 28px 26px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg);
}
.signin-brand { display: flex; align-items: center; gap: 9px; color: var(--accent); margin-bottom: 22px; }
.signin-brand .lc-mark { width: 24px; height: 24px; }
.signin-card h1 { margin: 0 0 4px; font-size: 21px; font-weight: 650; }
.signin-sub { margin: 0 0 22px; font-size: 13.5px; color: var(--text-dim); }
.signin-error {
  margin: 0 0 14px; font-size: 13px; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 8px; padding: 9px 11px;
}
.signin-error[hidden] { display: none; }
.signin-submit { width: 100%; margin-top: 6px; padding: 11px; font-size: 14.5px; }
.signin-switch {
  display: block; width: 100%; margin-top: 14px; padding: 6px; border: 0; background: none;
  color: var(--text-dim); font: inherit; font-size: 12.5px; cursor: pointer; text-align: center;
}
.signin-switch:hover { color: var(--accent); text-decoration: underline; }
.signin-submit[disabled] { opacity: .6; cursor: default; }

/* ── Dialog ────────────────────────────────────────────────────────────── */
.dialog-scrim { position: fixed; inset: 0; background: rgba(10,12,16,.45); z-index: 96; }
.dialog {
  position: fixed; z-index: 97; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(400px, calc(100vw - 32px)); padding: 22px 22px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg);
}
.dialog h2 { margin: 0 0 16px; font-size: 16px; font-weight: 650; }
.dialog-field { display: block; margin-bottom: 14px; }
.dialog-field span { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 5px; }
.dialog-field input {
  width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); font: inherit; font-size: 14px; color: var(--text);
}
.dialog-field input:focus { outline: none; border-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 95;
  padding: 11px 20px; border-radius: 11px; background: var(--text); color: var(--surface);
  font-size: 13px; box-shadow: var(--shadow-lg); animation: rise .2s ease;
}
@keyframes rise { from { transform: translate(-50%, 10px); opacity: 0; } }

/* ── Narrow screens ────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .tab { max-width: 150px; }
  .nav-group #btnHome { display: none; }
  .tool-group #btnHistory { display: none; }
  .start-inner { padding-top: 6vh; }
  .findbar { left: 12px; right: 12px; }
  #findInput { width: auto; flex: 1; }
  .panel { width: 100vw; }
}
