/* Ustalenia: tylko układ, z tokenów halonik.css (prefiks us-).
   Odstępy: 0.5 / 0.75 / 1 / 1.5 / 2.5 rem. Kolory odpowiedzi to tokeny: tak = zielony, jeśli trzeba = bursztynowy
   (jak w Doodle; znaczy też nawiasem wokół ikony, nie tylko barwą), nie = szary. */

.us-main { padding-block: 1.5rem 3rem; min-height: 60vh; }
.us-app .container { max-width: 56rem; }
.us-app { padding-bottom: env(safe-area-inset-bottom); }
.us-app .alert-box { margin: 0 0 1rem; }

/* Pola mają 16 px: mniejsze iOS powiększa po dotknięciu. */
.us-app :where(input[type="text"], input[type="date"], input[type="time"], select, textarea) { font-size: 16px; }
.us-app :where(input[type="text"], select) { min-height: 2.75rem; }
.us-app :where(input[type="date"], input[type="time"], textarea) {
  padding: 0.55rem 0.75rem; border: 1.5px solid var(--ink); border-radius: var(--radius-sm);
  font-family: inherit; background: #fff; color: var(--text-main); box-shadow: var(--shadow-sm);
  min-height: 2.75rem; width: 100%; transition: border-color 0.1s, box-shadow 0.1s;
}
.us-app textarea { resize: vertical; line-height: 1.4; }
.us-app :where(input[type="date"], input[type="time"], textarea):focus { outline: none; border-color: var(--tone); box-shadow: 4px 4px 0 var(--ink); }
.us-app :where(input[type="text"]):focus { border-color: var(--tone); }
.us-app .muted { font-weight: 500; color: var(--text-muted); }

