/* Import Fonts from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/*
   ==========================================================================
   Branding Variables
   Based on WVU Brand Guidelines and application-specific needs.
   ==========================================================================
*/
:root {
    /* WVU Primary Palette */
    --wvu-blue: #002855;
    --wvu-gold: #EAAA00;

    /* WVU Secondary Palette */
    --wvu-slate: #5A5A5A;
    --wvu-fog: #C0C8D8;
    --wvu-cloud: #F5F8FF;
    --wvu-sky: #EAF0FA;

    /* Natural Tones (for forestry context) */
    --forest-green: #2E4636;
    --bark-brown: #5C3317;

    /* Semantic/Feedback Colors */
    --feedback-success: #27ae60;
    --feedback-warning: #e67e22;
    --feedback-error: #c0392b;

    /* Defect Colors */
    --defect-knot: #8B4513;
    --defect-burl: #A0522D;
    --defect-seam: #444444;
    --defect-sweep: #DAA520;
    --defect-rot: #8B0000;
    --defect-stain: #7B0000;
    --defect-hole: #556B2F;
    --defect-check: #555555;

    /* Typography */
    --font-heading: 'Inter', 'Helvetica', 'Arial', sans-serif;
    --font-body: 'Inter', 'Helvetica', 'Arial', sans-serif;

    /* Dashboard-style accents */
    --accent-green: #059669;
    --accent-green-soft: #ecfdf5;
    --accent-indigo: #4f46e5;
    --accent-indigo-soft: #eef2ff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --page-bg: #f8fafc;

    /* Layout */
    --sidebar-w: 247px;
    --topbar-h: 0px;

    /* UI */
    --border-radius: 12px;
    --radius-card: 20px;
    --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
    --shadow-md: 0 4px 14px -2px rgb(15 23 42 / 0.08), 0 2px 6px -2px rgb(15 23 42 / 0.06);
}

/*
   ==========================================================================
   Base & Typographic Styles
   ==========================================================================
*/
body {
    font-family: var(--font-body);
    color: var(--ink);
    background-color: var(--page-bg);
    margin: 0;
    padding: 20px;
}

/* Signed in: make room for the sidebar and top bar */
body:has(#accountBar:not([hidden])) {
    padding: 28px 28px 40px calc(var(--sidebar-w) + 28px);
}

.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    background: var(--page-bg);
    display: grid;
    place-items: center;
}
.auth-screen[hidden] { display: none; }

.auth-card {
    width: min(100%, 380px);
    box-sizing: border-box;
    padding: 28px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md);
    text-align: left;
}

