/* ==========================================================================
   Zen Browser layout — body[data-layout="zen"] (browser/zen-layout.mjs).
   A full-viewport browser shell: glass sidebar with workspaces, vertical tabs,
   essentials and an add-on slot, plus a proxied viewport on the right.
   ========================================================================== */

/* ---------------------------------------------------------- layout overrides */
body[data-layout="zen"] {
  height: 100vh;
  overflow: hidden;
  background: #000 !important;
  background-image: none !important;
}

/* The page canvas behind the panels is black too, so nothing shows at the gaps. */
html:has(body[data-layout="zen"]) {
  background: #000;
}

/* Zen draws its own canvas: drop the site wallpaper layers entirely instead of
   letting the animated glow, stars and wallpaper motion run underneath. */
body[data-layout="zen"]::before,
body[data-layout="zen"]::after {
  display: none !important;
}

body[data-layout="zen"] .topbar,
body[data-layout="zen"] .tabbar,
body[data-layout="zen"] .os-taskbar,
body[data-layout="zen"] .os-start-menu,
body[data-layout="zen"] .whats-new,
body[data-layout="zen"] #os-desktop-widgets {
  display: none !important;
}

body[data-layout="zen"] #shell {
  height: 100vh;
  min-height: 0;
}

body[data-layout="zen"] #app {
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 100vh;
}

body[data-layout="zen"] #app > .view:not(#v-zen) {
  display: none !important;
}

body[data-layout="zen"] #app > #v-zen {
  display: block !important;
  animation: none;
}

/* ------------------------------------------------------------------- shell */
.zenl {
  --zenl-line: rgba(255, 255, 255, 0.08);
  --zenl-panel: rgba(13, 13, 15, 0.97);
  --zenl-muted: rgba(255, 255, 255, 0.45);
  --zenl-serif: 'Fraunces', Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --zenl-ink: #08080a;
  /* Wet ink on charcoal paper: a faint grain over every panel. */
  --zenl-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 .3 .3 .3 0 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
  position: relative;
  display: flex;
  gap: 8px;
  height: 100vh;
  padding: 8px;
  color: #e8e8ec;
  font-family: var(--font);
}

.zenl-panel {
  background:
    var(--zenl-grain) 0 0 / 180px 180px,
    radial-gradient(120% 60% at 50% -10%, rgba(255, 255, 255, 0.045), transparent 60%),
    var(--zenl-panel);
  border: 1px solid var(--zenl-line);
  border-radius: 16px 12px 14px 13px / 13px 15px 12px 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 24px 60px -40px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

.zenl-col {
  flex: none;
  width: 250px;
  overflow: hidden;
  transition:
    width 280ms cubic-bezier(0.22, 1, 0.36, 1),
    margin 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.zenl.is-collapsed .zenl-col {
  width: 0;
  margin-right: -8px;
}

/* Compact mode: hovering the far-left edge floats the sidebar over the viewport. */
.zenl.is-collapsed.is-revealed .zenl-col {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 8px;
  z-index: 40;
  width: 250px;
  margin: 0;
  overflow: visible;
  animation: zenl-float-in 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.zenl.is-revealed .zenl-col .zenl-sidebar {
  box-shadow:
    0 28px 70px -18px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}

@keyframes zenl-float-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}

.zenl-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: 8px;
}

/* ---------------------------------------------------------------- sidebar */
.zenl-sidebar {
  display: flex;
  flex-direction: column;
  width: 250px;
  height: 100%;
  overflow: hidden;
  /* Chrome text behaves like app chrome, not page content. */
  user-select: none;
  -webkit-user-select: none;
}

.zenl-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px 6px 8px 7px / 7px 9px 6px 8px;
  color: rgba(255, 255, 255, 0.6);
  transition: background 150ms ease, color 150ms ease;
}

