/* ===========================================================================
   Excise Tax Stamp & Tobacco Barcode Scanner — Codepool demo styles.

   Visual language follows the Codepool barcode-scanner page
   (../barcode-scanner/) and the Dynamsoft style guide
   (https://dynamsoft.github.io/styleguide/style-guide.html):

     - brand orange  #FE8E14  (CTA / active state only)
     - ink           #242427  (headings)
     - body text     #303034  (values, table cells)
     - secondary     #606068  (labels, hints, subtitles)
     - borders       #E0E0E5  (card outline) / #D4D4DA (controls)
     - page          #FFFFFF, working cards #FFFFFF with a hairline border

   The page is LIGHT on purpose: this is a tool plus its guide, not a
   full-screen viewfinder. Only the camera viewport stays dark, because a
   video surface needs a neutral surround.

   The result internals (status cells, field table, payload block) were already
   light-themed and keep their tints: green = passed, amber = warning,
   red = failed, neutral = not verified.
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&family=Oswald:wght@300;400;500&display=swap');

:root {
    --dy-orange: #fe8e14;
    --dy-orange-hover: #e07d0b;
    --dy-orange-ink: #a85100;

    --ink: #242427;
    --text: #303034;
    --muted: #606068;
    --muted-2: #8a8a92;

    --line: #e0e0e5;
    --line-strong: #d4d4da;
    --line-soft: #ececf0;

    --surface: #ffffff;
    --surface-2: #f7f7f8;
    --surface-3: #f2f2f5;

    --font-heading: 'Oswald', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --font-body: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    /* Inline text links. Brand orange stays reserved for CTAs and active
       states, so links use the style guide's Blumine. */
    --dy-link: #306877;
    --dy-link-hover: #27555f;

    --dy-error: #b3261e;
    --dy-error-tint: #fdf2f1;
    --dy-ok: #1e7a4b;
    --dy-ok-tint: #eef8f2;
    --dy-warn: #9a5b00;
    --dy-warn-tint: #fff8ee;

    --radius: 8px;
    --shadow-card: 0 1px 2px rgba(16, 16, 20, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------------------
   Codepool navigation — one restrained row above the page header
   --------------------------------------------------------------------------- */

.demo-page-nav {
    display: flex;
    justify-content: flex-end;
    gap: 22px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 14px 24px 0;
    font-size: 0.82rem;
    line-height: 1.5;
}

.demo-page-nav a {
    color: var(--muted);
    text-decoration: none;
}

.demo-page-nav a:hover,
.demo-page-nav a:focus-visible {
    color: var(--dy-orange-ink);
    text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   Page shell: header, tool, guide, footer in one centred column
   --------------------------------------------------------------------------- */

.demo-page {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px 32px;
}

/* ---------------------------------------------------------------------------
   Header — Dynamsoft logo lockup, top-left, matching every Codepool demo
   --------------------------------------------------------------------------- */

.demo-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 18px 0 20px;
    border-bottom: 1px solid var(--line);
}

.demo-brand {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 100%;
}

.brand-logo {
    display: block;
    height: 28px;
    width: auto;
    flex: 0 0 auto;
}

.brand-divider {
    width: 1px;
    height: 28px;
    background: #d8d8de;
    flex: 0 0 auto;
}

/* "Free" tag in the page heading. The orange is the brand accent — never used
   for body copy — and the label is decorative repetition of adjacent text, so
   it is not announced twice. */
.brand-tag {
    display: inline-block;
    margin-right: 8px;
    padding: 1px 7px 2px;
    border: 1px solid #efc58f;
    border-radius: 4px;
    background: #fff4e6;
    color: #9b4c00;
    font-family: var(--font-heading);
    font-size: 0.62em;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    vertical-align: 0.1em;
}

.demo-header h1 {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.25;
    color: var(--ink);
    white-space: normal;
}

.demo-header .subtitle {
    max-width: 76ch;
    font-size: 0.94rem;
    line-height: 1.55;
    color: var(--muted);
    text-align: left;
}

/* ---------------------------------------------------------------------------
   Tool column
   --------------------------------------------------------------------------- */

#tax-stamp-app {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---------------------------------------------------------------------------
   Scan input switch (Camera / Upload)
   --------------------------------------------------------------------------- */

.controls-row {
    display: flex;
    justify-content: center;
    width: 100%;
}

.mode-switch {
    position: relative;
    display: flex;
    padding: 4px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: 50px;
}

.mode-options {
    position: relative;
    z-index: 2;
    display: flex;
}

.mode-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    border-radius: 46px;
    color: var(--muted);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: color 0.3s ease;
}

