body {
  min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--ink); color: var(--on-dark);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  transition: background .3s ease, color .3s ease;
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.shop-name { font-weight: 700; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { flex: 1; display: flex; flex-direction: column; padding: 8px 20px 24px; max-width: 520px; width: 100%; margin: 0 auto; }
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; flex: 1; }
#loading { justify-content: center; color: var(--muted-dark); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--ink-3); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.label { margin: 18px 0 0; color: var(--muted-dark); font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.big { font-size: clamp(96px, 34vw, 168px); font-weight: 700; line-height: 1; margin: 0; color: var(--accent); direction: ltr; word-break: break-all; }

.steps { list-style: none; display: flex; width: 100%; padding: 0; margin: 10px 0 0; }
.steps li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; font-size: 13px; color: var(--muted-dark); }
.steps li span { width: 14px; height: 14px; border-radius: 50%; background: var(--ink-3); position: relative; z-index: 1; }
.steps li::before { content: ''; position: absolute; top: 6px; inset-inline-start: -50%; width: 100%; height: 2px; background: var(--ink-3); }
.steps li:first-child::before { display: none; }
.steps li.on span, .steps li.on::before { background: var(--accent); }
.steps li.on { color: var(--on-dark); }
.steps li:nth-child(2).on span { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px transparent; } }

.queue { margin: 4px 0 0; font-size: 16px; color: var(--on-dark); min-height: 1.4em; }