.zenl-icon:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  box-shadow: 0 0 16px -6px color-mix(in srgb, var(--accent) 60%, transparent);
}
.zenl-icon:disabled { opacity: 0.3; background: none; color: rgba(255, 255, 255, 0.6); }
.zenl-icon.is-on { background: rgba(255, 255, 255, 0.1); color: #fff; }
.zenl-icon svg { width: 15px; height: 15px; }

/* Keyboard focus stays visible without boxing every mouse click. */
.zenl :is(button, input, a, [tabindex]):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ browser chrome */
.zenl-browser {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--zenl-line);
  border-radius: 14px 12px 15px 13px / 13px 15px 12px 14px;
  background: #0c0c0e;
  box-shadow: 0 20px 60px -30px rgba(0, 0, 0, 0.9);
}

.zenl-tabbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  padding: 6px 10px;
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.13) 22%, rgba(255, 255, 255, 0.02)) 1;
  background:
    var(--zenl-grain) 0 0 / 180px 180px,
    linear-gradient(180deg, #151514, #0f0f0e);
}

/* The seal from the wordmark, pressed faintly into the empty end of the tab bar. */
.zenl-tabbar::before {
  content: "渊";
  position: absolute;
  top: 50%;
  right: 10px;
  color: rgba(255, 255, 255, 0.09);
  font-family: 'Ma Shan Zheng', var(--zenl-serif);
  font-size: 22px;
  line-height: 1;
  transform: translateY(-50%) rotate(-4deg);
  pointer-events: none;
  user-select: none;
}

.zenl-menubtn { color: rgba(255, 255, 255, 0.5); }

.zenl-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.zenl-strip::-webkit-scrollbar { display: none; }

.zenl-strip li {
  position: relative;
  flex: 0 0 auto;
  min-width: 0;
  max-width: 210px;
}

.zenl-strip .zenl-tab {
  min-width: 124px;
  max-width: 210px;
  padding: 7px 24px 7px 9px;
  border-radius: 11px 8px 10px 9px / 9px 11px 8px 10px;
  font-family: var(--zenl-serif);
  font-size: 12.5px;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.zenl-strip .zenl-tab[aria-current="page"] {
  background:
    radial-gradient(120% 140% at 40% -30%, rgba(255, 255, 255, 0.12), transparent 70%),
    rgba(255, 255, 255, 0.045);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.045);
}

/* Brushed underline on the active tab, like a loaded brush drawn across paper. */
.zenl-strip .zenl-tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: auto;
  right: 14px;
  bottom: 1px;
  left: 14px;
  display: block;
  width: auto;
  height: 1.5px;
  transform: none;
  border-radius: 40% 60% 55% 45% / 100% 100% 100% 100%;
  background: linear-gradient(90deg, transparent, var(--accent) 22%, var(--accent) 70%, transparent);
  opacity: 0.7;
}

.zenl-strip .zenl-tab-close {
  right: 2px;
  width: 18px;
  height: 18px;
  font-size: 13px;
}

.zenl-strip li:hover .zenl-tab-close,
.zenl-strip li:focus-within .zenl-tab-close,
.zenl-strip .zenl-tab[aria-current="page"] ~ .zenl-tab-close { opacity: 0.6; }

.zenl-plus { flex: none; }

.zenl-tabbar::after {
  content: "";
  flex: 1;
}

.zenl-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding: 7px 8px;
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.1) 30%, rgba(255, 255, 255, 0.02)) 1;
  background:
    var(--zenl-grain) 0 0 / 180px 180px,
    linear-gradient(180deg, #111110, #0d0d0c);
}

.zenl-addr {
  position: relative;
  flex: 1;
  min-width: 0;
  margin: 0 6px;
}

.zenl-addr svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

/* The address bar reads as an ink well: sunken, edged, with a brush line under focus. */
.zenl-addr::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 1.5px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 200ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.zenl-addr:focus-within::after { opacity: 0.85; transform: scaleX(1); }

.zenl-addr input {
  width: 100%;
  height: 31px;
  padding: 0 36px 0 30px;
  border: 0;
  border-radius: 11px 14px 12px 13px / 13px 11px 14px 12px;
  background: rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12.5px;
  outline: none;
  transition: box-shadow 180ms ease, background 180ms ease;
}

.zenl-addr input::placeholder { color: rgba(255, 255, 255, 0.3); }

