/* app.css */
*, *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f3f4f6;
  --surface: #fff;
  --surface2: #f9fafb;
  --border: #00000012;
  --border-hover: #0000002e;
  --text: #111;
  --text-2: #374151;
  --muted: #9ca3af;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow-card: 0 1px 4px #0000000f;
  --shadow-hover: 0 10px 50px #0000001f;
  --shadow-modal: 0 24px 80px #0000002e;
  --font-display: "Montserrat", system-ui, sans-serif;
  --font-ui: "Inter", system-ui, sans-serif;
}

html {
  font-size: 14px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.app-header {
  position: sticky;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  background: #f3f4f6d9;
  top: 0;
}

.header-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 32px 16px;
}

.header-inner h1 {
  font-family: var(--font-display);
  letter-spacing: -.04em;
  color: var(--text);
  display: flex;
  align-items:  center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 900;
}

.logo {
  opacity: .4;
  font-size: 1rem;
}

.search-wrap {
  display: flex;
  align-items:  center;
  gap: 16px;
}

.search-box {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  flex: 1;
  align-items:  center;
  gap: 10px;
  padding: 0 14px;
  transition: border-color .15s, box-shadow .15s;
}

.search-box:focus-within {
  border-color: var(--border-hover);
  box-shadow: 0 0 0 3px #0000000f;
}

.search-icon {
  color: var(--muted);
  user-select: none;
  flex-shrink: 0;
  font-size: 1.15rem;
}

.search-box input {
  outline: none;
  color: var(--text);
  font-family: var(--font-ui);
  background: none;
  border: none;
  flex: 1;
  padding: 11px 0;
  font-size: .92rem;
  font-weight: 500;
}

.search-box input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.search-clear {
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 4px;
  padding: 2px 4px;
  transition: color .1s;
  font-size: 1.1rem;
  line-height: 1;
}

.search-clear:hover {
  color: var(--text);
}

.search-count {
  color: var(--muted);
  white-space: nowrap;
  text-align: right;
  letter-spacing: .02em;
  min-width: 72px;
  font-size: .78rem;
  font-weight: 600;
}

.app-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.card-preview {
  aspect-ratio: 1;
  background: var(--surface2);
  display: flex;
  overflow: hidden;
  justify-content: center;
  align-items:  center;
  padding: 16px;
}

.card-preview img {
  object-fit: contain;
  width: 100%;
  height: 100%;
}

.card-meta {
  border-top: 1px solid var(--border);
  padding: 10px 14px 12px;
}

.card-label {
  display: block;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .01em;
  font-size: .75rem;
  font-weight: 700;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: .45;
  }
}

.loading-pulse {
  background: var(--surface2);
  animation: pulse 1.6s ease-in-out infinite;
  border-radius: 8px;
  width: 100%;
  height: 100%;
  min-height: 260px;
}

.state-message {
  text-align: center;
  color: var(--muted);
  padding: 100px 24px;
  font-size: .95rem;
  font-weight: 500;
}

.modal-backdrop {
  position: fixed;
  z-index: 200;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  background: #11111173;
  justify-content: center;
  align-items:  center;
  padding: 24px;
  inset: 0;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  display: flex;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  max-height: 90dvh;
}

.modal-close {
  position: absolute;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  cursor: pointer;
  z-index: 1;
  border-radius: 50%;
  justify-content: center;
  align-items:  center;
  width: 30px;
  height: 30px;
  transition: background .12s, color .12s;
  font-size: 1rem;
  line-height: 1;
  top: 16px;
  right: 16px;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-preview {
  background: var(--surface2);
  display: flex;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  justify-content: center;
  align-items:  center;
  min-height: 280px;
  padding: 48px;
}

.svg-inline {
  display: flex;
  justify-content: center;
  align-items:  center;
  width: 240px;
  height: 240px;
}

.svg-inline svg {
  width: 100% !important;
  height: 100% !important;
}

.modal-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 32px 32px;
}

.modal-info h2 {
  font-family: var(--font-display);
  letter-spacing: -.04em;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 900;
}

.modal-desc {
  color: var(--muted);
  font-size: .83rem;
  font-weight: 500;
  line-height: 1.6;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-2);
  letter-spacing: .03em;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 10px;
  transition: background .12s, border-color .12s, color .12s;
  font-size: .7rem;
  font-weight: 700;
}

.tag:hover {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.btn-download {
  display: inline-flex;
  background: var(--text);
  color: #fff;
  font-family: var(--font-ui);
  letter-spacing: .03em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  align-self:  flex-start;
  align-items:  center;
  gap: 8px;
  padding: 11px 22px;
  transition: opacity .15s;
  font-size: .82rem;
  font-weight: 800;
}

.btn-download:hover {
  opacity: .75;
}