.auth-card h1 { margin-top: 0; }
.auth-card label { display: block; margin: 12px 0 4px; font-weight: 700; }
.auth-card input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; }
.auth-button { width: 100%; margin-top: 16px; padding: 11px; border: 0; border-radius: 10px; background: var(--wvu-blue); color: #fff; font-weight: 700; cursor: pointer; }
.google-button { background: #4285f4; }
.auth-link { display: block; margin: 14px auto 0; border: 0; background: none; color: var(--wvu-blue); text-decoration: underline; cursor: pointer; }
.auth-divider { margin: 18px 0 2px; border-top: 1px solid #d4d9e2; text-align: center; }
.auth-divider span { position: relative; top: -10px; padding: 0 8px; background: #fff; color: #666; }
.auth-status { min-height: 1.3em; margin-bottom: 0; color: #555; }
.auth-status.error { color: var(--feedback-error); }

/* Signed-in shell: #accountBar wraps the sidebar and top bar */
.account-bar { display: contents; }
.account-bar[hidden] { display: none; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #002855 0%, #00204a 100%);
    color: #e2e8f0;
}
.sidebar-brand { padding: 22px 22px 16px; }
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.brand-sub { margin-top: 4px; font-size: 10px; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; color: var(--wvu-gold); }
.sidebar-org {
    display: flex; align-items: center; gap: 10px;
    margin: 0 22px; padding: 16px 0 18px;
    border-top: 1px solid rgb(255 255 255 / 0.1);
    border-bottom: 1px solid rgb(255 255 255 / 0.1);
}
.org-logo { height: 30px; width: auto; max-width: 64px; object-fit: contain; }
.org-fallback { font-size: 18px; font-weight: 800; color: var(--wvu-gold); }
.org-top { font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #cbd5e1; }
.org-bottom { font-size: 12px; font-weight: 700; color: var(--wvu-gold); }
.sidebar-nav { display: flex; flex-direction: column; gap: 6px; padding: 24px 14px; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 13px 16px;
    border: 0; border-radius: 12px; background: transparent;
    color: #e2e8f0; font-size: 15px; font-weight: 500; text-align: left;
}
.nav-item[hidden] { display: none; }
.nav-item:hover { background: rgb(255 255 255 / 0.08); transform: none; }
.nav-item.open { background: rgb(255 255 255 / 0.1); color: var(--wvu-gold); font-weight: 700; }
.nav-item.active {
    background: rgb(255 255 255 / 0.1); color: var(--wvu-gold); font-weight: 700;
    box-shadow: inset -4px 0 0 var(--wvu-gold);
}

.sidebar-account {
    margin: auto 14px 18px;
    padding: 10px;
    border: 1px solid rgb(255 255 255 / 0.14);
    border-radius: 14px;
    background: rgb(255 255 255 / 0.05);
}
.account-name {
    display: block; padding: 4px 6px 8px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: #cbd5e1; font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
}
.sidebar-account .nav-item { padding: 10px 12px; font-size: 14px; }

@media (max-width: 800px) {
    body:has(#accountBar:not([hidden])) { padding: 76px 12px 32px; }
    .sidebar { inset: 0 0 auto 0; width: auto; flex-direction: row; align-items: center; }
    .sidebar-brand { padding: 10px 16px; }
    .brand-sub, .sidebar-org { display: none; }
    .sidebar-nav { flex-direction: row; margin-left: auto; padding: 8px; }
    .nav-item { width: auto; padding: 8px 12px; font-size: 13px; }
    .nav-item.active { box-shadow: none; }
    .sidebar-nav .nav-item span { display: none; } /* icons only on phones */
    .sidebar-account { margin: 6px 8px 6px 0; padding: 4px 6px; display: flex; align-items: center; gap: 6px; }
    .account-name { max-width: 30vw; padding: 0; }
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-heading);
    color: var(--ink);
    letter-spacing: -0.02em;
}

h1 { font-weight: 800; }

#datasetPicker {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 12px 0 16px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: left;
}

.pickerGroup {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pickerDivider {
    width: 1px;
    align-self: stretch;
    background: var(--wvu-fog);
}

@media (max-width: 600px) {
    #datasetPicker {
        flex-direction: column;
        align-items: stretch;
    }
    .pickerDivider {
        width: auto;
        height: 1px;
        align-self: auto;
    }
}

#datasetSelect, #viewModeSelect {
    font: inherit;
    padding: 7px 28px 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: var(--wvu-blue);
    background: #fff;
}

#datasetStatus {
    color: var(--wvu-slate);
    font-size: 12px;
}

.dataset-story {
    margin: 0 0 16px;
    padding: 14px 18px;
    background: #f5f9fc;
    border-left: 4px solid var(--wvu-gold);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    color: var(--ink);
}

.dataset-story h2 {
    margin: 0 0 6px;
    font-size: 17px;
    color: var(--wvu-blue);
}

.dataset-story p {
    margin: 6px 0 0;
    line-height: 1.55;
}

#stemViewWrap {
    position: relative;
}

#stemViewWrap canvas {
    cursor: none;
}

#stem3dBadge {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 11px;
    color: var(--wvu-blue);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--wvu-fog);
    border-radius: 4px;
    padding: 3px 8px;
    pointer-events: none;
}

/* The chainsaw's blade tip is the only part meant to mark a location — it
   sits at (50%, 96%) of the icon's own box. transform-origin is pinned to
   that same point so rotation pivots around the tip instead of the icon's
   center, which is what keeps the tip anchored to the actual cursor/cut
   position at any angle. Kept small and off to the side isn't an option
   here (tip = the point), so precision instead comes from the tip anchor
   plus the separate cut-preview line/ring drawn on the stem itself. */
#chainsawCursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 26px;
    height: auto;
    display: none;
    pointer-events: none;
    z-index: 300;
    transform-origin: 50% 96%;
    transform: translate(-50%, -96%) rotate(-12deg);
    filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.35));
    transition: transform 0.08s ease-out;
}

#chainsawCursor.active {
    transform: translate(-50%, -96%) rotate(-12deg) scale(1.12);
}

button {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/*
   ==========================================================================
   Layout & Responsiveness
   ==========================================================================
*/
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0;
    text-align: center;
}

#finalReport {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
    body {
        padding: 10px 5px;
    }
    h1 {
        font-size: 22px;
    }
    #datasetPicker {
        align-items: stretch;
        flex-direction: column;
    }
    button {
        padding: 9px 15px;
        font-size: 14px;
    }
    .segment {
        font-size: 13px;
    }
    #finalReport table, #finalReport div {
        font-size: 13px;
    }
}

/*
   ==========================================================================
   Component Styles
   ==========================================================================
*/

/* Main action buttons */
#scoreLog, #nextLog {
    background-color: var(--wvu-blue);
    color: white;
}
#scoreLog:hover, #nextLog:hover {
    background-color: #003a7d; /* A slightly lighter blue */
}
#reset { background: #fff; color: var(--wvu-blue); border: 1px solid #cbd5e1; }
#reset:hover { background: var(--wvu-cloud); }

/* Segment cards */
.segment {
    background-color: #fff;
    border: 1px solid var(--line);
    border-left-width: 5px;
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

/* Tooltip */
#hoverTooltip {
    background-color: rgba(0, 40, 85, 0.9); /* semi-transparent wvu-blue */
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    position: absolute;
    z-index: 100;
}

/* ==========================================================================
   Pathway screens (menu, consent, sections, certificate, admin)
   ========================================================================== */
.pathway-root {
    position: fixed;
    inset: var(--topbar-h) 0 0 var(--sidebar-w);
    z-index: 900;
    overflow-y: auto;
    background: var(--page-bg);
}
.pathway-root[hidden] { display: none; }
@media (max-width: 800px) { .pathway-root { inset: 56px 0 0 0; } }