.zenl-addr input:focus {
  background: rgba(0, 0, 0, 0.5);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, rgba(255, 255, 255, 0.12));
}

.zenl-go {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 55% 45% 60% 40% / 45% 55% 45% 55%;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.7);
  transform: translateY(-50%);
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.zenl-go:hover { background: var(--accent); color: var(--on-accent); }
.zenl-go:active { transform: translateY(-50%) scale(0.94); }
.zenl-go svg { width: 13px; height: 13px; }

.zenl-sitechip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  max-width: 190px;
  height: 31px;
  padding: 0 10px;
  border-radius: 12px 9px 11px 10px / 10px 12px 9px 11px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.zenl-sitechip:hover {
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  color: #fff;
}

.zenl-chip-ico {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
}

.zenl-chip-fav {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  object-fit: contain;
}

.zenl-chip-dot {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.zenl-chip-host {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zenl-sitechip svg { flex: none; opacity: 0.5; }

/* The painted wordmark carried from the start page into the chrome. */
.zenl-brandrow {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 13px 15px 3px;
}

.zenl-brandrow b {
  color: #fff;
  font-family: 'Ma Shan Zheng', var(--zenl-serif);
  font-size: 27px;
  font-weight: 400;
  line-height: 1;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.18);
  transform: rotate(-1.4deg);
}

.zenl-brandrow span {
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--zenl-serif);
  font-size: 11.5px;
  font-style: italic;
}

.zenl-scroll {
  flex: 1;
  min-height: 0;
  padding: 10px 6px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}

.zenl-scroll::-webkit-scrollbar { width: 8px; }

.zenl-scroll::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  background-clip: padding-box;
}

.zenl-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); background-clip: padding-box; }
.zenl-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  background-clip: content-box;
  border: 2px solid transparent;
  border-radius: 999px;
}

/* Section labels borrow the painted wordmark's hand: italic, slight tilt. */
.zenl-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 7px;
  color: rgba(255, 255, 255, 0.42);
  font-family: var(--zenl-serif);
  font-size: 12.5px;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.zenl-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
}

.zenl-essentials {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

/* Pinned sites as hand-cut ink tiles: uneven corners, paper grain, a wet sheen. */
.zenl-essential {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px 10px 15px 9px / 10px 15px 9px 14px;
  background:
    radial-gradient(110% 100% at 30% 0%, rgba(255, 255, 255, 0.07), transparent 70%),
    rgba(255, 255, 255, 0.022);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.zenl-essential::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 8px;
  left: 12px;
  height: 1px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  opacity: 0;
  transition: opacity 160ms ease;
}

.zenl-essential:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(110% 100% at 30% 0%, rgba(255, 255, 255, 0.13), transparent 72%),
    rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 24px -18px rgba(0, 0, 0, 0.9);
}

.zenl-essential:hover::after { opacity: 1; }

.zenl-essential:active { transform: scale(0.975) rotate(-0.4deg); }

.zenl-essential-ico {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px 6px 7px 6px / 6px 7px 6px 8px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.zenl-essential-fav {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
}

/* Monogram fallback, lettered in the same brush as the wordmark. */
.zenl-essential b {
  color: #fff;
  font-family: 'Ma Shan Zheng', var(--zenl-serif);
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.22);
}

.zenl-essential span {
  max-width: 100%;
  padding: 0 4px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.38);
  font-size: 9px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zenl-essential:hover span { color: rgba(255, 255, 255, 0.68); }

.zenl-ws-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 8px 0;
}

.zenl-ws-head .zenl-label {
  padding: 0;
  color: rgba(255, 255, 255, 0.72);
  font-family: 'Ma Shan Zheng', var(--zenl-serif);
  font-size: 20px;
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.zenl-ws-head .zenl-label::after { display: none; }
.zenl-ws-head em {
  color: rgba(255, 255, 255, 0.25);
  font-size: 10px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.zenl-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.zenl-tabs li { position: relative; }

.zenl-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 28px 7px 12px;
  border-radius: 10px 7px 9px 8px / 8px 10px 7px 9px;
  color: rgba(255, 255, 255, 0.58);
  font-family: var(--zenl-serif);
  font-size: 12.5px;
  text-align: left;
  transition: background 150ms ease, color 150ms ease;
}

.zenl-tab:hover {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012));
  color: #fff;
}

