:root {
  color-scheme: only light;
  --ivory: #FBF7EF; --white: #FFFFFF; --silver: #C0C4CA; --silver-light: #ECEEF1;
  --orange: #B4541A; --orange-deep: #8F4212; --text: #2E2B28; --muted: #6B665F; --red: #B3261E;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Noto Serif", "Noto Naskh Arabic", "Geeza Pro", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ivory); color: var(--text); font-family: var(--sans); font-size: 17px; line-height: 1.5; }
[hidden] { display: none !important; }
main { max-width: 560px; margin: 0 auto; padding: 0 16px calc(48px + env(safe-area-inset-bottom)); }

#langs { display: flex; justify-content: center; gap: 4px; padding: calc(8px + env(safe-area-inset-top)) 8px 8px; }
#langs button { min-height: 48px; padding: 0 14px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 16px; border-radius: 24px; }
#langs button[aria-pressed="true"] { color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--silver); background: var(--white); }

#welcome { min-height: 72vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 8px; }
body[data-view="uploading"] #welcome, body[data-view="thanks"] #welcome { min-height: 0; padding: 16px 8px; }
body[data-view="uploading"] #welcome .intro, body[data-view="thanks"] #welcome .intro,
body[data-view="uploading"] .ornament, body[data-view="thanks"] .ornament { display: none; }
h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(30px, 8.4vw, 42px); line-height: 1.25; margin: 0; text-wrap: balance; }
body[data-view="uploading"] h1, body[data-view="thanks"] h1 { font-size: 22px; color: var(--muted); }
.ornament { display: flex; align-items: center; gap: 12px; width: 180px; margin: 28px auto; color: var(--silver); }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; background: var(--silver); }
.ornament span { width: 8px; height: 8px; border: 1px solid var(--silver); transform: rotate(45deg); }
.intro { margin: 0; font-size: 18px; color: var(--muted); }
#state-message { margin: 28px 0 0; font-size: 19px; }
#scroll-hint { margin-top: 40px; color: var(--muted); font-size: 16px; }
#scroll-hint::after { content: ""; display: block; width: 10px; height: 10px; margin: 10px auto 0; border-right: 1px solid var(--muted); border-bottom: 1px solid var(--muted); transform: rotate(45deg); }

.card { background: var(--white); border: 1px solid var(--silver); border-radius: 14px; padding: 20px 16px; margin-bottom: 16px; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; margin: 0 0 12px; }
label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 16px; }
input[type="text"], input[type="email"], input[type="tel"] { width: 100%; min-height: 52px; padding: 10px 14px; font: inherit; font-size: 17px; color: var(--text); background: var(--white); border: 1px solid var(--silver); border-radius: 10px; appearance: none; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--red); }
input.ltr { direction: ltr; text-align: left; }
.note { margin: 6px 0 0; font-size: 16px; color: var(--muted); }
.error { margin: 6px 0 0; font-size: 16px; color: var(--red); }
.error:empty { display: none; }
#known { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.btn { display: block; width: 100%; min-height: 56px; padding: 12px 18px; border: 0; border-radius: 12px; background: var(--orange); color: #fff; font: inherit; font-size: 19px; font-weight: 600; }
.btn:active { background: var(--orange-deep); }
.btn:disabled { background: var(--silver-light); color: var(--muted); }
.btn.outline { background: var(--white); color: var(--orange); box-shadow: inset 0 0 0 2px var(--orange); }
.btn.outline:active { color: var(--orange-deep); box-shadow: inset 0 0 0 2px var(--orange-deep); }
.btn.small { width: auto; min-height: 48px; font-size: 16px; padding: 8px 14px; }
.link { min-height: 48px; padding: 0 8px; border: 0; background: none; color: var(--orange); font: inherit; font-size: 16px; text-decoration: underline; }
.hint { margin: 10px 0 0; font-size: 16px; color: var(--muted); text-align: center; }
#preparing { margin: 12px 0 0; text-align: center; color: var(--muted); }
#rejected { list-style: none; margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: #FBEDEC; color: var(--red); font-size: 16px; }
#rejected li + li { margin-top: 6px; }

