/* Components: card, buttons, badges, fields, choice cards, chips, tape frame, toast, consent banner. */
.card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; padding: 26px 22px; background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow); }
@media (max-width: 480px) { .card { padding: 20px 16px; border-radius: 18px; } }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.em { font-size: 1.35rem; line-height: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; font: inherit; font-size: 0.95rem; font-weight: 700; line-height: 1.2; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn-primary { color: var(--tg-fg); background: var(--tg); border-color: var(--tg); }
.btn-primary:hover { border-color: var(--tg); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--fg); border-color: var(--line); }
.btn-danger-quiet:hover { color: var(--bad); border-color: var(--bad); }
.btn[aria-pressed="true"] { color: var(--fg); background: var(--tg-soft); border-color: var(--tg); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.badge { display: inline-block; padding: 3px 10px; font-size: 0.8rem; color: var(--muted); background: var(--soft); border-radius: var(--radius-pill); }
.badge-info { color: var(--fg); background: var(--tg-soft); }
.badge-ok { color: var(--ok); background: var(--ok-soft); }

.field { display: grid; gap: 6px; font-size: 0.92rem; color: var(--muted); }
.field small { font-size: 0.82rem; }
.input, textarea, select { width: 100%; min-width: 0; padding: 10px 12px; min-height: 44px; font: inherit; font-size: 1rem; color: var(--fg); background: var(--surface); border: 1px solid var(--muted); border-radius: var(--radius-field); }
textarea { resize: vertical; line-height: 1.5; min-height: 88px; }
::placeholder { color: var(--muted); opacity: 0.9; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--tg); outline-offset: 0; border-color: var(--tg); }
.counter { justify-self: end; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
fieldset { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 8px; font-weight: 700; font-size: 0.98rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--tg); }
.check small { display: block; color: var(--muted); font-size: 0.84rem; }

/* choice cards: native radios, stretched over the card so the whole area is clickable and keyboard focusable */
.opts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.opts.wide .opts-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.opt-body > span { min-width: 0; overflow-wrap: break-word; }
.opt { position: relative; display: block; cursor: pointer; }
.opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.opt-body { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-field); font-size: 0.95rem; }
.opt-body small { display: block; font-weight: 400; color: var(--muted); font-size: 0.82rem; line-height: 1.3; }
.opt-body::after { content: ""; flex: none; margin-left: auto; width: 18px; height: 18px; border: 2px solid var(--line); border-radius: 50%; }
.opt input:checked + .opt-body { border-color: var(--tg); background: var(--tg-soft); font-weight: 700; }
.opt input:checked + .opt-body::after { border-color: var(--tg); background: radial-gradient(var(--tg) 0 45%, transparent 50%); }
.opt input:focus-visible + .opt-body { outline: 2px solid var(--tg); outline-offset: 2px; }
.opt-body .icon { width: 1.4em; height: 1.4em; color: var(--accent); }

.ladder-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lad { position: relative; display: block; cursor: pointer; }
.lad input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.lad span { display: grid; place-items: center; min-height: 52px; font-weight: 700; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-field); }
.lad input:checked + span { color: var(--tg-fg); background: var(--tg); border-color: var(--tg); }
.lad input:focus-visible + span { outline: 2px solid var(--tg); outline-offset: 2px; }
.ladder-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 0.85rem; color: var(--muted); }

.tape-frame { padding: 6px; border-radius: 22px; background: repeating-linear-gradient(-45deg, var(--tape-yellow) 0 12px, var(--tape-black) 12px 24px); }
.tape-frame > .inner { display: grid; gap: 12px; padding: 16px; background: var(--surface); border-radius: 16px; }

.toast { min-height: 1.4em; color: var(--ok); font-weight: 700; font-size: 0.92rem; }
.warn-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; font-size: 0.92rem; background: var(--warn-soft); color: var(--fg); border-radius: var(--radius-field); }
.warn-note .icon { color: var(--warn); margin-top: 2px; }
.noscript-box { padding: 14px 16px; background: var(--warn-soft); border-radius: var(--radius-field); }

/* consent banner: three equal buttons, no preselection, never modal */
.consent { position: fixed; z-index: 60; left: 12px; right: 12px; bottom: 12px; display: grid; gap: 10px; max-height: 70vh; overflow: auto; padding: 16px; background: var(--surface); color: var(--fg); border-radius: 20px; box-shadow: 0 8px 40px rgb(0 0 0 / 28%), 0 0 0 1px var(--line); }
.consent h2 { font-size: 1.02rem; }
.consent p { font-size: 0.86rem; color: var(--muted); }
.consent:focus { outline: none; }
.consent:focus-visible { outline: 2px solid var(--tg); }
.consent-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.consent-actions .btn { padding: 8px 6px; font-size: 0.86rem; }
.consent-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.consent-row input { flex: none; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--tg); }
.consent-row small { display: block; color: var(--muted); }
@media (min-width: 700px) { .consent { right: auto; width: 400px; left: 20px; bottom: 20px; } }
.ladder { gap: 8px; }
.ladder-chosen { min-height: 1.5em; font-weight: 700; font-size: 0.92rem; color: var(--link); }
/* narrow screens: short options become small vertical cards so the icon, the label and the radio dot never collide */
@media (max-width: 520px) {
  .opts:not(.wide) .opt-body { position: relative; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 78px; padding: 10px 12px; }
  .opts:not(.wide) .opt-body::after { position: absolute; top: 10px; right: 10px; margin: 0; }
}
