:root {
  color-scheme: light;
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-muted: #fafaf9;
  --border: #e4e4e0;
  --border-strong: #d0d0cb;
  --text: #141414;
  --text-secondary: #5c5c58;
  --text-tertiary: #8a8a85;
  --accent: #141414;
  --accent-soft: rgba(20, 20, 20, 0.04);
  --success: #1a6b3c;
  --success-soft: #edf7f0;
  --error: #9b1c1c;
  --error-soft: #fdf2f2;
  --radius: 6px;
  --radius-sm: 4px;
  --topbar-h: 68px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top banner ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  height: var(--topbar-h);
}
.topbar__inner {
  max-width: 1040px;
  margin: 0 auto;
  height: 100%;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  padding: 6px 10px 6px 0;
  margin: 0 -10px 0 0;
  border-radius: var(--radius-sm);
  transition: opacity 140ms ease;
}
.topbar__brand:hover {
  opacity: 0.72;
}
.topbar__brand:hover .topbar__company-url {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.topbar__logo {
  display: block;
  height: 36px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}
.topbar__brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}
.topbar__company {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.topbar__company-url {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}
.topbar__divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}
.topbar__product-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}
.topbar__product {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.topbar__domain {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.topbar__spacer { flex: 1; }
.topbar__partner {
  display: block;
  height: 13px;
  width: auto;
  object-fit: contain;
  opacity: 0.5;
  flex-shrink: 0;
}

/* ── Main content ── */
.page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 64px;
}

main {
  width: 100%;
  max-width: 580px;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 500;
  margin: 0 0 10px;
  letter-spacing: -0.025em;
  color: var(--text);
}

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
  max-width: 44em;
}
.subtitle strong {
  color: var(--text);
  font-weight: 500;
}

kbd {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--text-secondary);
  vertical-align: 1px;
}

/* ── Usage stats ── */
.stats {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.stats__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stats__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0;
}
.stats__live {
  font-size: 10px;
  font-weight: 600;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.stats__live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ── Progress ── */
.stats__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stats__item {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}
.stats__value {
  display: block;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stats__label {
  display: block;
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}
.stats__detail {
  font-size: 11px;
  color: var(--text-tertiary);
  margin: 10px 0 0;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}
.stats__session {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 4px 0 0;
  font-variant-numeric: tabular-nums;
}

/* ── Progress ── */
.progress {
  margin-top: 16px;
}
.progress__track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0%;
  background: var(--text);
  border-radius: 2px;
  transition: width 180ms ease;
}
.progress__detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 8px 0 0;
  font-variant-numeric: tabular-nums;
}

/* ── Dropzone ── */
.dropzone {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 56px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  outline: none;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--border-strong);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.dropzone--drag {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.dropzone--busy {
  pointer-events: none;
  opacity: 0.55;
}
.dropzone__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.dropzone__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}
.dropzone:hover .dropzone__icon,
.dropzone--drag .dropzone__icon {
  color: var(--text-secondary);
}
.dropzone__text { text-align: center; line-height: 1.45; }
.dropzone__primary {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}
.dropzone__secondary {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Status ── */
.status { margin-top: 16px; }
.status:empty { display: none; }
.status__row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  animation: slidein 180ms ease;
}
.status__row--ok {
  border-color: #b8dcc8;
  background: var(--success-soft);
}
.status__row--err {
  border-color: #e8b4b4;
  background: var(--error-soft);
}
.status__icon {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  font-weight: 600;
}
.status__row--ok .status__icon { color: var(--success); }
.status__row--err .status__icon { color: var(--error); }
.status__msg { flex: 1; line-height: 1.45; min-width: 200px; }
.status__title { font-weight: 500; color: var(--text); display: block; }
.status__row--err .status__title { color: var(--error); }
.status__detail {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.status__hint {
  display: block;
  color: var(--text-tertiary);
  font-size: 11px;
  margin-top: 6px;
}
.status__batch-list {
  margin: 8px 0 0;
  padding: 0 0 0 16px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
}
.status__batch-more {
  color: var(--text-tertiary);
  list-style: none;
  margin-left: -16px;
}
.status__detail--warn {
  display: block;
  color: var(--error);
  margin-top: 6px;
}
.status__actions--batch {
  width: 100%;
}
.status__actions--batch .status__btn {
  flex: 1;
}
.status__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-start;
}
.status__btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  min-height: 44px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.status__btn:hover { background: var(--surface-muted); border-color: var(--text-tertiary); }
.status__btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.status__btn--primary:hover { opacity: 0.88; background: var(--accent); }
.status__copy {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  transition: opacity 120ms;
}
.status__copy:hover { opacity: 0.82; }

@keyframes slidein {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}

/* ── History ── */
.history { margin-top: 32px; }
.history__title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 10px;
}
.history__items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.history__item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  transition: border-color 120ms;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.history__item:hover { border-color: var(--border-strong); }
.history__badge {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--surface-muted);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
}
.history__thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--surface-muted);
  border-radius: 3px;
  object-fit: contain;
  display: block;
}
.history__meta {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.history__btns {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.history__btn {
  flex: 1;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 0;
  min-height: 36px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 120ms;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.history__btn:hover { border-color: var(--border-strong); color: var(--text); }
.history__copied {
  position: absolute;
  inset: 0;
  background: rgba(237, 247, 240, 0.96);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms;
}
.history__item--copied .history__copied { opacity: 1; }

/* ── Footer ── */
.footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer__note { letter-spacing: 0.01em; }
.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 120ms;
}
.footer a:hover { color: var(--text); }

@media (max-width: 600px) {
  .subtitle-paste-desktop { display: none; }
  .status__actions {
    width: 100%;
    flex-direction: row;
  }
  .status__btn {
    flex: 1;
    text-align: center;
  }
  .status__row { flex-direction: column; }
  .status__msg { min-width: 0; }
  .topbar__brand-text { display: none; }
  .topbar__domain { display: none; }
  .topbar__inner { padding: 0 16px; gap: 12px; }
  .topbar__logo { height: 28px; }
  .page { padding: 32px 16px 48px; }
  .history__items { grid-template-columns: 1fr 1fr; }
  .dropzone { padding: 44px 16px; }
  .page-header h1 { font-size: 22px; }
  .footer { flex-direction: column; align-items: flex-start; }
}
