/* Copyright (c) 2026 zzpice. MIT License. */
:root {
  --paper: var(--site-bg);
  --surface: var(--site-surface);
  --ink: var(--site-text);
  --muted: var(--site-muted);
  --line: var(--site-line);
  --accent: var(--site-accent);
  --error: var(--site-error);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 0.875rem/1.65 var(--site-font);
  -webkit-font-smoothing: antialiased;
}
body.authoring-app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  max-width: 100%;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}
button,
select,
input,
textarea {
  border: 1px solid var(--site-line-strong);
  border-radius: var(--site-radius-sm);
  background: var(--surface);
  padding: 6px 10px;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
select {
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 50%,
    calc(100% - 10px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  padding-inline-end: 28px;
}
button {
  cursor: pointer;
  min-height: 32px;
  font-size: 0.875rem;
  transition: background 0.15s;
}
button:hover:not(:disabled) {
  background: var(--site-soft);
}
button:disabled {
  opacity: 1;
  cursor: default;
  background: var(--site-disabled-bg);
  color: var(--site-disabled-text);
  border-color: var(--line);
  box-shadow: none;
}
button.primary:not(:disabled) {
  background: var(--site-accent-solid);
  border-color: var(--site-accent-solid);
  color: var(--site-on-accent);
}
button.primary:hover:not(:disabled) {
  background: var(--site-accent-hover);
}
a {
  color: inherit;
  text-underline-offset: 4px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}
h2 {
  font-size: 1rem;
  font-weight: 600;
}
h3 {
  font-size: 0.875rem;
  font-weight: 550;
  margin-bottom: 6px;
}
label {
  display: block;
}
label > input:not([type="checkbox"]),
label > textarea {
  display: block;
  width: 100%;
}
input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  vertical-align: middle;
  padding: 0;
  margin: 0;
}
textarea {
  resize: vertical;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.8;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.muted {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.9;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.page-header {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  white-space: nowrap;
}
.brand strong {
  font-size: 0.875rem;
  font-weight: 650;
}
.brand > span {
  border-left: 1px solid var(--line);
  padding-left: 13px;
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}
.page-header nav {
  align-items: center;
  display: flex;
  gap: 22px;
  font-size: 0.75rem;
}
.page-header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  text-decoration: none;
  color: var(--muted);
}
.page-header nav a:hover {
  color: var(--accent);
}
main {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
main:focus {
  outline: none;
}
.workspace-bar {
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.deck-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  max-width: 450px;
}
.deck-field > span {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.deck-field > input {
  font-size: 0.8125rem;
  font-weight: 550;
  min-height: 34px;
  background: transparent;
  border-color: transparent;
  padding: 5px 9px;
}
.deck-field > input:hover {
  border-color: var(--line);
}
.deck-field > input:focus {
  background: var(--paper);
  border-color: var(--accent);
}
.actions,
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.workspace-actions {
  flex-shrink: 0;
  gap: 8px;
}
.workspace-actions > button {
  padding-inline: 16px;
  min-height: 32px;
  font-size: 0.75rem;
}
.workspace-menu {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  z-index: 25;
}
.workspace-menu > summary {
  list-style: none;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 5px 8px;
  min-height: 32px;
  cursor: pointer;
  white-space: nowrap;
}
.workspace-menu > div {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  margin-top: 7px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--site-radius);
  box-shadow:
    0 4px 10px #11182712,
    0 16px 40px #1118271a;
}
.workspace-menu > div button {
  display: block;
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.875rem;
  min-height: 38px;
}
.workspace-menu > div button:hover:not(:disabled) {
  background: var(--site-soft);
}
summary::-webkit-details-marker {
  display: none;
}
.tool-view-nav {
  display: none;
}
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
}
.note-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
  padding: 18px 14px 12px;
  background: color-mix(in srgb, var(--paper) 80%, var(--surface));
  overflow-y: auto;
}
.panel-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 3px 16px;
  gap: 12px;
}
.panel-label h2 {
  font-size: 0.875rem;
  margin: 0;
  font-weight: 600;
}
.panel-label span {
  font-size: 0.75rem;
  color: var(--muted);
}
.new-note {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.new-note select {
  flex: 1;
  min-height: 34px;
  font-size: 0.875rem;
}
.new-note button {
  font-size: 0.875rem;
  min-width: 55px;
}
.note-panel #search {
  width: 100%;
  font-size: 0.875rem;
  min-height: 34px;
  margin-bottom: 10px;
  background: var(--surface);
}
.filters,
.list-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.filters select {
  font-size: 0.75rem;
  max-width: 126px;
  min-height: 30px;
}
.filters > label {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.list-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.list-meta button {
  border: 0;
  background: transparent;
  font-size: 0.75rem;
  padding: 0 2px;
  min-height: 28px;
}
#note-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  margin-inline: -7px;
  padding-inline: 4px;
  scrollbar-width: thin;
}
#list-empty {
  padding: 18px 6px;
  font-size: 0.875rem;
  line-height: 1.9;
  margin: 0;
  color: var(--muted);
}
.note-row {
  display: flex;
  align-items: start;
  gap: 5px;
  border-radius: var(--site-radius-sm);
  position: relative;
  padding: 5px 4px;
  margin-bottom: 3px;
}
.note-row:has([aria-current="true"]) {
  background: var(--site-selected);
  box-shadow: inset 3px 0 var(--accent);
}
.note-row > input {
  flex-shrink: 0;
  margin-top: 13px;
  opacity: 0;
  width: 13px;
  height: 13px;
}
.note-row:hover > input,
.note-row:focus-within > input,
.note-row > input:checked {
  opacity: 1;
}
.note-row button {
  border: 0;
  text-align: left;
  min-width: 0;
  flex: 1;
  background: transparent;
  padding: 6px 5px;
  border-radius: 4px;
}
.note-row button[aria-current="true"] {
  color: var(--accent);
}
.note-row:hover {
  background: var(--site-soft);
}
.note-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.875rem;
  line-height: 1.7;
}
.note-kind {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 3px;
  line-height: 1.8;
}
.note-kind.error {
  color: var(--error);
}
#batch {
  padding: 12px 3px 0;
  font-size: 0.75rem;
  border-top: 1px solid var(--line);
}
#batch p {
  margin-bottom: 8px;
}
#batch input {
  margin: 5px 0 8px;
}
#batch button {
  font-size: 0.75rem;
}
#undo {
  font-size: 0.75rem;
  margin-top: 12px;
}
#list-samples {
  font-size: 0.75rem;
  margin: 0 6px 16px;
}
.editor-panel {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
}
#editor {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  min-height: 70px;
}
.editor-heading .eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 2px;
}
.editor-heading h1 {
  margin: 0;
  font-size: 1rem;
}
.editor-heading .actions {
  gap: 5px;
}
.editor-heading button {
  font-size: 0.75rem;
  min-height: 30px;
  background: transparent;
}
.editor-heading #previous,
.editor-heading #next {
  font-size: 1.125rem;
  line-height: 1;
  width: 30px;
  min-height: 30px;
  padding: 0;
}
.editor-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 0.82fr);
}
.editing-fields {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 22px 30px;
  scrollbar-width: thin;
}
#type-help {
  font-size: 0.75rem;
  line-height: 1.85;
  margin-bottom: 14px;
}
#validation {
  font-size: 0.75rem;
  line-height: 1.8;
  color: var(--site-success);
  padding: 8px 10px;
  background: var(--site-success-bg);
  border-radius: 4px;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
}
#validation[data-error="true"] {
  background: color-mix(in srgb, var(--error) 6%, var(--surface));
  color: var(--error);
}
#validation ul {
  padding-left: 16px;
  margin: 0;
}
.toolbar {
  gap: 3px;
  padding: 7px 0;
  margin-bottom: 8px;
  line-height: 1.4;
}
.editing-fields > .toolbar[aria-label] {
  position: sticky;
  top: -20px;
  margin: 0 -2px 10px;
  padding: 9px 2px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 2;
}
.toolbar button {
  font-size: 0.75rem;
  min-height: 30px;
  padding: 5px 8px;
  background: transparent;
  border-color: transparent;
}
.toolbar button:hover:not(:disabled) {
  background: var(--site-soft);
}
.toolbar button[data-command="bold"],
.toolbar button[data-command="italic"] {
  width: 30px;
  padding: 0;
  font-size: 0.875rem;
}
.toolbar label {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.toolbar select {
  font-size: 0.75rem;
  min-height: 30px;
  padding: 4px 28px 4px 7px;
}
.toolbar input[type="number"] {
  width: 55px;
  font-size: 0.75rem;
  min-height: 30px;
}
#cloze-hint {
  width: 95px;
}
.field {
  margin: 18px 0;
}
.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.field-heading label {
  font-size: 0.875rem;
  font-weight: 550;
}
.field-heading button {
  border: 0;
  background: transparent;
  font-size: 0.75rem;
  padding: 3px 6px;
  min-height: 24px;
  color: var(--muted);
}
.field-heading button:hover:not(:disabled) {
  background: var(--site-soft);
  color: var(--accent);
}
.field-edit {
  min-height: 100px;
  border: 1px solid var(--site-line-strong);
  border-radius: var(--site-radius-sm);
  padding: 14px;
  font-size: 1rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
  background: var(--surface);
  transition: border-color 0.15s;
}
.field-edit:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}
.field:nth-child(n + 3) .field-edit {
  min-height: 74px;
}
.field-edit:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.field-edit img {
  max-width: 100%;
  max-height: 360px;
}
.field-edit > :first-child {
  margin-top: 0;
}
.field-edit > :last-child {
  margin-bottom: 0;
}
.field-edit pre,
.field-edit table {
  display: block;
  max-width: 100%;
  overflow: auto;
}
.field-edit ul,
.field-edit ol {
  padding-left: 24px;
}
.field-edit a {
  cursor: text;
}
.field textarea {
  width: 100%;
  min-height: 100px;
  font-size: 0.875rem;
  line-height: 1.9;
}
.field .muted {
  font-size: 0.75rem;
  margin: 6px 0;
}
.tags-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 22px;
}
.tags-label input {
  margin-top: 6px;
  min-height: 34px;
  font-size: 0.875rem;
}
details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
  margin-top: 18px;
}
summary {
  cursor: pointer;
  min-height: 32px;
  font-size: 0.75rem;
  align-content: center;
  color: var(--muted);
}
.media-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 9px 0;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}
.media-item img {
  width: 44px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}
