:root {
  --base-100: #fcfbff;
  --base-200: #f3f0fb;
  --base-300: #e3ddf3;
  --content: #2a2540;
  --muted: #7a7393;
  --primary: #9d7ff0;
  --primary-content: #ffffff;
  --secondary: #e27bb8;
  --success: #3fbf8c;
  --success-content: #ffffff;
  --info: #5aa9e6;
  --error: #e5566f;
  --radius: 14px;
  --radius-field: 9px;
  --footer-h: 52px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --base-100: #17151f;
    --base-200: #201d2b;
    --base-300: #2f2b3e;
    --content: #ebe7f7;
    --muted: #9c95b3;
    --primary: #b9a4f5;
    --primary-content: #1a1626;
    --secondary: #f09acb;
    --success: #5ad1a1;
    --success-content: #10241b;
    --info: #79bbf0;
    --error: #ff7a90;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--base-100);
  color: var(--content);
  font: 16px/1.5 "DM Sans", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

.hero {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 40px 16px 32px;
}

.hero-content {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.title {
  margin: 0;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.tagline {
  display: flex;
  justify-content: center;
  white-space: pre;
  margin-top: -16px;
}

.center {
  display: flex;
  justify-content: center;
}

.column {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer {
  position: sticky;
  bottom: 0;
  min-height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: var(--base-200);
  border-top: 1px solid var(--base-300);
  font-size: 14px;
}

.text-primary {
  color: var(--primary);
}

.text-secondary {
  color: var(--secondary);
  font-weight: 700;
  text-decoration: none;
}

.text-secondary:hover {
  text-decoration: underline;
}

.text-error {
  color: var(--error);
}

.bold {
  font-weight: 700;
}

.big {
  font-size: 4rem;
  font-weight: 700;
  margin: 0;
  line-height: 1;
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  min-height: 1em;
}

.truncate {
  max-width: 60ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.card {
  width: 100%;
  max-width: 24rem;
  margin: 0;
  padding: 16px;
  background: var(--base-200);
  border: 1px solid var(--base-300);
  border-radius: var(--radius);
}

.card-wide {
  max-width: none;
}

.card-legend {
  padding: 0 6px;
  font-weight: 600;
  font-size: 14px;
}

.label {
  display: block;
  margin: 10px 0 4px;
  font-size: 14px;
  color: var(--muted);
}

.divider {
  height: 1px;
  margin: 16px 0 6px;
  background: var(--base-300);
}

.input,
.file-input {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--base-100);
  border: 1px solid var(--base-300);
  border-radius: var(--radius-field);
}

.input {
  padding: 9px 12px;
}

.input:focus,
.file-input:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: -1px;
  border-color: transparent;
}

.file-input {
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}

.file-input::file-selector-button {
  font: inherit;
  font-weight: 600;
  margin-right: 12px;
  padding: 9px 14px;
  border: 0;
  background: var(--info);
  color: #fff;
  cursor: pointer;
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-form {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
}

.search-form .input {
  flex: 1;
  min-width: 0;
}

.dropdown {
  position: relative;
}

.dropdown>summary {
  list-style: none;
  height: 100%;
  white-space: nowrap;
  user-select: none;
}

.dropdown>summary::-webkit-details-marker {
  display: none;
}

.dropdown[open]>summary {
  border-color: var(--primary);
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  width: 18rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: var(--base-200);
  border: 1px solid var(--base-300);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(0 0 0 / .25);
}

.dropdown-menu>.hint {
  margin: 0 2px 2px;
}

.btn.client {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  text-align: left;
}

.btn.client .hint {
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  color: var(--content);
  background: var(--base-300);
  border: 1px solid transparent;
  border-radius: var(--radius-field);
  cursor: pointer;
  transition: filter .12s, transform .06s;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn:active {
  transform: translateY(1px);
}

.btn-block {
  width: 100%;
}

.btn-success {
  background: var(--success);
  color: var(--success-content);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-content);
}

.btn-ghost {
  background: transparent;
  border-color: var(--base-300);
}

.btn-small {
  padding: 4px 10px;
  font-size: 13px;
}

form>.btn-block {
  margin-top: 24px;
}

.btn[hidden] {
  display: none;
}

.progress-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.progress {
  width: 100%;
  max-width: 24rem;
  height: 8px;
  appearance: none;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  background: var(--base-300);
}

.progress::-webkit-progress-bar {
  background: var(--base-300);
}

.progress::-webkit-progress-value {
  background: var(--info);
  transition: width .1s;
}

.progress::-moz-progress-bar {
  background: var(--info);
}

.results {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.results:empty {
  display: none;
}

.result {
  width: 100%;
  max-width: 24rem;
  background: var(--base-100);
  border: 1px solid var(--base-300);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgb(0 0 0 / .06);
  overflow: hidden;
  text-align: center;
}

.result figure {
  margin: 0;
  padding: 16px 16px 0;
  display: flex;
  justify-content: center;
}

.result figure img,
.result figure video {
  max-width: 60%;
  max-height: 220px;
  border-radius: 10px;
}

.result-body {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.result-name {
  margin: 0;
  font-size: 1rem;
  word-break: break-all;
}

.result-actions {
  display: flex;
  gap: 8px;
}

.grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.grid:empty {
  display: none;
}

.grid+.btn {
  margin-top: 12px;
}

.item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--base-100);
  border: 1px solid var(--base-300);
  border-radius: 10px;
}

.item img,
.item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.item .file {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
  text-align: center;
  cursor: pointer;
}

.item .bar {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px;
  color: #fff;
  font-size: 12px;
  background: linear-gradient(transparent, rgb(0 0 0 / .7));
  opacity: 0;
  transition: opacity .12s;
}

.item:hover .bar,
.item:focus-within .bar {
  opacity: 1;
}

.item .bar span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item .bar button {
  font: inherit;
  color: #fff;
  background: rgb(0 0 0 / .45);
  border: 0;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
}

.item .quote {
  position: absolute;
  inset: 0 0 auto 0;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.35;
  color: #fff;
  background: linear-gradient(rgb(0 0 0 / .75), rgb(0 0 0 / .45));
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  pointer-events: none;
}

.item .quote b {
  color: var(--primary);
  margin-right: 2px;
}

body.dragging::after {
  content: "Drop to add";
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border: 3px dashed var(--primary);
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: calc(var(--footer-h) + 16px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  padding: 10px 14px;
  border-radius: var(--radius-field);
  background: var(--base-200);
  border: 1px solid var(--base-300);
  border-left: 4px solid var(--info);
  box-shadow: 0 6px 20px rgb(0 0 0 / .12);
  font-size: 14px;
  animation: toast-in .18s ease-out;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--error);
}

.toast[role=button] {
  cursor: pointer;
}

.toast.leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (max-width: 520px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-row {
    flex-direction: column;
  }

  .dropdown-menu {
    left: 0;
    width: auto;
  }
}

.viewer {
  max-width: 48rem;
}

.viewer figure img,
.viewer figure video,
.viewer figure audio {
  width: auto;
  max-width: 100%;
  max-height: 70vh;
}

.viewer figure video,
.viewer figure audio {
  width: 100%;
}

.info {
  width: 100%;
  text-align: center;
}

.info>summary {
  list-style: none;
  user-select: none;
}

.info>summary::-webkit-details-marker {
  display: none;
}

.info[open]>summary {
  border-color: var(--primary);
}

.info-panel {
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  text-align: left;
  background: var(--base-200);
  border: 1px solid var(--base-300);
  border-radius: var(--radius-field);
}

.info-panel dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 14px;
}

.info-panel dt {
  color: var(--muted);
}

.info-panel dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.info-panel .hash {
  font-size: 12px;
}

.info-section .label {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--muted);
}

.info-section,
.transcript {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--base-300);
}

.transcript .label {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--muted);
}

.transcript ol {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 16rem;
  overflow-y: auto;
  font-size: 14px;
}

.transcript li {
  display: flex;
  gap: 10px;
  padding: 3px 0;
}

.transcript .ts {
  flex: none;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.transcript .ts:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .info-panel dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .info-panel dd {
    margin-bottom: 6px;
  }
}
