/* ===========================================================================
   Online EMV QR Code Scanner — styles

   Brand: Dynamsoft style guide (https://dynamsoft.github.io/styleguide/style-guide.html).
   This is a live-camera page, so the surface stays DARK on purpose — the
   viewfinder needs a neutral surround, which is why it uses the brand gray
   #323234 rather than the white page the tool-style demos use. Branding comes
   from the orange accents and the logo in the header. The results panel is
   white: dense TLV tables and the wallet mock need the plain surface.
   =========================================================================== */

@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-gray-900: #323234;
    --dy-gray-800: #3a3a3d;
    --dy-gray-700: #606060;
    --dy-gray-500: #999999;
    --dy-gray-300: #cccccc;
    --dy-gray-200: #dddddd;
    --dy-gray-50: #f5f5f5;
    --white: #ffffff;

    --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;

    /* Hairlines and translucent fills that read on the dark surface. */
    --line-dark: rgba(255, 255, 255, 0.14);
    --fill-dark: rgba(255, 255, 255, 0.07);

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

    /* Verdict states. A red that reads on white for the failed checksum. */
    --dy-error: #b3261e;
    --dy-error-tint: #fdf2f1;
    --dy-ok: #1e7a4b;
    --dy-ok-tint: #eef8f2;
}

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

html,
body {
    width: 100%;
    /* Fallback for browsers without dvh support. */
    height: 100%;
    /* 100dvh follows the visible viewport, so mobile browser chrome does not
       push the camera out of view. */
    height: 100dvh;
}

body {
    font-family: var(--font-body);
    /* Brand gray, very slightly lifted at the top so the flat surface still has
       a sense of depth behind the viewfinder. */
    background: linear-gradient(180deg, var(--dy-gray-800) 0%, var(--dy-gray-900) 55%);
    color: var(--white);
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

.demo-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    padding: calc(8px + env(safe-area-inset-top)) 12px calc(8px + env(safe-area-inset-bottom));
    gap: 8px;
}

/* ---------------------------------------------------------------------------
   Header — Dynamsoft logo lockup, top-left over the viewfinder
   --------------------------------------------------------------------------- */

.demo-header {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    /* Logo sits top-left, matching every other Codepool demo. */
    align-items: flex-start;
    gap: 3px;
    padding-left: 2px;
}

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

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

.brand-divider {
    width: 1px;
    height: 20px;
    background: var(--line-dark);
    flex: 0 0 auto;
}

/* "Free" tag in the page heading. Demos are free to use and the claim only
   lived in <title>/<meta description>; spelling it out next to the h1 puts it
   in front of both the reader and the crawler that ranks the visible text.
   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 rgba(254, 142, 20, 0.55);
    border-radius: 4px;
    background: rgba(254, 142, 20, 0.15);
    color: var(--dy-orange, #fe8e14);
    font-family: var(--font-heading);
    font-size: 0.62em;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    vertical-align: 0.1em;
}

.demo-nav {
    display: flex;
    gap: 18px;
    margin-top: 10px;
    font-size: 0.85rem;
}

.demo-nav a {
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
}

.demo-nav a:hover {
    color: var(--dy-orange);
}

.demo-header h1 {
    font-family: var(--font-heading);
    font-size: 1.26rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--white);
    line-height: 1.2;
    white-space: nowrap;
}

.demo-header .subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.72);
    text-align: left;
}

/* ---------------------------------------------------------------------------
   Scanner
   --------------------------------------------------------------------------- */

#scanner-app {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    min-height: 0;
    gap: 8px;
}

#tip-message {
    flex: 0 0 auto;
    max-width: 100%;
    font-size: 0.9rem;
    color: #fff;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 1.1rem;
    border-radius: 25px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 5;
}

#tip-message.is-error {
    background: rgba(179, 38, 30, 0.92);
}

/* ---------------------------------------------------------------------------
   Mode switch
   --------------------------------------------------------------------------- */

