:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-alt: #eef1ed;
  --ink: #171a1f;
  --muted: #697078;
  --line: #d8ddd7;
  --line-strong: #bdc5bd;
  --blue: #315f9d;
  --blue-soft: #e9f0fa;
  --green: #187958;
  --green-soft: #e2f3eb;
  --coral: #c94f3d;
  --coral-soft: #fbe9e4;
  --amber-soft: #fff1d6;
  --violet-soft: #f1ebf8;
  --shadow: 0 18px 50px rgba(25, 32, 28, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    linear-gradient(rgba(23, 26, 31, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 26, 31, 0.028) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(49, 95, 157, 0.25); outline-offset: 2px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 310px minmax(260px, 620px) 1fr;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(189, 197, 189, 0.85);
  background: rgba(244, 246, 243, 0.92);
  backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: 12px; width: max-content; color: inherit; text-decoration: none; }
.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 15px; line-height: 1.2; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  gap: 3px;
  width: 32px;
  height: 32px;
  padding: 7px;
  border-radius: 7px;
  background: var(--ink);
}
.brand-mark i { display: block; border-radius: 1px; }
.brand-mark i:nth-child(1) { height: 9px; background: #5da680; }
.brand-mark i:nth-child(2) { height: 17px; background: #edc461; }
.brand-mark i:nth-child(3) { height: 13px; background: #e87562; }

.search-box {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 5px 20px rgba(31, 41, 35, 0.04);
}
.search-box > span { color: var(--muted); font-size: 22px; line-height: 1; transform: translateY(-1px); }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-box input::placeholder { color: #8b918c; }
.search-box kbd { min-width: 28px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--surface-alt); font-size: 11px; text-align: center; }

.top-actions, .detail-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { border-color: var(--ink); color: white; background: var(--ink); }
.button-primary:hover { background: #30343a; }
.button-quiet { border-color: var(--line-strong); background: var(--surface); }
.button-quiet:hover { border-color: #969f97; background: #fafbfa; }

.workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.library {
  position: sticky;
  top: 72px;
  align-self: start;
  height: calc(100vh - 72px);
  padding: 24px 16px 16px 24px;
  border-right: 1px solid var(--line-strong);
  background: rgba(247, 248, 246, 0.72);
  overflow: hidden;
}
.library-heading, .section-heading, .raw-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }
.library-heading h2, .section-heading h2, .raw-heading h2 { margin: 0; font-size: 18px; line-height: 1.2; letter-spacing: 0; }
.file-state { padding-bottom: 1px; color: var(--muted); font-size: 11px; }

.filter-row { display: flex; gap: 4px; margin: 20px 0 12px; padding-bottom: 2px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter, .tab { flex: 0 0 auto; border: 0; border-radius: 5px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.filter { padding: 7px 10px; }
.filter:hover, .filter.active { color: var(--ink); background: #e5e9e4; }

.preset-list { height: calc(100% - 102px); padding-right: 8px; overflow-y: auto; scrollbar-color: #b8c0b8 transparent; scrollbar-width: thin; }
.preset-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 66px;
  margin: 0 0 6px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.preset-item:hover { border-color: var(--line); background: rgba(255, 255, 255, 0.72); }
.preset-item.active { border-color: #aeb9ae; background: var(--surface); box-shadow: 0 7px 20px rgba(31, 41, 35, 0.07); }
.preset-thumb {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #485149;
  background: linear-gradient(145deg, #e7ece6 0 49%, #d5ddd4 49% 51%, #f2e5d8 51%);
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
}
.preset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.preset-copy { min-width: 0; }
.preset-copy strong { display: block; overflow: hidden; font-size: 13px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.preset-copy small { display: block; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.preset-index { color: #929992; font: 700 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.list-empty { padding: 48px 14px; color: var(--muted); font-size: 13px; text-align: center; }

.inspector { min-width: 0; padding: 32px clamp(24px, 4vw, 64px) 72px; }
.detail { width: min(1120px, 100%); margin: 0 auto; }
.empty-state { display: grid; place-items: center; align-content: center; min-height: calc(100vh - 144px); text-align: center; }
.empty-state h1 { margin: 22px 0 20px; font-size: 24px; letter-spacing: 0; }
.empty-symbol { display: flex; align-items: flex-end; gap: 9px; height: 64px; }
.empty-symbol span { width: 16px; border-radius: 3px 3px 0 0; background: var(--line-strong); }
.empty-symbol span:nth-child(1) { height: 30px; background: #7db293; }
.empty-symbol span:nth-child(2) { height: 58px; background: #e7bc55; }
.empty-symbol span:nth-child(3) { height: 43px; background: #df7764; }

.detail-header { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; align-items: center; gap: 24px; min-height: 150px; padding-bottom: 28px; }
.detail-preview {
  display: grid;
  place-items: center;
  width: 132px;
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: #313a33;
  background: linear-gradient(135deg, transparent 0 43%, rgba(255,255,255,.72) 43% 57%, transparent 57%), linear-gradient(150deg, #dce8e0, #f3d6bd 52%, #d7e1ef);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 28px;
  font-weight: 800;
}
.detail-preview img { width: 100%; height: 100%; object-fit: cover; }
.detail-title { min-width: 0; }
.detail-title h1 { margin: 0; overflow-wrap: anywhere; font-size: clamp(26px, 3vw, 42px); line-height: 1.08; letter-spacing: 0; }
.detail-title p { max-width: 720px; margin: 12px 0 0; color: #545b61; font-size: 14px; line-height: 1.7; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.meta-pill { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: rgba(255,255,255,.55); font-size: 10px; font-weight: 700; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-strong); }
.tab { position: relative; padding: 12px 14px; }
.tab:hover, .tab.active { color: var(--ink); }
.tab.active::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 3px; background: var(--ink); content: ""; }
.tab-panel { display: none; padding-top: 28px; }
.tab-panel.active { display: block; }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line-strong); border-radius: 7px; background: rgba(255, 255, 255, 0.72); }
.metric { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric strong { display: block; font: 800 24px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.metric span { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.analysis-section { padding: 34px 0; border-bottom: 1px solid var(--line); }
.analysis-section:last-child { border-bottom: 0; }

.fingerprint-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; margin-top: 20px; }
.fingerprint-group { display: grid; grid-template-columns: 82px 1fr; align-items: start; gap: 12px; min-height: 42px; }
.fingerprint-group h3 { margin: 7px 0 0; color: var(--muted); font-size: 11px; font-weight: 700; }
.chip-row, .token-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.chip, .token { max-width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; overflow-wrap: anywhere; background: var(--surface); font-size: 11px; line-height: 1.35; }
.chip.artist { border-color: #d3c4e4; color: #674889; background: var(--violet-soft); }
.chip.style { border-color: #bbd0e9; color: #285784; background: #e9f0fa; }
.chip.render { border-color: #b9d9ca; color: #176447; background: var(--green-soft); }
.chip.light { border-color: #ecd59f; color: #82540b; background: var(--amber-soft); }
.chip.color { border-color: #ebc3bb; color: #9c3e30; background: var(--coral-soft); }
.chip.composition { border-color: #cdd1d4; color: #4d545b; background: #eff1f2; }
.chip.empty { color: #929993; background: transparent; }

.split-section { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; }
.prompt-overview { min-width: 0; }
.prompt-overview + .prompt-overview { padding-left: 34px; border-left: 1px solid var(--line); }
.section-heading.compact { align-items: center; margin-bottom: 16px; }
.section-heading.compact > div { display: flex; align-items: center; gap: 8px; }
.section-heading.compact h2 { font-size: 16px; }
.signal { width: 9px; height: 9px; border-radius: 50%; }
.positive-signal { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.negative-signal { background: var(--coral); box-shadow: 0 0 0 4px var(--coral-soft); }
.text-button { border: 0; color: var(--blue); background: transparent; cursor: pointer; font-size: 11px; font-weight: 800; }
.text-button:hover { text-decoration: underline; }

.token.quality { border-color: #b9d9ca; color: #176447; background: var(--green-soft); }
.token.artist { border-color: #d3c4e4; color: #674889; background: var(--violet-soft); }
.token.emphasis { border-color: #ecd59f; color: #82540b; background: var(--amber-soft); }
.token.suppressed { opacity: .62; text-decoration: line-through; }
.weight { margin-left: 5px; color: inherit; opacity: .65; font: 700 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.negative-groups, .negative-detail { display: grid; gap: 14px; }
.negative-group { min-width: 0; }
.negative-group h3 { margin: 0 0 7px; color: var(--muted); font-size: 10px; font-weight: 800; }
.negative-group .token { border-color: #ecc8c1; color: #87382d; background: #fff4f1; }

.raw-heading { margin-bottom: 18px; }
.prompt-raw, .json-raw {
  width: 100%;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  overflow: auto;
  color: #2b3035;
  background: rgba(255, 255, 255, 0.8);
  font: 12px/1.75 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.positive-raw { border-left-color: var(--green); }
.negative-raw { border-left-color: var(--coral); }
.json-raw { max-height: 65vh; }
.token-table { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 24px; border: 1px solid var(--line); background: var(--line); }
.token-row { display: grid; grid-template-columns: minmax(0, 1fr) 78px; gap: 12px; min-height: 44px; padding: 11px 13px; background: rgba(255,255,255,.86); font-size: 11px; }
.token-row span:first-child { overflow-wrap: anywhere; }
.token-kind { color: var(--muted); text-align: right; }
.negative-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 24px; }
.negative-detail .negative-group { padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.65); }

.drop-overlay { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: rgba(23, 26, 31, 0.76); backdrop-filter: blur(6px); }
.drop-overlay.visible { display: grid; }
.drop-overlay div { display: grid; place-items: center; width: 160px; aspect-ratio: 1; border: 2px dashed rgba(255,255,255,.75); border-radius: 8px; color: white; font: 800 26px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 110;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid #374039;
  border-radius: 6px;
  color: white;
  background: #202522;
  box-shadow: 0 16px 40px rgba(0,0,0,.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 12px;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #b53f30; background: #7d2e24; }

@media (max-width: 1080px) {
  .topbar { grid-template-columns: 240px minmax(240px, 1fr) auto; gap: 14px; }
  .workspace { grid-template-columns: 300px minmax(0, 1fr); }
  .library { padding-left: 16px; }
  .detail-header { grid-template-columns: 104px minmax(0, 1fr); }
  .detail-preview { width: 104px; }
  .detail-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .fingerprint-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .topbar { position: relative; grid-template-columns: 1fr auto; padding: 12px 16px; }
  .brand small { display: none; }
  .search-box { grid-column: 1 / -1; grid-row: 2; }
  .top-actions .button-quiet { display: none; }
  .workspace { display: block; }
  .library { position: relative; top: auto; height: 320px; padding: 18px 12px 12px 16px; border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .preset-list { height: 210px; }
  .inspector { padding: 24px 16px 56px; }
  .detail-header { grid-template-columns: 82px minmax(0, 1fr); gap: 16px; }
  .detail-preview { width: 82px; }
  .detail-title h1 { font-size: 25px; }
  .detail-title p { font-size: 12px; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .split-section { grid-template-columns: 1fr; gap: 30px; }
  .prompt-overview + .prompt-overview { padding-top: 30px; padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .fingerprint-group { grid-template-columns: 72px 1fr; }
  .token-table, .negative-detail { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .brand strong { font-size: 13px; }
  .top-actions .button { padding: 0 10px; }
  .library-heading { align-items: center; }
  .detail-header { grid-template-columns: 68px minmax(0, 1fr); }
  .detail-preview { width: 68px; }
  .detail-title h1 { font-size: 22px; }
  .detail-title p { display: none; }
  .detail-actions { width: 100%; }
  .detail-actions .button { flex: 1; }
  .metric { padding: 15px; }
  .metric strong { font-size: 21px; }
}

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

/* AsakuraZen theme */
:root {
  --bg: #111513;
  --surface: #191e1b;
  --surface-alt: #202622;
  --ink: #edf1ee;
  --muted: #9ca6a0;
  --line: #323a35;
  --line-strong: #323a35;
  --blue: #77b592;
  --blue-soft: #263c30;
  --green: #77b592;
  --green-soft: #263c30;
  --coral: #e28a80;
  --coral-soft: #432b29;
  --amber-soft: #3b3423;
  --violet-soft: #312d3b;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.24);
  color: var(--ink);
  background: var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

body {
  color: var(--ink);
  background: var(--bg);
  background-image: none;
}

.topbar {
  position: relative;
  top: auto;
  display: flex;
  grid-template-columns: none;
  justify-content: space-between;
  width: min(1060px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  padding: 0;
  border-bottom: 1px solid var(--border, #323a35);
  background: transparent;
  backdrop-filter: none;
}

.brand { gap: 10px; color: var(--ink); }
.brand strong { font-size: 16px; }
.brand small { display: none; }
.brand-mark {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: #77b592;
}
.brand-mark i { display: none; }
.brand-mark::before {
  position: absolute;
  top: 10px;
  left: 13px;
  width: 11px;
  height: 18px;
  border: 2px solid #f4faf6;
  border-radius: 100% 0 100% 0;
  content: "";
  transform: rotate(34deg);
}
.brand-mark::after {
  position: absolute;
  top: 20px;
  left: 17px;
  width: 10px;
  height: 2px;
  background: #f4faf6;
  content: "";
  transform: rotate(-42deg);
  transform-origin: left center;
}

.top-actions { gap: 0; }
.top-actions .button {
  min-width: 58px;
  height: 40px;
  min-height: 40px;
  margin-left: -1px;
  padding: 0 14px;
  border-radius: 0;
}
.top-actions .button:first-child { border-radius: 6px 0 0 6px; }
.top-actions .button:last-of-type { border-radius: 0 6px 6px 0; }
.top-actions .button:only-of-type { border-radius: 6px; }

.button {
  border-color: var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: none;
}
.button:hover {
  border-color: #4a574f;
  color: #ffffff;
  background: var(--surface-alt);
  transform: none;
}
.button-primary { border-color: var(--line); color: var(--ink); background: var(--surface); }
.button-quiet { border-color: var(--line); color: var(--muted); background: var(--surface); }

.workspace {
  grid-template-columns: 300px minmax(0, 1fr);
  width: min(1060px, calc(100% - 32px));
  min-height: calc(100vh - 76px);
  margin: 0 auto;
}

.library {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 20px 24px 0;
  border-right: 1px solid var(--line);
  background: transparent;
}
.library-heading { display: none; }

.search-box {
  min-height: 40px;
  padding: 0 11px;
  border-color: var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: none;
}
.search-box > span { color: var(--muted); font-size: 20px; }
.search-box input { color: var(--ink); }
.search-box input::placeholder { color: #78827c; }
.search-box kbd { border-color: var(--line); color: var(--muted); background: var(--surface-alt); }

.filter-row { gap: 4px; margin: 14px 0 12px; }
.filter {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
}
.filter:hover { color: var(--ink); background: var(--surface); }
.filter.active { border-color: var(--line); color: var(--accent-strong, #91c8a7); background: var(--accent-soft, #263c30); }

.preset-list { height: calc(100% - 98px); padding-right: 8px; scrollbar-color: #465149 transparent; }
.preset-item {
  grid-template-columns: 44px minmax(0, 1fr);
  min-height: 58px;
  margin-bottom: 5px;
  padding: 7px;
  border-radius: 6px;
  color: var(--ink);
}
.preset-item:hover { border-color: var(--line); background: var(--surface); }
.preset-item.active { border-color: #48554d; background: var(--surface-alt); box-shadow: none; }
.preset-thumb {
  width: 44px;
  height: 44px;
  border-color: var(--line);
  border-radius: 5px;
  color: #c8d0cb;
  background: #252c28;
}
.preset-copy strong { color: var(--ink); font-size: 13px; }
.preset-copy small { margin-top: 4px; color: var(--muted); }
.preset-index { display: none; }
.list-empty { color: var(--muted); }

.inspector { padding: 28px 0 64px 32px; }
.detail { width: 100%; }
.detail-header {
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 18px;
  min-height: 112px;
  padding-bottom: 24px;
}
.detail-preview {
  width: 84px;
  border-color: var(--line);
  border-radius: 6px;
  color: #d9dfdb;
  background: var(--surface-alt);
  box-shadow: none;
  font-size: 20px;
}
.detail-title h1 { color: var(--ink); font-size: 26px; }
.detail-title p, .detail-meta, .detail-actions, #detailSequence { display: none; }
.eyebrow { display: none; }

.tabs { gap: 0; border-bottom-color: var(--line); }
.tab {
  min-width: 64px;
  padding: 12px 15px;
  border-radius: 0;
  color: var(--muted);
  font-size: 13px;
}
.tab:hover, .tab.active { color: var(--ink); background: transparent; }
.tab.active::after { right: 14px; left: 14px; height: 2px; background: var(--accent, #77b592); }
.tab[data-tab="raw"], .tab-panel[data-panel="raw"] { display: none !important; }
.tab-panel { padding-top: 24px; }

.metric-strip, .split-section { display: none; }
.analysis-section {
  padding: 0;
  border: 0;
}
.analysis-section > .section-heading { display: none; }
.fingerprint-grid { grid-template-columns: 1fr; gap: 0; margin-top: 0; }
.fingerprint-group {
  grid-template-columns: 76px minmax(0, 1fr);
  min-height: 52px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.fingerprint-group h3 { margin-top: 7px; color: var(--muted); font-size: 12px; }

.chip, .token {
  border-color: var(--line);
  border-radius: 5px;
  color: #cbd3ce;
  background: var(--surface);
}
.chip.artist, .token.artist { border-color: #4a4058; color: #c7b2dc; background: #312d3b; }
.chip.style { border-color: #365143; color: #a9d5bc; background: #263c30; }
.chip.render, .token.quality { border-color: #365143; color: #a9d5bc; background: #263c30; }
.chip.light, .token.emphasis { border-color: #544a30; color: #dbc98d; background: #3b3423; }
.chip.color { border-color: #58403c; color: #e5a69f; background: #432b29; }
.chip.composition { border-color: var(--line); color: #bbc4be; background: var(--surface-alt); }
.chip.empty { border-color: var(--line); color: #657069; background: transparent; }

.raw-heading { align-items: center; margin-bottom: 14px; }
.raw-heading h2 { color: var(--ink); font-size: 17px; }
.prompt-raw, .json-raw {
  padding: 16px;
  border-color: var(--line);
  border-left-width: 2px;
  border-radius: 6px;
  color: #d6ddd8;
  background: var(--surface);
}
.positive-raw { border-left-color: var(--accent, #77b592); }
.negative-raw { border-left-color: var(--danger, #e28a80); }
.token-table {
  grid-template-columns: 1fr;
  margin-top: 16px;
  border-color: var(--line);
  background: var(--line);
}
.token-row { color: #d0d7d2; background: var(--surface); }
.token-kind { color: var(--muted); }
.negative-detail { grid-template-columns: 1fr; margin-top: 16px; }
.negative-detail .negative-group {
  padding: 14px;
  border-color: var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.negative-group h3 { color: var(--muted); }
.negative-group .token { border-color: #5a3f3b; color: #e3a39b; background: var(--danger-soft, #432b29); }
.text-button { color: var(--accent-strong, #91c8a7); }

.empty-state { min-height: calc(100vh - 150px); }
.empty-state h1 { color: var(--ink); font-size: 18px; }
.empty-symbol { display: none; }
.drop-overlay { background: rgba(6, 8, 7, 0.88); }
.drop-overlay div { border-color: #77b592; color: #a9d5bc; }
.toast { border-color: var(--line); background: var(--surface-alt); }
.toast.error { border-color: #7f4d47; background: var(--danger-soft); }

@media (max-width: 780px) {
  .topbar {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 64px;
    padding: 0 16px;
  }
  .brand-mark { width: 36px; height: 36px; }
  .brand-mark::before { top: 8px; left: 11px; }
  .brand-mark::after { top: 18px; left: 15px; }
  .top-actions .button { display: block; height: 38px; min-height: 38px; }
  .top-actions .button-quiet { display: none; }
  .workspace { display: block; width: 100%; }
  .library {
    position: relative;
    top: auto;
    height: 300px;
    padding: 18px 16px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .preset-list { height: 204px; }
  .inspector { padding: 22px 16px 52px; }
  .detail-header { grid-template-columns: 68px minmax(0, 1fr); gap: 14px; min-height: 92px; }
  .detail-preview { width: 68px; }
  .detail-title h1 { font-size: 22px; }
  .tabs { overflow-x: visible; }
  .tab { flex: 1; min-width: 0; padding: 11px 8px; }
  .fingerprint-group { grid-template-columns: 62px minmax(0, 1fr); }
}

@media (max-width: 440px) {
  .topbar { grid-template-columns: none; }
  .brand strong { font-size: 15px; }
  .top-actions .button { padding: 0 13px; }
  .detail-header { grid-template-columns: 62px minmax(0, 1fr); }
  .detail-preview { width: 62px; }
  .detail-title h1 { font-size: 20px; }
}

.account-button {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  margin-left: 10px;
  padding: 0 11px 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}
.account-button:hover { border-color: #4a574f; background: var(--surface-alt); }
.account-avatar,
.avatar-editor span {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 4px;
  color: #142019;
  background: var(--accent, #77b592);
  font-weight: 800;
  background-position: center;
  background-size: cover;
}
.account-avatar { width: 28px; height: 28px; font-size: 11px; }
.account-button > span:last-child { max-width: 100px; overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.account-dialog {
  width: min(430px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: auto;
}
.account-dialog[open] { display: block; }
.account-dialog::backdrop { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px); }
.auth-dialog { width: min(390px, calc(100vw - 28px)); }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.dialog-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-alt);
  cursor: pointer;
  font-size: 20px;
}
.dialog-close:hover { color: var(--ink); }
.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 16px 20px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}
.auth-switch button {
  height: 32px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.auth-switch button.active { color: var(--ink); background: var(--surface-alt); }
.dialog-form { display: grid; gap: 14px; padding: 20px; }
.dialog-form + .dialog-form { border-top: 1px solid var(--line); }
.dialog-form label { display: grid; gap: 7px; }
.dialog-form label > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.dialog-form input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  color: var(--ink);
  background: var(--bg);
}
.dialog-form input:focus { border-color: var(--accent, #77b592); }
.dialog-submit {
  height: 40px;
  border: 1px solid #42604f;
  border-radius: 6px;
  color: #dff1e6;
  background: var(--accent-soft, #263c30);
  cursor: pointer;
  font-weight: 800;
}
.dialog-submit:hover { background: #304b3a; }
.form-error { min-height: 16px; margin: -4px 0 0; color: var(--danger, #e28a80); font-size: 11px; }
.account-profile {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}
.account-profile strong, .account-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-profile strong { font-size: 15px; }
.account-profile small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.avatar-editor {
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}
.avatar-editor span { width: 58px; height: 58px; font-size: 18px; }
.compact-form { gap: 12px; }
.password-form { background: #171b19; }
.account-links {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
}
.account-links a,
.account-links button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-alt);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 32px;
  text-decoration: none;
}
.account-links a:hover { color: var(--accent-strong, #91c8a7); }
.account-links button:hover { color: var(--danger, #e28a80); }

@media (max-width: 520px) {
  .account-button { width: 40px; padding: 0 5px; }
  .account-button > span:last-child { display: none; }
}

/* Wireframe-based library layout */
body { min-width: 0; padding: 18px; }

.topbar {
  width: min(1180px, 100%);
  min-height: 76px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line);
  background: #151a17;
}
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-size: 16px; line-height: 1.2; }
.brand-copy small { display: block; color: var(--muted); font-size: 10px; }
.brand-mark {
  width: 34px;
  height: 34px;
  border: 2px solid #9ec7ae;
  border-radius: 3px;
  background: transparent;
}
.brand-mark::before {
  top: 8px;
  left: 10px;
  width: 9px;
  height: 15px;
  border-color: #9ec7ae;
}
.brand-mark::after { top: 17px; left: 13px; background: #9ec7ae; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions .button,
.account-button { margin: 0; border-radius: 6px; }

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  width: min(1180px, 100%);
  min-height: calc(100vh - 112px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-top: 0;
  background: #111513;
}
.library {
  position: relative;
  top: auto;
  height: calc(100vh - 112px);
  min-height: 560px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
}
.library-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
.library-toolbar .button { width: 100%; height: 38px; min-height: 38px; }
.group-strip {
  display: flex;
  gap: 6px;
  margin: 12px -2px 10px;
  padding: 0 2px 10px;
  border-bottom: 1px dashed var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.group-strip::-webkit-scrollbar { display: none; }
.group-strip button {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}
.group-strip button:hover { color: var(--ink); background: var(--surface); }
.group-strip button.active { border-color: #3d5547; color: #b9dfc7; background: var(--blue-soft); }
.preset-list { height: calc(100% - 132px); padding-right: 4px; }
.preset-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 8px;
  margin-bottom: 7px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 6px;
}
.preset-card:hover { border-color: var(--line); background: #171c19; }
.preset-card.active { border-color: #4a5d51; background: var(--surface); }
.preset-item {
  grid-column: 1 / -1;
  grid-template-columns: 48px minmax(0, 1fr);
  min-height: 50px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.preset-item:hover,
.preset-item.active { border: 0; background: transparent; box-shadow: none; }
.preset-thumb { width: 48px; height: 48px; }
.preset-copy strong { font-size: 13px; }
.preset-copy small { max-width: 210px; font-size: 10px; }
.preset-actions { grid-column: 2; display: flex; justify-content: flex-end; gap: 4px; }
.preset-actions button {
  min-height: 25px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}
.preset-actions button:hover { color: var(--ink); background: var(--surface-alt); }
.preset-actions button[data-preset-action="delete"]:hover { color: var(--danger); border-color: #674641; }

.inspector { min-width: 0; padding: 14px 18px 40px; }
.detail-header {
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: start;
  gap: 24px;
  min-height: 190px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}
.detail-preview { width: 150px; aspect-ratio: 4 / 5; border-radius: 3px; font-size: 28px; }
.detail-title { min-width: 0; padding-top: 10px; }
.detail-title h1 { margin: 6px 0 8px; font-size: 24px; }
#detailSequence { display: block; color: var(--accent-strong, #91c8a7); font-size: 11px; }
.detail-title p { display: block; margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.detail-actions { display: flex; gap: 6px; padding-top: 10px; }
.detail-actions .button { min-height: 34px; padding: 0 10px; }
.detail .fingerprint-grid { display: grid; gap: 5px; }
.detail .fingerprint-group {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  min-height: 0;
  padding: 0;
  border: 0;
}
.detail .fingerprint-group h3 { margin: 5px 0 0; font-size: 10px; }
.detail .chip { min-height: 25px; padding: 4px 7px; font-size: 10px; }
.fingerprint-empty { color: var(--muted); font-size: 11px; }

.prompt-stack { display: grid; gap: 12px; padding-top: 16px; }
.prompt-panel { padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #151a17; }
.prompt-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.prompt-panel-head h2 { margin: 0; font-size: 15px; }
.prompt-panel .prompt-raw { max-height: 190px; margin: 0; overflow: auto; }
.prompt-panel .token-table { max-height: 210px; overflow: auto; }
.prompt-panel .negative-detail { max-height: 280px; overflow: auto; }
.text-button { border: 0; background: transparent; cursor: pointer; font-size: 11px; }

.group-create { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.group-create input,
.group-row input,
.edit-dialog select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: 0;
  color: var(--ink);
  background: var(--bg);
}
.group-list { display: grid; gap: 7px; padding: 16px 20px 20px; }
.group-row { display: grid; grid-template-columns: minmax(0, 1fr) 28px 48px 48px; align-items: center; gap: 6px; }
.group-row span { color: var(--muted); text-align: center; font-size: 11px; }
.group-row button {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-alt);
  cursor: pointer;
  font-size: 10px;
}
.group-row button:hover { color: var(--ink); }
.group-empty { margin: 0; padding: 18px; color: var(--muted); text-align: center; font-size: 12px; }
.notice-content { padding: 22px 20px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.notice-content p { margin: 0; }

@media (max-width: 860px) {
  body { padding: 0; }
  .topbar { width: 100%; border-width: 0 0 1px; }
  .workspace { display: block; width: 100%; border: 0; }
  .library { height: 360px; min-height: 0; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .preset-list { height: 226px; }
  .inspector { padding: 18px 16px 42px; }
  .detail-header { grid-template-columns: 104px minmax(0, 1fr); min-height: 150px; gap: 16px; }
  .detail-preview { width: 104px; }
  .detail-actions { grid-column: 1 / -1; padding-top: 0; }
}

@media (max-width: 520px) {
  .topbar { min-height: 64px; padding: 0 12px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy small { font-size: 9px; }
  .top-actions { gap: 5px; }
  .top-actions .button { min-width: 48px; padding: 0 10px; }
  .account-button { margin-left: 0; }
  .library { height: 350px; padding: 12px; }
  .preset-list { height: 216px; }
  .detail-header { grid-template-columns: 76px minmax(0, 1fr); min-height: 120px; gap: 12px; }
  .detail-preview { width: 76px; }
  .detail-title { padding-top: 3px; }
  .detail-title h1 { font-size: 19px; }
  .detail-title p, .detail-meta { display: none; }
  .detail .fingerprint-group { grid-template-columns: 44px minmax(0, 1fr); }
  .prompt-panel { padding: 12px; }
  .prompt-panel .prompt-raw { max-height: 160px; }
}

.auth-dialog .dialog-form { padding-bottom: 14px; }
.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
  padding: 0 20px 20px;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}
.auth-switch button,
.auth-switch button.active {
  width: auto;
  height: auto;
  padding: 2px;
  border: 0;
  color: var(--accent-strong, #91c8a7);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}
.auth-switch button:hover { color: #c6ead3; text-decoration: underline; }
.auth-avatar-field {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding-bottom: 2px;
}
.auth-avatar-button {
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-alt);
  cursor: pointer;
}
.auth-avatar-button span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
  color: #152019;
  background: var(--accent, #77b592);
  background-position: center;
  background-size: cover;
  font-size: 14px;
  font-weight: 800;
}
.auth-avatar-field strong,
.auth-avatar-field small { display: block; }
.auth-avatar-field strong { font-size: 12px; }
.auth-avatar-field small { margin-top: 5px; color: var(--muted); font-size: 10px; }

.crop-dialog { width: min(480px, calc(100vw - 24px)); }
.crop-workspace { display: grid; gap: 16px; padding: 18px; }
#avatarCropCanvas {
  width: min(100%, 380px);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b0e0c;
  cursor: grab;
  touch-action: none;
}
#avatarCropCanvas:active { cursor: grabbing; }
.crop-zoom { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.crop-zoom input { width: 100%; accent-color: var(--accent, #77b592); }
.crop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.crop-actions .button { min-height: 40px; }

.mobile-detail-bar { display: none; }

@media (min-width: 861px) {
  html,
  body { height: 100%; overflow: hidden; }
  .workspace {
    height: calc(100vh - 112px);
    min-height: 0;
    overflow: hidden;
  }
  .library {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  .inspector {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: #465149 transparent;
  }
}

/* Detail readability and prompt interpretation */
.detail-meta .meta-pill {
  border-color: #38443d;
  color: #aebbb3;
  background: #1b211e;
}

button.detail-preview {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  font: inherit;
  cursor: pointer;
}
.detail-preview img { object-fit: contain; }
.detail-preview:focus-visible { outline: 2px solid var(--accent-strong, #91c8a7); outline-offset: 2px; }
.preview-fallback { font-weight: 800; }
.preview-upload {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 7px 4px;
  color: #d9eee1;
  background: rgba(27, 39, 32, 0.94);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  transition: opacity 150ms ease;
}
.detail-preview.has-image .preview-upload { opacity: 0; }
.detail-preview.has-image:hover .preview-upload,
.detail-preview.has-image:focus-visible .preview-upload { opacity: 1; }

.prompt-panel .positive-detail,
.prompt-panel .negative-detail { margin-top: 0; }
.prompt-panel .positive-detail { max-height: 430px; }
.prompt-panel .negative-detail { max-height: 430px; }
.prompt-panel .prompt-raw {
  max-height: 220px;
  margin: 0;
  color: #f1f4f2;
  overflow: auto;
}
.prompt-fragment {
  border-radius: 2px;
  transition: color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}
.positive-raw .prompt-fragment.active {
  color: #0e1b13;
  background: #9ad2ae;
  box-shadow: 0 0 0 2px #9ad2ae;
}
.negative-raw .prompt-fragment.active {
  color: #24100e;
  background: #e7a098;
  box-shadow: 0 0 0 2px #e7a098;
}
.prompt-analysis-label {
  margin: 14px 0 8px;
  color: #9aa69f;
  font-size: 12px;
  font-weight: 800;
}
.token-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  min-height: 58px;
  padding: 10px 12px;
}
.token-copy { display: grid; gap: 4px; min-width: 0; }
.token-copy strong { color: #e0e7e2; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.token-copy small { color: #9ba79f; font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.token-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; max-width: 190px; }
.token-kind,
.weight-badge,
.count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid #3a453f;
  border-radius: 4px;
  color: #9eaaa3;
  background: #1b211e;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.weight-badge.reduced { border-color: #4f4732; color: #d1bd7a; background: #302b1e; }
.weight-badge.normal { border-color: #385043; color: #a7d0b7; background: #22362b; }
.weight-badge.boosted { border-color: #45614f; color: #bce3ca; background: #294234; }
.weight-badge.strong { border-color: #6a5430; color: #f0ce83; background: #43361f; }
.weight-badge.reverse { border-color: #6a413c; color: #e7a39a; background: #402725; }
.count-badge { border-color: #454153; color: #beb4cf; background: #292632; }

.token {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.token .token-label { min-width: 0; overflow-wrap: anywhere; }
.token .token-translation {
  flex-basis: 100%;
  color: #cbd3ce;
  opacity: 1;
  font: 12px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-wrap: anywhere;
}
.token .weight-badge,
.token .count-badge { min-height: 21px; padding: 0 6px; font-size: 10px; }
.token.suppressed { text-decoration: none; }

.positive-detail,
.negative-detail { display: grid; grid-template-columns: 1fr; gap: 12px; overflow: auto; }
.positive-group,
.negative-detail .negative-group {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  transition: border-color 120ms ease, background-color 120ms ease;
}
.positive-group h3,
.negative-detail .negative-group h3 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.positive-group .token { border-color: #385043; color: #b7d9c3; background: #223229; }
.positive-group .token,
.negative-detail .negative-group .token {
  min-height: 52px;
  padding: 8px 10px;
  color: #f1f4f2;
  font-size: 14px;
  line-height: 1.5;
}
.positive-group .token .weight-badge,
.negative-detail .negative-group .token .weight-badge { color: #f1f4f2; }
.positive-group .token.highlighting { border-color: #79ad8d; background: #2b4736; }
.negative-detail .negative-group .token.highlighting { border-color: #b87770; background: #55312d; }

.raw-details { margin-top: 12px; border-top: 1px solid var(--line); }
.raw-details summary {
  width: max-content;
  padding: 10px 0 0;
  color: #87958d;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  list-style-position: inside;
}
.raw-details[open] summary { color: var(--accent-strong, #91c8a7); }
.raw-details .prompt-raw { margin-top: 10px; }

@media (max-width: 520px) {
  .token-row { grid-template-columns: 1fr; }
  .token-meta { justify-content: flex-start; max-width: none; }
  .prompt-panel .positive-detail,
  .prompt-panel .negative-detail { max-height: none; }
}

@media (max-width: 860px) {
  .workspace { min-height: calc(100dvh - 68px); }
  .library {
    display: block;
    height: calc(100dvh - 68px);
    min-height: 0;
    overflow: hidden;
  }
  .preset-list { height: calc(100% - 132px); }
  .inspector { display: none; }
  .workspace.mobile-detail-open { min-height: 100dvh; }
  .workspace.mobile-detail-open .library { display: none; }
  .workspace.mobile-detail-open .inspector { display: block; min-height: 100dvh; padding: 0 14px 42px; }
  body.mobile-detail-mode .topbar { display: none; }
  .mobile-detail-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 58px;
    margin: 0 -14px 16px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(17, 21, 19, 0.96);
    backdrop-filter: blur(10px);
  }
  .mobile-detail-bar button {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 5px;
    color: var(--ink);
    background: var(--surface);
    cursor: pointer;
  }
  .mobile-detail-bar strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 520px) {
  .workspace { min-height: calc(100dvh - 64px); }
  .library { height: calc(100dvh - 64px); }
}

@media (min-width: 861px) {
  body { padding: 12px; }

  .topbar,
  .workspace {
    width: min(2200px, calc(100vw - 24px));
  }

  .topbar { min-height: 76px; padding: 0 20px; }
  .brand-copy strong { font-size: 18px; }
  .brand-copy small { font-size: 11px; }
  .top-actions .button,
  .account-button { font-size: 13px; }

  .workspace {
    grid-template-columns: clamp(330px, 22vw, 390px) minmax(0, 1fr);
    height: calc(100vh - 100px);
    min-height: 0;
  }
  .library { height: 100%; padding: 18px 16px; }
  .search-box { min-height: 46px; }
  .search-box input { font-size: 15px; }
  .library-toolbar .button { height: 42px; min-height: 42px; font-size: 14px; }
  .group-strip button { height: 32px; padding: 0 11px; font-size: 12px; }
  .preset-card { gap: 8px 10px; margin-bottom: 9px; padding: 9px; }
  .preset-item { grid-template-columns: 56px minmax(0, 1fr); min-height: 58px; }
  .preset-thumb { width: 56px; height: 56px; font-size: 14px; }
  .preset-copy strong { font-size: 15px; }
  .preset-copy small { max-width: 260px; font-size: 12px; }
  .preset-actions button { min-height: 29px; padding: 0 9px; font-size: 11px; }

  .inspector { padding: 18px 22px 52px; }
  .detail-header {
    grid-template-columns: 170px minmax(0, 1fr) auto;
    gap: 28px;
    min-height: 215px;
    padding-bottom: 22px;
  }
  .detail-preview { width: 170px; font-size: 31px; }
  .preview-upload { padding: 9px 5px; font-size: 11px; }
  .detail-title h1 { font-size: 30px; }
  #detailSequence { font-size: 12px; }
  .detail-title p { font-size: 14px; }
  .meta-pill { padding: 6px 9px; font-size: 11px; }
  .detail-actions .button { min-height: 38px; padding: 0 13px; font-size: 13px; }
  .detail .fingerprint-group { grid-template-columns: 64px minmax(0, 1fr); gap: 8px; }
  .detail .fingerprint-group h3 { margin-top: 7px; font-size: 12px; }
  .detail .chip { min-height: 30px; padding: 6px 9px; font-size: 12px; }
  .fingerprint-empty { font-size: 12px; }

  .prompt-stack { gap: 16px; padding-top: 20px; }
  .prompt-panel { padding: 18px; }
  .prompt-panel-head { margin-bottom: 12px; }
  .prompt-panel-head h2 { font-size: 18px; }
  .text-button { font-size: 12px; }
  .prompt-panel .prompt-raw {
    max-height: 260px;
    padding: 18px;
    font-size: 14px;
    line-height: 1.8;
  }
  .prompt-analysis-label { margin: 16px 0 10px; font-size: 12px; }
  .prompt-panel .positive-detail,
  .prompt-panel .negative-detail { max-height: 520px; }
  .positive-detail,
  .negative-detail { gap: 14px; }
  .positive-group,
  .negative-detail .negative-group { padding: 16px; }
  .positive-group h3,
  .negative-detail .negative-group h3 { margin-bottom: 12px; font-size: 14px; }
  .positive-group .token-cloud,
  .negative-detail .negative-group .token-cloud {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr));
    gap: 10px;
  }
  .positive-group .token,
  .negative-detail .negative-group .token {
    width: 100%;
    min-height: 64px;
    padding: 10px 12px;
    align-content: center;
    font-size: 15px;
    line-height: 1.55;
  }
  .token .token-translation { font-size: 13px; line-height: 1.45; }
  .token .weight-badge,
  .token .count-badge { min-height: 23px; padding: 0 7px; font-size: 11px; }
}

.prompt-panel .positive-detail,
.prompt-panel .negative-detail {
  max-height: none;
  overflow: visible;
}

.prompt-sticky {
  position: sticky;
  top: 0;
  z-index: 12;
  padding-bottom: 14px;
  background: #151a17;
}
.prompt-sticky .prompt-raw {
  max-height: min(260px, 38vh);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}
