:root {
    --page-bg: #eef1f5;
    --surface: #ffffff;
    --text: #17233d;
    --muted: #64748b;
    --border: #d8e0ea;
    --info-bg: #f0f5fb;
    --primary: #f58220;
    --primary-hover: #d96b0b;
    --navy: #15294b;
    --navy-hover: #0d1d37;
    --danger: #a93b32;
    --danger-bg: #fff5f4;
    --focus: rgba(245, 130, 32, 0.35);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    width: 100%;
    color-scheme: light;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    width: 100%;
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.45;
}

button,
input {
    font: inherit;
}

.price-app {
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: start;
    justify-items: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.price-card {
    width: min(100%, 480px);
    min-width: 0;
    padding: 16px;
    overflow: hidden;
    border: 1px solid rgba(21, 41, 75, 0.08);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(21, 41, 75, 0.1);
}

.app-logo,
.result-logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: 60px;
    margin: 0 auto 10px;
}

.result-logo {
    height: 54px;
    margin-bottom: 12px;
}

.page-header {
    margin-bottom: 14px;
    text-align: center;
}

.page-header h1 {
    margin: 0 0 4px;
    color: var(--navy);
    font-size: clamp(1.25rem, 6vw, 1.5rem);
    line-height: 1.15;
    letter-spacing: 0.005em;
    white-space: nowrap;
}

.page-header p {
    max-width: 360px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 0.875rem;
}

.button {
    display: inline-flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    touch-action: manipulation;
}

.button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.button--primary {
    background: var(--navy);
    color: #ffffff;
}

.button--primary:hover:not(:disabled) {
    background: var(--navy-hover);
}

.button--scan {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 5px 14px rgba(245, 130, 32, 0.2);
}

.button--scan:hover:not(:disabled) {
    background: var(--primary-hover);
}

.button--secondary {
    border-color: var(--border);
    background: var(--surface);
    color: var(--navy);
}

.button--secondary:hover {
    background: var(--info-bg);
}

.manual-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 10px;
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.manual-divider::before,
.manual-divider::after {
    height: 1px;
    flex: 1;
    background: var(--border);
    content: "";
}

.manual-divider span {
    flex: 0 0 auto;
}

.query-form {
    display: grid;
    gap: 10px;
}

.form-group {
    display: grid;
    min-width: 0;
    gap: 5px;
}

label {
    color: var(--navy);
    font-size: 0.825rem;
    font-weight: 700;
}

input[type="text"] {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcfe;
    color: var(--text);
    font-size: 1rem;
    letter-spacing: 0.035em;
    appearance: none;
}

input[type="text"]::placeholder {
    color: #98a2b3;
    letter-spacing: 0;
}

input:focus-visible,
.button:focus-visible,
.icon-button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.message {
    max-width: 100%;
    margin-bottom: 10px;
    padding: 0.7rem 0.8rem;
    overflow-wrap: anywhere;
    border: 1px solid;
    border-radius: 9px;
    font-size: 0.875rem;
}

.message--error {
    border-color: #f4c7c3;
    background: var(--danger-bg);
    color: var(--danger);
}

.camera-panel {
    width: 100%;
    min-width: 0;
    margin-top: 12px;
    padding: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--navy);
    color: #ffffff;
}

.camera-panel__header {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 0 7px 4px;
}

.camera-panel__header h2 {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
    line-height: 1.25;
}

.icon-button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    touch-action: manipulation;
}

.camera-viewport {
    position: relative;
    width: 100%;
    max-height: 260px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: #070d18;
}

.camera-viewport video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 48%;
    border: 2px solid var(--primary);
    border-radius: 8px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%);
}

.camera-status {
    margin: 0;
    padding: 7px 4px 1px;
    overflow-wrap: anywhere;
    font-size: 0.78rem;
    line-height: 1.3;
    text-align: center;
}

.result-view {
    display: grid;
    min-width: 0;
    gap: 10px;
    text-align: center;
}

.result-box,
.barcode-box,
.price-box {
    min-width: 0;
    margin: 0;
    border-radius: 11px;
}

.result-box {
    padding: 14px;
    background: var(--info-bg);
}

.result-label,
.price-box span {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.result-box h2 {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--navy);
    font-size: clamp(1.15rem, 5.5vw, 1.5rem);
    line-height: 1.3;
    text-align: center;
}

.barcode-box {
    padding: 10px 12px;
    overflow-wrap: anywhere;
    background: #f8fafc;
    color: var(--muted);
    font-size: 0.85rem;
}

.barcode-box strong {
    color: var(--navy);
}

.price-box {
    padding: 14px;
    border: 2px solid #fed7aa;
    background: #fff7ed;
}

.price-box strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--primary-hover);
    font-size: clamp(2.25rem, 12vw, 3rem);
    line-height: 1.05;
}

@media (min-width: 600px) {
    .price-app {
        align-items: center;
        padding: 24px;
    }

    .price-card {
        padding: 24px;
        border-radius: 16px;
    }

    .app-logo {
        height: 66px;
    }
}

@media (max-width: 340px) {
    .price-card {
        padding: 14px;
    }

    .page-header h1 {
        font-size: 1.25rem;
        letter-spacing: -0.01em;
    }

    .page-header p {
        font-size: 0.825rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

