/* IKEA Scratch & Win - customer site (mobile first).
   Colours are in :root below. Breakpoints: <=360px small phones, >=560px tablet/desktop (centred card),
   landscape phones get a side-by-side landing page. */
:root {
  --beige: #e2d3ba;
  --beige-2: #efe6d6;
  --sand: #f7f2ea;
  --blue: #0058a3;
  --blue-2: #004a8a;
  --yellow: #ffdb00;
  --red: #e2231a;
  --ink: #111111;
  --muted: #5c574f;
  --line: #d6c9b3;
  --ok: #0a8a3e;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink); font-size: 16px; line-height: 1.5; background: var(--beige);
  -webkit-font-smoothing: antialiased; text-size-adjust: 100%;
}
[dir=rtl] body { font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, "Geeza Pro", Arial, sans-serif; }
.hidden { display: none !important; }
body.no-scroll { overflow: hidden; }
main, .card, .voucher { min-width: 0; }
h1, .lead, .field-err, .alert, .notice { overflow-wrap: anywhere; }
button { font-family: inherit; }

/* Page frame: full screen on phones, centred card on larger screens */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--beige); }
main { flex: 1; }
@media (min-width: 560px) {
  body { background: radial-gradient(circle at 20% 10%, #efe4d1 0, #d9c8ab 60%, #cdb994 100%) fixed; padding: 28px 0; }
  .app { max-width: 460px; min-height: calc(100vh - 56px); margin: 0 auto; border-radius: 26px; overflow: hidden; box-shadow: 0 24px 60px rgba(60, 40, 10, .25); }
}

/* Top bar */
.bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 10px 14px; min-height: 56px; }
.bar-logo { height: 34px; width: auto; margin-inline-end: auto; }
.lang-btn {
  background: rgba(255,255,255,.7); border: 1px solid rgba(0,0,0,.12); border-radius: 999px;
  padding: 7px 16px; font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer; min-height: 38px;
}
.lang-btn:focus-visible, .btn:focus-visible, .btn-link:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* Landing */
.screen-landing { display: flex; flex-direction: column; }
.artwork { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; background: var(--beige-2); }
.cta {
  position: sticky; bottom: 0; z-index: 3; padding: 14px 18px calc(16px + var(--safe-b));
  background: linear-gradient(to bottom, rgba(226,211,186,0) 0, var(--beige) 18px);
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
}
.notice { margin: 0 0 4px; background: #fff7d1; border: 1px solid #ecd889; border-radius: 14px; padding: 12px 14px; font-weight: 700; text-align: center; }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px;
  border: 0; border-radius: 999px; padding: 14px 22px; font-size: 18px; font-weight: 800; cursor: pointer; text-align: center;
  transition: transform .08s, background-color .15s, box-shadow .15s;
}
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(0, 88, 163, .3); }
.btn-primary:hover { background: var(--blue-2); }
.btn-primary:active { transform: scale(.985); }
.btn-primary:disabled { opacity: .7; cursor: progress; }
.btn-link { background: none; border: 0; color: var(--blue); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 10px; font-size: 16px; min-height: 44px; }
.btn-link.small { display: block; margin: 4px auto 0; font-size: 14px; font-weight: 600; color: #3f3a33; align-self: center; }
.btn + .btn { margin-top: 8px; }

/* Spinner inside submit */
.spinner { display: none; width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress steps */
.steps { list-style: none; display: flex; gap: 6px; margin: 4px 16px 12px; padding: 0; }
.steps li { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #6f685d; padding-top: 8px; border-top: 4px solid rgba(0,0,0,.12); border-radius: 2px; }
.steps li span { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: rgba(0,0,0,.1); color: #555; }
.steps li b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li.on { border-color: var(--blue); color: var(--ink); }
.steps li.on span { background: var(--blue); color: #fff; }
.steps li.done { border-color: var(--ok); }
.steps li.done span { background: var(--ok); color: #fff; }

/* Cards & text */
.card { background: #fff; margin: 0 12px 14px; border-radius: var(--radius); padding: 22px 18px 18px; box-shadow: 0 8px 26px rgba(70, 50, 20, .12); }
.center { text-align: center; }
h1 { font-size: 25px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.2px; }
.lead { margin: 0 0 18px; color: var(--muted); }

/* Form */
.field { margin-bottom: 14px; }
label { display: block; font-weight: 800; font-size: 15px; margin: 0 0 6px; }
.optional { font-weight: 500; color: var(--muted); font-size: 14px; }
.field-hint { margin: -2px 0 8px; font-size: 13.5px; color: var(--muted); }
input[type=text], input:not([type]), input[type=tel], input[type=email] {
  width: 100%; min-height: 54px; padding: 14px; font-size: 17px; border: 1.5px solid #cfc4b2; border-radius: 12px;
  background: #fff; color: var(--ink); font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 88, 163, .15); }
input.invalid { border-color: var(--red); box-shadow: 0 0 0 4px rgba(226, 35, 26, .1); }
.phone { display: flex; direction: ltr; }
.phone .cc { display: flex; align-items: center; padding: 0 14px; background: var(--sand); border: 1.5px solid #cfc4b2; border-right: 0; border-radius: 12px 0 0 12px; font-weight: 800; color: #3b362f; }
.phone input { flex: 1; min-width: 0; border-radius: 0 12px 12px 0; letter-spacing: .5px; }
.field-err { color: var(--red); font-size: 14px; margin: 6px 0 0; font-weight: 700; }
.field-err:empty { display: none; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 500; font-size: 15px; margin: 6px 0 0; cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--blue); }
.inline-link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.alert { background: #fdecea; border: 1px solid #f4b9b4; color: #8f150f; border-radius: 12px; padding: 12px 14px; font-weight: 700; margin: 14px 0 0; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }
#turnstile { margin-top: 12px; }
#claimForm .btn-primary { margin-top: 18px; }

/* Scratch card */
.scratch { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1 / 1; margin: 0 auto 4px; border-radius: 20px; overflow: hidden; background: var(--yellow); box-shadow: 0 10px 28px rgba(0,0,0,.18); user-select: none; -webkit-user-select: none; touch-action: none; }
.prize { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, #fff27a 0, var(--yellow) 60%); }
.prize-pct { font-size: 104px; font-weight: 900; color: var(--red); line-height: .95; letter-spacing: -3px; direction: ltr; }
.prize-off { font-size: 30px; font-weight: 900; color: var(--blue); margin-top: 6px; }
#scratchCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; transition: opacity .7s; }
#scratchCanvas.gone { opacity: 0; pointer-events: none; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; opacity: 0; animation: fall 1.6s ease-in forwards; }
@keyframes fall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 0; transform: translateY(360px) rotate(540deg); } }

/* Live voucher */
.voucher { margin: 0 12px 14px; background: #fff; border-radius: 22px; overflow: hidden; box-shadow: 0 14px 34px rgba(60, 40, 10, .2); }
.v-head { display: flex; align-items: center; justify-content: center; background: var(--beige-2); padding: 14px; }
.v-head img { height: 44px; width: auto; }
.live { position: relative; overflow: hidden; height: 38px; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 800; font-size: 15px; direction: ltr; letter-spacing: .3px; }
.live::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,219,0,.9) 50%, transparent 70%); background-size: 60% 100%; background-repeat: no-repeat; animation: sweep 2.2s linear infinite; }
.live > * { position: relative; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #48ff8a; box-shadow: 0 0 0 0 rgba(72,255,138,.7); animation: pulse 1.2s infinite; }
@keyframes sweep { from { background-position: -70% 0; } to { background-position: 170% 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(72,255,138,.7); } 70% { box-shadow: 0 0 0 9px rgba(72,255,138,0); } 100% { box-shadow: 0 0 0 0 rgba(72,255,138,0); } }
.v-body { padding: 18px 18px 20px; text-align: center; }
.v-title { font-weight: 800; margin: 0; font-size: 16px; }
.v-pct { font-size: 62px; font-weight: 900; color: var(--red); line-height: 1.05; margin: 2px 0 2px; letter-spacing: -1px; }
.v-who { margin: 4px 0 14px; }
.v-name { font-size: 18px; font-weight: 800; margin: 0; overflow-wrap: anywhere; }
.v-mobile { color: var(--muted); font-size: 14px; margin: 0; direction: ltr; unicode-bidi: isolate; }
.v-code-label { font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.v-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 31px; font-weight: 800; letter-spacing: 3px; border: 2px dashed var(--blue); border-radius: 14px; padding: 10px 6px; direction: ltr; background: #f5f9fd; }
.v-barcode { width: 100%; max-width: 320px; height: 80px; margin: 12px auto 0; display: block; }
.v-valid { font-size: 14.5px; margin: 12px 0 0; font-weight: 700; }
.v-note { display: flex; gap: 10px; align-items: flex-start; text-align: start; background: #fff7d1; border-radius: 12px; padding: 12px 14px; font-size: 14.5px; font-weight: 700; margin: 14px 0 0; }
.v-note::before { content: "!"; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 900; }
/* Expired voucher (after the "valid to" date) */
.voucher.is-expired .live { background: #6b6b6b; }
.voucher.is-expired .live::before { display: none; }
.voucher.is-expired .v-pct, .voucher.is-expired .v-code { opacity: .45; text-decoration: line-through; }
.voucher.is-expired .v-valid { color: var(--red); }
.tip { text-align: center; color: #3f3a33; font-size: 14px; margin: 4px 22px 0; }

/* Message screen */
.message { padding-top: 30px; padding-bottom: 30px; margin-top: 8px; }
.message-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: #fff; font-size: 30px; font-weight: 900; }

/* Terms bottom sheet */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet-box { background: #fff; width: 100%; max-width: 560px; max-height: 86vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 0 20px calc(22px + var(--safe-b)); animation: up .25s ease-out; }
@media (min-width: 560px) { .sheet { align-items: center; } .sheet-box { border-radius: 22px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; padding: 18px 0 10px; border-bottom: 1px solid #eee; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.close { background: #f1f1f1; border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 26px; line-height: 1; cursor: pointer; }
.terms { padding-inline-start: 22px; margin: 14px 0 0; }
.terms li { margin: 0 0 10px; font-size: 15px; color: #2b2b2b; }
.privacy a { color: var(--blue); font-weight: 700; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }

.foot { text-align: center; font-size: 11.5px; color: #6f6556; padding: 10px 0 calc(16px + var(--safe-b)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .live::before { display: none; }
}
/* Landscape phones: artwork and buttons side by side so the button stays visible */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 560px) {
  body { padding: 0; }
  .app { max-width: none; min-height: 100vh; border-radius: 0; }
  .screen-landing { flex-direction: row; align-items: center; gap: 12px; padding: 0 12px 12px; }
  .artwork { width: auto; max-height: calc(100vh - 80px); }
  .cta { position: static; flex: 1; background: none; }
  .card, .voucher, .steps { max-width: 560px; margin-inline: auto; }
}
@media (max-width: 360px) {
  .card { padding: 18px 14px 16px; margin: 0 8px 12px; }
  .voucher { margin: 0 8px 12px; }
  .v-pct { font-size: 52px; }
  .phone .cc { padding: 0 10px; }
  h1 { font-size: 22px; }
  .v-code { font-size: 26px; letter-spacing: 2px; }
  .prize-pct { font-size: 88px; }
  .steps li b { display: none; }
}