.zenl-tab[aria-current="page"] {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.02) 88%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  color: #fff;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

/* A tapered ink stroke instead of a plain rectangle. */
.zenl-tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 3px;
  height: 17px;
  border-radius: 70% 40% 60% 45% / 45% 55% 45% 55%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 35%, #fff), var(--accent));
  transform: translateY(-50%);
}

.zenl-tab-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 14px;
  height: 14px;
}

.zenl-tab-fav {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  object-fit: contain;
}

.zenl-tab-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.65);
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.zenl-tab-mark--page {
  background: transparent;
  color: var(--accent);
}

.zenl-tab-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zenl-tab-close {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 150ms ease, background 150ms ease, color 150ms ease;
}

.zenl-tabs li:hover .zenl-tab-close,
.zenl-tabs li:focus-within .zenl-tab-close,
.zenl-tab[aria-current="page"] ~ .zenl-tab-close { opacity: 0.6; }

.zenl-tab-close:hover { background: rgba(255, 255, 255, 0.15); color: #fff; opacity: 1; }

.zenl-sengine-sec { padding: 12px 8px 2px; }

.zenl-sengine-sec .zenl-label { padding: 0; }

.zenl-sengines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.zenl-sengine {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 10px 7px 11px 8px / 8px 11px 7px 10px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11.5px;
  line-height: 1.2;
  text-align: left;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.zenl-sengine-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
}

.zenl-sengine-fav {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.zenl-sengine-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}

.zenl-sengine-fav:not([hidden]) + .zenl-sengine-dot { display: none; }

.zenl-sengine-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.zenl-sengine-check {
  display: flex;
  margin-left: auto;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.zenl-sengine:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.zenl-sengine:active { background: rgba(255, 255, 255, 0.09); }

.zenl-sengine.is-on {
  border-color: color-mix(in srgb, var(--accent) 38%, rgba(255, 255, 255, 0.06));
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--accent) 15%, transparent),
    rgba(255, 255, 255, 0.015) 78%
  );
  color: #fff;
}

.zenl-sengine.is-on .zenl-sengine-check { opacity: 1; transform: none; }

/* ------------------------------------------------------- Abyss pages (rows) */
.zenl-pages {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zenl-page {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}

.zenl-page > svg {
  margin-left: auto;
  opacity: 0.35;
  transition: opacity 140ms ease, transform 140ms ease;
}

.zenl-page:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.zenl-page:hover > svg { opacity: 0.7; transform: translateX(1px); }

.zenl-page:active { background: rgba(255, 255, 255, 0.09); }

.zenl-page-ico {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent);
}

.zenl-page-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.zenl-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.zenl-ws {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.45);
  transition: background 150ms ease, color 150ms ease;
}

.zenl-ws:hover { background: rgba(255, 255, 255, 0.07); color: rgba(255, 255, 255, 0.8); }
.zenl-ws svg { width: 14px; height: 14px; }

.zenl-ws[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: #fff;
}

.zenl-ws[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  transform: translateX(-50%);
}

.zenl-footer .zenl-gear { margin-left: auto; }

/* --------------------------------------------------------------- viewport */
.zenl-viewport {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0c0c0e;
  box-shadow: inset 0 14px 20px -18px rgba(0, 0, 0, 0.95);
}

.zenl-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* Abyss's own pages (Movies, Music, Games) hosted inside the viewport. */
.zenl-siteview {
  position: absolute;
  inset: 0;
  overflow: auto;
  background: #0b0b0f;
  overscroll-behavior: contain;
}

.zenl-siteview > .view {
  display: block;
  min-height: 100%;
}

.zenl-start {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 24px;
  background: #000;
}

.zenl-start-inner { width: min(520px, 100%); text-align: center; }

