:root {
    --bg-color: #f5eee3;
    --card-color: #7b231f;
    --text-color: #2f1b16;
    --accent-color: #c38370;
    --card-text: #fff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
}

/* Фоновая картинка заведения */
.app-background,
#venue-background {
    position: fixed;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    opacity: 0; /* по умолчанию скрыт */
    transition: opacity 0.3s ease;
}

.app__background--has-image {
    opacity: 0.25;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    padding: 1.5rem;
    position: relative;
    min-height: 100vh;
}

.app__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: var(--card-color);
    color: var(--card-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(123, 35, 31, 0.15);
}

/* Логотип из Theme (картинка) */
.logo img,
#venue-logo {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
    display: block;
}

.header-text h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.9);
}

.header-text p {
    margin: 0.35rem 0 0;
    color: rgba(0, 0, 0, 0.55);
    font-size: 0.9rem;
    line-height: 1.4;
}

.screen h2 {
    margin: 0 0 1.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.9);
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

label,
fieldset {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: rgba(0, 0, 0, 0.8);
}

input[type='text'],
input[type='date'],
input[type='tel'],
select {
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.2s ease;
    width: 100%;
    font-family: inherit;
}

input[type='text']:focus,
input[type='date']:focus,
input[type='tel']:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(195, 131, 112, 0.1);
}

input::placeholder {
    color: rgba(0, 0, 0, 0.35);
    opacity: 1;
}

.phone-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.country-select {
    flex-shrink: 0;
    width: auto;
    min-width: 115px;
    padding: 0.85rem 0.75rem;
}

.phone-input-group input[type='tel'] {
    flex: 1;
}

fieldset {
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1rem 1rem;
}

.radio {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
}

.consent-checkbox {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.65rem;
    font-weight: 400;
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.65);
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
}

.consent-checkbox input[type='checkbox'] {
    margin-top: 0.25rem;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.consent-checkbox a {
    color: var(--accent-color);
    text-decoration: underline;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.consent-checkbox a:hover {
    opacity: 0.8;
}

.hint {
    color: rgba(0, 0, 0, 0.5);
    font-size: 0.875rem;
    line-height: 1.4;
    margin-top: -0.25rem;
}

.primary-btn {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 0.95rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent-color);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 10px 25px rgba(195, 131, 112, 0.35);
}

.primary-btn:active {
    transform: translateY(1px);
    opacity: 0.95;
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.loyalty-card {
    background: var(--card-color);
    color: var(--bg-color);
    border-radius: 24px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 20px 50px rgba(123, 35, 31, 0.3);
    position: relative;
}

.loyalty-card__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.card-logo-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    font-weight: 700;
    font-size: 1rem;
}

.card-company-logo {
    max-width: 150px;
    max-height: 150px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.card-balance-section {
    margin-left: auto;
    text-align: right;
}

.card-balance-label {
    font-size: 0.75rem;
    letter-spacing: 0.1rem;
    opacity: 0.8;
    margin: 0;
}

.card-balance-value {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
}

.loyalty-card__strip {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0;
}

.card-strip-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.loyalty-card__fields {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.card-field {
    flex: 1;
}

.card-field:last-child {
    text-align: right;
}

.card-field-label {
    font-size: 0.7rem;
    letter-spacing: 0.05rem;
    text-transform: uppercase;
    opacity: 0.7;
    margin: 0 0 0.3rem 0;
}

.card-field-value {
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
}

.barcode-block {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

.qrcode-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 200px;
}

.qrcode-wrapper img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.card-number-text {
    width: 100%;
    padding: 0 25%;
    margin: 0.35rem 0 0;
    font-size: 0.65rem;
    line-height: 1.2;
    color: #000;
    text-align: center;
    letter-spacing: 0.05rem;
    font-weight: 600;
}

.barcode-text {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.6);
    text-align: center;
}

.card-info {
    margin-top: 1rem;
    text-align: center;
    color: rgba(0, 0, 0, 0.6);
}

.loading-screen {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
    padding: 2rem 1rem;
}

.loading-screen p {
    margin: 0;
    color: rgba(0, 0, 0, 0.6);
    font-size: 1rem;
}

.error-screen {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
    padding: 2rem 1rem;
}

.error-screen__eyebrow {
    margin: 0;
    letter-spacing: 0.3rem;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: rgba(0, 0, 0, 0.4);
}

.error-screen__title {
    margin: 0;
    font-size: 1.5rem;
}

.error-screen__message {
    margin: 0;
    color: rgba(0, 0, 0, 0.6);
    max-width: 280px;
    line-height: 1.4;
}

.error-screen__button {
    border: none;
    border-radius: 999px;
    padding: 0.95rem 2.5rem;
    font-weight: 600;
    font-size: 1rem;
    background: var(--accent-color);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(195, 131, 112, 0.25);
}

.error-screen__button:hover {
    box-shadow: 0 6px 16px rgba(195, 131, 112, 0.35);
    transform: translateY(-1px);
}

.error-screen__button:active {
    opacity: 0.85;
    transform: translateY(0);
}

.promotions {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.promotions h3 {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
}

.promotions__list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.promotion-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.promotion-card__content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.promotion-card__image {
    width: 100%;
    aspect-ratio: 2.6;
    object-fit: cover;
    border: 3px solid rgba(0, 0, 0, 0.7);
    border-radius: 12px;
    flex-shrink: 0;
}

.promotion-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}

.promotion-card__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.7);
}

.promotion-card__description {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(0, 0, 0, 0.7);
    line-height: 1.4;
}

.promotion-card__dates {
    font-size: 0.78rem;
    color: rgba(0, 0, 0, 0.55);
}

.promotion-card__button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    border-radius: 12px;
    background: #1a1a1a;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    justify-content: center;
    transition: background 0.2s ease;
    margin: 0 1rem 1rem 1rem;
}

.promotion-card__button:active {
    background: #000;
}

.promotion-card__button-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.promotions__state {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.55);
    text-align: center;
}

.loader {
    position: fixed;
    inset: 0;
    background: rgba(245, 238, 227, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 10;
}

.loader.hidden,
.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid rgba(123, 35, 31, 0.15);
    border-top-color: var(--card-color);
    animation: spin 0.8s linear infinite;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 0.875rem 1.5rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    animation: fade 2s forwards;
    backdrop-filter: blur(8px);
}

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

@keyframes fade {
    0% {
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@media (max-width: 480px) {
    .app {
        padding: 1.25rem;
    }

    .app__header {
        margin-bottom: 1.5rem;
        padding-bottom: 1.25rem;
    }

    .logo {
        width: 56px;
        height: 56px;
    }

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

    .header-text p {
        font-size: 0.85rem;
    }

    .screen h2 {
        font-size: 1.35rem;
        margin-bottom: 1.25rem;
    }

    .form {
        gap: 1rem;
    }

    input[type='text'],
    input[type='date'],
    input[type='tel'],
    select {
        padding: 0.8rem 0.9rem;
        font-size: 0.95rem;
    }

    .consent-checkbox {
        font-size: 0.825rem;
        padding: 0.65rem;
    }

    .holder-name {
        font-size: 1.4rem;
    }
}
