/* Page 8 · Custom drill builder (/drills/new). Phone-first form; share sheet slides up from the bottom. */

.b-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(250, 247, 242, 0.95); backdrop-filter: blur(10px); }
.b-row { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 var(--pad); max-width: 620px; margin: 0 auto; }
.b-row h1 { flex: 1; font-size: 1.15rem; }
.icon-btn { width: 44px; height: 44px; margin-left: -10px; flex: none; display: grid; place-items: center; border-radius: 12px; color: var(--muted); }
@media (max-width: 419px) { .b-top .lang-switch button { min-width: 30px; padding: 4px 6px; } }

.builder { max-width: 620px; margin: 0 auto; padding: 4px var(--pad) calc(32px + env(safe-area-inset-bottom)); }
.field-label { display: block; margin: 16px 0 6px; font-weight: 700; font-size: 0.92rem; }
.builder form > .field-label:first-child { margin-top: 4px; }
.input { width: 100%; min-height: 48px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); font-size: 1rem; }
.input:focus { outline: none; border-color: var(--ink); }

/* Segmented radios and chips */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.seg label, .chips label { position: relative; }
.seg input, .chips input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 42px; padding: 0 6px; border-radius: 999px; font-weight: 700; font-size: 0.86rem; color: var(--muted); text-align: center; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 0.88rem; }
.chips input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
:is(.seg, .chips) input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Range card */
.range { margin-top: 10px; padding: 10px 12px 12px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.range-title { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.range svg { display: block; width: 100%; height: auto; color: var(--ink); }
.ends { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; }
.end { display: flex; align-items: center; gap: 6px; }
.end b { min-width: 3.2em; text-align: center; font-size: 1.05rem; }
.step { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); font-size: 1.2rem; font-weight: 800; line-height: 1; }
.step:disabled { opacity: 0.35; }
.ends .dash { color: var(--muted); }
.strip { display: flex; height: 22px; margin-top: 10px; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.strip span { flex: 1; background: #fff; border-right: 1px solid var(--line); }
.strip span:last-child { border-right: 0; }
.strip span.in { background: var(--accent-soft); }
.strip span.c { box-shadow: inset 2px 0 0 #d8d2c6; }

.summary { margin-top: 16px; font-size: 0.9rem; color: var(--ink-2); }
.summary b { color: var(--ink); }
.summary.bad { color: var(--bad); font-weight: 700; }
.b-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-top: 16px; }
.b-actions .btn { width: 100%; }

/* Share sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: grid; align-items: end; background: rgba(31, 36, 64, 0.45); }
.sheet { position: relative; width: 100%; max-width: 520px; margin: 0 auto; max-height: 92vh; overflow-y: auto; padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); background: #fff; border-radius: 22px 22px 0 0; animation: up 0.25s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.grab { width: 40px; height: 4px; margin: 0 auto 12px; border-radius: 999px; background: var(--line); }
.sheet-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--paper-2); display: grid; place-items: center; color: var(--muted); }
.sheet-head { display: flex; gap: 10px; align-items: center; padding-right: 40px; }
.ok-icon { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #e5f4e4; color: var(--ok); }
.sheet h2 { font-size: 1.1rem; outline: none; }
.sheet-head p { font-size: 0.82rem; color: var(--muted); }
.link-row { display: flex; gap: 8px; margin-top: 14px; }
.link-row .input { min-height: 44px; font-size: 0.85rem; background: var(--paper); text-overflow: ellipsis; }
.link-row .btn { flex: none; min-height: 44px; padding-inline: 14px; }
.copied { margin-top: 6px; font-size: 0.82rem; font-weight: 700; color: var(--ok); }
.copied::before { content: "✓ "; }
.qr { width: 200px; height: 200px; margin: 14px auto 0; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-hint { margin-top: 6px; text-align: center; font-size: 0.82rem; color: var(--muted); }
.sheet .btn-block { width: 100%; margin-top: 10px; }
.assign-hint { margin-top: 4px; text-align: center; font-size: 0.75rem; color: var(--muted); }
.proto-note { margin-top: 12px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 10px; font-size: 0.75rem; color: var(--muted); }
@media (min-width: 600px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 22px; } }
.btn.disabled { opacity: 0.45; pointer-events: none; }