.zenl-eyebrow {
  margin-bottom: 6px;
  color: color-mix(in srgb, var(--accent) 70%, #fff);
  font-family: var(--zenl-serif);
  font-size: 13px;
  font-style: italic;
  letter-spacing: 0.02em;
}

.zenl-eyebrow::before,
.zenl-eyebrow::after {
  content: "";
  display: inline-block;
  width: 22px;
  height: 1px;
  margin: 0 10px 4px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35));
  vertical-align: middle;
}

.zenl-eyebrow::after { transform: scaleX(-1); }

/* Painted mark (渊) that flips over into the Latin wordmark. */
.zenl-brand {
  position: relative;
  display: grid;
  place-items: center;
  height: 178px;
  margin: 6px 0 24px;
  perspective: 1000px;
}

.zenl-brand-wash {
  position: absolute;
  width: 340px;
  height: 178px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.18), transparent 76%);
  filter: blur(12px);
  opacity: 0;
  transform: scale(0.7);
  pointer-events: none;
}

.zenl-brand-3d {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
}

.zenl-brand-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: 'Ma Shan Zheng', KaiTi, STKaiti, 'Kaiti SC', SimSun, serif;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* A soft offset copy under the stroke reads as wet ink bleeding into the page. */
.zenl-brand-face::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  filter: blur(8px);
  opacity: 0.45;
  pointer-events: none;
}

.zenl-brand-seal { font-size: 138px; line-height: 0.9; }
.zenl-brand-word {
  font-size: 94px;
  line-height: 1;
  letter-spacing: 0.02em;
  transform: rotateY(180deg);
}

/* A wet brush edge travels across each face, so the mark is written rather
   than popped in: the mask is soft-edged and oversized for that sweep. */
.zenl-brand-seal,
.zenl-brand-word {
  -webkit-mask-image: linear-gradient(93deg, #000 0 64%, transparent 71%);
  mask-image: linear-gradient(93deg, #000 0 64%, transparent 71%);
  -webkit-mask-size: 200% 100%;
  mask-size: 200% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 104% 0;
  mask-position: 104% 0;
}

#zenl-brand.is-playing .zenl-brand-wash { animation: zenl-wash 1.7s ease-out both; }
#zenl-brand.is-playing .zenl-brand-seal {
  animation:
    zenl-write 1.05s cubic-bezier(0.4, 0.05, 0.3, 1) both,
    zenl-ink 1.05s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
#zenl-brand.is-playing .zenl-brand-3d { animation: zenl-flip 1.05s cubic-bezier(0.62, 0.02, 0.3, 1) 1.35s both; }
#zenl-brand.is-playing .zenl-brand-word {
  animation:
    zenl-write 1s cubic-bezier(0.4, 0.05, 0.3, 1) 2.2s both,
    zenl-word-ink 0.8s ease-out 2.15s both;
}

@keyframes zenl-wash {
  0% { opacity: 0; transform: scale(0.7); }
  40% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.18); }
}

/* Ink spreads across the black page: blurred, oversized, then sharpens. */
@keyframes zenl-ink {
  0% { opacity: 0.6; filter: blur(6px); transform: scale(1.08) rotate(-2deg); }
  45% { opacity: 1; filter: blur(2px); }
  100% { opacity: 1; filter: blur(0); transform: scale(1) rotate(0deg); }
}

/* The mark turns over like a painted card to land on the Latin name. */
@keyframes zenl-flip {
  0% { transform: rotateY(0deg); }
  22% { transform: rotateY(0deg) scale(1.03); }
  100% { transform: rotateY(180deg) scale(1); }
}

@keyframes zenl-word-ink {
  0% { opacity: 0.35; }
  100% { opacity: 1; }
}

