/* Tablica i zdjęcie z telefonu (web/board.js). Kolory i przyciski z style.css. */

html.bd-lock, html.bd-lock body { overflow: hidden; }
.bd [hidden] { display: none !important; }

.bd-ov { position: fixed; inset: 0; z-index: 60; background: rgba(11, 11, 11, .32); display: grid; place-items: center; padding: 24px; }
.bd { width: min(860px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); border-radius: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .18); overflow: hidden; }

.bd-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px 10px; }
.bd-h b { font-size: 17px; letter-spacing: -.01em; }
.bd-k { color: var(--muted); font-size: 13px; }
.bd-x { border: 0; background: var(--soft); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; flex: none; font-size: 14px; }
.bd-x:hover { background: var(--line); }

.bd-tabs { display: flex; gap: 4px; padding: 0 22px 12px; }
.bd-tabs button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; cursor: pointer; }
.bd-tabs button.on { color: var(--ink); background: var(--soft); }

.bd-note { margin: 0 22px 12px; padding: 10px 14px; border-radius: 12px; background: var(--soft); color: var(--muted); font-size: 14px; }

.bd-b { overflow-y: auto; scrollbar-gutter: stable; padding: 0 22px 20px; }
.bd-hint { color: var(--muted); font-size: 13px; }
.bd-hint.err, .bd-f .err { color: var(--bad); }
.bd-f { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }

/* narzędzia */
.bd-tools { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.bd-seg { display: flex; gap: 4px; background: var(--soft); border-radius: 999px; padding: 4px; }
.bd-seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; min-width: 36px; height: 32px; cursor: pointer;
  font-size: 13px; font-weight: 500; display: grid; place-items: center; }
.bd-seg button i { display: block; border-radius: 50%; background: currentColor; }
.bd-seg button.on { background: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.bd-seg button:disabled { opacity: .35; cursor: default; }

/* kartka w kratkę: zawsze jasna, jak zeszyt */
.bd-paper { position: relative; width: 100%; border-radius: 14px; overflow: hidden; background-color: #fff;
  background-image: linear-gradient(#e3e8ef 1px, transparent 1px), linear-gradient(90deg, #e3e8ef 1px, transparent 1px);
  box-shadow: inset 0 0 0 1px var(--line); }
.bd-paper canvas { display: block; touch-action: none; cursor: crosshair; }
.bd-paper.tall { max-width: 560px; margin: 0 auto; }

/* zdjęcie z telefonu */
.bd-photo { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: center; background: var(--soft); border-radius: 18px; padding: 20px; }
.bd-qr { width: 220px; height: 220px; display: grid; place-items: center; background: #fff; border-radius: 12px; overflow: hidden; }
.bd-qr svg { width: 100%; height: 100%; display: block; }
.bd-exp { display: grid; gap: 10px; justify-items: center; }
.bd-ph b { display: block; margin-bottom: 4px; }
.bd-ph p { margin: 0 0 10px; }
.bd-url { font-size: 12px; color: var(--faint); word-break: break-all; }
.bd-file { position: relative; overflow: hidden; }
.bd-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.bd-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 14px; }
.bd-thumbs:empty { display: none; }
.bd-thumbs img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: var(--soft); display: block;
  border: 1px solid var(--line); }

/* oczekiwanie i komunikaty */
.bd-wait { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 56px 12px; }
.bd-wait .bd-hint { max-width: 380px; }
.bd-spin { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--ink); animation: bd-spin .8s linear infinite; }
@keyframes bd-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bd-spin { animation-duration: 2.4s; } }
.bd-msg { padding: 28px 4px; }
.bd-msg b { font-size: 17px; }
.bd-msg p { color: var(--muted); margin: 6px 0 18px; }

/* wynik */
.bd-score { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 6px; }
.bd-score b { font-size: 40px; letter-spacing: -.03em; line-height: 1; }
.bd-score span { color: var(--muted); font-weight: 600; }
.bd-score.ok b { color: var(--ok); }
.bd-score.bad b { color: var(--bad); }
.bd-fb { margin: 0 0 18px; font-size: 16px; }
.bd-steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.bd-steps li { display: flex; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); }
.bd-steps li.first { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 6%, var(--bg)); }
.bd-mk { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; margin-top: 1px; }
.bd-steps li.ok .bd-mk { background: var(--ok); }
.bd-steps li.bad .bd-mk { background: var(--bad); }
.bd-tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--bad); margin-bottom: 2px; }
.bd-st { font-weight: 500; }
.bd-cm { color: var(--muted); font-size: 14px; }
.bd-end { margin-top: 6px; }

/* telefon: pełny ekran */
@media (max-width: 640px) {
  .bd-ov { padding: 0; }
  .bd { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .bd-h { padding: 14px 16px 8px; }
  .bd-tabs, .bd-b { padding-left: 16px; padding-right: 16px; }
  .bd-note { margin-left: 16px; margin-right: 16px; }
  .bd-photo { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .bd-f { flex-direction: column; align-items: stretch; }
  .bd-f .btn { justify-content: center; }
}