#files { list-style: none; margin: 12px 0 0; padding: 0; }
.file { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--silver-light); }
.thumb { flex: none; width: 56px; height: 56px; border-radius: 8px; background: var(--silver-light); overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 18px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb img:not([hidden]) + .glyph { display: none; }
.meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.sub { font-size: 16px; color: var(--muted); }
.sub.error { color: var(--red); margin: 0; }
.track { display: block; height: 6px; margin-top: 6px; border-radius: 3px; background: var(--silver-light); overflow: hidden; }
.fill { display: block; height: 100%; width: 0; background: var(--orange); border-radius: 3px; transition: width .3s linear; }
.action { flex: none; }
.check { display: grid; place-items: center; width: 48px; height: 48px; color: var(--orange); font-size: 22px; }

#progress { margin-bottom: 8px; }
#overall-text { margin: 0 0 8px; font-weight: 600; font-size: 18px; }
#progress .track { height: 10px; border-radius: 5px; margin: 0; }
#progress .fill { border-radius: 5px; }
.notice { margin: 14px 0 0; padding: 12px; border-radius: 10px; background: var(--silver-light); font-size: 16px; }
#offline { background: #FBEDEC; color: var(--red); }
#turnstile { margin: 16px 0 0; min-height: 0; }
#turnstile:not(:empty) { min-height: 65px; }
#upload-btn { margin-top: 16px; }
#thanks { text-align: center; }
#thanks h2 { font-size: 30px; margin-bottom: 8px; }
#thanks p { margin: 0 0 20px; color: var(--muted); font-size: 18px; }

body[data-view="loading"] main > *, body[data-view="nokey"] #form, body[data-view="closed"] #form,
body[data-view="nokey"] #thanks, body[data-view="closed"] #thanks { display: none; }
body[data-view="form"] #progress, body[data-view="form"] #thanks { display: none; }
body[data-view="uploading"] #details-card, body[data-view="uploading"] .choose-area, body[data-view="uploading"] #upload-btn,
body[data-view="uploading"] #thanks, body[data-view="uploading"] #rejected { display: none; }
body[data-view="thanks"] #details-card, body[data-view="thanks"] .choose-area, body[data-view="thanks"] #upload-btn,
body[data-view="thanks"] #progress, body[data-view="thanks"] #turnstile, body[data-view="thanks"] #rejected { display: none; }
body[data-view="thanks"] #upload-card:has(#files:empty) { display: none; }

/* ---- shared by home, upload and seat pages (Spec 06) ---- */
a.btn { text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; }
.back { display: inline-flex; align-items: center; min-height: 48px; padding: 0 4px; color: var(--orange); font-size: 17px; text-decoration: none; }
.back::before { content: "\2039"; font-size: 24px; line-height: 1; margin-inline-end: 6px; }
body[data-view="loading"] .back, body[data-view="nokey"] .back { display: none; }
body.compact #welcome { min-height: 0; padding: 4px 8px 20px; }
body.compact h1 { font-size: clamp(24px, 6.6vw, 30px); }
body.compact .ornament { margin: 16px auto 14px; }
body.compact #scroll-hint { display: none !important; }
body.compact .intro { font-size: 17px; }

body.home #welcome { min-height: 0; padding: 20px 8px 8px; }
body.home .ornament { margin: 22px auto; }
#home-buttons { display: grid; gap: 14px; margin-top: 8px; }
#home-buttons .btn { min-height: 64px; font-size: 20px; }

#seat label { margin-top: 0; font-weight: 400; color: var(--muted); }
#name { direction: ltr; text-align: left; font-size: 20px; min-height: 56px; }
#pick { margin: 14px 0 4px; color: var(--muted); font-size: 16px; }
#suggestions { list-style: none; margin: 0; padding: 0; }
#suggestions li { border-top: 1px solid var(--silver-light); }
#suggestions button { display: block; width: 100%; min-height: 56px; padding: 10px 6px; border: 0; background: none; color: var(--text); font: inherit; font-size: 19px; text-align: start; direction: ltr; }
[dir="rtl"] #suggestions button { text-align: right; }
#suggestions button:active { background: var(--silver-light); }
#seat-message { margin: 16px 0 0; font-size: 18px; }
#seat-message.error { color: var(--red); }
#result { text-align: center; padding: 8px 0; }
#result-name { margin: 0 0 6px; font-size: 20px; color: var(--muted); direction: ltr; }
#result-table { margin: 0 0 24px; font-family: var(--serif); font-size: 30px; line-height: 1.3; }
#result-table strong { display: block; font-size: 84px; line-height: 1.1; font-weight: 600; color: var(--orange); }