/* Brush sweep: the leading edge of the mask crosses the whole glyph. */
@keyframes zenl-write {
  0% { -webkit-mask-position: 104% 0; mask-position: 104% 0; }
  100% { -webkit-mask-position: 50% 0; mask-position: 50% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .zenl-brand-3d { transform: rotateY(180deg); }
  .zenl-brand-seal,
  .zenl-brand-wash { display: none; }
  #zenl-brand.is-playing .zenl-brand-3d,
  #zenl-brand.is-playing .zenl-brand-word { animation: none; }
  .zenl-brand-word {
    letter-spacing: 0.02em;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

.zenl-start-form {
  position: relative;
  display: flex;
  align-items: center;
}

/* A loaded brush resting under the field, drawn in on focus. */
.zenl-start-form::after {
  content: "";
  position: absolute;
  right: 8%;
  bottom: -7px;
  left: 8%;
  height: 2px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 70%, #fff), transparent);
  opacity: 0;
  transform: scaleX(0.5);
  transition: opacity 240ms ease, transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.zenl-start-form:focus-within::after { opacity: 0.9; transform: scaleX(1); }

.zenl-start-form input {
  width: 100%;
  height: 50px;
  padding: 0 58px 0 18px;
  border: 0;
  border-radius: 16px 12px 15px 13px / 13px 16px 12px 15px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.075);
  color: #fff;
  font-size: 14.5px;
  outline: none;
  transition: background 200ms ease, box-shadow 200ms ease;
}

.zenl-start-form input::placeholder { color: rgba(255, 255, 255, 0.32); }

.zenl-start-form input:focus {
  background: rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 0 1px 3px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, rgba(255, 255, 255, 0.1));
}

.zenl-start-form button {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 60% 40% 55% 45% / 45% 55% 45% 55%;
  background: var(--accent);
  color: var(--on-accent);
  transform: translateY(-50%);
  transition: transform 160ms ease, filter 160ms ease;
}

.zenl-start-form button:hover { filter: brightness(1.08); }
.zenl-start-form button:active { transform: translateY(-50%) scale(0.94); }

.zenl-start-form button svg { width: 16px; height: 16px; }

.zenl-start-hint {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
}

.zenl-reveal {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 150ms ease, color 150ms ease;
}

.zenl-reveal:hover { background: rgba(0, 0, 0, 0.7); color: #fff; }
.zenl-reveal svg { width: 15px; height: 15px; }

.zenl-toast {
  position: absolute;
  bottom: 16px;
  left: 50%;
  z-index: 20;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  white-space: nowrap;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ------------------------------------------------------------------ modal */
.zenl-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.zenl-modal-card {
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  background: rgba(28, 28, 32, 0.98);
  border: 1px solid var(--zenl-line);
  border-radius: 12px;
  box-shadow: 0 28px 70px -18px rgba(0, 0, 0, 0.8);
}

.zenl-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.zenl-modal-head h2 { font-size: 13px; font-weight: 500; }

.zenl-modal-body { display: grid; gap: 16px; padding: 16px; }

.zenl-modal-body h3 {
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.zenl-themes { display: flex; flex-wrap: wrap; gap: 6px; }

.zenl-theme {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  transition: border-color 150ms ease, color 150ms ease;
}

.zenl-theme:hover { border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.zenl-theme.is-on { border-color: var(--accent); color: #fff; }

.zenl-theme i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

.zenl-engine {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
}

.zenl-engine-btn {
  flex: none;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(255, 113, 57, 0.18);
  color: #ffb08a;
  font-size: 11px;
  transition: background 150ms ease, color 150ms ease;
}

.zenl-engine-btn:hover { background: rgba(255, 113, 57, 0.28); color: #fff; }

.zenl-engine + .zenl-modal-note { margin-top: 8px; }

.zenl-shortcuts { display: grid; gap: 6px; }

.zenl-shortcuts div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}

.zenl-shortcuts kbd {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
  font: 500 10px/1.4 var(--font);
}

.zenl-modal-note {
  color: rgba(255, 255, 255, 0.35);
  font-size: 11px;
  line-height: 1.5;
}

.zenl-exit {
  width: 100%;
  padding: 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  transition: background 150ms ease, color 150ms ease;
}

.zenl-exit:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

@media (max-width: 600px) {
  .zenl-col { width: 0; margin-right: -8px; }
  .zenl.is-revealed .zenl-col {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 8px;
    z-index: 40;
    width: min(250px, calc(100vw - 16px));
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zenl-col { transition: none; }
  .zenl.is-collapsed.is-revealed .zenl-col { animation: none; }
}
