.package-scene { background: #161e19; color: #f1e8d2; }
.package-nvim {
  --editor-ink: #f1e8d2;
  --editor-muted: #b8baab;
  --editor-rule: #465143;
  --editor-shell: #222a24;
  --editor-bg: #161e19;
  --editor-panel: #28352d;
  --editor-accent: #eac294;
  --editor-selected: #344239;
  min-inline-size: 0;
  background: #161e19;
  background: var(--editor-bg);
  color: #f1e8d2;
  color: var(--editor-ink);
  color-scheme: dark;
  font: 500 .875rem/1.6 var(--mono, monospace);
}
.package-nvim [hidden] { display: none; }
.package-workbench { min-inline-size: 0; }
.package-nvim[data-package-ready] .package-workbench {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  block-size: 100vh;
  block-size: 100svh;
  block-size: 100dvh;
}

.package-workbench :is(button, summary) { font: inherit; }
.package-workbench button {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.package-workbench :is(a, button, summary):focus-visible {
  outline: 2px solid var(--editor-accent);
  outline-offset: -2px;
}

.package-workbench-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
  border-block-end: 1px solid var(--editor-rule);
  background: var(--editor-shell);
}
.package-workbench-title, .package-toolbar { display: flex; align-items: center; min-inline-size: 0; }
.package-workbench-title { flex-wrap: wrap; gap: .15rem .65rem; padding: .42rem .85rem; }
.package-workbench-title h2 { margin: 0; color: var(--editor-ink); font: 650 1rem/1.25 var(--mono, monospace); }
.package-workbench-mark { color: var(--editor-accent); }
.package-workbench-readonly { color: var(--editor-muted); font-size: .75rem; }
.package-toolbar { flex-shrink: 0; }
.package-toolbar :is(button, a) {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  min-inline-size: 44px;
  padding-inline: .8rem;
  border-inline-start: 1px solid var(--editor-rule);
  text-decoration: none;
}
.package-toolbar a { color: var(--editor-accent); }
.package-toolbar :is(button, a):hover, .package-toolbar button[aria-expanded="true"] { background: var(--editor-selected); }

.package-workbench-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-block-size: 0;
  min-inline-size: 0;
}
.package-workbench-body[data-tree-open] { grid-template-columns: clamp(12rem, 24vw, 17rem) minmax(0, 1fr); }
.package-file-tree {
  min-block-size: 0;
  min-inline-size: 0;
  overflow: auto;
  padding: .65rem 0;
  padding-inline-start: env(safe-area-inset-left, 0px);
  border-inline-end: 1px solid var(--editor-rule);
  background: var(--editor-shell);
  color: var(--editor-ink);
  font-size: .83rem;
}
.package-tree-label { padding-inline: .85rem; color: var(--editor-accent); font-size: .76rem; }
.package-tree-root { padding: .12rem .85rem .48rem; color: var(--editor-muted); font-size: .77rem; overflow-wrap: anywhere; }
.package-file-tree :is(summary, .package-file) {
  display: block;
  inline-size: 100%;
  min-block-size: 34px;
  padding: .37rem .65rem .37rem 1rem;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.package-file-tree summary::-webkit-details-marker { display: none; }
.package-file-tree summary::before { display: inline-block; inline-size: 1.25em; content: '▸'; color: var(--editor-accent); }
.package-file-tree details[open] > summary::before { content: '▾'; }
.package-file-tree details > .package-file { padding-inline-start: 2.3rem; }
.package-file-tree .package-file span { display: inline-block; inline-size: 2ch; color: #b8c8aa; font-size: .78rem; }
.package-file-tree :is(summary, .package-file):hover { background: var(--editor-panel); }
.package-file-tree .package-file[aria-current="true"] {
  box-shadow: inset 2px 0 0 var(--editor-accent);
  background: var(--editor-selected);
  color: var(--editor-ink);
}

.package-editor {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-block-size: 0;
  min-inline-size: 0;
}
.package-editor-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 .55rem;
  min-block-size: 2.35rem;
  padding-inline: .85rem max(.85rem, env(safe-area-inset-right, 0px));
  border-block-end: 1px solid var(--editor-rule);
  background: #1d261f;
  color: #e7dec9;
  font-size: .8rem;
}
[data-package-path] { flex-shrink: 0; max-inline-size: 100%; overflow-wrap: anywhere; }
.package-download {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  min-inline-size: 0;
  color: var(--editor-accent);
}
.package-buffer {
  min-block-size: 0;
  min-inline-size: 0;
  overflow: auto;
  scrollbar-gutter: stable;
  scrollbar-color: #788474 var(--editor-bg);
  padding-block: .68rem 1rem;
  padding-inline-end: env(safe-area-inset-right, 0px);
  outline: none;
  tab-size: 2;
}
.package-buffer:focus-visible { box-shadow: inset 0 0 0 1px var(--editor-accent); }
.package-line { display: grid; grid-template-columns: 4ch minmax(0, 1fr); align-items: stretch; }
.package-line[data-cursor-line] { background: #222e26; }
.package-line-number {
  padding-inline-end: .9ch;
  border-inline-end: 1px solid #303a31;
  color: #a4b1a2;
  text-align: end;
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.package-line[data-cursor-line] .package-line-number { color: var(--editor-accent); }
.package-line-text { padding-inline: .64rem .85rem; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.package-cursor { color: var(--editor-bg); background: #b7c4a3; }
.package-cursor:empty { display: inline-block; inline-size: 1ch; block-size: 1em; vertical-align: -.13em; }
.package-token-heading, .package-token-key { color: #edc68d; }
.package-token-code, .package-token-string { color: #bdcfa8; }
.package-token-mark, .package-token-value { color: #a4c9c6; }
.package-token-comment { color: #aebfa9; }

.package-editor-status {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-block-size: 1.85rem;
  padding-inline-end: max(.8rem, env(safe-area-inset-right, 0px));
  padding-block-end: env(safe-area-inset-bottom, 0px);
  background: var(--editor-selected);
  color: #e7ead6;
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}
.package-editor-mode {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding-inline: .65rem;
  background: #b7c4a3;
  color: #17241b;
  font-weight: 700;
}
.package-editor-position { margin-inline-start: auto; }

.package-documents { max-inline-size: 76ch; margin-inline: auto; padding: 1.25rem; }
.package-documents > section + section { margin-block-start: 1.2rem; padding-block-start: 1rem; border-top: 1px solid var(--editor-rule); }
.package-documents .panel-note { color: var(--editor-muted); }
.package-documents a { color: var(--editor-accent); }

@media (max-width: 660px) {
  .package-nvim { font-size: .82rem; }
  .package-workbench-title h2 { font-size: .9rem; overflow-wrap: anywhere; }
  .package-workbench-body[data-tree-open] { grid-template-columns: minmax(0, 1fr); }
  .package-workbench-body[data-tree-open] .package-editor { display: none; }
  .package-file-tree { border-inline-end: 0; }
  .package-file-tree :is(summary, .package-file) { min-block-size: 44px; padding-block: .64rem; }
  .package-line { grid-template-columns: 3.5ch minmax(0, 1fr); }
}

@media (max-width: 440px) {
  .package-workbench-title { padding-inline: .62rem .35rem; }
  .package-workbench-title :is(.package-workbench-mark, .package-workbench-readonly) { display: none; }
  .package-toolbar :is(button, a) { padding-inline: .58rem; white-space: nowrap; }
  .package-buffer { scrollbar-gutter: auto; }
}

@media (max-width: 375px) {
  .package-workbench-header { flex-wrap: wrap; }
  .package-workbench-title, .package-toolbar { inline-size: 100%; }
  .package-toolbar { justify-content: flex-end; border-block-start: 1px solid var(--editor-rule); }
}

@media print {
  .package-scene, .package-nvim { min-block-size: 0; background: #fff !important; color: #000 !important; }
  .package-nvim[data-package-ready] .package-workbench { display: block; block-size: auto; }
  .package-nvim :is(.package-workbench-header, .package-workbench-body, .package-editor-status) { display: none !important; }
  .package-nvim .package-documents { display: block !important; max-inline-size: none; padding-inline: 0; }
  .package-nvim .package-documents :is(.panel-note, a) { color: inherit; }
}