.mode-option.active {
    color: #ffffff;
    font-weight: 600;
}

.mode-icon {
    flex: 0 0 auto;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 2;
}

.mode-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--dy-orange);
    border-radius: 42px;
    box-shadow: 0 2px 8px rgba(254, 142, 20, 0.28);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Camera is the first option, upload the second: the slider follows the
   second one. */
.mode-switch[data-active="upload"] .mode-slider {
    transform: translateX(100%);
}

/* `display:flex` would otherwise beat the [hidden] attribute. */
#camera-section[hidden],
#scan-workbench[hidden] {
    display: none;
}

#camera-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* The one deliberately dark surface on the page: a video viewport. */
#camera-view {
    width: 100%;
    height: 420px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #111114;
}

/* ---------------------------------------------------------------------------
   Status line + notice banner
   --------------------------------------------------------------------------- */

#tip-message {
    align-self: center;
    max-width: 100%;
    padding: 0.45rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.88rem;
    text-align: center;
}

#tip-message.is-error {
    border-color: #f0c9c6;
    background: var(--dy-error-tint);
    color: var(--dy-error);
}

.notice-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0.75rem 1rem;
    border: 1px solid #f0d7b4;
    border-left: 3px solid var(--dy-orange);
    border-radius: 6px;
    background: #fff8ef;
    color: #6b4a12;
    font-size: 0.86rem;
    line-height: 1.55;
}

.notice-banner svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    margin-top: 2px;
    stroke: var(--dy-orange);
}

.notice-banner strong {
    color: #3d2a06;
}

.notice-banner em {
    font-style: italic;
}

/* ---------------------------------------------------------------------------
   Workbench: upload / camera input beside manual entry
   --------------------------------------------------------------------------- */

.workbench {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 14px;
    align-items: stretch;
}

/* One card language for every working surface. */
.panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

/* Upload drop zone: click, drag & drop, or paste. */
.upload-zone {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 180px;
    padding: 22px;
    border: 2px dashed #c9c9d1;
    border-radius: var(--radius);
    background: #fbfbfc;
    color: var(--text);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-zone:hover,
.upload-zone:focus-visible,
.upload-zone.dragover {
    border-color: var(--dy-orange);
    background: #fff8ef;
    outline: none;
}

.upload-zone-icon {
    width: 38px;
    height: 38px;
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.upload-zone:hover .upload-zone-icon {
    stroke: var(--dy-orange);
}

.upload-zone-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
}

.upload-zone-hint {
    margin: 0;
    max-width: 38ch;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--muted);
}

.upload-zone kbd {
    padding: 1px 5px;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--surface);
    font-family: inherit;
    font-size: 0.85em;
    color: var(--muted);
}

/* Bundled sample symbols, so the page is usable with no file at hand. */
.sample-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.sample-row-label {
    width: 100%;
    font-size: 0.78rem;
    color: var(--muted);
}

.sample-chip {
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 0.38rem 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.sample-chip:hover,
.sample-chip:focus-visible {
    border-color: var(--dy-orange);
    background: #fff8ef;
    color: var(--dy-orange-ink);
    outline: none;
}

.sample-chip.active {
    background: var(--dy-orange);
    border-color: var(--dy-orange);
    color: #ffffff;
}

/* ---------------------------------------------------------------------------
   Manual entry
   --------------------------------------------------------------------------- */

.manual-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
}

.manual-label {
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--muted);
}

.manual-input {
    width: 100%;
    padding: 0.58rem 0.75rem;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    letter-spacing: 0.03em;
}

.manual-input:focus-visible {
    border-color: var(--dy-orange);
    outline: none;
    box-shadow: 0 0 0 3px rgba(254, 142, 20, 0.16);
}

.manual-input::placeholder {
    color: #a9a9b1;
}

.manual-textarea {
    font-size: 0.82rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 96px;
}

.manual-hint {
    font-size: 0.76rem;
    line-height: 1.5;
    color: var(--muted);
}