.controls-row {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.mode-switch {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50px;
    padding: 4px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

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

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

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

.mode-icon {
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 2;
    transition: all 0.3s ease;
    flex: 0 0 auto;
}

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

.mode-switch[data-active="upload"] .mode-slider {
    transform: translateX(100%);
}

.mode-switch[data-active="upload"] .mode-option[data-mode="upload"] {
    color: #fff;
    font-weight: 600;
}

.mode-switch[data-active="upload"] .mode-option[data-mode="camera"] {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

/* Camera / image view */
#main-container {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    /* min-height:0 lets the flex item shrink, keeping the view in the viewport. */
    min-height: 0;
    width: min(100%, 680px);
    position: relative;
}

/* `display:flex` would otherwise beat the [hidden] attribute. */
#main-container[hidden] {
    display: none;
}

#camera-view {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ---------------------------------------------------------------------------
   Upload drop zone
   Replaces the SDK's own image picker so switching to Upload mode never opens
   the OS file dialog on its own.
   --------------------------------------------------------------------------- */

.upload-zone {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: min(100%, 680px);
    min-height: 0;
    padding: 24px;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    color: #fff;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-zone[hidden] {
    display: none;
}

.upload-zone:hover,
.upload-zone:focus-visible,
.upload-zone.dragover {
    border-color: var(--dy-orange);
    background: rgba(254, 142, 20, 0.18);
    outline: none;
}

.upload-zone-icon {
    width: 42px;
    height: 42px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.9;
}

.upload-zone-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.upload-zone-hint {
    margin: 0;
    max-width: 36ch;
    font-size: 0.83rem;
    line-height: 1.5;
    opacity: 0.9;
}

.upload-zone kbd {
    padding: 1px 5px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.85em;
}

/* Bundled sample symbols, so the page is usable with no camera and no file. */
.sample-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    max-width: 46ch;
}

.sample-row[hidden] {
    display: none;
}

.sample-row-label {
    width: 100%;
    font-size: 0.78rem;
    opacity: 0.8;
}

.sample-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 40px;
    padding: 0.32rem 0.9rem 0.32rem 0.4rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sample-chip:hover,
.sample-chip:focus-visible {
    background: rgba(254, 142, 20, 0.25);
    border-color: var(--dy-orange);
    outline: none;
}

.sample-chip img {
    display: block;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
}

/* The payload-string inspector lives inside the upload zone: the same "no
   image needed" spirit, one level down. The row stops the zone's own click
   handler from opening the file dialog. */
.payload-row {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line-dark);
    width: 100%;
    max-width: 560px;
    cursor: default;
}

.payload-row-label {
    display: block;
    font-size: 0.78rem;
    opacity: 0.8;
    margin-bottom: 6px;
    text-align: left;
}

.manual-row {
    display: flex;
    gap: 8px;
}

.manual-row .payload-text {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
}

.manual-row .payload-text::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.manual-row .payload-text:focus-visible {
    outline: 2px solid var(--dy-orange);
    outline-offset: 1px;
}

.payload-parse-button {
    flex: 0 0 auto;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: #fff;
    background: var(--dy-orange);
    border: none;
    border-radius: 8px;
    padding: 0 1.1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.payload-parse-button:hover {
    background: var(--dy-orange-hover);
}

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

.demo-footer {
    flex: 0 0 auto;
    padding: 6px 10px;
    background-color: var(--fill-dark);
    border: 1px solid var(--line-dark);
    border-radius: 6px;
    font-size: 0.8em;
    text-align: center;
}

.demo-footer p {
    margin: 0;
}

.demo-footer a {
    color: var(--dy-gray-200);
    text-decoration: none;
    margin: 0 3px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.demo-footer a:hover {
    color: var(--dy-orange);
    border-bottom-color: var(--dy-orange);
}

.demo-footer-cta {
    display: inline-block;
    margin-left: 8px;
    padding: 0.28rem 0.75rem;
    background: var(--dy-orange);
    border-radius: 5px;
    border-bottom: none !important;
    color: #fff !important;
    font-weight: 600;
}

.demo-footer-cta:hover {
    background: var(--dy-orange-hover) !important;
}

/* ---------------------------------------------------------------------------
   Results overlay
   --------------------------------------------------------------------------- */

.results-container {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(94vw, 760px);
    max-height: min(86vh, 86dvh);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    z-index: 100;
    overflow: hidden;
}

.results-container.is-open {
    display: flex;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    padding: 0.75rem 1.25rem;
    background: var(--dy-gray-900);
    color: var(--white);
    font-family: var(--font-heading);
    font-weight: 400;
    letter-spacing: 0.02em;
    font-size: 15px;
}

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

.text-button {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--white);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 4px;
    padding: 0.32rem 0.7rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.text-button:hover {
    background: rgba(255, 255, 255, 0.26);
}

.close-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-header .close-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.results-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 1.25rem;
    color: var(--dy-gray-900);
}

.results-body a {
    color: var(--dy-link);
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}

.results-body a:hover {
    color: var(--dy-link-hover);
}

/* The scanned image, so the result can be checked against what was read. */
.source-preview {
    margin: 0 0 1.25rem;
    text-align: center;
}

.source-preview img,
.source-preview canvas {
    max-width: 100%;
    max-height: 220px;
    border: 1px solid var(--dy-gray-200);
    border-radius: 6px;
    background: #fff;
}

.source-preview figcaption {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--dy-gray-700);
}

