:root {
  color-scheme: light dark;
  --bg: #080808;
  --panel: #212121;
  --text: #f4f6ff;
  --muted: #a3abc7;
  --line: #2a3152;
  --accent: #7aa2ff;
  --chip: #313a62;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1 {
  margin: 0;
  font-size: 28px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.header-search {
  flex: 1 1 12rem;
  max-width: 22rem;
  min-width: 10rem;
  width: 100%;
}

.repo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
}

.repo-link-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: block;
}

.repo-link:hover,
.repo-link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

main {
  padding: 1.25rem 1.5rem 2rem;
}

.category-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.category-tab {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  padding: 8px 12px;
  cursor: pointer;
}

.category-tab:hover,
.category-tab:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.category-tab.active {
  background: rgba(255, 255, 255, 0.15);
}

input,
select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

#searchInput {
  background: #212121;
  border: 1px solid rgba(255, 255, 255, 0.5);
  height: 36px;
}

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

.asset-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  position: relative;
}

.asset-card:hover,
.asset-card:focus-within {
  border-color: transparent;
}

.preview-shell {
  position: relative;
  width: 100%;
  min-width: 240px;
  display: grid;
  place-items: stretch;
}

.preview-shell > .preview-area {
  grid-area: 1 / 1;
}

.preview-shell > .download-overlay {
  grid-area: 1 / 1;
  z-index: 1;
  align-self: stretch;
  justify-self: stretch;
  border-radius: 20px;
  position: relative;
}

.download-overlay {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 0 20px;
  box-sizing: border-box;
  min-height: 0;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.download-overlay-bottom {
  display: flex;
  justify-content: center;
  width: 100%;
}

.edit-json-btn {
  position: absolute;
  top: 11px;
  right: 11px;
  z-index: 2;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 1000px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  color: #fff;
}

.edit-json-btn:hover,
.edit-json-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.edit-json-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.edit-json-btn-icon {
  display: block;
  pointer-events: none;
}

.download-button-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.download-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-sizing: border-box;
  width: 72px;
  height: 28px;
  padding: 0 8px;
  border-radius: 1000px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.24px;
}

.download-option-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: block;
  pointer-events: none;
}

.download-option-label {
  white-space: nowrap;
}

.download-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.download-option:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.preview-shell:hover .download-overlay,
.preview-shell:focus-within .download-overlay {
  opacity: 1;
  pointer-events: auto;
}

.preview-area {
  aspect-ratio: 1 / 1;
  width: 100%;
  min-width: 240px;
  min-height: 240px;
  padding: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: stretch;
  background: #2a2a2a;
  border-radius: 20px;
  overflow: hidden;
  font-weight: 400;
}

.lottie-mount-host {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lottie-mount-host svg {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.preview-area > img {
  place-self: center;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-area > .preview-iframe {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  display: block;
}

.preview-area > .preview-error {
  place-self: center;
  margin: 0;
}

.preview-error {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.card-text-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 4px;
  background: #444444;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: #ffffff;
}

.shared-note {
  margin: 0;
  width: 100%;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  color: var(--muted);
  padding: 1rem 0;
}

.hidden {
  display: none;
}

.color-edit-dialog {
  --color-count: 1;
  margin: auto;
  padding: 0;
  border: none;
  background: transparent;
  max-width: calc(100vw - 2rem);
  overflow-x: auto;
}

.color-edit-dialog::backdrop {
  background: rgba(0, 0, 0, 0.2);
}

.color-edit-dialog-surface {
  position: relative;
  box-sizing: border-box;
  min-width: 400px;
  width: min(
    calc(100vw - 2rem),
    max(400px, calc(60px + max(240px, calc(68px * var(--color-count, 1) - 8px))))
  );
  padding: 40px 30px;
  border-radius: 20px;
  background: #1d1d1d;
  color: #fff;
  box-shadow: 4px 8px 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.color-edit-dialog-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.color-edit-dialog-close:hover,
.color-edit-dialog-close:focus-visible {
  color: #fff;
}

.color-edit-dialog-close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
  border-radius: 4px;
}

.color-edit-dialog-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 30px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.color-edit-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-edit-toggle-label {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.color-edit-theme-switch {
  width: 34px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.color-edit-theme-switch:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 3px;
  border-radius: 6px;
}

.color-edit-theme-switch-track {
  display: block;
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 100px;
  background: #3d3d3d;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-sizing: border-box;
  transition: background 0.15s ease;
}

.color-edit-theme-switch-thumb {
  position: absolute;
  top: 50%;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transform: translate(0, -50%);
  transition: right 0.15s ease, left 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.color-edit-theme-switch[aria-checked="false"] .color-edit-theme-switch-thumb {
  right: auto;
  left: 2px;
}

.color-edit-preview-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.color-edit-dialog-preview-area {
  width: 240px;
  height: 240px;
  border-radius: 16px;
  background: #333;
  overflow: hidden;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  transition: background 0.15s ease;
}

.color-edit-dialog-preview-area.is-preview-light {
  background: #fff;
}

.color-edit-dialog-preview-area svg {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.color-edit-filename {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: #fff;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.color-edit-swatch-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.color-edit-swatch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 60px;
  flex: 0 0 auto;
}

.color-edit-swatch-label {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
}

.color-edit-swatch-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  border: 0;
}

.color-edit-swatch-visual {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.color-edit-swatch-caption {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: #fff;
  text-align: center;
  width: 60px;
  margin: 0;
}

.color-edit-error {
  margin: 0;
  font-size: 13px;
  color: #ff8a8a;
  text-align: center;
}

.color-edit-dialog-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.color-edit-figma-hint {
  margin: 0;
  max-width: 22rem;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
}

.color-edit-figma-hint strong {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
}

.color-edit-footer-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.color-edit-footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.24px;
  cursor: pointer;
  white-space: nowrap;
}

.color-edit-footer-btn:hover,
.color-edit-footer-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.color-edit-footer-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.color-edit-footer-btn--download {
  background: #2a54ff;
  border-color: rgba(255, 255, 255, 0.2);
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.8));
}

.color-edit-footer-btn--download:hover,
.color-edit-footer-btn--download:focus-visible {
  filter: brightness(1.06) drop-shadow(0 1px 6px rgba(0, 0, 0, 0.8));
  background: #2a54ff;
}

.color-edit-footer-btn-icon {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.color-edit-figma-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 8px;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  cursor: pointer;
  white-space: nowrap;
}

.color-edit-figma-copy:hover,
.color-edit-figma-copy:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.color-edit-figma-copy:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.color-edit-figma-icon {
  flex-shrink: 0;
  display: block;
}
