:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #20252b;
  --muted: #69717b;
  --line: #dfe3e8;
  --blue: #376c9e;
  --blue-soft: #edf4fa;
  --rust: #9b5842;
  --rust-soft: #f8efeb;
  --focus: #1769aa;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  padding: 7px 10px;
  color: #fff;
  background: var(--ink);
  border-radius: 4px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: none;
}

.shell {
  width: min(1120px, calc(100% - 36px));
  margin-inline: auto;
}

.page-header {
  padding: 34px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
}

.eyebrow,
.section-type {
  margin: 0 0 4px;
  color: var(--muted);
  font: 700 0.68rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.13em;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.15rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.subtitle {
  margin: 9px 0 0;
  color: var(--muted);
}

.header-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(80px, 1fr));
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.header-counts a {
  display: grid;
  gap: 1px;
  padding: 12px 16px;
  text-decoration: none;
}

.header-counts a + a {
  border-left: 1px solid var(--line);
}

.header-counts a:hover,
.header-counts a:focus-visible {
  background: #f8f9fa;
}

.header-counts strong {
  font-size: 1.2rem;
}

.header-counts span {
  color: var(--muted);
  font-size: 0.75rem;
}

main.shell {
  padding: 28px 0 18px;
}

.toolbar {
  display: grid;
  grid-template-columns: auto minmax(240px, 520px) 1fr;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toolbar label {
  font-size: 0.88rem;
  font-weight: 700;
}

.search-wrap {
  position: relative;
}

.search-wrap input {
  width: 100%;
  height: 42px;
  padding: 8px 46px 8px 12px;
  color: var(--ink);
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.14);
}

.search-wrap kbd {
  position: absolute;
  top: 50%;
  right: 10px;
  translate: 0 -50%;
  min-width: 24px;
  padding: 1px 6px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  text-align: center;
}

.search-result {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.library-section {
  margin-top: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.section-header--images {
  background: var(--blue-soft);
  border-top: 3px solid var(--blue);
}

.section-header--audio {
  background: var(--rust-soft);
  border-top: 3px solid var(--rust);
}

.section-header--images .section-type {
  color: var(--blue);
}

.section-header--audio .section-type {
  color: var(--rust);
}

.section-header h2,
.usage-note h2 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.section-count {
  color: var(--muted);
  font: 600 0.76rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.file-grid {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.file-grid--images {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.file-grid--audio {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.file-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.image-preview {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  background: #eef1f4;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.file-body {
  padding: 14px;
}

.file-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.7rem;
}

.file-meta span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card h3 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
}

.file-path {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font: 0.7rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.audio-card audio {
  width: 100%;
  height: 42px;
  display: block;
  margin-top: 13px;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.file-actions button,
.file-actions a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.file-actions button:hover,
.file-actions a:hover,
.file-actions button:focus-visible,
.file-actions a:focus-visible {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.empty-state {
  min-height: 128px;
  display: grid;
  place-content: center;
  grid-column: 1 / -1;
  padding: 24px;
  color: var(--muted);
  background: #fafbfc;
  border: 1px dashed #cfd4da;
  border-radius: 6px;
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.empty-state span {
  margin-top: 3px;
  font-size: 0.8rem;
}

.usage-note {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 24px;
  margin-top: 22px;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.usage-examples {
  display: grid;
  gap: 10px;
}

.usage-examples p {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 0;
}

.usage-examples strong {
  padding-top: 7px;
  font-size: 0.75rem;
}

.usage-examples code {
  padding: 7px 9px;
  color: #39414a;
  background: #f5f6f8;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: 0.7rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0 34px;
  color: var(--muted);
  font-size: 0.72rem;
}

.copy-status {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(320px, calc(100% - 36px));
  padding: 10px 13px;
  color: #fff;
  background: var(--ink);
  border-radius: 5px;
  box-shadow: 0 8px 30px rgba(32, 37, 43, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.copy-status.is-visible {
  opacity: 1;
  transform: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 800px) {
  .file-grid--images,
  .file-grid--audio {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: auto 1fr;
  }

  .search-result {
    grid-column: 1 / -1;
    text-align: left;
  }
}

@media (max-width: 580px) {
  .shell {
    width: min(100% - 22px, 1120px);
  }

  .page-header {
    padding: 24px 0;
  }

  .header-row {
    display: grid;
  }

  .header-counts {
    min-width: 0;
  }

  .toolbar,
  .usage-note {
    grid-template-columns: 1fr;
  }

  .toolbar {
    gap: 7px;
  }

  .file-grid--images,
  .file-grid--audio {
    grid-template-columns: 1fr;
  }

  .usage-examples p {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .usage-examples strong {
    padding: 0;
  }

  .page-footer {
    display: grid;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}
