/* Base Dark Theme & Reset */
body { background-color: #0f141c; color: #fff; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 0; display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; }

/* APP CONTAINER */
.app-container { max-width: 1100px; width: 95%; margin: 30px auto; background-color: #1a222d; border: 1px solid #2c3e50; border-radius: 12px; padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); position: relative; flex: 1; }

/* HEADER SECTION */
.app-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #2c3e50; padding-bottom: 15px; margin-bottom: 20px; }
.logo-area h1 { color: #ffcc00; margin: 0; font-size: 26px; font-weight: 800; letter-spacing: 1px; }
.logo-area span { color: #8a9ba8; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; }

/* Version Badge */
.version-badge { display: inline-block; background-color: #2c3e50; color: #ffcc00; font-size: 10px; font-weight: bold; padding: 2px 6px; border-radius: 4px; margin-left: 5px; vertical-align: middle; border: 1px solid #ffcc00; }

.header-actions { display: flex; gap: 10px; }
.action-btn { background: #2c3e50; border: 1px solid #34495e; color: #fff; padding: 10px 15px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: bold; transition: background 0.2s; }

/* AUDUBON HERO BANNER */
.audubon-banner { background: linear-gradient(135deg, #1e3a2b 0%, #122219 100%); border: 1px solid #2d5a3e; border-radius: 8px; padding: 20px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; box-shadow: inset 0 0 20px rgba(0,0,0,0.3); }
.donate-btn { background-color: #ffcc00; color: #0f141c; padding: 12px 20px; border-radius: 6px; font-weight: bold; border: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }

/* MAIN DASHBOARD AREA */
.main-dashboard {
    background-color: #151c24; 
    padding: 20px; 
    border-radius: 8px; 
    border: 1px solid #2c3e50;
}

/* Helper label markers on top of rows */
.section-divider {
    font-size: 9px; 
    color: #8a9ba8; 
    text-transform: uppercase; 
    margin-bottom: 4px;
    margin-top: 15px;
}
.section-divider:first-child { margin-top: 0; }

/* Dedicated Row Wrappers for absolute alignment control */
.dashboard-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

/* Force items in rows to always share space proportionally */
.dashboard-row > .input-group {
    flex: 1;
}

/* Double span width for row 3 special block */
.dashboard-row > .input-group.double-span {
    flex: 2;
}

/* AUDUBON ROW 1 CONTAINER METHOD */
.flex-row-container {
    display: flex;
    flex-direction: row;
    align-items: flex-end; 
    justify-content: space-between; 
    gap: 15px; 
    width: 100%;
    margin-bottom: 20px; 
    box-sizing: border-box;
}

.flex-item-box {
    flex: 1; 
    display: flex;
    flex-direction: column;
    gap: 5px; 
}

/* Dark banner conversion for drop-downs in Row 1 */
.dark-banner {
    width: 100%;
    height: 48px;
    background: #2c3e50;
    border: 1px solid #34495e;
    color: #ffffff;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px; 
    box-sizing: border-box;
    font-size: 16px;
}

/* Standard Mobile Wrap Fix (Excluding Row 1 to keep it side-by-side) */
@media (max-width: 600px) {
    .dashboard-row {
        flex-direction: column;
        gap: 10px;
    }
    .row-three-columns {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .row-three-columns > .input-group {
        flex: 1 1 calc(50% - 15px);
    }
    .row-3-special > .input-group:not(.double-span) {
         flex: 1 1 calc(50% - 15px);
    }
    .row-3-special > .input-group.double-span {
         flex: 1 1 100%;
    }
}

.input-group { display: flex; flex-direction: column; }
label { font-size: 13px; color: #ffcc00; margin-bottom: 8px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; }
input, select { padding: 12px; background-color: #0d1117; border: 1px solid #2c3e50; border-radius: 6px; color: #fff; font-size: 16px; width: 100%; box-sizing: border-box; }

/* Standardize Heights for Dashboard Controls and Buttons */
.dashboard-row input,
.dashboard-row select,
.dashboard-row .btn-yellow,
.dashboard-row .action-btn,
.dashboard-row .open-knot-hopper-btn {
    height: 48px !important;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Keep labels locked in size so buttons don't push unevenly */
.input-group label { height: 16px; display: flex; align-items: center; margin-bottom: 8px; }

/* Dissected Materials Rectangle Block */
.materials-container { 
    display: flex;
    height: 48px; 
    background-color: #0d1117; 
    border: 1px solid #2c3e50; 
    border-radius: 6px; 
    box-sizing: border-box; 
    overflow: hidden;
}

.material-box { 
    flex: 1; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4px 0;
}

.material-box.left-box { 
    border-right: 1px solid #2c3e50; 
}

.material-box .lbl { 
    font-size: 9px; 
    color: #8a9ba8; 
    text-transform: uppercase; 
    margin-top: 2px;
}

.material-box .num { 
    font-size: 18px; 
    color: #ffcc00; 
    font-weight: bold; 
    line-height: 1;
}

.btn-yellow { width: 100%; background-color: #ffcc00; color: #0f141c; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; gap: 10px; font-size: 14px; text-transform: uppercase; }

.board-viewer { margin: 25px 0; background-color: #0d1117; padding: 15px; border-radius: 8px; border: 1px solid #2c3e50; }

/* --- BUTTON FIXES --- */

/* The Schematics Button */
.dashboard-row .open-knot-hopper-btn { 
    width: 100%; 
    background-color: #2c3e50; 
    color: #ffcc00; 
    border: 1px solid #ffcc00; 
    border-radius: 6px; 
    font-weight: bold; 
    cursor: pointer; 
}

/* The Knot Hopper Button */
.board-viewer .open-knot-hopper-btn { 
    width: 100%; 
    background-color: #5c4033 !important;
    color: #ffcc00; 
    border: 1px solid #e67e22;
    border-radius: 6px; 
    font-weight: bold; 
    cursor: pointer; 
    padding: 15px; 
    height: auto !important;
    font-size: 20px !important;
    text-transform: uppercase;
}

/* The Assembly Guide Button breakout class */
.btn-proud {
    width: 100%;
    height: 48px !important;
    background-color: #3498db !important;
    color: white !important;
    border: none;
    border-radius: 6px;
    font-weight: 900;
    font-size: 16px !important;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- END OF BUTTON FIXES --- */

/* Cutting Layout - Picket Wizard Button at the bottom */
.btn-action { 
    width: 100%; 
    padding: 16px; 
    background-color: #2ecc71; 
    color: white; 
    border: none; 
    border-radius: 6px; 
    font-weight: 900;
    font-size: 18px !important;
    cursor: pointer; 
    margin-top: 15px; 
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3); 
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* SLIDE-OUT DRAWER */
.side-drawer { position: fixed; top: 0; width: 250px; height: 100%; background-color: #1a222d; border-left: 1px solid #2c3e50; box-shadow: 0 0 25px rgba(0,0,0,0.7); z-index: 100; transition: all 0.3s ease; padding: 25px 15px; box-sizing: border-box; overflow-y: auto; right: -270px; }
.side-drawer.open { right: 0; }

/* ── The Assembly Guide is not a settings panel ───────────────────────────────────────────────
   Alan, 2026-09-09, looking at the rebuilt guide: "the slide out drawer will not work for this
   now. it needs to be a full screen images."
   He is right. .side-drawer is 250px wide, which is fine for a list of toggles and hopeless for a
   drawing plus a paragraph of instructions — on a 412px phone the text was running four words to
   a line. Only the assembly drawer gets this; every other drawer keeps its 250px. */
/* Full screen, every size. The first attempt capped this at 720px so it would not sprawl on a
   monitor — but that just made it a wider side panel, which is the thing Alan said had to go:
   "the slide out drawer needs to go for this". The drawing is the point of the screen and it
   needs the width. Readability is handled by centering the CONTENT in a column instead, so the
   text stays a sane measure while the image gets the whole width. */
.side-drawer.drawer-full {
    width: 100%;
    max-width: none;
    right: -100%;
    padding: 18px 0 24px;
}
.side-drawer.drawer-full.open { right: 0; }
.side-drawer.drawer-full > * { max-width: 900px; margin-left: auto; margin-right: auto; padding-left: 16px; padding-right: 16px; box-sizing: border-box; }
/* the drawing itself is allowed past the text column */
.side-drawer.drawer-full > #assemblyImage { max-width: 1400px; }

/* Full-screen drawing viewer. The plates are SVG, so zoom stays razor sharp at any factor —
   which is the whole reason they were generated as vector rather than exported as PNG. */
#plateViewer { position: fixed; inset: 0; z-index: 10050; background: #06090d; display: none; flex-direction: column; }
#plateViewer.open { display: flex; }
/* A plain block, not a flex row (audit I-19, 2026-09-14): as a flex item the drawing shrank back to the screen's
   width at every zoom, so + and − did nothing; and flex centering put the left side of a zoomed drawing where it
   could not be scrolled to. The image centers itself with auto margins instead (below). */
#plateViewerScroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; display: block; padding: 10px; }
#plateViewerImg { display: block; margin: 0 auto; max-width: none; flex: none; transform-origin: top center; transition: width 0.12s ease; }
/* The Species Blueprint drawing at its own 850px, scrolled sideways on a phone (audit I-53, 2026-09-14). */
.blueprint-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.blueprint-scroll canvas { width: 850px; max-width: none; }
@media (min-width: 960px) { .blueprint-scroll canvas { width: 100%; } }
#plateViewerBar { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 10px 12px; background: #0d1117; border-top: 1px solid #2c3e50; flex-shrink: 0; }
#plateViewerBar button { background: #1a222d; color: #ffcc00; border: 1px solid #2c3e50; border-radius: 6px; padding: 12px 16px; font-size: 16px; font-weight: bold; cursor: pointer; min-width: 54px; }
#plateViewerBar button.wide { flex: 1; color: #fff; }
/* Tappable hint on the step image */
#assemblyImage { cursor: zoom-in; }
.drawer-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #2c3e50; padding-bottom: 15px; margin-bottom: 20px; }
.drawer-header h2 { margin: 0; color: #ffcc00; font-size: 18px; }
/* Thumb-sized (audit I-46, 2026-09-14): the ✕ is the only way out of every drawer, and it was 28 × 32px. */
.close-drawer { background: none; border: none; color: #8a9ba8; font-size: 24px; cursor: pointer; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
/* The rest of the small ones (audit I-46): measured 23 to 32px tall. min-height wins over an inline height. */
#assemblyPrevBtn, #assemblyNextBtn, #onboardDrawer .open-knot-hopper-btn { min-height: 44px; }
#scoutShareBtn, #kitOpenBtn, #helpBtn, #settingsBtn { min-height: 40px; }

/* Accordion Styles */
.accordion-item { border: 1px solid #2c3e50; border-radius: 6px; background-color: #151c24; margin-bottom: 10px; overflow: hidden; }
.accordion-header { width: 100%; padding: 12px 15px; background: #1a222d; color: #ffcc00; font-size: 11px; font-weight: bold; text-transform: uppercase; text-align: left; border: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.accordion-content { padding: 15px; display: none; background-color: #151c24; }
.accordion-item.active .accordion-content { display: block; }
.accordion-item.active .accordion-header { border-bottom: 1px solid #2c3e50; }

/* Toggles and Inputs inside drawers */
.switch { position: relative; display: inline-block; width: 46px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #2c3e50; transition: .4s; border-radius: 22px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #2ecc71; }
input:checked + .slider:before { transform: translateX(24px); }

.drawer-btn { width: 100%; padding: 12px; background-color: #ffcc00; color: #151c24; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; margin-top: 10px; }

/* MODAL SLIDE SHEET */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 200; display: none; justify-content: center; align-items: center; }
.modal-overlay.open { display: flex; }
.modal-content { background-color: #1a222d; border: 1px solid #2c3e50; border-radius: 12px; width: 900px; max-width: 95%; padding: 25px; max-height: 90vh; overflow-y: auto; }

.verification-table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 14px; text-align: left; background-color: #151c24; border-radius: 6px; overflow: hidden; }
.verification-table th, .verification-table td { padding: 12px; border-bottom: 1px solid #2c3e50; }
.verification-table th { background-color: #0d1117; color: #ffcc00; text-transform: uppercase; font-size: 11px; }
.verification-table td { color: #fff; }
.status-pass     { color: #2ecc71; font-weight: bold; }
.status-fail     { color: #e74c3c; font-weight: bold; }
.status-warn     { color: #ffcc00; font-weight: bold; }   /* outside every published figure (audit I-105) */
.status-info     { color: #8a9ba8; }                      /* nothing published to judge it by */

/* The "Why this number?" explanation row. Hidden by class rather than by an inline style so the
   narrow-screen rules below can still restyle it — an inline display would outrank them. */
.verification-table tr.why-row { display: none; }
.verification-table tr.why-row.why-open { display: table-row; }

/* ── The compliance table on a narrow screen ──────────────────────────────────────────────────
   Alan, 2026-09-10: "the bottom section with the pass section overflows the screen and needs to
   scroll to see the pass markings."

   Four columns cannot fit a phone. Measured: the table's minimum content width is ~361px and the
   space inside the Blueprint modal on a 390px phone is 264px, so the STATUS column — the entire
   point of a compliance check — was pushed off the right edge. It breaks below roughly a 475px
   viewport.

   Horizontal scrolling is the usual answer and it is the wrong one here: it leaves the verdict
   hidden until you think to swipe for it. Each row becomes a card instead, so every value is on
   screen at once, and the status gets its own full-width band at the foot of the card where it
   cannot be missed. Headers move into the cells via data-label, which is why the render adds
   those attributes. */
@media (max-width: 560px) {
    .verification-table, .verification-table tbody, .verification-table tr, .verification-table td {
        display: block; width: 100%; box-sizing: border-box;
    }
    /* Still hidden until opened — the blanket rule above would otherwise reveal every explanation. */
    .verification-table tr.why-row { display: none; }
    .verification-table tr.why-row.why-open { display: block; }
    .verification-table thead { display: none; }
    .verification-table tr { border-bottom: 1px solid #2c3e50; padding: 4px 0 0 0; }
    .verification-table td { border-bottom: none; padding: 4px 12px !important; }
    /* First cell is the card's heading — it carries the parameter name and the Why button. */
    .verification-table td:first-child { color: #fff !important; font-weight: bold; padding-top: 10px !important; }
    .verification-table td[data-label]::before {
        content: attr(data-label) ": ";
        color: #8a9ba8; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
    }
    /* The verdict, as a band rather than a cell. */
    .verification-table td[id^="chk-"] {
        margin-top: 6px; padding: 8px 12px !important; background: #0d1117; text-align: center;
    }
    .verification-table td[id^="chk-"]::before { display: block; margin-bottom: 2px; }
    /* An explanation row is already full width; it must not gain a label or a band. */
    .verification-table tr td[colspan] { padding: 0 10px 12px 10px !important; }
}

@keyframes scanPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.15; }
}
.scan-dot { display: inline-block; animation: scanPulse 0.65s ease-in-out infinite; }

canvas { width: 100%; height: auto; border: 1px solid #2c3e50; background: #0d1117; margin-top: 15px; border-radius: 4px; }

/* =================================================================== */
/* DARK MODE THEME OVERRIDES */
/* =================================================================== */

body.dark-theme {
    background-color: #1a1a1a !important;
    color: #e0e0e0 !important;
}

body.dark-theme .app-header {
    background-color: #111111 !important;
}

body.dark-theme .card, 
body.dark-theme .drawer, 
body.dark-theme .scratchpad-area textarea {
    background-color: #262626 !important;
    color: #e0e0e0 !important;
    border-color: #404040 !important;
}

body.dark-theme .accordion-header {
    background-color: #333333 !important;
    color: #ffffff !important;
}

body.dark-theme label, 
body.dark-theme span, 
body.dark-theme h1, 
body.dark-theme h2, 
body.dark-theme h3 {
    color: #e0e0e0 !important;
}

body.dark-theme select, 
body.dark-theme input {
    background-color: #404040 !important;
    color: #ffffff !important;
    border: 1px solid #555555 !important;
}

/* Keep the background dark when clicked and add a yellow shop glow */
.dashboard-grid-item input:focus {
    background: #0d1117 !important;
    outline: none !important;
    border-color: #ffcc00 !important;
    box-shadow: 0 0 5px rgba(255, 204, 0, 0.5);
}

/* =================================================================== */
/* GLOBAL GHOST BORDER FIX - KEEPS SCREEN FROM SHIFTING ON HOVER */
/* =================================================================== */
button, 
.action-btn, 
.donate-btn, 
.btn-yellow, 
.open-knot-hopper-btn, 
.btn-proud, 
.btn-action {
    border: 1px solid transparent !important;
}

/* =================================================================== */
/* MASTER HOVER KILL SWITCH - FORCES EVERYTHING TO TURN BLACK ON HOVER */
/* =================================================================== */

/* ⚠️ ONLY WHERE THERE IS A REAL MOUSE (2026-09-13). On a phone there is no hover, but a tapped
   button is left in the :hover state until you tap somewhere else — so every button you pressed
   stayed black. (hover: hover) is true for a mouse and false for a finger. */
@media (hover: hover) {
/* 1. Target all general buttons */
button:hover,
.action-btn:hover,
.donate-btn:hover,
.btn-yellow:hover,
.open-knot-hopper-btn:hover,
.btn-proud:hover,
.btn-action:hover,
.drawer-btn:hover {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #ffffff !important;
    box-shadow: none !important;
    filter: none !important;
    cursor: pointer;
}

/* 2. Target the Rebels by their exact IDs to override inline styles */
#openKnotHopperBtn:hover,
#cutSheetBtn:hover {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #ffffff !important;
    background-image: none !important; /* Kills any lingering gradients */
}
}
/* Forces the two rebel buttons to have a ghost border by default */
#openKnotHopperBtn, 
#cutSheetBtn {
    border: 1px solid transparent !important;
}
/* Mobile Fix for Knot Hopper and Picket Wizard text */
@media (max-width: 600px) {
    #openKnotHopperBtn, 
    #cutSheetBtn {
        font-size: 16px !important; /* Shrinks the font slightly on small screens */
        white-space: nowrap !important; /* Forces Knot Hopper onto one line */
        overflow: hidden !important; /* Prevents text from spilling out */
        text-overflow: ellipsis !important; /* Adds '...' if the screen is wildly small */
    }
}

/* ── Teaching Mode: the leader's voice (teaching.js) ──────────────────────────────────────────── */
#teachVoicePanel { background: #0d1117; border: 1px solid #2ecc71; border-radius: 8px; padding: 12px; margin-bottom: 14px; }
.teach-head { display: flex; justify-content: space-between; align-items: center; color: #2ecc71; font-size: 12px; font-weight: bold; letter-spacing: 0.5px; margin-bottom: 6px; }
.teach-tag { color: #8a9ba8; font-size: 10px; }
.teach-status { color: #cbd5e1; font-size: 13px; line-height: 1.5; }
.teach-scope { color: #8a9ba8; font-size: 11px; margin-top: 2px; }
.teach-warn { color: #ffcc00; font-size: 12px; line-height: 1.5; margin-top: 8px; }
.teach-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.teach-btn { flex: 1 1 auto; min-height: 44px; padding: 10px 12px; border-radius: 6px; border: 1px solid #484f58; background: #21262d; color: #fff; font-size: 13px; font-weight: bold; cursor: pointer; box-sizing: border-box; }
.teach-play { background: #1f6f43; border-color: #2ecc71; }
.teach-rec { background: #5c1f1f; border-color: #e74c3c; }
.teach-del { flex: 0 0 auto; }
.teach-auto { display: flex; gap: 8px; align-items: center; color: #8a9ba8; font-size: 12px; margin-top: 10px; }
.teach-auto input { width: 20px; height: 20px; flex-shrink: 0; }
.teach-msg { color: #ffcc00; font-size: 12px; margin-top: 8px; line-height: 1.5; }
/* Restore: a full-size transparent file input laid over the button and tapped directly (Android). */
.teach-restore { position: relative; overflow: hidden; display: block; text-align: center; }
.teach-restore input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
/* The recording screen: the text to read on top, the controls at the BOTTOM — never under the top strip. */
#teachRecorder { position: fixed; inset: 0; z-index: 10100; background: #06090d; display: none; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
#teachRecorder.open { display: flex; }
#teachRecHead { flex-shrink: 0; padding: 14px 16px 10px; border-bottom: 1px solid #2c3e50; }
#teachRecTitle { color: #ffcc00; font-size: 16px; font-weight: bold; }
#teachRecScope { color: #8a9ba8; font-size: 12px; margin-top: 2px; }
#teachRecText { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; color: #fff; font-size: 21px; line-height: 1.55; }
#teachRecText .tp-method, #teachRecText .tp-note { margin-top: 18px; padding: 12px; border-radius: 8px; background: #0d1117; border-left: 4px solid #e8955a; }
#teachRecText .tp-note { border-left-color: #ffcc00; font-size: 18px; color: #cbd5e1; }
#teachRecText .tp-label { font-size: 12px; font-weight: bold; letter-spacing: 1px; color: #8a9ba8; margin-bottom: 6px; }
#teachRecBar { flex-shrink: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: #0d1117; border-top: 1px solid #2c3e50; }
#teachRecStatus { color: #cbd5e1; font-size: 15px; text-align: center; margin-bottom: 10px; min-height: 22px; }
#teachRecBtns { display: flex; gap: 10px; }
#teachRecBtns button { flex: 1; min-height: 52px; border-radius: 8px; border: 1px solid #484f58; background: #21262d; color: #fff; font-size: 15px; font-weight: bold; cursor: pointer; }
#teachRecBtns button.go { background: #c0392b; border-color: #e74c3c; }
#teachRecBtns button.ok { background: #1f6f43; border-color: #2ecc71; }
/* START while the microphone opens, and STOP for the first second of a take (audit I-36): held, and shown held. */
#teachRecBtns button:disabled { opacity: 0.5; cursor: default; }
.rec-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #e74c3c; margin-right: 6px; vertical-align: middle; animation: recblink 1s infinite; }
@keyframes recblink { 50% { opacity: 0.2; } }
/* The funny lines around a step on the recording screen (the Leader's Kit scripts). */
#teachRecText .tp-fun { color: #7ee2a8; font-style: italic; margin: 6px 0 14px; }
#teachRecText .tp-fun-edit { width: 100%; box-sizing: border-box; margin: 6px 0 14px; padding: 10px; border-radius: 8px; border: 1px dashed #2ecc71; background: #0d1117; color: #7ee2a8; font-size: 17px; font-style: italic; font-family: inherit; resize: vertical; }

/* ── The Scout Leader's Kit (leaders-kit.js) ──────────────────────────────────────────────────── */
.kit-open-btn { width: 100%; margin: 6px 0 0 0; padding: 10px 8px; border-radius: 4px; border: 1px solid #2ecc71; background: #12301f; color: #2ecc71; font-weight: bold; font-size: 13px; cursor: pointer; }
#kitMeetingPill { align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; padding: 8px 10px; border-radius: 6px; background: #12301f; border: 1px solid #2ecc71; color: #2ecc71; font-size: 12px; font-weight: bold; }
#kitMeetingPill button { background: #21262d; color: #fff; border: 1px solid #484f58; border-radius: 6px; padding: 6px 12px; font-weight: bold; cursor: pointer; }
/* A bottom sheet: never taller than 88% of the screen, so its top — and the close button in it —
   always sits clear of the phone's top strip. It scrolls inside itself. */
#kitSheet { position: fixed; inset: 0; z-index: 10080; display: none; }
#kitSheet.open { display: block; }
#kitBackdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
#kitPanel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column; background: #161b22; border-top: 2px solid #2ecc71; border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6); max-width: 720px; margin: 0 auto; }
#kitHead { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #2c3e50; color: #2ecc71; font-size: 14px; font-weight: bold; letter-spacing: 0.5px; }
#kitHead button { background: #21262d; color: #fff; border: 1px solid #484f58; border-radius: 8px; min-width: 44px; min-height: 44px; font-size: 18px; cursor: pointer; }
#kitBody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }

/* Materials Prep sheet (materials-prep.js, 2026-09-13) — the Leader's Kit's sheet, same shape. */
#prepSheet { position: fixed; inset: 0; z-index: 10080; display: none; }
#prepSheet.open { display: block; }
#prepBackdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
#prepPanel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column; background: #161b22; border-top: 2px solid #e67e22; border-radius: 14px 14px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6); max-width: 720px; margin: 0 auto; }
#prepHead { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #2c3e50; color: #e67e22; font-size: 14px; font-weight: bold; letter-spacing: 0.5px; }
#prepHead button { background: #21262d; color: #fff; border: 1px solid #484f58; border-radius: 8px; min-width: 44px; min-height: 44px; font-size: 18px; cursor: pointer; }
#prepBody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 16px calc(16px + env(safe-area-inset-bottom, 0px)); color: #c9d1d9; font-size: 14px; line-height: 1.5; }
.prep-sum { padding: 10px 0 6px; font-weight: bold; color: #fff; }
.prep-hint { color: #8a9ba8; font-size: 12px; font-weight: normal; margin-top: 4px; }
.prep-sec { border-top: 1px solid #2c3e50; padding: 12px 0; }
.prep-h { color: #ffcc00; font-size: 12px; font-weight: bold; letter-spacing: 0.5px; margin-bottom: 8px; }
.prep-row { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid #222; }
.prep-row .q { color: #ffcc00; font-weight: bold; min-width: 40px; text-align: right; white-space: nowrap; }
.prep-row .n { color: #8a9ba8; font-size: 12px; }
.prep-sec ul, .prep-sec ol { margin: 0; padding-left: 20px; }
.prep-sec li { margin: 5px 0; }
.prep-sec p { margin: 8px 0 0; }
.prep-job { margin: 10px 0 18px; }
.prep-job-t { color: #fff; font-weight: bold; font-size: 15px; margin-bottom: 6px; }
.prep-job img { display: block; width: 100%; max-width: 560px; background: #fff; border-radius: 6px; margin: 6px 0 10px; }
.prep-job .m { background: #1a2505; border-left: 3px solid #7bc67e; padding: 8px 10px; margin: 10px 0; }
.prep-job .nt { color: #8a9ba8; font-size: 13px; margin-top: 8px; }
.prep-sub { color: #fff; font-weight: bold; margin: 2px 0 6px; }
.prep-parts { display: block; width: 100%; max-width: 560px; background: #fff; border-radius: 6px; margin: 0 0 12px; }
/* Flat or gable? — the comparison that opens Materials Prep (materials-prep.js chooseHtml). */
.prep-cmp-wrap { overflow-x: auto; margin: 10px 0 6px; }
.prep-cmp { width: 100%; border-collapse: collapse; font-size: 12px; line-height: 1.4; }
.prep-cmp th, .prep-cmp td { padding: 6px; border-bottom: 1px solid #222; text-align: left; vertical-align: top; }
.prep-cmp th { color: #fff; font-size: 13px; }
.prep-cmp td:first-child { color: #8a9ba8; font-weight: bold; width: 26%; }
.prep-cmp .sel { background: rgba(46, 204, 113, 0.10); }
.prep-cmp th.sel { color: #2ecc71; }
.prep-pick { display: flex; gap: 8px; margin-top: 10px; }
.prep-pick-b { flex: 1; min-height: 48px; border-radius: 8px; border: 1px solid #484f58; background: #21262d; color: #c9d1d9; font-weight: bold; font-size: 14px; cursor: pointer; }
.prep-pick-b.on { background: #1a2505; border-color: #2ecc71; color: #2ecc71; }
/* The guard bin's count, with − and + big enough for a thumb (materials-prep.js guardsHtml). */
.prep-bin { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #161b22; border: 1px solid #2c3e50; border-radius: 8px; padding: 10px 12px; margin: 10px 0 4px; }
.prep-bin-l { flex: 1 1 100%; color: #8a9ba8; font-size: 12px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; }
.prep-bin-b { width: 48px; height: 48px; border-radius: 8px; border: 1px solid #484f58; background: #21262d; color: #fff; font-size: 24px; font-weight: bold; cursor: pointer; }
.prep-bin-n { flex: 1; text-align: center; color: #ffcc00; font-weight: bold; font-size: 17px; }
.prep-go { width: 100%; min-height: 48px; margin-top: 10px; background: #27ae60; color: #fff; border: 0; border-radius: 8px; font-weight: bold; font-size: 15px; cursor: pointer; }
.kit-sec { padding: 14px 0; border-bottom: 1px solid #21262d; }
.kit-h { color: #ffcc00; font-size: 11px; font-weight: bold; letter-spacing: 1px; margin-bottom: 8px; }
.kit-lbl { display: block; color: #8a9ba8; font-size: 12px; margin: 10px 0 4px; }
.kit-select { width: 100%; min-height: 44px; background: #0d1117; color: #fff; border: 1px solid #484f58; border-radius: 6px; padding: 8px; font-size: 15px; }
.kit-seg { display: flex; gap: 6px; }
.kit-seg button { flex: 1; min-height: 44px; border-radius: 6px; border: 1px solid #484f58; background: #21262d; color: #c9d1d9; font-size: 13px; font-weight: bold; cursor: pointer; padding: 6px 4px; }
.kit-seg button.on { background: #1f6f43; border-color: #2ecc71; color: #fff; }
.kit-hint { color: #8a9ba8; font-size: 12px; line-height: 1.5; margin-top: 8px; }
.kit-prog { color: #cbd5e1; font-size: 14px; }
.kit-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.kit-btns .teach-btn { flex: 1 1 140px; }
.kit-link { display: block; padding: 12px; border-radius: 6px; border: 1px solid #ffcc00; color: #ffcc00; text-decoration: none; font-weight: bold; font-size: 13px; background: #1a242f; }
.kit-thanks { color: #2ecc71; font-size: 13px; font-weight: bold; }
.kit-sub { display: flex; align-items: center; gap: 10px; padding-top: 10px; }
.kit-sub .teach-btn { flex: 0 0 auto; }
.kit-line { padding: 12px 0; border-bottom: 1px solid #21262d; }
.kit-line-t { color: #cbd5e1; font-size: 12px; font-weight: bold; margin-bottom: 6px; }
.kit-line textarea { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 8px; border-radius: 6px; border: 1px solid #2c3e50; background: #0d1117; color: #7ee2a8; font-size: 15px; font-family: inherit; resize: vertical; }
/* The whole-script page: text on top, controls at the bottom (the top-strip rule again). */
#kitScriptPage { position: fixed; inset: 0; z-index: 10090; background: #06090d; display: none; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
#kitScriptPage.open { display: flex; }
#kitScriptHead { flex-shrink: 0; padding: 14px 16px 10px; border-bottom: 1px solid #2c3e50; }
#kitScriptTitle { color: #ffcc00; font-size: 14px; font-weight: bold; }
#kitScriptBody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px; color: #e6edf3; font-size: 17px; line-height: 1.55; }
#kitScriptBar { flex-shrink: 0; display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: #0d1117; border-top: 1px solid #2c3e50; }
#kitScriptBar button { flex: 1; min-height: 52px; border-radius: 8px; border: 1px solid #484f58; background: #21262d; color: #fff; font-size: 15px; font-weight: bold; cursor: pointer; }
.sp-step { padding: 14px 0; border-bottom: 1px solid #21262d; }
.sp-title { color: #ffcc00; font-weight: bold; font-size: 15px; margin-bottom: 8px; }
.sp-fun { color: #7ee2a8; font-style: italic; margin: 6px 0; }
.sp-method, .sp-note { margin-top: 10px; padding: 10px; border-radius: 6px; background: #0d1117; border-left: 4px solid #e8955a; font-size: 15px; }
.sp-note { border-left-color: #ffcc00; }
.sp-label { font-size: 11px; font-weight: bold; letter-spacing: 1px; color: #8a9ba8; margin-bottom: 4px; }
/* Inputs, the extra recordings, the shopping list. */
.kit-input { width: 100%; box-sizing: border-box; min-height: 44px; background: #0d1117; color: #fff; border: 1px solid #484f58; border-radius: 6px; padding: 8px; font-size: 15px; font-family: inherit; }
textarea.kit-input { resize: vertical; line-height: 1.5; }
.kit-extra { padding: 10px 0; border-top: 1px solid #21262d; }
.kit-extra-t { color: #cbd5e1; font-size: 14px; font-weight: bold; }
.kit-extra-s { color: #8a9ba8; font-size: 12px; margin-top: 2px; }
.kit-extra .teach-del { flex: 0 0 56px; }
.kit-shop { margin-top: 10px; }
.kit-shop-row { display: flex; gap: 12px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid #21262d; color: #e6edf3; font-size: 14px; }
.kit-shop-q { min-width: 44px; text-align: right; color: #ffcc00; font-weight: bold; font-size: 16px; }
.kit-shop-n { display: block; color: #8a9ba8; font-size: 11px; }
/* Build photos. The pick button is a label over a full-size transparent file input (Android rule). */
.kit-pick { margin-top: 10px; }
.kit-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.kit-thumb { position: relative; width: 76px; height: 76px; }
.kit-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid #2c3e50; }
.kit-thumb button { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid #484f58; background: #21262d; color: #fff; font-size: 13px; cursor: pointer; }
.kit-consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; color: #cbd5e1; font-size: 13px; line-height: 1.5; text-transform: none; letter-spacing: normal; font-weight: normal; }
.kit-consent input { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; }
/* The honeypot: a field no person sees. A bot that fills it is quietly ignored by the server. */
.kit-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
/* Certificates — on screen a stack of cards; in print, one landscape page each. */
/* On screen the card grows to fit its words — a fixed landscape shape was too short on a phone and
   spilled the signature lines onto the next card. Print gives each one a real landscape page. */
.cert-page { background: #fff; color: #1a1a1a; border-radius: 6px; margin: 0 0 14px; padding: 10px; box-sizing: border-box; }
.cert-inner { height: 100%; box-sizing: border-box; border: 3px double #1f6f43; border-radius: 4px; padding: 4% 6%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-family: Georgia, 'Times New Roman', serif; }
.cert-icon { width: 11%; max-width: 72px; margin-bottom: 1%; }
.cert-kicker { font-family: Arial, sans-serif; font-size: 10px; letter-spacing: 3px; color: #1f6f43; font-weight: bold; }
.cert-title { font-size: 22px; font-weight: bold; margin: 2% 0 3%; color: #1f6f43; }
.cert-line { font-size: 13px; margin: 1% 0; }
.cert-small { font-size: 11px; color: #555; font-style: italic; }
.cert-name { font-size: 26px; font-weight: bold; margin: 1% 0 2%; border-bottom: 1px solid #999; padding: 0 4% 1%; }
.cert-foot { display: flex; gap: 12%; margin-top: 5%; width: 80%; justify-content: space-between; }
.cert-foot > div { flex: 1; }
.cert-sig { border-bottom: 1px solid #333; min-height: 18px; font-size: 13px; padding-bottom: 2px; }
.cert-cap { font-family: Arial, sans-serif; font-size: 9px; letter-spacing: 1px; color: #555; margin-top: 3px; text-transform: uppercase; }
@page cert { size: landscape; margin: 0.4in; }
@media print {
    body.kit-printing .cert-page { page: cert; break-after: page; margin: 0; border-radius: 0; aspect-ratio: auto; height: 7.6in; padding: 0; }
    body.kit-printing .cert-title { font-size: 34pt; }
    body.kit-printing .cert-name { font-size: 40pt; }
    body.kit-printing .cert-line { font-size: 16pt; }
    body.kit-printing .cert-kicker { font-size: 11pt; }
}
/* Meeting mode's dark curtain — 95% black, one tap lifts it (the library app's pattern). */
#kitCurtain { position: fixed; inset: 0; z-index: 10300; background: rgba(0, 0, 0, 0.95); display: none; align-items: flex-end; justify-content: center; padding-bottom: 12vh; color: #3a4450; font-size: 14px; }
#kitCurtain.on { display: flex; }
/* Printing the script prints the script, in ink on white, and nothing else. */
@media print {
    body.kit-printing > *:not(#kitScriptPage) { display: none !important; }
    body.kit-printing #kitScriptPage { display: block !important; position: static !important; background: #fff !important; padding: 0 !important; }
    body.kit-printing #kitScriptBar { display: none !important; }
    body.kit-printing #kitScriptBody { overflow: visible !important; color: #000 !important; font-size: 12pt; }
    body.kit-printing #kitScriptTitle, body.kit-printing .sp-title { color: #000 !important; }
    body.kit-printing .sp-fun { color: #1a5c33 !important; }
    body.kit-printing .sp-method, body.kit-printing .sp-note { background: #f4f4f4 !important; }
    body.kit-printing .sp-step { break-inside: avoid; border-bottom: 1px solid #ccc; }
    /* Certificates print with no title and no padding (audit I-68, 2026-09-14): the title printed alone on
       a portrait first sheet, and the padding pushed the foot of the first certificate onto a sheet of its
       own — three wasted sheets of the leader's cardstock every run. With both gone, 3 certificates are 3
       landscape sheets. openPrintPage() marks the page .kit-certs; the script page is not marked. */
    body.kit-printing #kitScriptPage.kit-certs #kitScriptHead { display: none !important; }
    body.kit-printing #kitScriptPage.kit-certs #kitScriptBody { padding: 0 !important; }
}