.manual-button {
    align-self: flex-start;
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 999px;
    background: var(--dy-orange);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.manual-button:hover,
.manual-button:focus-visible {
    background: var(--dy-orange-hover);
    outline: none;
}

.ghost-button {
    padding: 0.48rem 1.25rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ghost-button:hover,
.ghost-button:focus-visible {
    border-color: var(--dy-orange);
    background: #fff8ef;
    outline: none;
}

.ghost-button.is-fix {
    border-color: rgba(254, 142, 20, 0.65);
    color: var(--dy-orange-ink);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.button-row.center {
    justify-content: center;
}

/* ---------------------------------------------------------------------------
   Profile controls
   --------------------------------------------------------------------------- */

.profile-panel {
    padding: 14px 16px;
}

.profile-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.profile-field[hidden] {
    display: none;
}

.profile-panel .manual-hint {
    margin-top: 2px;
}

/* ---------------------------------------------------------------------------
   Results — one card under the workbench
   --------------------------------------------------------------------------- */

.results {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    color: var(--text);
}

.results[hidden] {
    display: none;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    padding: 0.7rem 1.1rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.results-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.text-button {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.text-button:hover,
.text-button:focus-visible {
    border-color: var(--dy-orange);
    background: #fff8ef;
    outline: none;
}

.results-body {
    flex: 1 1 auto;
    padding: 1.1rem;
}

/* ---------------------------------------------------------------------------
   Result card
   --------------------------------------------------------------------------- */

.barcode-card {
    padding: 1rem 1.1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.barcode-card + .barcode-card {
    margin-top: 1.1rem;
}

.barcode-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-bottom: 0.7rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid var(--line-soft);
}

.format-chip {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--ink);
}

.card-note {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--muted);
}

/* Facts list and diagnostics */
.facts {
    display: grid;
    grid-template-columns: minmax(180px, max-content) 1fr;
    gap: 0.3rem 1rem;
    margin-bottom: 0.2rem;
    font-size: 0.84rem;
}

.facts dt {
    font-weight: 600;
    color: var(--muted);
}

.facts dd {
    color: var(--text);
    overflow-wrap: anywhere;
}

.facts dd.mono {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
}

/* ---------------------------------------------------------------------------
   The four independent statuses
   --------------------------------------------------------------------------- */

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.status-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-left-width: 3px;
    border-radius: 4px;
    background: var(--surface-2);
}

.status-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
}

.status-value {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
    overflow-wrap: anywhere;
}

.status-cell.is-ok {
    border-left-color: var(--dy-ok);
    background: var(--dy-ok-tint);
}

.status-cell.is-ok .status-value {
    color: var(--dy-ok);
}

.status-cell.is-warn {
    border-left-color: var(--dy-warn);
    background: var(--dy-warn-tint);
}

.status-cell.is-warn .status-value {
    color: var(--dy-warn);
}

.status-cell.is-bad {
    border-left-color: var(--dy-error);
    background: var(--dy-error-tint);
}

.status-cell.is-bad .status-value {
    color: var(--dy-error);
}

/* "Not Verified" is neutral on purpose: it is the absence of a check, not a
   failed one, and must never read as either a pass or a rejection. */
.status-cell.is-idle {
    border-left-color: var(--line-strong);
}

.status-cell.is-idle .status-value {
    color: var(--muted);
}

/* ---------------------------------------------------------------------------
   Result card pieces
   --------------------------------------------------------------------------- */

.profile-chip {
    display: inline-block;
    padding: 2px 9px 3px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.field-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.payload-block {
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface-2);
}

.payload-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 5px;
}

.payload-text {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.field-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.82rem;
}

.field-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--line);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.field-table td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
    color: var(--text);
}

.field-table tr:last-child td {
    border-bottom: 0;
}

.field-table td.field-name {
    font-weight: 600;
    white-space: nowrap;
}

.field-table td.mono {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.field-tag {
    display: inline-block;
    padding: 1px 7px 2px;
    border-radius: 10px;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.field-tag.is-ok {
    background: var(--dy-ok-tint);
    color: var(--dy-ok);
}

.field-tag.is-warn {
    background: var(--dy-warn-tint);
    color: var(--dy-warn);
}

.field-tag.is-error {
    background: var(--dy-error-tint);
    color: var(--dy-error);
}

.field-tag.is-opaque {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--muted);
}

.field-note {
    display: block;
    margin-top: 3px;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--muted);
}

.tag-ok {
    color: var(--dy-ok);
    font-weight: 600;
}

.note-list {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--muted);
}

.note-list li + li {
    margin-top: 3px;
}

.note-list.is-info li::before {
    content: "i";
    color: var(--dy-link);
}

