:root {
  color-scheme: light;
  --ink: #183630;
  --ink-soft: #58706a;
  --green: #173f36;
  --green-2: #245d50;
  --green-pale: #e6eee9;
  --paper: #f6f4ed;
  --paper-deep: #eeeae0;
  --white: #fffefa;
  --line: #dedbd1;
  --line-soft: #ebe8df;
  --amber: #d79a3d;
  --amber-pale: #f5e6c8;
  --danger: #a33f3f;
  --shadow: 0 20px 50px rgba(28, 47, 41, 0.09);
  --font-sans: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --font-serif: "Source Han Serif SC", "Songti SC", STSong, SimSun, serif;
}

* { box-sizing: border-box; }

html { height: 100%; background: var(--paper); }

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 87% 9%, rgba(215, 154, 61, 0.08), transparent 27rem),
    var(--paper);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] { display: none !important; }

.app-shell { min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: 272px minmax(240px, 640px) 1fr;
  align-items: center;
  gap: 24px;
  height: 78px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(24, 54, 48, 0.1);
  background: rgba(246, 244, 237, 0.91);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: max-content;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #f8f3e5;
  background: var(--green);
  box-shadow: 0 8px 18px rgba(23, 63, 54, 0.2);
}

.brand-mark svg { width: 29px; height: 29px; stroke-width: 2; }
.brand span:last-child { display: grid; line-height: 1; }
.brand strong { font: 700 21px var(--font-serif); letter-spacing: 0.08em; }
.brand small { margin-top: 6px; color: var(--ink-soft); font-size: 10px; letter-spacing: 0.2em; }

.global-search {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 46px;
  padding: 0 12px 0 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink-soft);
  background: rgba(255, 254, 250, 0.9);
  transition: border-color 160ms, box-shadow 160ms, background 160ms;
}

.global-search:focus-within {
  border-color: rgba(36, 93, 80, 0.55);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(36, 93, 80, 0.08);
}

.global-search svg { flex: none; width: 19px; height: 19px; }
.search-scope {
  flex: none;
  margin-left: 8px;
  padding: 3px 7px;
  border: 0;
  border-radius: 6px;
  color: var(--green-2);
  background: var(--green-pale);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.search-scope.is-local { color: #8a621f; background: var(--amber-pale); }
.global-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 11px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}
.global-search input::placeholder { color: #899891; }
.global-search kbd {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #83918c;
  background: var(--paper);
  font: 500 11px var(--font-sans);
  white-space: nowrap;
}

.search-clear {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--paper-deep);
  font-size: 18px;
  cursor: pointer;
}

.top-actions { display: flex; justify-content: flex-end; gap: 10px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 140ms, box-shadow 140ms, background 140ms;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { color: #fff; background: var(--green); box-shadow: 0 9px 22px rgba(23, 63, 54, 0.17); }
.button-primary:hover { background: var(--green-2); box-shadow: 0 11px 25px rgba(23, 63, 54, 0.22); }
.button-ghost { border-color: var(--line); background: transparent; }
.button-soft { border-color: var(--line); background: var(--white); }
.button-large { min-height: 52px; padding: 0 23px; border-radius: 14px; }
.button-small { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 13px; }

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink-soft);
  background: var(--white);
  font-size: 23px;
  cursor: pointer;
}

.main-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 78px); min-height: calc(100dvh - 78px); }

.sidebar {
  position: sticky;
  top: 78px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 78px);
  height: calc(100dvh - 78px);
  padding: 30px 20px 20px;
  border-right: 1px solid rgba(24, 54, 48, 0.09);
  background: rgba(239, 236, 227, 0.63);
}

