:root {
    --background: 40 44% 93%;
    --foreground: 20 51% 15%;
    --border: 40 30% 78%;
    --card: 40 35% 90%;
    --card-foreground: 20 51% 15%;
    --card-border: 40 25% 80%;
    --primary: 350 56% 27%;
    --primary-foreground: 40 44% 93%;
    --muted-foreground: 20 30% 45%;
    --accent: 40 47% 69%;
    --accent-foreground: 20 51% 15%;
    --destructive: 0 65% 50%;
    --input: 40 25% 82%;
    --ring: 350 56% 27%;
    color-scheme: light;
    font-family: Inter, sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 0;
    background: transparent;
}

body {
    min-width: 320px;
    min-height: 0;
    margin: 0;
    background: transparent;
    color: hsl(var(--foreground));
    font-family: Inter, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
input,
select {
    color: inherit;
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
}

[hidden] {
    display: none !important;
}

.page-shell {
    display: block;
    width: 100%;
    min-height: 0;
    padding: 0;
    background: transparent;
}

.form-frame {
    width: 350px;
    max-width: 100%;
}

.card {
    overflow: hidden;
    border: 1px solid hsl(var(--card-border));
    border-radius: 12px;
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
    box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}

.order-header {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 24px 24px 16px;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    text-align: center;
}

.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: hsl(var(--accent) / 10%);
}

.header-icon .icon {
    width: 24px;
    height: 24px;
}

.header-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    color: hsl(var(--primary));
    font-family: "Crimson Text", serif;
    font-size: 24px;
    font-weight: 600;
    line-height: 32px;
}

.header-copy p {
    color: hsl(var(--muted-foreground));
    font-size: 14px;
}

.language-switcher {
    position: absolute;
    z-index: 20;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.language-toggle,
.language-menu button,
.icon-button {
    border: 1px solid transparent;
    background: transparent;
}

.language-toggle {
    min-height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.language-toggle:hover,
.language-menu button:hover,
.icon-button:hover {
    background: rgb(0 0 0 / 3%);
}

.language-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 44px;
    overflow: hidden;
    border: 1px solid hsl(var(--card-border));
    border-radius: 8px;
    background: hsl(var(--card));
    box-shadow: 0 4px 8px rgb(0 0 0 / 10%);
}

.language-menu button {
    display: block;
    width: 100%;
    padding: 4px 8px;
    text-align: center;
    font-size: 12px;
}

.order-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 0 24px 24px;
}

.order-fields,
.donation-form,
.donation-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label,
.field-label {
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
}

input[type="text"],
input[type="email"],
input[type="number"],
select {
    width: 100%;
    height: 36px;
    border: 1px solid hsl(var(--input));
    border-radius: 6px;
    outline: none;
    background: hsl(var(--background));
    padding: 8px 12px;
    font-size: 14px;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

input::placeholder,
select:invalid {
    color: hsl(var(--muted-foreground));
    opacity: 1;
}

input:focus,
select:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring) / 45%);
}

input.has-error {
    border-color: hsl(var(--destructive));
}

.field-error {
    color: hsl(var(--destructive));
    font-size: 14px;
    line-height: 20px;
}

.select-wrap {
    position: relative;
}

select {
    appearance: none;
    padding-right: 36px;
}

.select-arrow {
    position: absolute;
    top: 50%;
    right: 12px;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    pointer-events: none;
}

.donation-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    line-height: 1.5;
    transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.donation-option:hover {
    border-color: hsl(var(--accent) / 60%);
}

.donation-option-selected {
    border-color: hsl(var(--accent));
    background: hsl(var(--accent) / 10%);
    box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
}

.donation-option input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 4px 0 0;
    accent-color: hsl(var(--primary));
}

.donation-copy,
.donation-benefits {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.donation-copy {
    gap: 8px;
}

.donation-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
}

.donation-description {
    color: hsl(var(--muted-foreground));
    font-size: 14px;
    font-weight: 400;
}

.donation-benefits {
    gap: 4px;
    color: hsl(var(--muted-foreground));
    font-size: 14px;
    font-weight: 400;
}

.donation-benefits span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.donation-benefits b {
    color: hsl(var(--accent));
    font-weight: 700;
}

.report-card {
    border-color: hsl(var(--accent) / 20%);
    background: linear-gradient(to bottom right, hsl(var(--accent) / 5%), hsl(var(--accent) / 10%));
}

.compact-card-content {
    padding: 16px;
}

.payment-header {
    padding: 24px;
}

.payment-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
}

.payment-header h2 .icon {
    width: 20px;
    height: 20px;
}

.payment-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 24px 24px;
}

.payment-loading,
.payment-status {
    padding: 16px;
    color: hsl(var(--muted-foreground));
    text-align: center;
    font-size: 14px;
}

.payment-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid hsl(var(--muted-foreground) / 25%);
    border-top-color: currentColor;
    border-radius: 999px;
    animation: spin .8s linear infinite;
}

.stripe-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stripe-element {
    min-height: 48px;
    padding: 12px;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    background: hsl(var(--background));
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 36px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    transition: filter 140ms ease, opacity 140ms ease;
}

.button-primary {
    border: 1px solid hsl(var(--primary));
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.button:hover:not(:disabled) {
    filter: brightness(.96);
}

.button:focus-visible,
.language-toggle:focus-visible,
.language-menu button:focus-visible,
.icon-button:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}

.button:disabled {
    opacity: .5;
}

.button .spinner {
    width: 16px;
    height: 16px;
}

.icon {
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.icon-flame,
.icon-accent {
    color: hsl(var(--accent));
}

.icon-muted {
    color: hsl(var(--muted-foreground));
}

.modal {
    position: fixed;
    z-index: 50;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 50%);
}

.modal-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 448px;
    background: hsl(var(--background));
    border-color: hsl(var(--accent) / 20%);
}

.modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    text-align: center;
}

.modal-close-row {
    display: flex;
    justify-content: flex-end;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 6px;
}

.result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto;
    border-radius: 999px;
    font-size: 28px;
    font-weight: 600;
}

.result-icon .icon {
    width: 32px;
    height: 32px;
}

.result-icon-success {
    background: hsl(var(--accent) / 10%);
    color: hsl(var(--accent));
}

.result-icon-error {
    background: #fee2e2;
    color: #dc2626;
}

.result-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.result-copy h2 {
    color: hsl(var(--primary));
    font-size: 18px;
    font-weight: 600;
}

.result-copy p {
    color: hsl(var(--muted-foreground));
    font-size: 14px;
    white-space: pre-line;
}

body.modal-open {
    overflow: hidden;
}

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

@media (max-width: 380px) {
    .order-header {
        padding-right: 20px;
        padding-left: 20px;
    }

    .order-content {
        padding-right: 20px;
        padding-left: 20px;
    }

    .payment-header {
        padding: 20px;
    }

    .payment-content {
        padding: 0 20px 20px;
    }
}

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