.pw-wrap { max-width: 1000px; margin: 0 auto; padding: 28px 28px 48px; box-sizing: border-box; }
.pw-title {
    color: var(--ink); margin: 0 0 6px; font-size: 30px; font-weight: 800; letter-spacing: -0.03em;
}
.pw-sub { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.pw-step { margin: 0 0 4px; color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: 11px; letter-spacing: .14em; }
.pw-grid { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 22px; }
.pw-grid > .pw-card { flex: 1 1 280px; margin: 0; }
.pw-card {
    position: relative;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card);
    box-shadow: var(--shadow-md); padding: 24px 26px; margin-bottom: 22px; text-align: left;
}
.pw-card.highlight { background: var(--accent-green); border-color: var(--accent-green); color: #ecfdf5; }
.pw-card.highlight h2, .pw-card.highlight .pw-note { color: #fff; }
.pw-card.highlight .pw-btn { background: #fff; color: var(--accent-green); }
.pw-card h2 { margin-top: 0; color: var(--ink); font-size: 20px; font-weight: 800; }
.pw-center { text-align: center; }
.pw-note { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.pw-big { font-size: 20px; margin: 6px 0; }
.pw-grade { font-size: 72px; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.pw-btn {
    padding: 11px 22px; border: 0; border-radius: 10px; background: var(--wvu-blue); color: #fff;
    font-weight: 600; font-size: 15px; cursor: pointer;
}
.pw-btn:hover { background: #003a7d; }
.pw-btn.secondary { background: #fff; color: var(--wvu-blue); border: 1px solid #cbd5e1; }
.pw-btn.secondary:hover { background: var(--wvu-cloud); }
.pw-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.pw-actions.center { justify-content: center; }
.pw-details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); padding: 16px 26px; margin-bottom: 22px; }
.pw-details summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.pw-details li { margin-bottom: 6px; }
.pw-card label { display: block; margin: 14px 0 4px; font-weight: 600; font-size: 13px; }
.pw-card input:not([type=checkbox]) { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; }
.pw-card label.pw-check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin-top: 16px; }
.pw-status { min-height: 1.3em; color: var(--feedback-error); }
.pw-table { border-collapse: separate; border-spacing: 0; margin: 14px auto; width: 100%; max-width: 560px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.pw-table th { background: var(--wvu-blue); color: #fff; padding: 10px 12px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.pw-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); }

/* Certificate */
.certificate { margin-bottom: 18px; }
.cert-border { background: #fff; border: 6px double var(--wvu-blue); outline: 2px solid var(--wvu-gold); outline-offset: -14px; padding: 34px 40px; text-align: center; }
.cert-logo { display: block; height: 56px; width: auto; margin: 0 auto 10px; }
.cert-org { margin: 0; letter-spacing: .12em; text-transform: uppercase; font-size: 13px; color: var(--wvu-slate); }
.cert-title { font-family: var(--font-heading); color: var(--wvu-blue); font-size: 38px; margin: 10px 0 14px; border: 0; }
.cert-line { margin: 6px 0; color: #444; }
.cert-name { font-family: var(--font-heading); font-size: 32px; margin: 8px 0 2px; color: #111; }
.cert-aff { margin: 0 0 8px; color: var(--wvu-slate); }
.cert-program { font-size: 20px; font-weight: 700; color: var(--wvu-blue); margin: 4px 0; }
.cert-credit { display: inline-block; margin: 10px 0 14px; padding: 6px 18px; border: 2px solid var(--wvu-gold); border-radius: 999px; font-weight: 700; color: var(--wvu-blue); }
.cert-table { border-collapse: collapse; margin: 0 auto 18px; min-width: 60%; }
.cert-table th { border-bottom: 2px solid var(--wvu-blue); padding: 5px 16px; color: var(--wvu-blue); }
.cert-table td { padding: 5px 16px; border-bottom: 1px solid #e3e7ef; }
.cert-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; text-align: left; margin-top: 10px; }
.cert-sig { font-family: 'Brush Script MT', 'Segoe Script', cursive; font-size: 30px; color: var(--wvu-blue); }
.cert-sigline { border-top: 1px solid #333; width: 260px; margin: 2px 0 4px; }
.cert-date, .cert-small { font-size: 12px; color: var(--wvu-slate); margin-top: 6px; }
.cert-verify { text-align: center; }
.cert-verify img, .cert-verify canvas { max-width: 110px; }

@media print {
    body * { visibility: hidden; }
    .pathway-root { position: absolute; inset: auto; left: 0; top: 0; width: 100%; overflow: visible; background: #fff; }
    .pathway-root .certificate, .pathway-root .certificate * { visibility: visible; }
    .pw-wrap { padding: 0; max-width: none; }
    .no-print { display: none !important; }
    @page { size: landscape; margin: 0.4in; }
}

/* Trainer screen: card treatment to match the dashboard look */
#gameHeader, #logInfo {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px;
    margin: 0 0 12px; padding: 12px 18px; text-align: left;
    background: #fff; border: 1px solid var(--line); border-radius: var(--border-radius); box-shadow: var(--shadow-sm);
}
#logCounter, #gameScore { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
#logInfo { justify-content: flex-start; }
#stemViewWrap, #optContainer {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card);
    box-shadow: var(--shadow-md); padding: 16px; margin-top: 12px;
}
#optContainer { margin-top: 16px; }
/* script.js sets the 2D/3D stem canvas to display:block, which drops the
   inherited text-align centering, so center all stem canvases explicitly. */
#logCanvas, #stem3dCanvas, #optCanvas, #faceCanvas, #optFaceCanvas {
    display: block; margin-left: auto; margin-right: auto; max-width: 100%;
}
.canvas-label { max-width: 800px; margin: 2px auto 0; font-size: 11px; font-weight: bold; color: #002855; text-align: left; letter-spacing: 0.03em; }
#info { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
#finalReport {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-md);
    font-family: var(--font-body) !important;
}

/* Reference panel (How to use / Grading reference): docked right, non-modal.
   On wide screens it pushes the trainer aside so the log stays fully visible;
   on narrower screens it overlays the right edge but never blocks the page. */
:root { --panel-w: 460px; }
.side-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(var(--panel-w), 100vw);
    z-index: 1000;
    display: flex; flex-direction: column;
    background: #fff; border-left: 1px solid var(--line);
    box-shadow: -8px 0 24px -12px rgb(15 23 42 / 0.25);
}
.side-panel[hidden] { display: none; }
.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.panel-close {
    width: 32px; height: 32px; padding: 0; border-radius: 8px;
    background: transparent; color: var(--muted); font-size: 24px; line-height: 1;
}
.panel-close:hover { background: var(--wvu-cloud); color: var(--ink); }
.panel-body { flex: 1; overflow: auto; padding: 16px 20px 28px; text-align: left; font-size: 13px; }
.panel-body[hidden] { display: none; }
.panel-body table { width: 100%; }
.panel-body p { line-height: 1.5; }

/* Weight-priced products in the grading panel: stacked blocks, not a table */
.wp-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.wp-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--page-bg); }
.wp-item h4 { margin: 0 0 6px; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; font-size: 14px; color: var(--wvu-blue); }
.wp-price { font-size: 13px; font-weight: 700; color: var(--ink); }
.wp-test { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .08em; color: var(--feedback-error); }
.wp-range { font-style: normal; font-size: 11px; font-weight: 500; color: var(--muted); }
.wp-item ul { margin: 0 0 6px; padding-left: 18px; }
.wp-item li { margin-bottom: 2px; }
.wp-item p { margin: 0; color: #334155; font-size: 12.5px; }

@media (min-width: 1500px) {
    body.panel-open:has(#accountBar:not([hidden])) { padding-right: calc(var(--panel-w) + 28px); }
    body.panel-open .pathway-root { right: var(--panel-w); }
}
@media (max-width: 800px) {
    .side-panel { top: 56px; width: 100vw; }
}

/* Defects list: one-line summary + expandable, position-sorted list */
#defectLegend { margin: 12px 0; text-align: left; }
.dl-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.dl-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px 4px 10px; border-radius: 999px;
    background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm);
    font-size: 12px; font-weight: 600; color: var(--ink);
}
.dl-chip::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.dl-chip b { font-weight: 800; color: var(--muted); }
.dl-none { font-size: 12px; font-weight: 600; color: var(--muted); }
.dl-details { margin-top: 8px; font-size: 13px; }
.dl-details > summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--wvu-blue); }
.dl-list {
    list-style: none; margin: 8px 0 0; padding: 4px 0;
    max-height: 260px; overflow-y: auto;
    background: #fff; border: 1px solid var(--line); border-radius: var(--border-radius); box-shadow: var(--shadow-sm);
}
.dl-row {
    display: grid; grid-template-columns: 12px minmax(120px, 1.4fr) minmax(110px, 1fr) minmax(90px, 1fr);
    align-items: center; gap: 10px; padding: 6px 14px; cursor: default;
}
.dl-row:hover, .dl-row:focus { background: var(--wvu-cloud); outline: none; }
.dl-dot { width: 10px; height: 10px; border-radius: 50%; }
.dl-name { font-weight: 600; }
.dl-pos { color: var(--muted); font-variant-numeric: tabular-nums; }
.dl-eff { color: #334155; }
.face-badge {
    display: inline-block; margin-right: 4px; padding: 1px 7px; border-radius: 6px;
    background: var(--c); color: #fff; font-size: 11px; font-weight: 800;
}
@media (max-width: 600px) {
    .dl-row { grid-template-columns: 12px 1fr; }
    .dl-pos, .dl-eff { grid-column: 2; }
}

/* Per-log defect breakdown (live piece cards and scored results) */
.log-defects { flex-basis: 100%; margin-top: 6px; text-align: left; }
.ld-faces { display: flex; flex-wrap: wrap; gap: 6px; }
.ld-face { padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 700; border: 1px solid; }
.ld-face em { font-style: normal; font-weight: 600; }
.ld-face.blocked { background: #fef2f2; color: #b42318; border-color: #fecaca; }
.ld-face.clear { background: var(--accent-green-soft); color: #047857; border-color: #a7f3d0; }
.ld-notes { margin-top: 5px; font-size: 12px; color: var(--muted); }
