/* Panel-Odpowiedzi — wspólny styl (panel + nauka) */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --text: #1c2129;
  --muted: #6b7380;
  --accent: #e87000;          /* pomarańcz Alukraft, przyciemniony dla kontrastu */
  --accent-soft: #fff1e3;
  --accent-text: #ffffff;
  --ok: #1a7f37;  --ok-soft: #e6f4ea;
  --bad: #c62828; --bad-soft: #fdecec;
  --warn: #9a6700; --warn-soft: #fff6dc; --warn-line: #e6a700;
  --info: #1f5fbf; --info-soft: #e8f0fc;
  --demo: #6d3fd6; --demo-soft: #efe9fc;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / .06), 0 1px 3px rgb(16 24 40 / .08);
  --shadow-lg: 0 8px 24px rgb(16 24 40 / .14);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1e232b;
    --border: #2a313b;
    --text: #e6e9ee;
    --muted: #9aa3af;
    --accent: #ff8a1f;
    --accent-soft: #3a2614;
    --accent-text: #1a1206;
    --ok: #4cc26b;  --ok-soft: #15301d;
    --bad: #ff6b6b; --bad-soft: #3a1b1b;
    --warn: #f0c04a; --warn-soft: #33290f; --warn-line: #c99a1e;
    --info: #7aa7ff; --info-soft: #18243a;
    --demo: #b39bff; --demo-soft: #261d3d;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-lg: 0 8px 24px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* --- pasek górny --- */
.topbar {
  height: 56px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; text-decoration: none; white-space: nowrap; }
.brand .logo {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-size: 14px;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; border: 1px solid var(--border); background: var(--surface-2);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.busy { background: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* --- przyciski --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  font: inherit; font-weight: 550; font-size: 13.5px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon { width: 34px; padding: 0; font-size: 16px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.up.on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.btn.down.on { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .item:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* --- pola --- */
input[type=text], input[type=search], select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
input[type=text], input[type=search], select { height: 34px; padding: 0 10px; }
textarea { padding: 12px 14px; resize: none; line-height: 1.6; }

/* --- chipy --- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 8px; height: 20px; border-radius: 999px;
  font-size: 11.5px; font-weight: 550; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.chip.new { background: var(--info-soft); color: var(--info); }
.chip.draft_ready { background: var(--accent-soft); color: var(--accent); }
.chip.saved { background: var(--ok-soft); color: var(--ok); }
.chip.demo { background: var(--demo-soft); color: var(--demo); }
.chip.error { background: var(--bad-soft); color: var(--bad); }

/* --- baner --- */
.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 16px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.info { background: var(--info-soft); color: var(--info); }
.banner b { font-weight: 650; }

/* --- karty --- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.callout {
  border-radius: 8px; padding: 10px 12px; font-size: 13px;
  background: var(--warn-soft); color: var(--text); border-left: 3px solid var(--warn-line);
}
.callout.info { background: var(--info-soft); border-left-color: var(--info); }
.callout.bad { background: var(--bad-soft); border-left-color: var(--bad); }
.callout ul { margin: 4px 0 0; padding-left: 18px; }
.callout b { font-weight: 650; }

/* --- toast --- */
#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px);
  background: #1c2129; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 100;
  max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); }

.spinner {
  display: inline-block; width: 14px; height: 14px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite; opacity: .8;
}
@keyframes spin { to { transform: rotate(360deg); } }

kbd {
  font: 11px ui-monospace, monospace; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}

@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .hide-sm { display: none !important; }
  .banner { padding: 8px 12px; font-size: 12px; }
  .banner b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
