/* Silicic Icons 预览页。颜色是 macOS 系统语义色的近似值，只在这一页用；产品里取真正的系统色。 */
:root {
  --page: #ffffff;
  --panel: #f5f5f7;
  --line: rgba(0, 0, 0, 0.1);
  --label: rgba(0, 0, 0, 0.85);
  --label-secondary: rgba(0, 0, 0, 0.5);
  --label-tertiary: rgba(0, 0, 0, 0.26);
  --fill-secondary: rgba(0, 0, 0, 0.12);
  --fill-tertiary: rgba(0, 0, 0, 0.08);
  --fill-quaternary: rgba(0, 0, 0, 0.05);
  --accent: #007aff;
  --grid: rgba(0, 0, 0, 0.08);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --page: #1e1e1e;
  --panel: #2a2a2c;
  --line: rgba(255, 255, 255, 0.12);
  --label: rgba(255, 255, 255, 0.85);
  --label-secondary: rgba(255, 255, 255, 0.55);
  --label-tertiary: rgba(255, 255, 255, 0.25);
  --fill-secondary: rgba(255, 255, 255, 0.16);
  --fill-tertiary: rgba(255, 255, 255, 0.11);
  --fill-quaternary: rgba(255, 255, 255, 0.07);
  --accent: #0a84ff;
  --grid: rgba(255, 255, 255, 0.1);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-padding-top: var(--bar-height, 160px); }

body {
  margin: 0;
  background: var(--page);
  color: var(--label);
  font: 13px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

/* ---------- 顶栏 ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 14px 24px 10px;
  background: var(--page);
  border-bottom: 1px solid var(--line);
}

.bar-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.bar-head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  white-space: nowrap;
}

.summary {
  margin: 0;
  flex: 1 1 200px;
  min-width: 0;
  color: var(--label-secondary);
  font-size: 12px;
}

.search {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 340px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  outline: none;
}

.search:focus { border-color: var(--accent); }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 10px;
}

.control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.control-name {
  flex: none;
  color: var(--label-secondary);
  font-size: 12px;
}

.segments {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  padding: 2px;
  gap: 2px;
  border-radius: 8px;
  background: var(--fill-quaternary);
}

.segments button {
  flex: none;
  height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--label-secondary);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.segments button:hover { color: var(--label); }

.segments button[aria-pressed="true"] {
  background: var(--page);
  color: var(--label);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* ---------- 分区导航 ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 12px 24px 0;
}

.tabs a {
  color: var(--label-secondary);
  text-decoration: none;
  white-space: nowrap;
}

.tabs a:hover { color: var(--accent); }
.tabs a span { margin-left: 4px; color: var(--label-tertiary); font-variant-numeric: tabular-nums; }

/* ---------- 内容 ---------- */
main { padding: 4px 24px 24px; }

.section > h2 {
  margin: 26px 0 4px;
  font-size: 16px;
  font-weight: 650;
}

.section > .note {
  margin: 0 0 6px;
  max-width: 78ch;
  color: var(--label-secondary);
  font-size: 12px;
}

.group > h3 {
  margin: 16px 0 8px;
  color: var(--label-secondary);
  font-size: 12px;
  font-weight: 600;
}

.group > h3 span { margin-left: 6px; color: var(--label-tertiary); font-weight: 400; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(132px, 100%), 1fr));
  gap: 6px;
}

.tiles.wide { grid-template-columns: repeat(auto-fill, minmax(min(252px, 100%), 1fr)); }

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 10px 8px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: center;
  cursor: pointer;
}

.tiles.wide .tile {
  flex-direction: row;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  text-align: left;
}

.tile:hover { border-color: var(--line); background: var(--panel); }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tile.is-open { border-color: var(--accent); }

.tile-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

.tiles:not(.wide) .tile-text { margin-top: 8px; }
.tiles.wide .tile-text { flex: 1 1 0; }