/* ---------------------------------------------------------------------------
   Verdict strip — the CRC check runs before anything else, so its verdict is
   the first thing in the panel. Green only ever means "checksum verified";
   red means tampered or not an EMV QR at all.
   --------------------------------------------------------------------------- */

.verify-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.9rem;
    margin-bottom: 1.25rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--dy-gray-200);
    border-radius: 6px;
    background: var(--dy-gray-50);
    font-size: 0.88rem;
}

.verify-strip.is-ok {
    border-color: #b7dfc9;
    background: #f2faf6;
}

.verify-strip.is-bad {
    border-color: #f0c9c6;
    background: var(--dy-error-tint);
}

.verify-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}

.verify-badge svg {
    flex: 0 0 auto;
}

.verify-strip.is-ok .verify-badge {
    color: var(--dy-ok);
}

.verify-strip.is-bad .verify-badge {
    color: var(--dy-error);
}

.verify-detail {
    color: var(--dy-gray-700);
}

/* Section label above each block of the result. */
.result-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--dy-gray-700);
    margin: 1.25rem 0 0.5rem;
}

/* ---------------------------------------------------------------------------
   Tag table — the parsed TLV fields, nested templates indented
   --------------------------------------------------------------------------- */

.tag-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.tag-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dy-gray-700);
    background: var(--dy-gray-50);
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--dy-gray-300);
    white-space: nowrap;
}

.tag-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--dy-gray-200);
    vertical-align: top;
}

.tag-table tbody tr:last-child td {
    border-bottom: none;
}

.tag-table td.tag-cell {
    font-family: var(--font-mono);
    color: var(--dy-gray-700);
    white-space: nowrap;
    width: 1%;
}

.tag-table td.field-cell {
    font-weight: 600;
}

.tag-table td.value-cell {
    font-family: var(--font-mono);
    word-break: break-all;
}

.tag-table tr.sub-row td {
    padding-left: 2.4rem;
    color: var(--dy-gray-700);
    font-size: 0.84rem;
}

.tag-table tr.sub-row td.field-cell {
    font-weight: 400;
}

/* The nested template's label sits at the same indent as its children, so the
   whole block reads as one unit instead of three columns drifting apart. */
.tag-table td.template-label-cell {
    padding-left: 2.4rem;
    padding-bottom: 0.2rem;
    border-bottom: none;
}

.template-label {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--dy-gray-500);
}

/* A field whose display form differs from the raw value (a currency code
   resolved to its name) keeps both on screen. */
.value-note {
    display: block;
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--dy-gray-700);
    margin-top: 2px;
}

.value-note.is-ok {
    color: var(--dy-ok);
    font-weight: 600;
}

.value-note.is-bad {
    color: var(--dy-error);
    font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Raw payload block
   --------------------------------------------------------------------------- */

.mono-block {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    background: var(--dy-gray-50);
    border: 1px solid var(--dy-gray-200);
    border-radius: 4px;
    padding: 0.6rem 0.75rem;
    overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------
   Buttons inside the white results panel (wallet actions)
   --------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    border-radius: 6px;
    padding: 0.5rem 1.1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
    background: var(--dy-orange);
    color: #fff;
    border: 1px solid var(--dy-orange);
}

.btn-primary:hover {
    background: var(--dy-orange-hover);
    border-color: var(--dy-orange-hover);
}

.btn-secondary {
    background: #fff;
    color: var(--dy-gray-700);
    border: 1px solid var(--dy-gray-300);
}

.btn-secondary:hover {
    border-color: var(--dy-gray-500);
}

/* ---------------------------------------------------------------------------
   Wallet simulation — a phone-shaped mock driven by the parsed fields, so the
   "so what" of the table above is something you can see and click.
   --------------------------------------------------------------------------- */

.wallet-mock {
    display: flex;
    justify-content: center;
    padding: 0.9rem 0 0.2rem;
}

.wallet-screen {
    width: 100%;
    max-width: 360px;
    border: 1px solid var(--dy-gray-300);
    border-radius: 18px;
    background: var(--white);
    padding: 1.1rem 1.2rem 1.3rem;
    font-size: 0.92rem;
}

.wallet-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dy-gray-500);
}

