:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --accent: #22c55e;
  --error: #ef4444;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app__header {
  text-align: center;
  padding: 8px 0;
}

.app__header h1 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -0.02em;
}

.app__subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card--center {
  align-items: center;
  text-align: center;
}

.card--error {
  border-color: var(--error);
}

.hidden { display: none !important; }

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.05s ease, background 0.15s ease;
  user-select: none;
}

.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--primary);
  color: #fff;
}
.btn--primary:hover { background: var(--primary-dark); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--card-border);
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.row {
  display: flex;
  gap: 12px;
}
.row .btn { flex: 1; }

.preview__img {
  width: 100%;
  border-radius: 12px;
  display: block;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--card-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Wynik */
.answer {
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.answer__letter {
  flex-shrink: 0;
  width: 64px;
  min-height: 64px;
  padding: 12px;
  border-radius: 16px;
  background: var(--accent);
  color: #052e16;
  font-size: 2.2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.answer__text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.answer__reason {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

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

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

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}
.badge--wysoka { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.badge--srednia { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.badge--niska { background: rgba(239, 68, 68, 0.2); color: #f87171; }
