:root {
    --ink: #202520;
    --muted: #738074;
    --line: #dce3da;
    --paper: #f5f6f2;
    --white: #ffffff;
    --sage: #7e8e7e;
    --sage-dark: #617162;
    --danger: #a34d44;
    --safe: #53715a;
    --shadow: 0 24px 70px rgba(43, 57, 45, .10);
    --sans: "Avenir Next", Avenir, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 100% 0, rgba(126,142,126,.18), transparent 36%), var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.is-hidden { display: none !important; }

.ffpwa-shell { width: min(100%, 520px); min-height: 100vh; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 22px max(22px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.ffpwa-brand { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 2px 0 18px; }
.ffpwa-wordmark { font-size: 23px; font-weight: 500; letter-spacing: .19em; }
.ffpwa-product { color: var(--muted); font-size: 12px; letter-spacing: .13em; text-transform: uppercase; }
main { flex: 1; display: flex; align-items: center; padding: 34px 0; }
.ffpwa-view { width: 100%; animation: ffpwa-in .28s ease both; }
@keyframes ffpwa-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ffpwa-kicker { margin-bottom: 10px; color: var(--sage-dark); font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
h1 { max-width: 420px; margin: 0 0 28px; font-size: clamp(31px, 8vw, 48px); font-weight: 450; letter-spacing: -.045em; line-height: 1.02; }
footer { padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; letter-spacing: .12em; text-align: center; text-transform: uppercase; }

.ffpwa-stack { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; letter-spacing: .05em; }
input, select { width: 100%; min-height: 54px; border: 1px solid var(--line); border-radius: 0; outline: 0; background: var(--white); color: var(--ink); padding: 0 15px; font-size: 16px; }
input:focus, select:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(126,142,126,.13); }
.ffpwa-primary { min-height: 56px; border: 1px solid var(--sage); border-radius: 0; background: var(--sage); color: white; cursor: pointer; font-weight: 600; letter-spacing: .035em; }
.ffpwa-primary:disabled { opacity: .55; cursor: wait; }
.ffpwa-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 13px; }
.ffpwa-hint { color: var(--muted); font-size: 13px; text-align: center; }
.ffpwa-link, .ffpwa-back { border: 0; background: transparent; color: var(--sage-dark); cursor: pointer; padding: 8px 0; text-decoration: underline; text-underline-offset: 4px; }
.ffpwa-back { margin: 0 0 26px; text-decoration: none; }

.ffpwa-session { display: flex; align-items: center; justify-content: space-between; margin-bottom: 38px; padding: 13px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ffpwa-session span, .ffpwa-session strong { display: block; }
.ffpwa-session span { color: var(--muted); font-size: 11px; }
.ffpwa-session strong { margin-top: 2px; font-size: 14px; font-weight: 600; }
.ffpwa-session button { border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.ffpwa-actions { display: grid; grid-template-columns: 1.15fr .85fr; gap: 12px; }
.ffpwa-action { min-height: 176px; padding: 22px 18px; border: 1px solid var(--line); border-radius: 0; background: rgba(255,255,255,.78); color: var(--ink); text-align: left; cursor: pointer; box-shadow: 0 10px 30px rgba(43,57,45,.05); transition: transform .16s ease, border-color .16s ease; }
.ffpwa-action:active { transform: scale(.985); }
.ffpwa-action--scan { background: var(--sage); border-color: var(--sage); color: white; }
.ffpwa-action strong, .ffpwa-action small { display: block; }
.ffpwa-action strong { margin-top: 34px; font-size: 18px; line-height: 1.12; }
.ffpwa-action small { margin-top: 9px; opacity: .72; font-size: 11px; line-height: 1.35; }
.ffpwa-action-icon { display: block; width: 28px; height: 28px; border: 2px solid currentColor; position: relative; }
.ffpwa-action-icon::after { content: ""; position: absolute; inset: 7px; border: 2px solid currentColor; }

.ffpwa-scanner-frame { position: relative; overflow: hidden; min-height: 330px; border: 1px solid var(--sage); background: #111; box-shadow: var(--shadow); }
.ffpwa-scanner-frame::before, .ffpwa-scanner-frame::after, .ffpwa-scanner-frame i::before, .ffpwa-scanner-frame i::after { content: ""; position: absolute; z-index: 3; width: 42px; height: 42px; border-color: white; border-style: solid; pointer-events: none; }
.ffpwa-scanner-frame::before { left: 20px; top: 20px; border-width: 2px 0 0 2px; }
.ffpwa-scanner-frame::after { right: 20px; top: 20px; border-width: 2px 2px 0 0; }
.ffpwa-scanner-frame i::before { left: 20px; bottom: 20px; border-width: 0 0 2px 2px; }
.ffpwa-scanner-frame i::after { right: 20px; bottom: 20px; border-width: 0 2px 2px 0; }
#qrReader { min-height: 330px; }
#qrReader video { object-fit: cover !important; min-height: 330px; }
#qrReader img, #qrReader button, #qrReader select { display: none !important; }

.ffpwa-coupon { background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ffpwa-coupon-head { padding: 24px; border-bottom: 1px solid var(--line); }
.ffpwa-status { display: inline-block; margin-bottom: 18px; padding: 6px 9px; background: #eef3ed; color: var(--safe); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.ffpwa-status.is-blocked { background: #f6ece9; color: var(--danger); }
.ffpwa-code { overflow-wrap: anywhere; font-size: clamp(28px, 8vw, 43px); font-weight: 500; letter-spacing: .05em; }
.ffpwa-discount { margin-top: 8px; color: var(--sage-dark); font-size: 18px; }
.ffpwa-detail-list { margin: 0; padding: 8px 24px; }
.ffpwa-detail { display: grid; grid-template-columns: minmax(105px,.7fr) 1.3fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid #edf0eb; font-size: 13px; }
.ffpwa-detail:last-child { border: 0; }
.ffpwa-detail dt { color: var(--muted); }
.ffpwa-detail dd { margin: 0; overflow-wrap: anywhere; }
.ffpwa-note { margin: 0 24px 20px; padding: 13px; border-left: 3px solid var(--sage); background: var(--paper); color: var(--muted); font-size: 12px; line-height: 1.45; }
.ffpwa-redeem { padding: 0 24px 24px; }
.ffpwa-confirm { margin-top: 12px; padding: 16px; border: 1px solid var(--sage); background: var(--paper); }
.ffpwa-confirm p { margin: 0 0 12px; font-size: 13px; }
.ffpwa-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ffpwa-confirm-actions button { min-height: 44px; border-radius: 0; border: 1px solid var(--sage); background: white; color: var(--sage-dark); }
.ffpwa-confirm-actions .is-confirm { background: var(--sage); color: white; }

.ffpwa-success-mark { display: grid; place-items: center; width: 92px; height: 92px; margin-bottom: 28px; border: 1px solid var(--sage); color: var(--sage); font-size: 44px; animation: ffpwa-mark .38s ease both; }
@keyframes ffpwa-mark { from { transform: scale(.7) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
.ffpwa-success-copy { margin: -10px 0 28px; color: var(--muted); font-size: 18px; line-height: 1.5; }

@media (max-width: 390px) {
    .ffpwa-shell { padding-left: 18px; padding-right: 18px; }
    .ffpwa-actions { grid-template-columns: 1fr; }
    .ffpwa-action { min-height: 132px; }
    .ffpwa-action strong { margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