.tile-id, .tile-label {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-id { font: 11px/1.45 var(--mono); }
.tile-label { color: var(--label-secondary); font-size: 11px; line-height: 1.45; }
.tiles.wide .tile-id { font: 12.5px/1.45 var(--sans); }
.tiles.wide .tile-label { font: 11px/1.45 var(--mono); }

.empty { margin: 28px 0; color: var(--label-secondary); }

/* ---------- 图标与状态 ---------- */
.plate {
  --icon-color: var(--label-secondary);
  display: grid;
  place-items: center;
  flex: none;
  width: calc(var(--icon-size, 20px) + 18px);
  height: calc(var(--icon-size, 20px) + 18px);
  border-radius: 9px;
  color: var(--icon-color);
}

.plate svg { display: block; width: var(--icon-size, 20px); height: var(--icon-size, 20px); overflow: hidden; }

body[data-state="hover"] .plate { background: var(--fill-quaternary); }
body[data-state="pressed"] .plate { background: var(--fill-secondary); }
body[data-state="selected"] .plate { background: var(--fill-tertiary); }
body[data-state="pressed"] .plate.neutral, body[data-state="selected"] .plate.neutral { --icon-color: var(--label); }
body[data-state="dimmed"] .plate.neutral { --icon-color: var(--label-tertiary); }
body[data-state="dimmed"] .plate:not(.neutral) svg, body[data-state="off"] .plate.brand svg { filter: grayscale(1); }
:root[data-theme="dark"] body[data-state="dimmed"] .plate:not(.neutral) svg,
:root[data-theme="dark"] body[data-state="off"] .plate.brand svg { filter: grayscale(1) brightness(1.35); }
body[data-state="disabled"] .plate { opacity: 0.4; }

.tone-blue { --icon-color: var(--tone-blue); }
.tone-green { --icon-color: var(--tone-green); }
.tone-orange { --icon-color: var(--tone-orange); }
.tone-red { --icon-color: var(--tone-red); }
.tone-pink { --icon-color: var(--tone-pink); }
.tone-purple { --icon-color: var(--tone-purple); }
.tone-indigo { --icon-color: var(--tone-indigo); }
.tone-teal { --icon-color: var(--tone-teal); }
.tone-brown { --icon-color: var(--tone-brown); }
.tone-accent { --icon-color: var(--accent); }

/* ---------- 文件名试配 ---------- */
.matcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 10px 0 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel);
}

.matcher input[type="text"] {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 320px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--page);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}

.matcher input[type="text"]:focus { border-color: var(--accent); }
.matcher label { display: flex; align-items: center; gap: 5px; color: var(--label-secondary); font-size: 12px; white-space: nowrap; }

.matcher-result {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 220px;
}

.matcher-result .plate { width: 30px; height: 30px; --icon-size: 16px; background: none !important; opacity: 1 !important; }
.matcher-result span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matcher-result code { color: var(--label-secondary); font: 11px var(--mono); }

/* ---------- 详情 ---------- */
.detail {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--page);
  box-shadow: var(--shadow);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.detail-head h2 {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  font: 600 14px/1.4 var(--mono);
  overflow-wrap: anywhere;
}

.detail-close {
  flex: none;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: var(--fill-quaternary);
  line-height: 1;
  cursor: pointer;
}

.detail-sub { margin: 2px 0 10px; color: var(--label-secondary); overflow-wrap: anywhere; }

.detail-stage {
  display: grid;
  place-items: center;
  height: 176px;
  border-radius: 10px;
  background: var(--panel);
}

.detail-canvas {
  position: relative;
  width: 144px;
  height: 144px;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 9px 9px;
  box-shadow: inset 0 0 0 1px var(--grid);
}

.detail-canvas .plate { width: 144px; height: 144px; --icon-size: 144px; border-radius: 0; background: none !important; }

.detail-sizes {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  margin: 10px 0 4px;
}

.detail-sizes .plate { width: auto; height: auto; background: none !important; }

.detail dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 3px 12px;
  margin: 10px 0;
  font-size: 12px;
}

.detail dt { color: var(--label-secondary); }
.detail dd { margin: 0; overflow-wrap: anywhere; }
.detail dd code { font: 11px var(--mono); }

.detail-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.detail-actions button {
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  font-size: 12px;
  cursor: pointer;
}

.detail-actions button:hover { border-color: var(--accent); }

.foot {
  padding: 4px 24px 40px;
  color: var(--label-tertiary);
  font-size: 11.5px;
}

.foot p { max-width: 90ch; margin: 0; }

[hidden] { display: none !important; }

/* 窄屏上控件要折成好几行：顶栏不再吸顶，免得占掉半个屏幕。 */
@media (max-width: 760px) {
  .bar { position: static; }
  html { scroll-padding-top: 12px; }
}

@media (max-width: 560px) {
  .bar { padding: 10px 14px 8px; }
  .tabs { padding: 10px 14px 0; }
  main { padding: 4px 14px 20px; }
  .foot { padding: 4px 14px 32px; }
  .search { max-width: none; }
}
