/* WRAP 911 polish 2.9.2: search, settings, help, toasts, offline banner, empty and
   loading states, tap targets, focus rings. Loaded after field-bg.css.
   Does not style or touch any payment, IAP, or unlock UI. */

/* field-bg.css set header and nav to position:relative so they sat above the photo layer.
   That also un-stuck the header and dropped the bottom nav into the page flow (it floated
   mid-screen on short screens like Jobs). Keep the z-index, restore sticky/fixed. */
.app-header { position: sticky; top: 0; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; }

/* ---------- header actions ---------- */
.app-header { gap: 0.5rem; }
.app-header .brand { flex: 0 1 auto; min-width: 0; }
.app-header .brand-logo { max-width: 46vw; height: auto; max-height: 42px; }
.w9-header-actions { display: flex; align-items: center; gap: 0.15rem; margin-left: auto; }
.app-header .header-meta { flex: 0 0 auto; }
button.w9-icon-btn,
.app-header button.w9-icon-btn {
  width: 44px; height: 44px; min-width: 44px; padding: 0; margin: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; box-shadow: none; border: 0; border-radius: 12px;
  color: #fff6ee; font: inherit; letter-spacing: 0; text-transform: none;
}
button.w9-icon-btn:active { background: rgba(255, 176, 0, 0.14); }
button.w9-icon-btn svg { width: 22px; height: 22px; display: block; }
@media (max-width: 360px) { .app-header .header-sub { display: none; } }

