:root {
    --ink: #172033;
    --muted: #667085;
    --line: #dbe6e1;
    --paper: #ffffff;
    --soft: #f6faf8;
    --accent: #0f766e;
    --accent-dark: #075f58;
    --brand-green-soft: #e8f5f0;
    --danger: #b42318;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 0%, rgba(15, 118, 110, .12), transparent 32%),
        linear-gradient(180deg, #f4faf7 0%, #fff 44%, var(--soft) 100%);
    line-height: 1.5;
}
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(248, 250, 252, .78);
    backdrop-filter: blur(12px);
}
.loading-box {
    display: grid;
    justify-items: center;
    gap: 10px;
    width: min(360px, 100%);
    padding: 30px;
    border: 1px solid rgba(223,230,239,.9);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 28px 90px rgba(15, 23, 42, .14);
    text-align: center;
}
.loading-box strong {
    font-size: 22px;
}
.loading-box span {
    color: var(--muted);
}
.loading-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #dce7ef;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: rt-spin .8s linear infinite;
}
@keyframes rt-spin {
    to { transform: rotate(360deg); }
}
.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 30px 0 72px;
}
.hero {
    position: relative;
    padding: 18px 0 34px;
}
.brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 42px;
}
.brand-logo {
    display: inline-flex;
    align-items: center;
    width: 175px;
    height: 63px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    text-decoration: none;
}
.brand-logo img {
    display: block;
    width: 175px;
    height: auto;
}
.language-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 14px 36px rgba(15, 23, 42, .07);
}
.language-switch a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 34px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
}
.language-switch a.active {
    background: var(--accent-dark);
    color: #fff;
}
.kicker {
    margin: 0 0 10px;
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.kicker a {
    color: inherit;
    text-decoration: none;
}
.kicker a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}
h1 {
    margin: 0 0 16px;
    font-size: clamp(36px, 6vw, 68px);
    letter-spacing: -.04em;
    line-height: 1.02;
    color: #10243a;
}
h2 {
    margin: 0 0 18px;
    font-size: clamp(22px, 3vw, 30px);
}
.hero p:last-child {
    max-width: 820px;
    color: var(--muted);
    font-size: clamp(18px, 2.2vw, 22px);
}
.card {
    margin: 20px 0;
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .06);
}
.input-card {
    border-color: rgba(15, 118, 110, .18);
    box-shadow: 0 28px 90px rgba(15, 118, 110, .10);
}
label {
    display: block;
    margin-bottom: 10px;
    font-weight: 800;
}
.input-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
}
input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
}
textarea {
    width: 100%;
    min-height: 132px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
    resize: vertical;
}
button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border: 0;
    border-radius: 999px;
    padding: 0 20px;
    background: var(--accent-dark);
    color: white;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
}
button.secondary,
.button.secondary {
    border: 1px solid var(--line);
    background: white;
    color: var(--ink);
}
button:hover,
.button:hover,
.mode-button:hover {
    transform: translateY(-1px);
}
.loading,
.message {
    margin-top: 16px;
    font-weight: 700;
}
.error {
    color: var(--danger);
}
.success {
    border-color: rgba(15,118,110,.28);
    background: #f0faf8;
}
.result-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    align-items: start;
    margin: 26px 0 18px;
    padding: 30px;
    border: 1px solid rgba(15,118,110,.22);
    border-radius: 22px;
    background: linear-gradient(135deg, #ffffff 0%, #eefaf7 100%);
    box-shadow: 0 28px 90px rgba(15, 23, 42, .08);
}
.result-label {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.result-hero h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 46px);
    letter-spacing: -.03em;
    line-height: 1.06;
}
.result-manufacturer {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 19px;
    font-weight: 800;
}
.result-badge {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-weight: 900;
    white-space: nowrap;
}
.result-badge.found {
    background: #d9f7ee;
    color: #096b5b;
}
.result-badge.not-found {
    background: #fff0e6;
    color: #9a3412;
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}
.summary-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 45px rgba(15, 23, 42, .05);
}
.summary-card span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}
.summary-card strong {
    display: block;
    font-size: 17px;
    overflow-wrap: anywhere;
}
.validation-card h2 {
    margin-bottom: 16px;
}
.validation-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.validation-row {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}
.validation-row.passed {
    border-color: rgba(15,118,110,.24);
    background: #f3fbf8;
}
.validation-row.failed {
    border-color: rgba(180,35,24,.24);
    background: #fff7f5;
}
.validation-row.neutral {
    background: #f8fafc;
}
.validation-row strong,
.validation-row span {
    display: block;
}
.validation-row span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 14px;
}
.check-icon {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
}
.check-icon svg {
    display: block;
    width: 19px;
    height: 19px;
    overflow: visible;
}
.check-icon svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.check-icon.pass {
    background: #d9f7ee;
    color: #08745f;
}
.check-icon.fail {
    background: #fee4df;
    color: #b42318;
}
.check-icon.neutral {
    background: #e8edf4;
    color: #667085;
}
.input-card {
    position: relative;
}
.mode-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}
.mode-button {
    position: relative;
    min-height: 124px;
    align-items: flex-start;
    overflow: hidden;
    border-radius: 20px;
    padding: 24px;
    flex-direction: column;
    text-align: left;
    gap: 8px;
    box-shadow: 0 20px 50px rgba(15, 118, 110, .12);
    transition: transform .18s ease, box-shadow .18s ease;
}
.mode-button::after {
    content: "";
    position: absolute;
    right: -28px;
    bottom: -36px;
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
}
.mode-button span {
    position: relative;
    z-index: 1;
    font-size: 25px;
    line-height: 1.1;
}
.mode-button small {
    position: relative;
    z-index: 1;
    color: rgba(255,255,255,.84);
    font-size: 15px;
    line-height: 1.35;
}
.mode-button.secondary-mode {
    border: 1px solid var(--line);
    background: linear-gradient(135deg, #fff 0%, #f8fbf9 100%);
    color: var(--ink);
    box-shadow: 0 16px 45px rgba(15, 23, 42, .06);
}
.mode-button.secondary-mode::after {
    background: rgba(15, 118, 110, .06);
}
.mode-button.secondary-mode small {
    color: var(--muted);
}
.hri-panel {
    margin-top: 22px;
}
.hri-actions {
    margin-top: 12px;
}
.scanner-panel {
    margin-top: 22px;
}
.scanner-top {
    position: sticky;
    top: 8px;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin: -12px -12px 14px;
    border: 1px solid rgba(223,230,239,.9);
    border-radius: 16px;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(10px);
}
.scanner-status {
    margin-bottom: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #eef7f6;
    color: var(--ink);
    font-weight: 800;
}
.scanner-status.error {
    background: #fff3f0;
    color: var(--danger);
}
.video-wrap {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 340px;
    border-radius: 18px;
    background: #0f172a;
}
.video-wrap video {
    display: block;
    width: 100%;
    min-height: 340px;
    max-height: min(68vh, 620px);
    object-fit: cover;
}
.scan-frame {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(72vw, 420px);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border: 3px solid rgba(255,255,255,.92);
    border-radius: 22px;
    box-shadow: 0 0 0 999px rgba(2, 6, 23, .34);
    pointer-events: none;
}
.scanner-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    margin-top: 0;
}
.icon-button,
.toolbar-text-button {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 46px;
    min-width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    text-align: center;
}
.toolbar-text-button {
    width: auto;
    min-width: 58px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 900;
}
.file-button {
    cursor: pointer;
}
.file-button span {
    display: block;
    transform: translateY(-1px);
    line-height: 1;
}
.scan-debug-button {
    display: none;
}
.info-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}
.info-strip article {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.74);
}
.info-strip strong,
.info-strip span {
    display: block;
}
.info-strip strong {
    margin-bottom: 6px;
}
.info-strip span {
    color: var(--muted);
    font-size: 14px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}
