:root {
  --accent: #0a84ff;
  --accent-strong: #0071e3;
  --text: #1c1c1e;
  --muted: #999;
  --line: #d6d6d8;
  --compass-bg: #fafafb;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

html.ui-mobile {
  --tint: #0a84ff;
  --accent: var(--tint);
  --accent-strong: var(--tint);
  --text: #fff;
  --muted: #999;
  --label: #999;
  --faint: #48484a;
  --on-tint: #fff;
  --sep: #2c2c2e;
  --line: #2c2c2e;
  --bg: #0f0f0f;
  --bar: var(--bg);
  --section: var(--bg);
  --raised: #1c1c1e;
  --search: #1c1c1e;
  --pressed: #2c2c2e;
  --backdrop: rgba(0, 0, 0, .6);
  --compass-bg: #1c1c1e;
  --danger: #ff453a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { touch-action: pan-x pan-y; }

html, body {
  height: 100%;
  margin: 0;
  background: #fff;
  color: var(--text);
  font: 13px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body { overflow: hidden; }

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: default; }
a { color: var(--accent-strong); }
svg { display: block; width: 1em; height: 1em; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#app { height: 100%; }

#boot {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  background: #f5f5f7;
  text-align: center;
}
#boot h1 { font-size: 28px; font-weight: 300; }
#boot p { max-width: 42ch; color: var(--muted); }
#boot nav { display: flex; gap: 16px; margin-top: 8px; }
#boot img { max-width: 40px; max-height: 40px; margin-top: 8px; }

@media (max-width: 820px) {
  html, body, #boot { background: #0f0f0f; color: #fff; }
}

.cover {
  display: block;
  object-fit: cover;
  background: #e9e9eb;
}
.cover-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b3b3b8;
  background: linear-gradient(#f1f1f3, #e3e3e6);
}
.cover-empty svg { width: 46%; height: 46%; }
.cover.zoomed { transform: scale(1.34); }


#toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  z-index: 120;
  max-width: min(90vw, 460px);
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(30, 30, 32, .88);
  color: #fff;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .18s, transform .18s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .28);
}
.modal-card {
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: min(84vh, 720px);
  border-radius: 8px;
  overflow: hidden;
  background: #f4f4f5;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .34), 0 0 0 .5px rgba(0, 0, 0, .3);
}
.modal.alert .modal-card { width: min(380px, 100%); }
.modal-head { padding: 12px 18px 8px; text-align: center; }
.modal-head h2 { font-size: 14px; font-weight: 600; }
.modal-body { flex: 1; padding: 6px 18px 14px; overflow-y: auto; }
.modal-body > p { line-height: 1.45; color: #39393d; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid #dcdcde;
  background: #ececee;
}

.btn {
  min-height: 26px;
  padding: 3px 14px;
  border-radius: 5px;
  background: linear-gradient(#fff, #f1f1f2);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .28), 0 .5px 1px rgba(0, 0, 0, .1);
  white-space: nowrap;
}
.ui-desktop .btn:hover:not(:disabled) { background: linear-gradient(#fff, #e8e8ea); }
.ui-desktop .btn:active:not(:disabled) { background: #dedee0; }
.btn:disabled { opacity: .5; }
.btn-primary { background: linear-gradient(#2e97ff, #0a78ee); color: #fff; box-shadow: 0 0 0 .5px rgba(0, 60, 150, .6); }
.ui-desktop .btn-primary:hover:not(:disabled) { background: linear-gradient(#45a3ff, #1a84f4); }
.ui-desktop .btn-primary:active:not(:disabled) { background: #0a6fdc; }
.btn-danger { color: #d70015; }

.link { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.field {
  display: block;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 4px;
  background: #fff;
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .3);
  outline-offset: 0;
  resize: vertical;
}
.field-label { display: block; margin: 10px 0 4px; color: #4c4c50; font-size: 12px; }
.field-label .field { margin-top: 3px; color: var(--text); font-size: 13px; }
.field-label output { float: right; color: var(--muted); }
.field-label input[type=range] { display: block; width: 100%; margin-top: 8px; accent-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 96px; gap: 10px; }
.hint { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }

.dropzone {
  display: block;
  width: 100%;
  padding: 18px 12px;
  border: 1px dashed #aeaeb2;
  border-radius: 6px;
  color: #4c4c50;
  background: #fafafa;
  text-align: center;
  cursor: pointer;
}
.dropzone.over { border-color: var(--accent); background: #eaf3ff; }
.add-progress { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); }
.add-progress img { width: 18px; height: 18px; }

.info-top { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.info-top strong, .info-top span { display: block; }
.info-top span { color: var(--muted); }
.info-cover { width: 64px; height: 64px; border-radius: 3px; flex: none; }
.info-form h3, .prefs h3 { margin: 16px 0 4px; font-size: 12px; font-weight: 600; }
.prefs h3:first-child { margin-top: 2px; }

.info-list { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; font-size: 12px; }
.info-list dt { color: var(--muted); }
.info-list dd { min-width: 0; overflow-wrap: anywhere; }

.import-actions { display: grid; gap: 8px; margin-top: 10px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.button-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 6px; }

.menu-layer { position: fixed; inset: 0; z-index: 110; }
.menu {
  position: absolute;
  min-width: 210px;
  max-height: calc(100vh - 12px);
  padding: 4px 0;
  overflow-y: auto;
  border-radius: 5px;
  background: rgba(248, 248, 249, .98);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .28), 0 0 0 .5px rgba(0, 0, 0, .25);
}
.menu-title { display: none; }
.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  width: 100%;
  padding: 3px 14px 3px 24px;
  text-align: left;
  white-space: nowrap;
}
.ui-desktop .menu-item:hover:not(:disabled) { background: var(--accent-strong); color: #fff; }
.menu-item:disabled { color: #a7a7ab; }
.menu-item.danger { color: #d70015; }
.ui-desktop .menu-item.danger:hover { color: #fff; }
.menu-item.checked::before { content: ""; position: absolute; left: 9px; top: 50%; width: 5px; height: 9px; margin-top: -6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(40deg); }
.menu-item kbd { color: #8a8a8e; font: inherit; font-size: 12px; }
.ui-desktop .menu-item:hover kbd { color: inherit; }
.menu-arrow { border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.menu-sep { height: 1px; margin: 4px 0; background: #dedee0; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(244, 244, 246, .55);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}
.intro-card {
  width: min(440px, 100%);
  padding: 26px 30px 20px;
  border-radius: 12px;
  background: #fff;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .22), 0 0 0 .5px rgba(0, 0, 0, .12);
}
.intro-logo { width: 54px; height: 54px; margin: 0 auto 10px; color: var(--text); }
.intro-logo svg { width: 100%; height: 100%; }
.intro-content { min-height: 132px; }
.intro-content h2 { margin-bottom: 8px; font-size: 20px; font-weight: 400; }
.intro-content p { color: #4c4c50; font-size: 14px; line-height: 1.5; }
.intro-dots { display: flex; justify-content: center; gap: 7px; margin: 14px 0; }
.intro-dots i { width: 6px; height: 6px; border-radius: 50%; background: #d4d4d8; }
.intro-dots i.on { background: var(--accent); }
.intro-actions { display: flex; justify-content: center; gap: 10px; }
.intro-actions .btn { min-width: 110px; min-height: 30px; }

.metis-panel h2 { font-size: 19px; font-weight: 300; }
.metis-panel h2 em { font-style: normal; font-weight: 500; color: var(--accent-strong); }
.metis-panel h3 { margin: 18px 0 6px; font-size: 13px; font-weight: 600; }
.metis-panel section > h3:first-child { margin-top: 0; }
.metis-sub { margin-top: 2px; color: var(--muted); }
.compass { width: 100%; max-width: 280px; height: auto; margin: 12px auto 10px; }
.compass text { fill: #8a8a8e; font-size: 9.5px; font-family: var(--font); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips li { padding: 2px 9px; border-radius: 10px; background: #efeff1; color: #4c4c50; font-size: 12px; }
.why { display: flex; gap: 10px; }
.why-cover { width: 56px; height: 56px; flex: none; border-radius: 3px; }
.why li { color: #4c4c50; font-size: 12px; }
.why li::before { content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 6px 2px 0; border-radius: 50%; background: var(--accent); }
.metis-queue li { display: flex; align-items: center; gap: 10px; padding: 5px 4px; border-bottom: 1px solid #ededef; cursor: pointer; }
.ui-desktop .metis-queue li:hover { background: #f5f5f7; }
.metis-queue strong, .metis-queue span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.metis-queue span { color: var(--muted); font-size: 12px; }
.metis-queue div { flex: 1; min-width: 0; }
.metis-queue time { color: var(--muted); font-variant-numeric: tabular-nums; }
.row-cover { width: 36px; height: 36px; flex: none; border-radius: 2px; }
