/* picyourpic — schlankes, neutrales Styling. Mobile first, kein Framework
   (Tailwind per CDN scheitert an der CSP default-src 'self'). */

:root {
  --bg: #fafafa;
  --card: #ffffff;
  --line: #e4e4e7;
  --text: #18181b;
  --muted: #71717a;
  --accent: #18181b;
  --accent-text: #ffffff;
  --ok: #15803d;
  --err: #b91c1c;
  --err-bg: #fef2f2;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --card: #18181b;
    --line: #2a2a2e;
    --text: #fafafa;
    --muted: #a1a1aa;
    --accent: #fafafa;
    --accent-text: #18181b;
    --ok: #4ade80;
    --err: #fca5a5;
    --err-bg: #2a1416;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* ---------------------------------------------------------------- Kopf */

.head { margin-bottom: 1.5rem; }

.head h1 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.sub { margin: 0.25rem 0 0; }

/* --------------------------------------------------------------- Karten */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.875rem;
}

/* -------------------------------------------------------------- Buttons */

.btn {
  flex: 1 1 auto;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:active { opacity: 0.75; }

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn[disabled] { opacity: 0.5; cursor: default; }

.btn-primary { background: var(--accent); color: var(--accent-text); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

/* ------------------------------------------------------------- Dropzone */

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 2rem 1rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop:hover, .drop:focus-visible { border-color: var(--muted); outline: none; }

.drop.over { border-color: var(--accent); background: var(--bg); }

.drop-icon {
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.25rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop-title { margin: 0; font-weight: 500; }

.drop-sub, .drop-types { margin: 0; }

.drop-types { margin-top: 0.5rem; font-size: 0.75rem; }

.link { text-decoration: underline; }

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

/* --------------------------------------------------------- gewählte Datei */

.chosen { margin-top: 1rem; }

.chosen-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 8px;
}

.chosen-name {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.chosen-size {
  flex: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------- Fortschritt */

.pct-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}

.pct {
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.state {
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.bar {
  height: 0.5rem;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 1rem 0 0;
}

.stats dt {
  color: var(--muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats dd {
  margin: 0.125rem 0 0;
  /* Knapp gehalten: "4,59 / 12,40 GB" muss auf 390 px in eine Spalte passen. */
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* ----------------------------------------------------------------- fertig */

.done-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.done-head h2 { margin: 0; }

.done-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: var(--ok);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-label {
  display: block;
  color: var(--muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.share {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.share input {
  flex: 1 1 14rem;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 0.875rem;
}

.share .btn { flex: 0 1 auto; }

.done .hint { margin: 0.75rem 0 0; }

.done .btn-ghost { width: 100%; margin-top: 0.875rem; }

/* ----------------------------------------------------------------- Fehler */

.alert {
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--err-bg);
  color: var(--err);
  border: 1px solid currentColor;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.resume .hint { margin: 0.25rem 0 0; }

.resume-info { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

@media (min-width: 30rem) {
  .wrap { padding-top: 3rem; }
  .head h1 { font-size: 1.625rem; }
  .stats dd { font-size: 0.875rem; }
  .btn { flex: 0 1 auto; }
  .done .btn-ghost { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