dl {
    display: grid;
    grid-template-columns: minmax(170px, .42fr) 1fr;
    gap: 10px 18px;
    margin: 0;
}
dt {
    color: var(--muted);
    font-weight: 700;
}
dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.wide-dl {
    grid-template-columns: minmax(220px, .35fr) 1fr;
}
.hint,
.notice {
    color: var(--muted);
}
.warning {
    margin: 8px 0 0;
    color: #8a5a00;
    font-weight: 700;
}
summary {
    cursor: pointer;
    font-weight: 800;
}
pre {
    overflow-x: auto;
    padding: 16px;
    border-radius: 12px;
    background: #101828;
    color: #eef7f6;
}
.site-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
}
.site-footer a {
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
}
.site-footer span a {
    color: var(--muted);
}
.site-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 760px) {
    .input-row,
    .grid,
    .summary-grid,
    .validation-list,
    .info-strip,
    dl,
    .wide-dl,
    .mode-actions {
        grid-template-columns: 1fr;
    }
    .result-hero {
        grid-template-columns: 1fr;
        padding: 24px;
    }
    .result-badge {
        width: fit-content;
    }
    .card {
        padding: 22px;
    }
    .shell {
        width: min(100% - 20px, 1120px);
        padding-top: 24px;
    }
    .hero {
        padding: 72px 0 18px;
    }
    .language-switch {
        top: 18px;
        left: 0;
        right: auto;
    }
    .mode-button {
        min-height: 96px;
    }
    .scanner-actions,
    .hri-actions {
        display: flex;
    }
    .scanner-top {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .scanner-actions {
        justify-content: space-between;
    }
    .hri-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
    .hri-actions > * {
        width: 100%;
    }
    .video-wrap,
    .video-wrap video {
        min-height: min(62vh, 520px);
    }
}
