:root {
  color-scheme: dark;
  --bg: #121214;
  --surface: #1c1c1f;
  --text: #f2f2f3;
  --muted: #a3a3ab;
  --border: #3a3a40;
  --accent: #f2f2f3;
  --accent-text: #121214;
  --danger: #ff8a80;
  --success: #7fd29a;
  --radius: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

:focus:not(:focus-visible) {
  outline: none;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page {
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: 880px;
  margin-inline: auto;
  padding: 32px 16px 64px;
}

.is-login .page {
  min-height: 100vh;
  align-content: center;
  max-width: 400px;
}

.title {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: 0 0 12px;
  font-size: 1.125rem;
  line-height: 1.3;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.card {
  display: grid;
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.flash {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid currentColor;
  color: var(--danger);
}

.flash[data-type="success"] {
  color: var(--success);
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  font-weight: 600;
}

input[type="password"],
input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--text);
}

.btn[data-variant="primary"] {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}

.btn[data-variant="danger"] {
  color: var(--danger);
}

.btn[data-variant="danger"]:hover {
  border-color: var(--danger);
}

.btn[data-size="small"] {
  min-height: 36px;
  padding: 4px 14px;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.btn[hidden] {
  display: none;
}

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

.actions form {
  margin: 0;
}

.drop {
  position: relative;
  display: grid;
  gap: 4px;
  place-items: center;
  align-content: center;
  min-height: 180px;
  padding: 24px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.drop:hover,
.drop:has(input:focus-visible) {
  border-color: var(--text);
}

.drop:has(input:focus-visible) {
  outline: auto;
}

.drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.drop-hint {
  color: var(--muted);
  font-size: 0.875rem;
}

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

.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 200px;
}

.progress[hidden] {
  display: none;
}

.progress progress {
  flex: 1;
  height: 8px;
  accent-color: var(--accent);
}

.progress-value {
  min-width: 3.5em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.upload-status {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
}

.upload-status:empty {
  display: none;
}

.upload-status[data-type="error"] {
  color: var(--danger);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-field {
  flex: 1 1 280px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.875rem;
}

.upload-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.upload-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.upload-thumb {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg);
}

.upload-body {
  display: grid;
  gap: 6px;
  min-width: 0;
  align-content: start;
}

.upload-name {
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.upload-stats {
  margin: 0 0 6px;
  font-size: 0.9375rem;
}

.upload-log summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  cursor: pointer;
}

.upload-log table {
  width: 100%;
  margin-top: 8px;
  font-size: 0.8125rem;
  border-collapse: collapse;
}

.upload-log th,
.upload-log td {
  padding: 4px 8px 4px 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.upload-log th {
  color: var(--muted);
  font-weight: 600;
}

.share {
  display: grid;
  gap: 24px;
}

.share-image img {
  width: auto;
  max-height: 70vh;
  margin-inline: auto;
  border-radius: var(--radius);
}

.share-body {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

.share .actions {
  justify-content: center;
}

.hint {
  max-width: 36em;
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

@media (max-width: 560px) {
  .upload-item {
    grid-template-columns: 72px 1fr;
  }

  .upload-thumb {
    width: 72px;
    height: 72px;
  }

  .upload-log {
    overflow-x: auto;
  }
}