.media-item span {
  min-width: 0;
}
.media-item button {
  font-size: 0.75rem;
  min-height: 28px;
  padding: 4px 7px;
}
#preview-panel {
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  border-top: 0;
  border-left: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
}
#preview-panel[open] {
  display: flex;
  flex-direction: column;
}
#preview-panel > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
  flex-shrink: 0;
  color: var(--ink);
  list-style: none;
}
#preview-panel > summary > span {
  font-size: 0.75rem;
  color: var(--muted);
}
#preview-panel > .toolbar {
  padding: 10px 14px 6px;
  gap: 8px;
  margin: 0;
  flex-shrink: 0;
  align-items: end;
}
#preview-panel .toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  font-size: 0.75rem;
  flex: 1;
}
#preview-panel .toolbar select {
  flex: 1;
  font-size: 0.75rem;
  background-color: var(--surface);
  border-color: var(--site-line-strong);
  min-height: 30px;
}
#preview-panel #flip {
  font-size: 0.75rem;
  background: var(--site-accent-solid);
  color: var(--site-on-accent);
  border-color: var(--accent);
  min-height: 30px;
  padding: 5px 9px;
}
#preview-help {
  padding: 4px 14px 10px;
  font-size: 0.75rem;
  margin: 0;
  flex-shrink: 0;
  color: var(--muted);
  line-height: 1.85;
}
#preview {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  height: 100%;
  flex: 1;
  border: 0;
  background: var(--paper);
  margin: auto;
}
#preview[data-viewport="phone"] {
  width: 390px;
}
#occlusion-stage {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 12px;
  user-select: none;
  touch-action: none;
}
#occlusion-picture {
  display: block;
  max-width: 100%;
  max-height: 65vh;
}
#occlusion-overlay {
  position: absolute;
  inset: 0;
}
.mask {
  position: absolute;
  border: 2px solid #b95326;
  background: #e8aa6ae6;
  font-weight: 600;
  color: #33251b;
  overflow: hidden;
  cursor: pointer;
}
.mask.selected {
  border-color: #265b95;
  background: #90b7eae6;
}
.mask.drawing {
  pointer-events: none;
}
#rect-list button[aria-pressed="true"] {
  background: var(--site-soft);
  border-color: var(--accent);
}
#welcome {
  display: flex;
  align-items: start;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  max-width: 700px;
  margin: auto;
  padding: 50px 48px;
}
#welcome .welcome-glyph {
  font-size: 1.5rem;
  color: var(--accent);
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--site-radius);
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 26px;
  transform: rotate(-5deg);
}
#welcome .eyebrow {
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  margin: 0 0 12px;
}
#welcome h1 {
  font-size: 1.625rem;
  line-height: 1.6;
  margin-bottom: 16px;
  letter-spacing: -0.035em;
}
#welcome > p {
  font-size: 0.875rem;
  line-height: 1.9;
  max-width: 490px;
  color: var(--muted);
}
#welcome > p.muted {
  font-size: 0.75rem;
}
#welcome .welcome-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0 18px;
}
#welcome button {
  font-size: 0.75rem;
  min-height: 36px;
}
#welcome .welcome-types {
  font-size: 0.75rem;
  color: var(--muted);
}
dialog {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--site-radius-dialog);
  padding: 24px;
  width: 720px;
  max-width: calc(100vw - 24px);
  max-height: 90dvh;
  overscroll-behavior: contain;
}
dialog[open] {
  animation: dialog-enter 0.12s ease-out;
}
@keyframes dialog-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}
dialog::backdrop {
  background: var(--site-overlay);
  backdrop-filter: blur(3px);
}
.dialog-header {
  position: sticky;
  top: -24px;
  z-index: 3;
  background: var(--surface);
  padding: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
}
.dialog-header h2 {
  margin: 0;
  font-size: 1.125rem;
}
.dialog-header button {
  font-size: 0.75rem;
  min-height: 32px;
}
dialog > p {
  font-size: 0.875rem;
  line-height: 1.9;
  color: var(--muted);
}
dialog label {
  font-size: 0.75rem;
  margin-bottom: 14px;
}
dialog input:not([type="checkbox"]),
dialog textarea {
  margin-top: 6px;
  font-size: 0.8125rem;
  min-height: 36px;
  background: var(--paper);
}
dialog .toolbar {
  margin: 12px 0 16px;
}
dialog .toolbar button {
  border-color: var(--line);
}
dialog .toolbar label {
  margin: 0;
}
dialog input[type="file"] {
  font-size: 0.875rem;
  min-height: 40px;
  padding: 8px;
}
dialog .actions button {
  min-height: 36px;
}
dialog a {
  font-size: 0.75rem;
  color: var(--accent);
}
.export-option {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 18px;
}
.export-option p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.9;
}
.export-option button {
  min-height: 36px;
  font-size: 0.75rem;
}
.export-option label {
  font-size: 0.75rem;
}
.export-option input[type="checkbox"] {
  margin-right: 5px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.75rem;
  background: var(--paper);
  padding: 14px;
  border-radius: var(--site-radius-sm);
  line-height: 1.9;
}
#notice {
  position: fixed;
  z-index: 50;
  bottom: 45px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  width: max-content;
  background: var(--ink);
  color: var(--surface);
  border-radius: var(--site-radius);
  padding: 10px 16px;
  margin: 0;
  box-shadow: 0 6px 20px #0002;
  font-size: 0.875rem;
}
#notice:empty {
  display: none;
}
.ecosystem-footer {
  height: 30px;
  min-height: 30px;
  flex-shrink: 0;
  margin: 0;
  padding: 0 20px;
  gap: 20px;
  background: var(--paper);
  font-size: 0.75rem;
  overflow: visible;
}
.ecosystem-footer #save-status {
  margin: 0 auto 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
}
.ecosystem-footer #save-status[data-error="true"] {
  color: var(--error);
  background: var(--surface);
  position: relative;
  z-index: 10;
  box-shadow: 0 0 0 8px var(--surface);
  max-width: calc(100vw - 40px);
}
.ecosystem-footer a {
  font-size: 0.75rem;
  white-space: nowrap;
  text-decoration: none;
}
.load-state {
  padding: 90px 30px;
  max-width: 700px;
  margin: auto;
  width: 100%;
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
}
.loading-line {
  height: 20px;
  background: var(--site-soft);
  display: block;
  border-radius: 4px;
  width: 70%;
  margin: 0 auto 14px;
  animation: load-pulse 1.5s infinite alternate;
}
.loading-line:nth-child(2) {
  width: 50%;
  margin-bottom: 30px;
}
#retry-load {
  margin-top: 12px;
}
.load-state:has(#retry-load:not([hidden])) .loading-line {
  display: none;
}
@keyframes load-pulse {
  to {
    opacity: 0.3;
  }
}
#preview-panel #flip:disabled {
  background: var(--site-disabled-bg);
  color: var(--site-disabled-text);
  border-color: var(--site-line);
}
@media (max-width: 1270px) {
  .workspace {
    grid-template-columns: 235px minmax(0, 1fr);
  }
  .editor-layout {
    grid-template-columns: minmax(0, 1fr) 310px;
  }
  .editing-fields {
    padding: 18px;
  }
  .field-edit {
    padding: 12px;
    font-size: 1rem;
  }
  .editor-heading {
    padding: 13px 18px;
  }
  .toolbar button {
    font-size: 0.75rem;
    padding: 5px 6px;
  }
  .page-header nav {
    gap: 18px;
  }
}
@media (max-width: 1179px) {
  .workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .editor-layout {
    display: block;
  }
  .editing-fields {
    height: 100%;
  }
  #preview-panel {
    height: 100%;
    border-left: 0;
  }
  body[data-tool-view="preview"] .editing-fields {
    display: none;
  }
  body:not([data-tool-view="preview"]) #preview-panel {
    display: none;
  }
  .tool-view-nav {
    display: flex;
    position: absolute;
    right: 30px;
    top: 124px;
    z-index: 5;
    gap: 3px;
    padding: 3px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--site-radius-sm);
  }
  .tool-view-nav button {
    background: transparent;
    border: 0;
    min-height: 28px;
    min-width: 50px;
    font-size: 0.75rem;
    padding: 4px 10px;
  }
  .tool-view-nav button[aria-pressed="true"] {
    background: var(--site-selected);
    color: var(--accent);
    box-shadow: 0 1px 3px #0001;
  }
  .tool-view-nav button[data-tool-view="notes"] {
    display: none;
  }
  .editor-heading {
    padding-right: 175px;
    min-height: 85px;
  }
  .editor-heading .actions {
    gap: 4px;
  }
  .editor-heading #duplicate {
    font-size: 0.75rem;
    padding: 4px 7px;
  }
  .editor-heading #previous,
  .editor-heading #next {
    width: 26px;
    min-height: 28px;
  }
  .editor-heading h1 {
    font-size: 0.9375rem;
  }
  .editor-heading .eyebrow {
    font-size: 0.75rem;
  }
  #preview-panel > .toolbar {
    max-width: 650px;
    width: 100%;
    margin: auto;
    padding: 16px 24px 8px;
  }
  #preview-help {
    max-width: 650px;
    width: 100%;
    margin: auto;
    padding: 4px 24px 16px;
  }
  #preview {
    max-width: 760px;
  }
  #welcome {
    padding: 40px 36px;
  }
  #welcome h1 {
    font-size: 1.4375rem;
  }
}
@media (max-width: 760px) {
  body.authoring-app {
    padding-bottom: 54px;
  }
  .page-header {
    height: 54px;
    padding: 0 14px;
    gap: 12px;
  }
  .brand {
    gap: 7px;
  }
  .brand img {
    width: 24px;
    height: 24px;
  }
  .brand strong {
    font-size: 0.8125rem;
  }
  .brand > span {
    font-size: 0.75rem;
    padding-left: 8px;
    margin-left: 0;
  }
  .brand > span { display: none; }
  .page-header { gap: 8px; }
  .page-header select[data-site-theme] { width: 100px; padding-left: 8px; font-size: 0.75rem; }
  .page-header nav {
    font-size: 0.75rem;
    gap: 8px;
  }
  .page-header nav a {
    min-height: 40px;
    font-size: 0.75rem;
  }
  .page-header nav a:not(:first-child) {
    display: none;
  }
  .workspace-bar {
    height: 58px;
    padding: 10px 14px;
    gap: 7px;
  }
  .deck-field {
    gap: 4px;
    max-width: none;
  }
  .deck-field > span {
    font-size: 0.75rem;
  }
  .deck-field > input {
    font-size: 0.8125rem;
    min-height: 36px;
    padding: 5px 6px;
    max-width: 150px;
  }
  .workspace-actions {
    gap: 6px;
  }
  .workspace-actions > button {
    font-size: 0.75rem;
    padding: 6px 12px;
    min-height: 36px;
  }
  .workspace-menu > summary {
    font-size: 0.75rem;
    padding: 6px 3px;
    min-height: 36px;
  }
  .workspace-menu > div {
    min-width: 180px;
    box-shadow:
      0 4px 10px #11182712,
      0 16px 40px #1118271a;
  }
  .workspace-menu > div button {
    min-height: 44px;
  }
  .tool-view-nav {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: 54px;
    min-height: 54px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-radius: 0;
    border: 0;
    border-top: 1px solid var(--line);
    padding: 4px 12px calc(4px + env(safe-area-inset-bottom));
    background: var(--surface);
    gap: 8px;
    z-index: 20;
  }
  .tool-view-nav button {
    font-size: 0.875rem;
    min-height: 44px;
    padding: 6px 10px;
    border-radius: var(--site-radius-sm);
  }
  .tool-view-nav button[data-tool-view="notes"] {
    display: block;
  }
  .tool-view-nav button[aria-pressed="true"] {
    background: var(--site-selected);
    box-shadow: none;
    font-weight: 550;
    color: var(--accent);
  }
  .workspace {
    display: block;
  }
  .note-panel {
    height: 100%;
    border-right: 0;
    padding: 18px 16px 12px;
  }
  body:not([data-tool-view="notes"]) .note-panel {
    display: none;
  }
  body[data-tool-view="notes"] .editor-panel {
    display: none;
  }
  .editor-panel {
    height: 100%;
  }
  .panel-label h2 {
    font-size: 0.875rem;
  }
  .panel-label span {
    font-size: 0.75rem;
  }
  .new-note {
    margin-bottom: 16px;
  }
  .new-note select {
    min-height: 42px;
    font-size: 0.875rem;
  }
  .new-note button {
    min-height: 42px;
    padding-inline: 20px;
    font-size: 0.875rem;
  }
  .note-panel #search {
    min-height: 42px;
    font-size: 0.875rem;
    margin-bottom: 12px;
  }
  .filters select {
    font-size: 0.8125rem;
    min-height: 38px;
    max-width: 160px;
  }
  .filters label {
    font-size: 0.75rem;
  }
  .filters input {
    width: 16px;
    height: 16px;
  }
  .list-meta {
    font-size: 0.75rem;
  }
  .list-meta button {
    min-height: 36px;
    font-size: 0.75rem;
  }
  .note-row {
    padding: 8px 5px;
    gap: 10px;
    margin-bottom: 4px;
  }
  .note-row > input {
    opacity: 1;
    width: 16px;
    height: 16px;
    margin-top: 13px;
  }
  .note-summary {
    font-size: 0.875rem;
  }
  .note-kind {
    font-size: 0.75rem;
    margin-top: 4px;
  }
  .note-row button {
    min-height: 48px;
    padding: 5px;
  }
  .editor-heading {
    padding: 12px 16px;
    min-height: 72px;
    gap: 8px;
  }
  .editor-heading h1 {
    font-size: 1rem;
  }
  .editor-heading .eyebrow {
    font-size: 0.75rem;
  }
  .editor-heading .actions {
    gap: 5px;
  }
  .editor-heading #previous,
  .editor-heading #next {
    min-height: 36px;
    width: 32px;
  }
  .editor-heading #duplicate {
    min-height: 36px;
    font-size: 0.75rem;
    padding: 5px 8px;
  }
  .editing-fields {
    padding: 16px 16px 30px;
    overscroll-behavior: contain;
  }
  #type-help {
    font-size: 0.75rem;
    margin-bottom: 14px;
  }
  #validation {
    font-size: 0.75rem;
    padding: 10px;
    margin-bottom: 12px;
    color: var(--site-success);
    background: var(--site-success-bg);
  }
  .editing-fields > .toolbar[aria-label] {
    top: -16px;
    padding: 9px 0;
  }
  .toolbar {
    gap: 4px;
  }
  .toolbar button {
    font-size: 0.75rem;
    min-height: 36px;
    padding: 5px 7px;
  }
  .toolbar button[data-command="bold"],
  .toolbar button[data-command="italic"] {
    width: 30px;
    min-height: 36px;
  }
  .toolbar input,
  .toolbar select {
    font-size: 1rem;
    min-height: 36px;
  }
  .toolbar label {
    font-size: 0.75rem;
  }
  .toolbar input[type="number"] {
    font-size: 1rem;
    min-height: 36px;
    width: 54px;
  }
  #cloze-hint {
    width: 110px;
  }
  .field {
    margin: 18px 0;
  }
  .field-heading label {
    font-size: 0.875rem;
  }
  .field-heading button {
    min-height: 32px;
    font-size: 0.75rem;
  }
  .field-edit {
    font-size: 1rem;
    line-height: 1.9;
    min-height: 114px;
    padding: 13px;
    border: 1px solid var(--site-line-strong);
  }
  .field:nth-child(n + 3) .field-edit {
    min-height: 82px;
  }
  .field textarea {
    font-size: 1rem;
    min-height: 110px;
  }
  .field .muted {
    font-size: 0.75rem;
  }
  .tags-label {
    font-size: 0.875rem;
  }
  .tags-label input {
    font-size: 1rem;
    min-height: 42px;
  }
  #preview-panel > .toolbar {
    padding: 14px 16px 8px;
    gap: 8px;
  }
  #preview-panel > summary {
    padding-inline: 16px;
    min-height: 40px;
  }
  #preview-panel .toolbar select {
    font-size: 0.875rem;
    min-height: 40px;
    padding: 5px 28px 5px 8px;
    border-color: var(--site-line-strong);
  }
  #preview-panel .toolbar label {
    font-size: 0.75rem;
  }
  #preview-panel #flip {
    min-height: 36px;
    font-size: 0.75rem;
    background: var(--site-accent-solid);
    color: var(--site-on-accent);
  }
  #preview-help {
    padding: 4px 16px 12px;
    font-size: 0.75rem;
    line-height: 1.85;
  }
  .ecosystem-footer {
    height: 30px;
    min-height: 30px;
    padding-inline: 14px;
    gap: 8px;
  }
  .ecosystem-footer #save-status {
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  .ecosystem-footer #save-status[data-error="true"] {
    white-space: normal;
    overflow: visible;
    padding: 10px 0;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 90px;
    max-width: none;
  }
  .ecosystem-footer a {
    display: none;
  }
  dialog {
    padding: 18px;
    max-height: 90dvh;
  }
  dialog .dialog-header {
    top: -18px;
  }
  .dialog-header h2 {
    font-size: 1rem;
  }
  .dialog-header button {
    min-height: 40px;
  }
  dialog > p {
    font-size: 0.875rem;
  }
  dialog label {
    font-size: 0.875rem;
  }
  dialog input:not([type="checkbox"]),
  dialog textarea {
    font-size: 1rem;
  }
  dialog button {
    min-height: 40px;
  }
  dialog .toolbar label {
    font-size: 0.75rem;
  }
  dialog .toolbar select {
    font-size: 0.875rem;
    min-height: 40px;
  }
  dialog .actions button {
    font-size: 0.875rem;
    min-height: 40px;
  }
  .export-option p {
    font-size: 0.875rem;
  }
  .export-option button {
    font-size: 0.875rem;
    min-height: 40px;
  }
  #notice {
    bottom: 95px;
    font-size: 0.875rem;
    max-width: calc(100% - 32px);
    width: max-content;
  }
  #batch {
    font-size: 0.875rem;
    padding-top: 14px;
  }
  #batch input {
    font-size: 1rem;
    min-height: 40px;
  }
  #batch button {
    min-height: 38px;
    font-size: 0.75rem;
  }
  #undo {
    min-height: 40px;
    font-size: 0.75rem;
  }
  #list-samples {
    min-height: 40px;
    font-size: 0.875rem;
  }
  #list-empty {
    font-size: 0.8125rem;
    max-width: 300px;
    margin: auto;
    padding: 30px 12px;
  }
  .load-state {
    padding: 50px 24px;
  }
  .media-item {
    font-size: 0.75rem;
  }
  .media-item button {
    min-height: 40px;
  }
  #occlusion-picture {
    max-height: 50dvh;
  }
}
@media (max-width: 360px) {
  .brand > span {
    display: none;
  }
  .workspace-bar {
    padding-inline: 12px;
    gap: 4px;
  }
  .deck-field > span {
    display: none;
  }
  .deck-field > input {
    max-width: 125px;
    font-size: 0.8125rem;
  }
  .workspace-actions {
    gap: 4px;
  }
  .workspace-actions > button {
    padding: 6px 10px;
  }
  .workspace-menu > summary {
    font-size: 0.75rem;
  }
  .editor-heading {
    padding: 10px 12px;
  }
  .editor-heading .actions {
    gap: 3px;
  }
  .editing-fields {
    padding-inline: 12px;
  }
  #preview-panel > .toolbar {
    padding-inline: 12px;
    gap: 5px;
  }
  #preview-panel .toolbar select {
    font-size: 0.75rem;
    padding: 5px 28px 5px 4px;
    border-color: var(--site-line-strong);
  }
  .tool-view-nav {
    padding-inline: 10px;
  }
  .field-heading button {
    padding: 3px 5px;
  }
  .toolbar button {
    font-size: 0.75rem;
    padding-inline: 6px;
  }
}