.candidate-box {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.candidate-list {
    display: grid;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.candidate-list li {
    display: grid;
    gap: 2px;
}

.candidate-list .text-button {
    justify-self: start;
    font-size: 0.8rem;
}

.candidate-reason {
    font-size: 0.74rem;
    line-height: 1.45;
    color: var(--muted);
}

/* ---------------------------------------------------------------------------
   Image preview with the detected region drawn over it
   --------------------------------------------------------------------------- */

/* The decoded image is evidence, not the subject: cap it so the statuses and
   the field table stay within a screen of it. The marker overlay is positioned
   as a percentage of this box, so the cap lives on the figure, never on the
   <img>. */
.source-preview {
    max-width: 380px;
    margin: 0 auto 14px;
}

.source-preview img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.source-preview figcaption {
    margin-top: 6px;
    font-size: 0.74rem;
    color: var(--muted);
}

.preview-stage {
    position: relative;
    display: block;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-2);
    line-height: 0;
}

.preview-stage img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 3px;
}

.preview-marker {
    position: absolute;
    pointer-events: none;
}

.preview-marker svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.preview-marker polygon {
    fill: rgba(254, 142, 20, 0.14);
    stroke: var(--dy-orange);
    stroke-width: 2;
    stroke-linejoin: round;
}

.preview-marker-tag {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-2px, -100%);
    padding: 1px 6px 2px;
    border-radius: 3px;
    background: var(--dy-orange);
    color: #1c1c1e;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1.4;
}

/* ---------------------------------------------------------------------------
   Crosslink to the generator
   --------------------------------------------------------------------------- */

.crosslink-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-left: 3px solid var(--dy-link);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.crosslink-banner p {
    margin: 0;
}

.crosslink-banner strong {
    color: var(--ink);
}

.crosslink-banner a {
    color: var(--dy-link);
}

.crosslink-banner a:hover {
    color: var(--dy-link-hover);
}

/* ---------------------------------------------------------------------------
   Explainer — the guide under the tool, on the page rather than in a card
   --------------------------------------------------------------------------- */

.explainer {
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.explainer h2 {
    margin-bottom: 10px;
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.3;
    color: var(--ink);
}

.explainer h3 {
    margin: 18px 0 6px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink);
}

.explainer p {
    max-width: 82ch;
    margin-bottom: 10px;
    font-size: 0.9rem;
    line-height: 1.7;
    color: #4a4a50;
}

.explainer code {
    padding: 1px 4px;
    border-radius: 3px;
    background: var(--surface-3);
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.explainer-list {
    display: grid;
    gap: 7px;
    max-width: 88ch;
    margin: 0;
    padding-left: 18px;
}

.explainer-list li {
    font-size: 0.86rem;
    line-height: 1.65;
    color: #4a4a50;
}

.explainer-list strong {
    color: var(--ink);
}

.explainer-list a {
    color: var(--dy-link);
}

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */

.demo-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 0 28px;
    border-top: 1px solid #e7e7ec;
    font-size: 0.8rem;
    line-height: 1.65;
    color: #5b5b62;
}

.demo-footer p {
    margin: 0;
}

.demo-footer a {
    color: var(--dy-link);
}

.demo-footer .demo-footer-cta {
    color: var(--dy-orange-ink);
    font-weight: 600;
}

.demo-footer-note {
    color: var(--muted-2);
}

/* ---------------------------------------------------------------------------
   Loading / error overlay
   --------------------------------------------------------------------------- */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.94);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-overlay p {
    max-width: 520px;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
    white-space: pre-line;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--line);
    border-top-color: var(--dy-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */

@media (max-width: 820px) {
    .workbench {
        grid-template-columns: 1fr;
    }

    .profile-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-table td.field-name {
        white-space: normal;
    }
}

@media (max-width: 768px) {
    .demo-header h1 {
        font-size: 1.35rem;
    }

    .demo-header .subtitle {
        font-size: 0.88rem;
    }

    #camera-view {
        height: 300px;
    }

    .facts {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .facts dt {
        margin-top: 0.5rem;
    }
}

@media (max-width: 560px) {
    .demo-page-nav {
        padding: 12px 14px 0;
    }

    .demo-page {
        padding: 0 14px 24px;
    }

    .demo-header {
        padding-top: 12px;
    }

    .demo-header .brand-tag {
        display: none;
    }

    /* The logo lockup wraps onto two lines at this width; a divider floating
       at the end of the first line reads as a stray rule. */
    .demo-header .brand-divider {
        display: none;
    }

    .demo-header h1 {
        font-size: 1.15rem;
    }

    .demo-header .subtitle {
        font-size: 0.86rem;
    }

    .results-header {
        flex-wrap: wrap;
        row-gap: 6px;
    }

    .panel {
        padding: 14px;
    }

    .upload-zone {
        min-height: 150px;
        padding: 18px;
    }

    .status-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .demo-footer {
        font-size: 0.74rem;
    }
}
