/* Icon Fetch —— 检查器式界面：左侧检索列表，右侧资源面板
   石墨中性色 + 一个钴蓝强调色；数据用等宽，界面用系统无衬线 */

:root {
  color-scheme: dark;
  --bg: #141415;
  --card: #19191b;
  --raised: #232325;
  --raised-2: #2e2e33;
  --ink: #ededed;
  --ink-2: #a1a1a6;
  --muted: #85858b;
  --line: rgba(237, 237, 237, 0.08);
  --line-2: rgba(237, 237, 237, 0.16);
  --accent: #6b93ff;
  --danger: #ff7b72;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.6, 0.35, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 顶栏 ---------- */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  flex-none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.brand svg {
  color: var(--ink);
}

.region select {
  height: 28px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2385858b' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.region select:hover {
  border-color: var(--line-2);
}

/* ---------- 双栏骨架 ---------- */

.shell {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

/* ---------- 左：检索与列表 ---------- */

.pane-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--card);
}

.search {
  display: flex;
  gap: 8px;
  flex: none;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.search input::placeholder {
  color: var(--muted);
}

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

.search input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.search button {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #17171a;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.12s var(--ease);
}

.search button:hover {
  opacity: 0.88;
}

.search button:disabled {
  opacity: 0.5;
  cursor: progress;
}

.examples {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  flex: none;
}

.example {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.12s var(--ease);
}

.example:hover {
  color: var(--accent);
}

.dot {
  color: var(--line-2);
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 20px 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  outline: none;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

.row + .row {
  margin-top: 2px;
}

.row:hover {
  background: var(--raised);
}

.row[aria-selected="true"] {
  background: var(--raised);
  box-shadow: inset 2px 0 0 var(--accent);
}

.row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.row-thumb {
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background-color: #232327;
}

.row-thumb img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: cover;
  transition: transform 0.12s var(--ease);
}

.row-text {
  min-width: 0;
}

.row-name {
  display: block;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-seller {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--danger);
  flex: none;
}

.status:empty {
  display: none;
}

.credit {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  flex: none;
}

/* ---------- 右：资源面板 ---------- */

.pane-sheet {
  min-width: 0;
  overflow-y: auto;
  padding: 28px 32px 40px;
}

.sheet-empty {
  max-width: 360px;
  padding-top: 64px;
}

.empty-title {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.empty-text {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.sheet-body {
  max-width: 760px;
}

.sheet-head {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sheet-icon {
  width: 168px;
  height: 168px;
  border: 1px solid var(--line);
  border-radius: 36px;
  overflow: hidden;
  background-color: #242429;
  background-image: conic-gradient(#303038 25%, transparent 0 50%, #303038 0 75%, transparent 0);
  background-size: 16px 16px;
}

.sheet-icon img {
  display: block;
  width: 168px;
  height: 168px;
  object-fit: cover;
  transition: transform 0.12s var(--ease);
}

.sheet-name {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.sheet-seller {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 12px 0 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.fact {
  display: flex;
  gap: 6px;
}

.fact dd {
  margin: 0;
  color: var(--ink-2);
}

.sheet-links {
  display: flex;
  gap: 16px;
  margin-top: 14px;
}

.sheet-links a {
  font-size: 12px;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 1px;
  transition: color 0.12s var(--ease), border-color 0.12s var(--ease);
}

.sheet-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- 尺寸与格式 ---------- */

.section {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}

.format-hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raised);
}

.segmented button {
  height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-pressed="true"] {
  background: var(--raised-2);
  color: var(--ink);
}

.segmented button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.size-table {
  margin-top: 12px;
}

.size-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) 60px;
  align-items: center;
  gap: 12px;
  height: 44px;
  border-bottom: 1px solid var(--line);
}

.size-row:last-child {
  border-bottom: 0;
}

.size-value {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.size-url {
  display: flex;
  align-items: baseline;
  min-width: 0;
  font-family: var(--mono);
  font-size: 11px;
}

.size-url .dir {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.size-url .tail {
  flex: none;
  color: var(--ink);
}

.size-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease), border-color 0.12s var(--ease);
}

.icon-btn:hover {
  background: var(--raised);
  color: var(--ink);
  border-color: var(--line-2);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 8px);
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #17171a;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .pane-list {
    height: 52vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pane-sheet {
    padding: 20px 16px 32px;
  }

  .sheet-head {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 16px;
  }

  .sheet-icon,
  .sheet-icon img {
    width: 96px;
    height: 96px;
    border-radius: 22px;
  }

  .sheet-name {
    font-size: 17px;
  }

  .size-row {
    grid-template-columns: max-content minmax(0, 1fr) 56px;
    gap: 8px;
    height: 40px;
  }
}

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