/* ---------- focus + tap targets ---------- */
:focus-visible { outline: 2px solid #ffb000; outline-offset: 2px; border-radius: 8px; }
.card.tap:focus-visible { outline-offset: 0; }
.back-link { min-height: 44px; }
.filter-chips .chip, button.chip { min-height: 44px; }
button.secondary, .quiz-nav button, #btn-unlock, #btn-clear-license, .doctor-entry button { min-height: 44px; }
.mode-tab, button.mode-tab, .about-tabs button { min-height: 44px; }
.bottom-nav button { min-height: 48px; }

/* ---------- search field ---------- */
.w9-search { position: relative; margin: 0.6rem 0 0.9rem; }
.w9-search-box {
  display: flex; align-items: center; gap: 0.4rem;
  background: rgba(22, 16, 24, 0.96); border: 1px solid #5a304c; border-radius: 14px;
  padding: 0 0.35rem 0 0.75rem; min-height: 48px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.w9-search-box:focus-within { border-color: #ffb000; box-shadow: 0 0 0 3px rgba(255, 176, 0, 0.22); }
.w9-search-box svg { width: 20px; height: 20px; flex: 0 0 20px; color: #ffb000; }
.w9-search-box input[type="search"] {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent; padding: 0.7rem 0.2rem;
  font-size: 1rem; color: #fff6ee; outline: none; -webkit-appearance: none; appearance: none;
}
.w9-search-box input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.w9-search-box input::placeholder { color: #b9a6ae; }
.w9-search-box button.w9-clear {
  width: 36px; height: 36px; min-width: 36px; border-radius: 50%; padding: 0; margin: 0;
  background: #3a2636; color: #fff6ee; box-shadow: none; font: 700 1rem/1 var(--font, sans-serif);
  letter-spacing: 0; text-transform: none; display: inline-flex; align-items: center; justify-content: center;
}
.w9-search-box button.w9-clear[hidden] { display: none; }
.w9-results { margin-top: 0.6rem; }
.w9-results:empty { display: none; }
.w9-group { margin: 0.2rem 0 0.8rem; }
.w9-group h3 {
  margin: 0.6rem 0 0.35rem; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: #ffb000;
}
.w9-hit {
  display: flex; gap: 0.7rem; align-items: flex-start; width: 100%; text-align: left;
  background: rgba(22, 16, 24, 0.97); color: #fff6ee; border: 1px solid #3a2636; border-radius: 12px;
  padding: 0.65rem 0.75rem; margin: 0 0 0.4rem; min-height: 52px; cursor: pointer;
  font: inherit; letter-spacing: 0; text-transform: none; box-shadow: none;
}
button.w9-hit { font-family: var(--font, inherit); }
.w9-hit:active { border-color: #ffb000; }
.w9-hit-icon {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: #2a1424; font-size: 1.05rem; line-height: 1;
}
.w9-hit-body { flex: 1 1 auto; min-width: 0; }
.w9-hit-title { display: block; font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.w9-hit-snip { display: block; color: #d7c4cc; font-size: 0.82rem; line-height: 1.35; margin-top: 0.15rem;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.w9-hit mark { background: rgba(255, 176, 0, 0.28); color: #fff; border-radius: 3px; padding: 0 1px; }
.w9-lock { flex: 0 0 auto; align-self: center; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #ffb000; border: 1px solid rgba(255, 176, 0, 0.5); border-radius: 999px; padding: 0.1rem 0.45rem; }
button.w9-more { background: transparent; box-shadow: none; color: #ffb000; border: 0; padding: 0.4rem 0.2rem; min-height: 44px;
  font: 700 0.85rem var(--font, inherit); letter-spacing: 0; text-transform: none; width: auto; }
.w9-count { font-size: 0.8rem; color: #d7c4cc; margin: 0.2rem 0 0.4rem; }
.w9-recent { margin-top: 0.6rem; }
.w9-recent-head { display: flex; align-items: center; justify-content: space-between; }
.w9-recent-head h3 { margin: 0.4rem 0; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: #ffb000; }
.w9-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.w9-chips button.chip { min-height: 40px; }

/* ---------- empty states ---------- */
.w9-empty {
  text-align: center; padding: 1.4rem 1rem; margin: 0.6rem 0; border-radius: 14px;
  background: rgba(22, 16, 24, 0.96); border: 1px dashed #5a304c;
}
.w9-empty-icon { font-size: 1.8rem; line-height: 1; margin-bottom: 0.4rem; }
.w9-empty h3 { margin: 0.2rem 0 0.3rem; font-size: 1.05rem; }
.w9-empty p { margin: 0 0 0.6rem; color: #d7c4cc; font-size: 0.9rem; }
.w9-empty .w9-chips { justify-content: center; margin-bottom: 0.6rem; }
.w9-empty button { width: auto; }
.w9-filter { margin: 0.2rem 0 0.8rem; }
.w9-filter .w9-search-box { min-height: 44px; box-shadow: none; }
.w9-hide { display: none !important; }

/* ---------- loading skeletons (lists that fill in after data loads) ---------- */
#photo-list:empty, #video-list:empty, #library-list:empty, #practice-hub-list:empty {
  min-height: 260px; border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0) 0, rgba(255,255,255,0.07) 40%, rgba(255,255,255,0) 80%) -300px 0 / 300px 100% no-repeat,
    repeating-linear-gradient(180deg, rgba(36, 24, 42, 0.95) 0 72px, transparent 72px 84px);
  animation: w9-shimmer 1.2s linear infinite;
}
@keyframes w9-shimmer { to { background-position: 420px 0, 0 0; } }
.thumb-grid img, .video-still, .lesson-media img { background-color: #1a1520; }
@media (prefers-reduced-motion: reduce) {
  #photo-list:empty, #video-list:empty, #library-list:empty, #practice-hub-list:empty { animation: none; }
  .w9-toast { transition: none; }
}

/* ---------- offline banner + toast ---------- */
.w9-offline {
  position: sticky; top: var(--header-h, 76px); z-index: 25;
  margin: 0; padding: 0.55rem 1rem; font-size: 0.85rem; line-height: 1.35;
  background: #3a1f00; color: #ffe2b0; border-bottom: 1px solid #7a3d00; text-align: left;
}
.w9-offline strong { color: #ffb000; }
.w9-offline[hidden] { display: none; }
.w9-toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 0.7rem 1rem; border-radius: 12px;
  background: #fff6ee; color: #09070d; font-weight: 700; font-size: 0.9rem; box-shadow: 0 10px 28px rgba(0,0,0,0.45);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.w9-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- settings + help ---------- */
.w9-list { margin: 0.3rem 0 1.1rem; border-radius: 14px; overflow: hidden; background: rgba(22, 16, 24, 0.97); border: 1px solid #3a2636; }
.w9-list h2 { margin: 0; padding: 0.75rem 0.9rem 0.3rem; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: #ffb000; }
.w9-row, a.w9-row, button.w9-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; width: 100%;
  min-height: 52px; padding: 0.6rem 0.9rem; margin: 0; text-align: left; text-decoration: none;
  background: transparent; color: #fff6ee; border: 0; border-top: 1px solid #2a1c28; border-radius: 0; box-shadow: none;
  font: 400 0.95rem/1.35 var(--font, inherit); letter-spacing: 0; text-transform: none; cursor: pointer;
}
.w9-list h2 + .w9-row { border-top: 0; }
.w9-row .w9-row-sub { display: block; color: #d7c4cc; font-size: 0.8rem; margin-top: 0.1rem; }
.w9-row .w9-chev { color: #8f7a86; flex: 0 0 auto; }
.w9-row.danger { color: #ff8a9a; }
.w9-row .w9-val { color: #d7c4cc; font-size: 0.85rem; flex: 0 0 auto; }
.w9-seg { display: flex; gap: 0.3rem; flex: 0 0 auto; }
.w9-seg button {
  min-width: 44px; min-height: 40px; padding: 0 0.6rem; margin: 0; border-radius: 10px; width: auto;
  background: #24182a; color: #fff6ee; border: 1px solid #4a2a44; box-shadow: none;
  font: 700 0.85rem var(--font, inherit); letter-spacing: 0; text-transform: none;
}
.w9-seg button[aria-pressed="true"] { background: #ffb000; color: #09070d; border-color: #ffb000; }
.w9-switch { position: relative; width: 52px; height: 32px; flex: 0 0 52px; }
.w9-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.w9-switch span { position: absolute; inset: 0; border-radius: 999px; background: #4a2a44; transition: background 0.15s; pointer-events: none; }
.w9-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.w9-switch input:checked + span { background: #ff2d8c; }
.w9-switch input:checked + span::after { transform: translateX(20px); }
.w9-switch input:focus-visible + span { outline: 2px solid #ffb000; outline-offset: 2px; }
.w9-fine { font-size: 0.8rem; color: #b9a6ae; margin: 0.2rem 0.2rem 1rem; line-height: 1.4; }
.w9-faq details { border-top: 1px solid #2a1c28; }
.w9-faq h2 + details { border-top: 0; }
.w9-faq summary {
  list-style: none; cursor: pointer; min-height: 52px; padding: 0.75rem 2.2rem 0.75rem 0.9rem; position: relative;
  font-weight: 700; font-size: 0.95rem; line-height: 1.35;
}
.w9-faq summary::-webkit-details-marker { display: none; }
.w9-faq summary::after { content: "+"; position: absolute; right: 0.9rem; top: 50%; transform: translateY(-50%); color: #ffb000; font-size: 1.2rem; }
.w9-faq details[open] summary::after { content: "\2212"; }
.w9-faq details p { margin: 0 0.9rem 0.85rem; color: #e9dbe1; font-size: 0.9rem; line-height: 1.45; }
.w9-steps { margin: 0 0.9rem 0.9rem; padding-left: 1.2rem; color: #e9dbe1; font-size: 0.92rem; }
.w9-steps li { margin: 0.35rem 0; }

/* ---------- confirm sheet ---------- */
.w9-sheet { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-end; justify-content: center; }
.w9-sheet-card {
  width: 100%; max-width: 520px; background: #161018; color: #fff6ee; border-radius: 18px 18px 0 0;
  padding: 1.1rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom, 0px)); border-top: 1px solid #4a2a44;
}
.w9-sheet-card h2 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.w9-sheet-card p { margin: 0 0 1rem; color: #d7c4cc; font-size: 0.92rem; }
.w9-sheet-card .w9-sheet-row { display: flex; gap: 0.6rem; }
.w9-sheet-card .w9-sheet-row button { flex: 1 1 0; min-height: 48px; width: auto; }
.w9-sheet-card button.w9-danger { background: #ff5d73 !important; color: #09070d; box-shadow: none !important; }

/* Text size (Settings). Most type is rem-based, so scaling the root scales the app. */
html[data-w9-text="large"] { font-size: 112.5%; }
html[data-w9-text="xl"] { font-size: 125%; }
/* Background photos off (Settings): plain dark backdrop, for readability in bright sun. */
body.w9-no-photos #field-bg { background-image: none !important; }

/* style.css gives every plain <button> the pink/orange CTA gradient through a long :not() chain
   (very high specificity). The list rows, search hits, and small controls here are not CTAs. */
button.w9-hit, button.w9-row, button.w9-more, .w9-seg button, button.w9-icon-btn, button.w9-clear {
  font-family: var(--font, inherit) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  box-shadow: none !important;
}
button.w9-hit { background: rgba(22, 16, 24, 0.97) !important; font-weight: 400 !important; }
button.w9-row { background: transparent !important; font-weight: 400 !important; }
button.w9-row.danger { color: #ff8a9a !important; }
button.w9-more { background: transparent !important; }
button.w9-icon-btn { background: transparent !important; }
button.w9-icon-btn:active { background: rgba(255, 176, 0, 0.14) !important; }
button.w9-clear { background: #3a2636 !important; }
.w9-seg button { background: #24182a !important; color: #fff6ee !important; }
.w9-seg button[aria-pressed="true"] { background: #ffb000 !important; color: #09070d !important; }
/* Library level chips ran the title into the note ("L1 Installer BasicsInternal..."). */
.cert-chip strong { margin-right: 0.35rem; }


/* Build 31: I'm stuck / first install, and lesson teaser before the paywall. */
.stuck-entry {
  margin: 0 0 0.75rem;
  border: 0;
  border-radius: 18px;
  min-height: 86px;
  padding: 1rem 1rem 1rem 1.15rem;
  background: linear-gradient(115deg, #14344a 0%, #0c2230 100%);
  box-shadow: inset 0 0 0 2px #7ad0ff, 0 12px 26px rgba(0, 0, 0, 0.28);
}
.stuck-entry .card-title {
  font-family: var(--display);
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 400;
  color: #fff;
}
.stuck-entry .card-sub { color: #d7f3ff; }
#screen-stuck .card.tap { margin: 0 0 0.65rem; }
.lesson-teaser {
  margin: 0.6rem 0 1rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: rgba(255, 176, 0, 0.08);
  box-shadow: inset 3px 0 0 #ffb000;
}
.lesson-teaser .muted { margin: 0 0 0.7rem; }
#lesson-teaser-unlock { margin-top: 0.4rem; width: 100%; }
#screen-lesson.is-teaser .lesson-full { display: none; }