.card { width: 100%; margin-top: 10px; padding: 20px; border-radius: var(--radius); background: var(--ink-2); border: 1px solid var(--ink-3); text-align: start; }
.card h2 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0 0 16px; color: var(--muted-dark); font-size: 14px; }
.note { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--ink-2); color: var(--muted-dark); font-size: 14px; width: 100%; }
.note.ok { color: #9fd9b5; }
.welcome { margin-top: auto; color: var(--muted-dark); font-size: 14px; }

/* ready: the whole screen turns to the shop colour */
body.is-ready { background: var(--accent); color: #17130c; }
body.is-ready .lang { background: rgba(0,0,0,.12); }
body.is-ready .lang-btn.on { background: #17130c; color: var(--accent); }
body.is-ready .brand { color: rgba(0,0,0,.55); }
#ready h1 { font-size: clamp(36px, 11vw, 52px); line-height: 1.1; margin: 6px 0 0; }
#ready .sub { margin: 0; font-size: 18px; font-weight: 600; opacity: .8; }
.bell { width: 84px; height: 84px; border-radius: 26px; background: #17130c; color: var(--accent); display: grid; place-items: center; margin-top: 16px; animation: ring 1.2s ease-in-out infinite; }
.bell svg { width: 44px; height: 44px; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 10% { transform: rotate(14deg); } 20% { transform: rotate(-12deg); } 30% { transform: rotate(8deg); } 40% { transform: rotate(0); } }
body.acked .bell { animation: none; }
.ticket { position: relative; width: 100%; margin-top: 18px; padding: 22px 16px 26px; border-radius: 26px; background: #17130c; color: var(--on-dark); }
.ticket .label { margin: 0; }
.ticket .big { color: var(--accent); }
.stamp { position: absolute; top: -14px; inset-inline-end: 18px; background: var(--paper); color: #17130c; font-weight: 700; font-size: 14px; padding: 4px 12px; border-radius: 8px; transform: rotate(-4deg); border: 2px solid #17130c; }
.ack-hint { margin: auto 0 0; font-weight: 600; opacity: .75; font-size: 15px; }
.coming { background: #17130c; color: var(--on-dark); min-height: 58px; font-size: 18px; }
.acked { margin-top: auto; font-weight: 700; font-size: 17px; padding: 16px; border-radius: 16px; background: rgba(0,0,0,.1); width: 100%; }

#end { justify-content: center; }
#end h1 { margin: 0; font-size: 30px; }
#end .sub { margin: 0 0 12px; color: var(--muted-dark); }
.end-mark { font-size: 56px; }
.rate { width: 100%; margin-top: 18px; padding: 20px; border-radius: var(--radius); background: var(--ink-2); border: 1px solid var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.rate-title { margin: 0; font-weight: 700; font-size: 18px; }
.stars { display: flex; gap: 6px; }
.star { border: 0; background: transparent; font-size: 44px; line-height: 1; padding: 2px; color: var(--ink-3); transition: transform .1s ease, color .1s ease; }
.star.on { color: var(--accent); }
.star:active { transform: scale(1.2); }
.rate textarea { width: 100%; border-radius: 12px; border: 1.5px solid var(--ink-3); background: var(--ink); color: var(--on-dark); padding: 12px; font-size: 15px; resize: none; }
.rate textarea:focus { outline: none; border-color: var(--accent); }
.rate-thanks { margin-top: 14px; font-size: 17px; font-weight: 700; }
.rate-thanks .shown { color: var(--accent); letter-spacing: 2px; display: block; font-size: 28px; margin-bottom: 6px; }

.offline { position: fixed; top: 0; inset-inline: 0; text-align: center; padding: 6px; font-size: 13px; background: var(--warn); color: #17130c; z-index: 30; }

.brand { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; color: var(--muted-dark); font-size: 13px; font-weight: 600; }

.top .who { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* light background (Custom shops) */
.theme-light .ticket { color: #f4efe6; }
.theme-light .ticket .label { color: #9aa1a8; }
.theme-light .coming { color: #f4efe6; }
.theme-light .note.ok { color: var(--ok); }
.theme-light .card, .theme-light .rate { box-shadow: 0 2px 12px rgba(0,0,0,.05); }

.rate.google { gap: 10px; }
.g-stars { color: var(--accent); font-size: 30px; letter-spacing: 4px; }
.g-sub { margin: -4px 0 4px; color: var(--muted-dark); font-size: 14px; }
.g-thanks { margin: 0; font-weight: 700; color: var(--accent); }

.play-btn { margin-top: 4px; min-height: 52px; font-size: 17px; font-weight: 700; background: transparent; color: var(--on-dark); border: 1.5px solid var(--ink-3); }

/* loyalty code */
.loyal { width: 100%; margin-top: 6px; padding: 16px; border-radius: var(--radius); background: var(--ink-2); border: 1px solid var(--ink-3); text-align: start; display: flex; flex-direction: column; gap: 10px; }
.loyal.hidden { display: none; }
.loyal.on-accent { background: #17130c; border-color: transparent; color: #f4efe6; }
.ly-head { font-weight: 700; font-size: 16px; }
.ly-row { display: flex; gap: 8px; }
.ly-in { flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--ink-3); background: var(--ink); color: var(--on-dark); font: inherit; font-family: var(--digits); font-size: 18px; letter-spacing: 2px; text-transform: uppercase; }
.ly-link { align-self: flex-start; background: none; border: 0; padding: 4px 0; color: var(--accent); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.ly-code { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ly-code b { font-family: var(--digits); font-size: 26px; letter-spacing: 2px; color: var(--accent); margin-inline-end: auto; }
.loyal .btn.small.line { min-height: 40px; padding: 0 12px; font-size: 14px; background: transparent; color: inherit; border: 1px solid var(--ink-3); text-decoration: none; display: inline-flex; align-items: center; }
.ly-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.ly-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent); }
.ly-dots span.on { background: var(--accent); }
.ly-left, .ly-win p, .ly-note { margin: 0; font-size: 14px; color: var(--muted-dark); }
.ly-left { color: inherit; font-size: 15px; font-weight: 600; }
.ly-win b { display: block; font-size: 18px; color: var(--accent); }
.on-accent .ly-note, .on-accent .ly-win p { color: #c9c3b8; }
#end .loyal { margin-top: 18px; }

.priv-link { display: block; text-align: center; font-size: 12px; color: var(--muted-dark); padding: 0 0 calc(10px + env(safe-area-inset-bottom)); text-decoration: none; }
body.is-ready .priv-link { color: rgba(0,0,0,.5); }