.sidebar-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 0 10px 22px; }
.eyebrow { color: #81908a; font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.sidebar-header h2, .pane-heading h1, .modal-heading h2 { margin: 5px 0 0; font: 700 20px var(--font-serif); }

.library-nav { display: grid; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: 11px;
  color: #567069;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.58); }
.nav-item.is-active { color: var(--ink); background: var(--white); box-shadow: 0 5px 18px rgba(34, 55, 49, 0.06); }
.nav-icon { display: grid; width: 24px; height: 24px; place-items: center; }
.nav-icon svg { width: 18px; height: 18px; }
.nav-count { min-width: 22px; margin-left: auto; padding: 1px 6px; border-radius: 999px; background: rgba(23, 63, 54, 0.07); font-size: 11px; text-align: center; }

.folder-section { min-height: 0; margin-top: 28px; overflow: auto; scrollbar-width: thin; }
.section-label { display: flex; align-items: center; justify-content: space-between; padding: 0 9px 8px; color: #81908a; font-size: 11px; font-weight: 700; letter-spacing: 0.16em; }
.section-actions { display: inline-flex; align-items: center; gap: 2px; }
.section-label button { width: auto; min-width: 26px; height: 26px; padding: 0 5px; border: 0; border-radius: 8px; color: var(--ink-soft); background: transparent; font-size: 17px; cursor: pointer; }
.section-label button:hover { background: var(--white); }
.sidebar-empty { margin: 20px 10px; color: #87958f; font-size: 12px; line-height: 1.8; }

.folder-tree details { margin: 2px 0; }
.folder-tree summary, .tree-file {
  display: flex;
  align-items: center;
  min-height: 34px;
  gap: 7px;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  list-style: none;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.folder-tree summary::-webkit-details-marker { display: none; }
.folder-tree summary::before { content: "›"; width: 12px; color: #91a099; font-size: 17px; transition: transform 140ms; }
.folder-tree details[open] > summary::before { transform: rotate(90deg); }
.folder-tree summary::after { content: attr(data-count); margin-left: auto; color: #98a49f; font-size: 10px; }
.folder-tree summary:hover, .tree-file:hover, .tree-file.is-active { color: var(--ink); background: rgba(255, 254, 250, 0.8); }
.tree-file { width: calc(100% - 19px); margin-left: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-file::before { content: ""; width: 7px; height: 9px; flex: none; border: 1px solid #8da098; border-radius: 1px; }
.tree-children { padding-left: 11px; border-left: 1px solid rgba(24, 54, 48, 0.1); margin-left: 13px; }

.sidebar-footer { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(24, 54, 48, 0.09); }
.storage-row { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: var(--ink-soft); font-size: 10px; }
.storage-row span { display: flex; align-items: center; gap: 6px; }
.storage-row i, .welcome-kicker i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #4c9876; box-shadow: 0 0 0 3px rgba(76, 152, 118, 0.13); }
.text-button { padding: 4px; border: 0; color: var(--green-2); background: transparent; font-size: 10px; font-weight: 600; cursor: pointer; }
.sidebar-footer p { margin: 8px 0 0; color: #899791; font-size: 10px; }
.sidebar-install { width: 100%; margin-top: 11px; padding: 8px; border: 1px solid rgba(36, 93, 80, 0.18); border-radius: 9px; color: var(--green-2); background: rgba(230, 238, 233, 0.65); font-size: 10px; font-weight: 600; cursor: pointer; }

.workspace { min-width: 0; }
.welcome { display: grid; grid-template-columns: minmax(380px, 0.9fr) minmax(410px, 1.1fr); align-content: center; gap: 55px 6%; max-width: 1240px; min-height: calc(100vh - 78px); min-height: calc(100dvh - 78px); margin: auto; padding: 70px 6% 40px; overflow: hidden; }
.welcome-copy { align-self: center; }
.welcome-kicker { display: inline-flex; align-items: center; gap: 9px; padding: 7px 11px; border: 1px solid rgba(36, 93, 80, 0.13); border-radius: 99px; color: var(--green-2); background: rgba(230, 238, 233, 0.62); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; }
.welcome-copy h1 { margin: 25px 0 20px; color: #193931; font: 700 clamp(41px, 4.5vw, 66px)/1.23 var(--font-serif); letter-spacing: 0.015em; }
.welcome-copy h1 em { color: var(--green-2); font-style: normal; background: linear-gradient(transparent 72%, rgba(215, 154, 61, 0.25) 0); }
.welcome-copy > p { max-width: 570px; margin: 0; color: #60736e; font-size: 15px; line-height: 2; }
.welcome-actions { display: flex; gap: 12px; margin-top: 32px; }
.privacy-note { display: flex; align-items: center; gap: 7px; margin-top: 19px !important; color: #81908b !important; font-size: 11px !important; }
.privacy-note svg { width: 14px; height: 14px; }

.welcome-visual { position: relative; align-self: center; min-height: 450px; }
.paper-stack, .paper-card { position: absolute; inset: 42px 7% 36px 12%; border: 1px solid rgba(24, 54, 48, 0.1); border-radius: 5px 18px 18px 5px; background: #fffefa; box-shadow: var(--shadow); }
.paper-back { transform: rotate(7deg) translate(15px, -3px); background: #e8e1d2; }
.paper-mid { transform: rotate(2.5deg) translate(7px, -1px); background: #f4efe2; }
.paper-card { z-index: 2; padding: 54px 49px; background: linear-gradient(90deg, rgba(215, 154, 61, 0.09) 1px, transparent 1px) 33px 0 / 100% 100%, #fffefa; transform: rotate(-2.5deg); }
.paper-card::before { position: absolute; inset: 0 auto 0 31px; width: 1px; background: rgba(192, 94, 77, 0.13); content: ""; }
.paper-top { display: flex; align-items: center; justify-content: space-between; padding-bottom: 20px; border-bottom: 1px solid var(--line-soft); color: #83918d; font-size: 10px; letter-spacing: 0.09em; }
.paper-top i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.paper-card p { margin: 29px 0 0; color: #315047; font: 500 16px/2.1 var(--font-serif); }
.paper-card p + p { margin-top: 6px; }
.paper-highlight { display: inline-block; margin-top: 24px; padding: 5px 10px; color: #70531d; background: var(--amber-pale); font: 600 13px var(--font-serif); }
.paper-lines { display: grid; gap: 12px; margin-top: 28px; }
.paper-lines i { height: 1px; background: #ece9df; }
.paper-lines i:nth-child(2) { width: 82%; }
.paper-lines i:nth-child(3) { width: 52%; }
.floating-search { position: absolute; z-index: 5; right: 0; bottom: 52px; display: flex; align-items: center; gap: 10px; min-width: 215px; padding: 14px 16px; border: 1px solid rgba(24, 54, 48, 0.1); border-radius: 14px; background: rgba(255, 254, 250, 0.96); box-shadow: 0 17px 40px rgba(23, 63, 54, 0.17); font-size: 12px; }
.floating-search svg { width: 17px; color: var(--green-2); }
.floating-search span { font-weight: 600; }
.floating-search b { margin-left: auto; color: var(--amber); font-size: 10px; }
.feature-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 20px; border-top: 1px solid rgba(24, 54, 48, 0.11); }
.feature-strip > div { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; padding: 5px 10px; }
.feature-number { grid-row: 1 / 3; color: var(--amber); font: 600 13px var(--font-serif); }
.feature-strip strong { font: 600 13px var(--font-serif); }
.feature-strip small { margin-top: 3px; color: #83918c; font-size: 10px; }

.content-view { display: grid; grid-template-columns: minmax(340px, 42%) minmax(420px, 58%); height: calc(100vh - 78px); height: calc(100dvh - 78px); }
.results-pane { min-width: 0; padding: 34px 30px 0; border-right: 1px solid rgba(24, 54, 48, 0.09); overflow: hidden; }
.pane-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.pane-heading h1 { font-size: 25px; }
.sort-button { display: flex; align-items: center; gap: 6px; padding: 7px 9px; border: 0; border-radius: 9px; color: var(--ink-soft); background: transparent; font-size: 11px; cursor: pointer; }
.sort-button:hover { background: var(--paper-deep); }
.sort-button svg { width: 15px; }
.result-summary { min-height: 38px; padding: 10px 0 8px; color: #84938d; font-size: 11px; }
.result-summary strong { color: var(--amber); }
.result-list { height: calc(100% - 94px); padding: 3px 2px 45px 0; overflow: auto; scrollbar-width: thin; }
.result-card { display: block; width: 100%; margin-bottom: 8px; padding: 16px 17px; border: 1px solid transparent; border-radius: 13px; background: transparent; text-align: left; cursor: pointer; transition: border 140ms, background 140ms, box-shadow 140ms; }
.result-card:hover { background: rgba(255, 254, 250, 0.75); }
.result-card.is-active { border-color: rgba(36, 93, 80, 0.16); background: var(--white); box-shadow: 0 8px 24px rgba(28, 47, 41, 0.07); }
.result-card-head { display: flex; align-items: center; gap: 9px; }
.result-file-icon { display: grid; width: 29px; height: 31px; flex: none; place-items: center; border: 1px solid rgba(36, 93, 80, 0.16); border-radius: 5px 9px 5px 5px; color: var(--green-2); background: var(--green-pale); font-size: 8px; font-weight: 700; }
.result-card-title { min-width: 0; overflow: hidden; color: var(--ink); font: 600 14px var(--font-serif); text-overflow: ellipsis; white-space: nowrap; }
.result-match-count { margin-left: auto; color: #9a6a22; font-size: 9px; white-space: nowrap; }
.result-path { display: block; margin: 7px 0 0 38px; overflow: hidden; color: #91a09a; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.result-snippet { display: -webkit-box; margin: 10px 0 0 38px; overflow: hidden; color: #647873; font: 400 12px/1.75 var(--font-serif); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
mark { padding: 1px 2px; border-radius: 2px; color: #5b4319; background: #f5dcaa; }
.no-results { display: grid; place-items: center; padding: 70px 20px; color: #82918b; text-align: center; }
.no-results > span { color: rgba(215, 154, 61, 0.5); font: 700 80px/0.5 var(--font-serif); }
.no-results h3 { margin: 24px 0 8px; color: var(--ink); font: 600 18px var(--font-serif); }
.no-results p { max-width: 280px; margin: 0; font-size: 11px; line-height: 1.8; }

.reader { position: relative; min-width: 0; overflow: auto; background: rgba(255, 254, 250, 0.72); scrollbar-width: thin; }
.reader-empty { display: grid; min-height: 100%; place-content: center; justify-items: center; padding: 30px; color: #82918c; text-align: center; }
.empty-book { display: grid; width: 82px; height: 82px; place-items: center; border-radius: 50%; color: #6d817a; background: var(--green-pale); }
.empty-book svg { width: 46px; height: 46px; }
.reader-empty h2 { margin: 22px 0 7px; color: var(--ink); font: 600 19px var(--font-serif); }
.reader-empty p { margin: 0; font-size: 11px; }
.reader-content { min-height: 100%; }
.reader-header { position: sticky; z-index: 4; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 20px; padding: 12px 35px; border-bottom: 1px solid rgba(24, 54, 48, 0.08); background: rgba(255, 254, 250, 0.91); backdrop-filter: blur(14px); }
.reader-path { min-width: 0; overflow: hidden; color: #84948e; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.reader-actions { display: flex; align-items: center; gap: 8px; }
.reader-actions .icon-button { width: 36px; height: 36px; border-color: var(--line-soft); }
.reader-actions .icon-button.is-active { color: #c2872d; background: #fff8e9; }
.reader-actions .icon-button.is-active svg { fill: currentColor; }
.document-head { max-width: 760px; margin: 0 auto; padding: 54px 60px 26px; text-align: center; }
.file-badge { display: inline-block; padding: 3px 6px; border-radius: 4px; color: var(--green-2); background: var(--green-pale); font-size: 8px; font-weight: 700; letter-spacing: 0.1em; }
.document-head h2 { margin: 16px 0 10px; color: #183831; font: 700 clamp(26px, 3vw, 35px)/1.35 var(--font-serif); }
.document-head p { margin: 0; color: #8c9995; font-size: 10px; }
.match-nav { position: sticky; z-index: 3; top: 68px; display: flex; align-items: center; justify-content: space-between; max-width: 690px; height: 39px; margin: 0 auto; padding: 0 9px 0 14px; border: 1px solid #e8d7b8; border-radius: 9px; color: #785a25; background: #fff9eb; font-size: 10px; box-shadow: 0 6px 18px rgba(72, 54, 22, 0.06); }
.match-nav button { width: 27px; height: 26px; margin-left: 3px; border: 0; border-radius: 6px; color: #785a25; background: transparent; cursor: pointer; }
.match-nav button:hover { background: var(--amber-pale); }
.document-body { max-width: 780px; margin: 0 auto; padding: 22px 60px 90px; color: #314d46; font: 500 15px/2.15 var(--font-serif); white-space: pre-wrap; overflow-wrap: anywhere; }
.document-body.is-empty { color: #83918c; font-family: var(--font-sans); font-size: 12px; text-align: center; }
.document-body mark.is-current { outline: 2px solid rgba(205, 139, 40, 0.4); background: #efc571; }
.media-preview { max-width: 780px; margin: 12px auto 6px; padding: 0 40px; }
.media-preview img { display: block; max-width: 100%; max-height: 520px; margin: auto; border-radius: 12px; object-fit: contain; box-shadow: 0 15px 40px rgba(28, 47, 41, 0.12); }
.media-preview audio { display: block; width: min(100%, 590px); margin: 30px auto; }
.media-preview iframe { display: block; width: 100%; height: min(60vh, 640px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.media-placeholder { display: grid; place-items: center; min-height: 160px; padding: 30px; border: 1px dashed #cad3cf; border-radius: 13px; color: #7d8d87; background: var(--paper); font-size: 12px; text-align: center; line-height: 1.9; }
.media-placeholder svg { width: 38px; height: 38px; margin-bottom: 12px; color: var(--green-2); }
.reader-tool-row { max-width: 700px; margin: 10px auto 0; padding: 0 30px; text-align: center; }
.preview-warning { max-width: 660px; margin: -55px auto 90px; padding: 12px 15px; border-radius: 8px; color: #876126; background: #fff4dc; font-size: 10px; text-align: center; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(16, 35, 31, 0.48); backdrop-filter: blur(6px); }
.modal { width: min(510px, 100%); max-height: min(720px, calc(100vh - 40px)); padding: 30px; overflow: auto; border: 1px solid rgba(255, 255, 255, 0.55); border-radius: 20px; background: var(--white); box-shadow: 0 30px 80px rgba(12, 35, 29, 0.3); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.modal-heading h2 { font-size: 24px; }
.progress-modal { width: min(420px, 100%); text-align: center; }
.progress-icon { position: relative; display: grid; width: 74px; height: 74px; margin: 0 auto 20px; place-items: center; border-radius: 22px; color: #fff; background: var(--green); }
.progress-icon span { position: absolute; inset: -7px; border: 2px solid rgba(36, 93, 80, 0.12); border-top-color: var(--amber); border-radius: 28px; animation: spin 1s linear infinite; }
.progress-icon svg { width: 44px; height: 44px; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-modal h2 { margin: 8px 0; font: 700 22px var(--font-serif); }
.progress-modal p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.progress-track { height: 7px; margin: 24px 0 9px; overflow: hidden; border-radius: 999px; background: var(--paper-deep); }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-2), #68a58d); transition: width 180ms; }
.progress-modal > strong { color: var(--green-2); font-size: 11px; }
.data-modal > p { margin: 20px 0; color: var(--ink-soft); font-size: 12px; line-height: 1.8; }
.data-actions { display: grid; gap: 9px; }
.data-action { display: flex; align-items: center; width: 100%; gap: 14px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: transparent; text-align: left; cursor: pointer; }
.data-action:hover { border-color: #cfd9d4; background: var(--paper); }
.data-action > span { display: grid; width: 38px; height: 38px; flex: none; place-items: center; border-radius: 10px; color: var(--green-2); background: var(--green-pale); }
.data-action > span svg { width: 18px; }
.data-action div { display: grid; gap: 3px; }
.data-action strong { font-size: 12px; }
.data-action small { color: #8a9893; font-size: 9px; line-height: 1.5; }
.data-action.danger > span { color: var(--danger); background: #f8e8e5; }
.data-action.danger strong { color: var(--danger); }
.install-modal #installInstructions { margin-top: 22px; color: var(--ink-soft); font-size: 13px; line-height: 1.9; }
.install-browser-card { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--paper); }
.install-browser-card > div { display: grid; gap: 1px; }
.install-browser-card small { color: #8a9893; font-size: 9px; }
.install-browser-card strong { color: var(--ink); font-size: 13px; }
.install-browser-mark { display: grid; width: 36px; height: 36px; flex: none; place-items: center; border-radius: 11px; color: #fff; background: var(--green); font-size: 13px; font-weight: 700; }
.install-lead { margin: 15px 0 5px; }
.install-step { display: flex; align-items: flex-start; gap: 12px; margin: 12px 0; }
.install-step b { display: grid; width: 25px; height: 25px; flex: none; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font-size: 10px; }
.install-note, .install-storage-warning { margin: 13px 0 0; padding: 10px 12px; border-radius: 10px; color: #6f5b2b; background: #f8f1dc; font-size: 10px; line-height: 1.65; }
.install-storage-warning { color: #5e6d68; background: var(--green-pale); }
.install-apk-button { display: flex; width: 100%; margin: 14px 0 7px; text-decoration: none; }
.install-apk-note { margin: 0 0 16px; color: var(--ink-soft); font-size: 10px; line-height: 1.65; }
.install-alternatives { margin-top: 14px; border-top: 1px solid var(--line-soft); }
.install-alternatives summary { padding: 12px 0 5px; color: var(--green-2); cursor: pointer; font-size: 11px; font-weight: 700; }
.install-alternatives > div { display: grid; gap: 1px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.install-alternatives strong { color: var(--ink); font-size: 10px; }
.install-alternatives span { color: #71807b; font-size: 10px; line-height: 1.6; }
.field-label { display: block; margin: 23px 0 7px; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.field-input { width: 100%; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--ink); background: #fff; }
.field-input:focus { border-color: rgba(36, 93, 80, 0.55); box-shadow: 0 0 0 4px rgba(36, 93, 80, 0.08); }
.modal-submit { width: 100%; margin-top: 11px; }
.modal-divider { display: flex; align-items: center; gap: 12px; margin: 25px 0 0; color: #94a09c; font-size: 9px; }
.modal-divider::before, .modal-divider::after { height: 1px; flex: 1; background: var(--line-soft); content: ""; }

.toast-region { position: fixed; z-index: 150; right: 22px; bottom: 22px; display: grid; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; max-width: min(360px, calc(100vw - 44px)); gap: 10px; padding: 12px 15px; border: 1px solid rgba(255, 255, 255, 0.13); border-radius: 12px; color: #fff; background: #24483f; box-shadow: 0 13px 35px rgba(18, 47, 39, 0.25); font-size: 11px; animation: toast-in 180ms ease-out; }
.toast::before { content: "✓"; display: grid; width: 20px; height: 20px; flex: none; place-items: center; border-radius: 50%; color: var(--green); background: #dcece3; font-size: 10px; font-weight: 700; }
.toast.is-error { background: #793c3a; }
.toast.is-error::before { content: "!"; color: #793c3a; background: #f7dcda; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.mobile-only { display: none; }

@media (max-width: 1050px) {
  .topbar { grid-template-columns: 230px minmax(250px, 1fr) auto; }
  .main-layout { grid-template-columns: 245px minmax(0, 1fr); }
  .welcome { grid-template-columns: 1fr; max-width: 760px; padding-top: 55px; }
  .welcome-visual { min-height: 410px; }
  .feature-strip { margin-top: 0; }
  .content-view { grid-template-columns: minmax(300px, 43%) minmax(360px, 57%); }
  .results-pane { padding-inline: 20px; }
  .reader-header { padding-inline: 24px; }
  .document-head, .document-body { padding-inline: 38px; }
  .match-nav { margin-inline: 25px; }
}

@media (max-width: 760px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-grid; }
  .topbar { grid-template-columns: 40px 44px minmax(0, 1fr) auto; gap: 8px; height: auto; min-height: 67px; padding: max(9px, env(safe-area-inset-top)) 12px 9px; }
  .brand { width: 42px; }
  .brand > span:last-child { display: none; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
  .global-search { height: 42px; }
  .search-scope { margin-left: 5px; padding-inline: 5px; font-size: 9px; }
  .top-actions .button { width: 42px; min-height: 42px; padding: 0; }
  .top-actions .button svg { margin: 0; }
  .main-layout { display: block; min-height: calc(100dvh - 67px); }
  .sidebar { position: fixed; z-index: 60; top: 0; left: 0; width: min(84vw, 330px); height: 100dvh; padding-top: max(25px, env(safe-area-inset-top)); transform: translateX(-105%); background: #f1eee5; box-shadow: 20px 0 60px rgba(20, 43, 37, 0.2); transition: transform 220ms ease; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; z-index: 55; inset: 0; background: rgba(15, 33, 29, 0.42); }
  .welcome { grid-template-columns: 1fr; min-height: calc(100dvh - 67px); padding: 42px 22px 35px; text-align: center; }
  .welcome-kicker { margin: auto; }
  .welcome-copy h1 { margin-top: 22px; font-size: clamp(37px, 12vw, 53px); }
  .welcome-copy > p { margin-inline: auto; font-size: 13px; line-height: 1.9; }
  .welcome-actions { justify-content: center; }
  .privacy-note { justify-content: center; }
  .welcome-visual { min-height: 335px; margin-top: 5px; }
  .paper-stack, .paper-card { inset: 26px 7% 28px 9%; }
  .paper-card { padding: 38px 30px; text-align: left; }
  .paper-card p { font-size: 12px; }
  .floating-search { bottom: 31px; min-width: 185px; padding: 11px 13px; }
  .feature-strip { gap: 2px; padding-top: 18px; }
  .feature-strip > div { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; }
  .feature-number { display: none; }
  .feature-strip strong { font-size: 11px; }
  .feature-strip small { font-size: 8px; }
  .content-view { display: block; height: calc(100dvh - 67px); }
  .results-pane { height: 100%; padding: 26px 16px 0; border: 0; }
  .pane-heading { padding-inline: 5px; }
  .pane-heading h1 { font-size: 23px; }
  .result-list { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
  .result-card { padding: 15px 13px; }
  .reader { position: fixed; z-index: 50; inset: 0; display: none; background: var(--white); }
  .reader.is-open { display: block; }
  .reader-header { min-height: 64px; padding: max(10px, env(safe-area-inset-top)) 12px 9px; }
  .reader-path { display: none; }
  .reader-actions { width: 100%; }
  .reader-actions .mobile-only { margin-left: auto; }
  .document-head { padding: 41px 25px 22px; }
  .document-head h2 { font-size: 27px; }
  .match-nav { top: 64px; margin-inline: 15px; }
  .document-body { padding: 18px 26px calc(70px + env(safe-area-inset-bottom)); font-size: 14px; line-height: 2.05; }
  .media-preview { padding: 0 16px; }
  .media-preview iframe { height: 55vh; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: 88dvh; padding: 25px 20px calc(25px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
  .progress-modal { margin: auto; width: calc(100% - 34px); border-radius: 20px; }
  .toast-region { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .topbar { grid-template-columns: 38px 38px minmax(0, 1fr) 40px; padding-inline: 8px; gap: 5px; }
  .topbar > .icon-button, .brand-mark { width: 38px; height: 38px; }
  .global-search { padding-inline: 10px 5px; }
  .global-search input { padding-inline: 7px; font-size: 12px; }
  .welcome-actions { display: grid; }
  .button-large { width: 100%; }
  .welcome-visual { min-height: 315px; }
  .paper-card { padding: 34px 24px; }
  .feature-strip small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (display-mode: standalone) {
  .topbar { padding-top: max(9px, env(safe-area-inset-top)); }
}