/* ---------- Ekran startowy */
.us-home .page-title { margin-bottom: 1.25rem; }
.us-intro { display: grid; gap: 1.25rem; margin: 0; }
.us-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.us-facts li { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.75rem; align-items: start; font-size: var(--fs-body); line-height: 1.45; color: var(--text-body); }
.us-facts .ic { color: var(--tone); margin-top: 0.15rem; }
.us-facts b { color: var(--ink); }
.us-h2 { font-size: 1rem; font-weight: 800; margin: 0 0 0.75rem; }
.us-mine { list-style: none; margin: 0 0 1.75rem; padding: 0; display: grid; gap: 0.75rem; }
.us-mine:empty { display: none; }
.us-mine-item {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--bg-card); border: 1.5px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 0.5rem 0.6rem 0.5rem 1rem;
}
.us-mine-open { flex: 1; min-width: 0; display: grid; gap: 0.3rem; padding-block: 0.3rem; color: var(--ink); text-decoration: none; }
.us-mine-top { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.us-mine-top b { font-family: var(--font-display); font-size: var(--fs-title); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-mine-top .pill { flex-shrink: 0; font-size: var(--fs-micro); }
.us-mine-meta { font-size: var(--fs-small); color: var(--text-muted); }
.us-ios { margin: 1.25rem 0 0; }

/* ---------- Formularz ankiety */
.us-formpage .page-title { margin-bottom: 1.25rem; }
.us-form { display: grid; gap: 1.5rem; margin: 0; }
.us-form .form-field, .us-answer .form-field { margin: 0; border: 0; padding: 0; min-width: 0; }
.us-form legend, .us-form label, .us-answer label.lbl { font-size: var(--fs-small); font-weight: 700; color: var(--text-body); padding: 0; }
.us-kind { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.us-kind legend { width: 100%; margin-bottom: 0.3rem; }
.us-pick { position: relative; flex: 1 1 10rem; cursor: pointer; }
.us-pick input { position: absolute; opacity: 0; inset: 0; }
.us-pick > span {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.4rem 1rem;
  font: 700 var(--fs-body) var(--font-display); color: var(--ink);
  background: var(--bg-card); border: 1.5px solid var(--ink); border-radius: var(--radius-sm); box-shadow: 2px 2px 0 var(--ink);
}
.us-pick input:checked + span { background: var(--tone-light); box-shadow: none; transform: translate(2px, 2px); }
.us-pick input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.us-pick input:disabled + span { opacity: 0.6; cursor: not-allowed; }
.us-options { display: grid; gap: 0.75rem; margin: 0.4rem 0 0.9rem; }
.us-orow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem 0.6rem; align-items: center; }
.us-orow > input[type="text"] { grid-column: 1; }
.us-orow .us-times { grid-column: 1; display: flex; align-items: center; gap: 0.5rem; }
.us-orow .us-act { grid-column: 2; grid-row: 1; }
.us-dash { color: var(--text-muted); }
.us-add-option { justify-self: start; }
@media (min-width: 40rem) {
  .us-orow { grid-template-columns: 11rem minmax(0, 1fr) auto; }
  .us-orow .us-times { grid-column: 2; max-width: 15rem; }
  .us-orow .us-act { grid-column: 3; }
  .us-orow > input[type="text"] { grid-column: 1 / 3; }
}
.us-form-foot, .us-answer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.us-form .alert-box, .us-answer .alert-box { margin: 0; }

/* ---------- Nagłówek ankiety */
.us-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.us-head-main { flex: 1 1 18rem; min-width: 0; }
.us-title { margin: 0; font-family: var(--font-display); font-size: 1.7rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.us-note { margin: 0.5rem 0 0; color: var(--text-body); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.us-head-actions { display: flex; gap: 0.6rem; flex-shrink: 0; }
.us-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin: 0.9rem 0 1.5rem; font-size: var(--fs-small); color: var(--text-muted); }
.us-status { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; color: var(--text-body); }
.us-meta .pill { font-size: var(--fs-micro); }
.us-chosen { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.us-chosen-text { font-size: 1.05rem; font-weight: 800; }
.us-chosen-text .alert-title { font-size: var(--fs-small); font-weight: 700; color: var(--text-body); }

/* ---------- Sekcje */
.us-sec { margin: 0 0 2rem; }
.us-sec-h { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.75rem; font-size: var(--fs-title); font-weight: 800; letter-spacing: -0.01em; }
.us-sec-h .pill { font-size: var(--fs-micro); }
.us-empty { margin: 0.75rem 0 0; }

/* ---------- Tabela odpowiedzi */
.us-scroll {
  overflow-x: auto; background: var(--bg-card); border: 1.5px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); -webkit-overflow-scrolling: touch;
}
.us-scroll[hidden] { display: none; }
.us-scroll:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.us-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--fs-body); }
.us-table th, .us-table td { padding: 0; border-bottom: 1px solid var(--gray-200); background: var(--bg-card); text-align: center; }
.us-table thead th { border-bottom: 1.5px solid var(--ink); vertical-align: bottom; }
.us-table tbody tr:last-child > * { border-bottom: 1.5px solid var(--ink); }
.us-table tfoot td, .us-table tfoot th { border-bottom: 0; }
.us-corner, .us-name, .us-sum-h { position: sticky; left: 0; z-index: 2; width: 11rem; min-width: 8.5rem; max-width: 14rem; text-align: left !important; border-right: 1.5px solid var(--ink); }
.us-opt { min-width: 5.75rem; padding: 0.6rem 0.4rem 0.7rem !important; }
.us-opt-head { display: grid; justify-items: center; gap: 0.1rem; line-height: 1.15; }
.us-wd { font-size: var(--fs-micro); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.us-day { font: 800 1.55rem var(--font-display); color: var(--ink); line-height: 1; }
.us-mon { font-size: var(--fs-small); font-weight: 600; color: var(--text-body); }
.us-time { margin-top: 0.2rem; font: 700 var(--fs-micro) var(--font-mono); color: var(--ink); background: var(--gray-100); border-radius: 999px; padding: 0.05rem 0.5rem; white-space: nowrap; }
.us-label { font: 700 var(--fs-body) var(--font-display); color: var(--ink); overflow-wrap: anywhere; }
.us-badge {
  display: inline-flex; align-items: center; gap: 0.25rem; margin-bottom: 0.4rem; padding: 0.05rem 0.5rem;
  font: 700 var(--fs-micro) var(--font-display); color: var(--ink); background: var(--tone-light);
  border: 1.5px solid var(--ink); border-radius: 999px; white-space: nowrap;
}
.us-badge.ok { background: var(--accent-green-light); }
.us-badge .ic { width: 0.8rem; height: 0.8rem; }
.us-pick-btn { margin-top: 0.5rem; }
.us-name { padding: 0.5rem 0.7rem !important; font-weight: 700; }
.us-who { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.us-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.us-you { flex-shrink: 0; padding: 0 0.4rem; font: 700 var(--fs-micro) var(--font-display); color: var(--ink); background: var(--tone-light); border: 1.5px solid var(--ink); border-radius: 999px; }
.us-row-acts { display: flex; gap: 0.1rem; margin: 0.15rem 0 0 -0.35rem; }
tr.mine > .us-name { background: var(--tone-light); }

.us-act {
  display: inline-grid; place-content: center; flex-shrink: 0; width: 2rem; height: 2rem; padding: 0;
  background: transparent; color: var(--gray-600); border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.us-act .ic { width: 0.95rem; height: 0.95rem; }
.us-act:hover { background: var(--gray-100); color: var(--ink); }
.us-act:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.us-act-del:hover { color: var(--accent-red); background: var(--accent-red-light); }
.us-orow .us-act { width: 2.75rem; height: 2.75rem; }

.us-cell { height: 3rem; }
.us-cell .ic { position: relative; width: 1.1rem; height: 1.1rem; }
.us-cell.y { background: var(--accent-green-light); }
.us-cell.y .ic { color: var(--accent-green); }
.us-cell.m { background: var(--accent-amber-light); }
.us-cell.m .ic { color: var(--accent-amber); }
.us-cell.m .ic::before, .us-cell.m .ic::after { position: absolute; top: -0.12rem; font: 700 1.15rem/1 var(--font-main); color: var(--accent-amber); }
.us-cell.m .ic::before { content: "("; left: -0.55rem; }
.us-cell.m .ic::after { content: ")"; right: -0.55rem; }
.us-cell.n { background: var(--gray-50); }
.us-cell.n .ic { color: var(--gray-300); }
.us-sum-h { padding: 0.55rem 0.7rem !important; font-size: var(--fs-small); color: var(--text-muted); }
.us-sum { padding: 0.55rem 0.3rem !important; background: var(--bg-subtle) !important; }
.us-sum b { font: 800 1.1rem var(--font-display); color: var(--ink); }
.us-sum small { margin-left: 0.2rem; font-weight: 700; color: var(--accent-amber); }
.us-table tfoot .us-sum-h { background: var(--bg-subtle); }

/* Najlepsza i wybrana kolumna: pionowe ramki z obu stron. */
.us-table .best { box-shadow: inset 2px 0 0 var(--tone), inset -2px 0 0 var(--tone); }
.us-table .chosen { box-shadow: inset 2px 0 0 var(--accent-green), inset -2px 0 0 var(--accent-green); }
th.us-opt.best { background: var(--tone-light); }
th.us-opt.chosen { background: var(--accent-green-light); }

/* ---------- Odpowiedź */
.us-answer { display: grid; gap: 1.25rem; margin: 0; }
.us-choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.us-choice {
  display: grid; gap: 0.6rem; padding: 0.75rem; background: var(--bg-subtle);
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
}
.us-choice-text { font: 700 var(--fs-body) var(--font-display); color: var(--ink); overflow-wrap: anywhere; }
.us-nowrap { white-space: nowrap; }
.us-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.us-seg-b { position: relative; cursor: pointer; }
.us-seg-b input { position: absolute; opacity: 0; inset: 0; }
.us-seg-b > span {
  display: flex; align-items: center; justify-content: center; gap: 0.35rem; min-height: 2.75rem; padding: 0.3rem 0.4rem;
  font: 700 var(--fs-small) var(--font-display); color: var(--text-body); text-align: center;
  background: #fff; border: 1.5px solid var(--gray-400); border-radius: var(--radius-sm);
  transition: background-color 0.1s, border-color 0.1s;
}
.us-seg-b i { font-style: normal; }
.us-seg-b:hover span { border-color: var(--ink); }
.us-seg-b input:checked + span { color: var(--ink); border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.us-seg-b.y input:checked + span { background: var(--accent-green-light); }
.us-seg-b.m input:checked + span { background: var(--accent-amber-light); }
.us-seg-b.n input:checked + span { background: var(--gray-100); }
.us-seg-b.y input:checked + span .ic { color: var(--accent-green); }
.us-seg-b.m input:checked + span .ic { color: var(--accent-amber); }
.us-seg-b input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (min-width: 40rem) {
  .us-choice { grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr); align-items: center; }
}

/* ---------- Zakończenie ankiety i „Cofnij” */
.us-bottom { display: flex; justify-content: flex-end; margin-top: 3rem; padding-top: 1rem; border-top: 1.5px dashed var(--gray-300); }
.us-bottom[hidden] { display: none; }
/* Jedna mała, blada ikona na dole, daleko od reszty: trzeba chcieć w nią trafić (i potwierdzić dwa razy). */
.us-end {
  display: inline-grid; place-content: center; width: 1.75rem; height: 1.75rem; padding: 0;
  background: transparent; color: var(--gray-400); border: 0; border-radius: var(--radius-sm); cursor: pointer; opacity: 0.8;
}
.us-end .ic { width: 0.95rem; height: 0.95rem; }
.us-end:hover, .us-end:focus-visible { color: var(--accent-red); background: var(--accent-red-light); opacity: 1; }
.us-undo { display: flex; align-items: center; gap: 0.9rem; bottom: 1.25rem; padding: 0.5rem 0.6rem 0.5rem 1rem; }
.us-undo.show { pointer-events: auto; }
.us-undo .btn { background: #fff; color: var(--ink); }
#toast { bottom: 4.75rem; }

/* ---------- Okna */
.us-foot-dialog { display: flex; justify-content: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.us-share-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.us-share-body .hint { margin: 0; }
.us-share-body .share-link { justify-self: center; }
.us-share-body .alert-box { margin: 0; }
.us-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.us-tabs[hidden] { display: none; }
.us-tab {
  min-height: 2.5rem; font: 700 var(--fs-small) var(--font-display); color: var(--ink); cursor: pointer;
  background: var(--bg-card); border: 1.5px solid var(--ink); border-radius: var(--radius-sm); box-shadow: 2px 2px 0 var(--ink);
}
.us-tab[aria-selected="true"] { background: var(--tone-light); box-shadow: none; transform: translate(2px, 2px); }
.us-qr {
  justify-self: center; background: #fff; border: 1.5px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 0.75rem; line-height: 0;
}
.us-qr img, .us-qr canvas { width: 14rem; height: 14rem; }

/* ---------- Wąskie ekrany */
@media (max-width: 30rem) {
  .us-main { padding-block: 1rem 2.5rem; }
  .us-title { font-size: 1.4rem; }
  .us-head-actions { width: 100%; }
  .us-head-actions .btn { flex: 1; }
  .us-corner, .us-name, .us-sum-h { min-width: 6.75rem; max-width: 8rem; }
  .us-opt { min-width: 5rem; }
  .us-seg-b span { flex-direction: column; gap: 0.1rem; min-height: 3.25rem; }
  .us-seg-b i { font-size: var(--fs-micro); }
}

/* Aplikacja nie prowadzi nigdzie poza siebie: logo jest obrazkiem, nie odnośnikiem, a stopka ma tylko prawa autorskie. */
.us-brand { cursor: default; }
.us-brand:hover img { transform: none; }
.us-app .site-footer-copy { margin-left: auto; }
