:root {
  color-scheme: light;
  font-family:
    "Pretendard",
    "Segoe UI",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  --ink: #1f2733;
  --muted: #667085;
  --line: #d9e0e8;
  --panel: #f7f9fb;
  --paper: #ffffff;
  --blue: #2478d4;
  --blue-dark: #155aa6;
  --mint: #1e9b86;
  --rose: #d93e63;
  --shadow: 0 16px 42px rgba(31, 39, 51, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #edf2f7;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.brand p,
.eyebrow {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.search-box,
.stacked-input {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.search-box span,
.stacked-input span,
.filter-section h2 {
  color: #394456;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 120, 212, 0.14);
}

.filter-section {
  margin-top: 24px;
}

.filter-section h2 {
  margin: 0 0 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.segmented button,
.chip-list button,
.utility-row button,
.file-button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.segmented button.is-active,
.chip-list button.is-active {
  background: var(--blue);
  color: #fff;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-category + .tag-category {
  margin-top: 14px;
}

.tag-category h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip-list button {
  padding: 0 12px;
  background: var(--panel);
  border-color: var(--line);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #394456;
}

.toggle-row input {
  width: 18px;
  height: 18px;
}

.utility-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.utility-row button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  padding: 0 10px;
}

.file-button input {
  display: none;
}

.content {
  min-width: 0;
  padding: 28px;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.toolbar h2 {
  margin: 4px 0 0;
  font-size: 28px;
}

.counter {
  min-width: 76px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 10px 14px;
  color: var(--muted);
  text-align: center;
}

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

.asset-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(31, 39, 51, 0.04);
}

.thumb-button {
  display: block;
  width: 100%;
  height: 238px;
  border: 0;
  padding: 0;
  background: #dbeefa;
}

.thumb-button img,
.thumb-button video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.card-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
}

.card-title-row h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-button,
.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.favorite-button.is-active {
  border-color: rgba(217, 62, 99, 0.35);
  background: rgba(217, 62, 99, 0.1);
  color: var(--rose);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
}

.meta-row span {
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  padding: 4px 7px;
  font-size: 12px;
}

.type-badge[data-type="motion"] {
  color: #0f766e;
  background: rgba(30, 155, 134, 0.12);
}

.type-badge[data-type="pose"] {
  color: var(--blue-dark);
  background: rgba(36, 120, 212, 0.12);
}

.empty-state {
  margin-top: 18vh;
  color: var(--muted);
  text-align: center;
}

.preview-dialog {
  width: min(980px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.preview-dialog::backdrop {
  background: rgba(20, 28, 38, 0.52);
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.preview-media {
  height: min(74vh, 760px);
  background: #dbeefa;
}

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

.preview-info {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
}

.preview-info p,
.preview-info h2 {
  margin: 0;
}

.preview-info p {
  color: var(--muted);
  font-size: 13px;
}

.preview-info h2 {
  margin-top: 4px;
  font-size: 18px;
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding: 20px;
  }

  .toolbar {
    align-items: flex-start;
  }

  .toolbar h2 {
    font-size: 22px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .thumb-button {
    height: 210px;
  }
}