.wallet-merchant {
    margin-top: 0.3rem;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--dy-gray-900);
}

.wallet-sub {
    color: var(--dy-gray-700);
    font-size: 0.85rem;
}

.wallet-amount {
    margin: 0.9rem 0 0.2rem;
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--dy-gray-900);
}

.wallet-amount .wallet-currency {
    font-size: 1.1rem;
    color: var(--dy-gray-500);
    margin-right: 0.3rem;
}

.wallet-meta {
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--dy-gray-200);
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.8rem;
    font-size: 0.83rem;
}

.wallet-meta dt {
    color: var(--dy-gray-500);
}

.wallet-meta dd {
    margin: 0;
    color: var(--dy-gray-900);
    font-family: var(--font-mono);
    word-break: break-all;
}

.wallet-type {
    margin-top: 0.8rem;
    padding: 0.5rem 0.7rem;
    border-radius: 5px;
    background: var(--dy-gray-50);
    color: var(--dy-gray-700);
    font-size: 0.83rem;
}

.wallet-amount-input {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.wallet-amount-input input {
    flex: 1 1 auto;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--dy-gray-300);
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 1.05rem;
}

.wallet-amount-input input:focus-visible {
    outline: 2px solid var(--dy-orange);
    outline-offset: 1px;
}

.wallet-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
}

.wallet-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
}

.wallet-receipt {
    margin-top: 1rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid #b7dfc9;
    border-radius: 6px;
    background: #f2faf6;
}

.wallet-receipt .wallet-receipt-title {
    font-weight: 600;
    color: var(--dy-ok);
}

.wallet-receipt p {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
    color: var(--dy-gray-700);
}

.wallet-receipt .wallet-authref {
    font-family: var(--font-mono);
}

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

.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    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;
    text-align: center;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--white);
    white-space: pre-line;
}

.spinner {
    width: 46px;
    height: 46px;
    border: 5px solid rgba(255, 255, 255, 0.25);
    border-top-color: var(--dy-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

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

    /* The header is nowrap and every character of the product name earns its
       place, so the tag is what gives way as the header tightens. */
    .brand-tag {
        display: none;
    }

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

    .mode-option {
        padding: 0.6rem 1.1rem;
        font-size: 0.85rem;
        gap: 0.4rem;
    }

    .mode-icon {
        width: 18px;
        height: 18px;
    }

    #main-container {
        width: 100%;
    }

    .results-container {
        width: 100%;
    }

    /* Stack the tag table into label/value pairs rather than a squeezed grid. */
    .tag-table thead {
        display: none;
    }

    .tag-table,
    .tag-table tbody,
    .tag-table tr,
    .tag-table td {
        display: block;
        width: auto;
    }

    .tag-table tr {
        padding: 0.6rem 0;
        border-bottom: 1px solid var(--dy-gray-200);
    }

    .tag-table tr:last-child {
        border-bottom: none;
    }

    .tag-table td {
        padding: 0;
        border: none;
    }

    .tag-table td.tag-cell {
        width: auto;
    }

    .tag-table td:not(.tag-cell) {
        margin-top: 3px;
    }
}

@media only screen and (max-width: 480px) {
    .demo-shell {
        padding: calc(6px + env(safe-area-inset-top)) 8px calc(6px + env(safe-area-inset-bottom));
        gap: 6px;
    }

    /* The camera is the point of this demo, so trim the header on phones. */
    .demo-header .subtitle {
        display: none;
    }

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

    #scanner-app {
        gap: 6px;
    }

    .controls-row {
        gap: 6px;
    }

    .mode-switch {
        flex: 1 1 auto;
        max-width: 300px;
    }

    .mode-option {
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
    }

    #tip-message {
        font-size: 0.78rem;
        padding: 0.4rem 0.8rem;
    }

    .upload-zone {
        padding: 16px;
    }

    .demo-footer {
        font-size: 0.7em;
        padding: 5px 8px;
    }

    /* Bottom sheet so the camera stays visible behind the results. */
    .results-container {
        top: auto;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-height: 88dvh;
        border-radius: 16px 16px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .results-body {
        padding: 0.9rem;
    }
}

/* Landscape phones: every pixel of height counts. */
@media only screen and (max-height: 460px) and (orientation: landscape) {

    .demo-header .subtitle,
    .demo-footer {
        display: none;
    }

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

    #tip-message {
        font-size: 0.75rem;
        padding: 0.3rem 0.7rem;
    }

    .mode-option {
        padding: 0.35rem 0.85rem;
        font-size: 0.75rem;
    }
}
