/* B-jar identity: night and paper, amber LED dots for preparing, ready red, teal for «جاي», brick for errors.
   The old variable and class names stay, so every page keeps working while it moves to the new look. */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=VT323&display=swap");

:root {
  --bg: #f4efe6;
  --ink: #1c1915;
  --muted: #6a6256;
  --card: #fffdf9;
  --surface-2: #e9e2d5;
  --line: #d5cbb9;
  --brand: #c8102e;          /* ready red: the ready state only */
  --red-band: #9e0d25;
  --red-ink: #fff4ec;
  --ok: #0b6b57;             /* «جاي» */
  --come-fill: #d8f1e8;
  --warn: #8a5000;           /* amber as text on light */
  --amber: #ffb648;
  --prep-fill: #fbe9c8;
  --err: #a23b2a;            /* errors are brick, never the ready red */
  --pager: #14120f;
  --led: #ffb648;
  --dot-off: #ddd3c1;
  --font-ar: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-lat: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-grid: "VT323", "IBM Plex Mono", ui-monospace, monospace;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120f;
    --ink: #f3efe8;
    --muted: #a89f91;
    --card: #1e1b16;
    --surface-2: #27231c;
    --line: #2e2a23;
    --ok: #4fc3a1;
    --come-fill: #12302a;
    --warn: #ffb648;
    --prep-fill: #2a2216;
    --err: #ff8a7a;
    --dot-off: #2a2418;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
/* no visible scroll bars on any screen: every area still scrolls by touch, wheel and keys */
* { scrollbar-width: none; }
::-webkit-scrollbar { display: none; width: 0; height: 0; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  min-height: 100vh; min-height: 100dvh;
  font-family: var(--font-ar);
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
::selection { background: var(--amber); color: #14120f; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
main { max-width: 480px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 1.25rem; margin: 0 0 4px; }
p { margin: 8px 0; text-wrap: pretty; }
.muted { color: var(--muted); font-size: 0.9rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 14px 0; }
/* primary actions are ink (cream on night) */
button, .btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 14px; padding: 14px 16px; width: 100%; min-height: 52px;
  background: var(--ink); color: var(--bg); cursor: pointer; display: block; text-align: center; text-decoration: none;
}
button.secondary { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
input {
  font: inherit; font-family: var(--font-grid); font-size: 2rem; text-align: center; letter-spacing: 0.08em; width: 100%;
  padding: 8px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); min-height: 56px;
}
input::placeholder { font-family: var(--font-ar); font-size: 1rem; letter-spacing: 0; color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--err); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.err { color: var(--err); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
.mk { font-family: var(--font-grid); font-weight: 400; direction: ltr; unicode-bidi: isolate; white-space: pre; line-height: 1; }
bdi.lat, .lat { font-family: var(--font-lat); direction: ltr; unicode-bidi: isolate; }

/* the order number in 5x7 dots (common.js dotsSVG) */
.dotnum { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.dotnum .on { fill: var(--dot-on, var(--amber)); }
.dotnum .off { fill: var(--dot-off-c, var(--dot-off)); }

/* the old LED screen, kept for pages not moved yet */
.pager { background: var(--pager); border-radius: 22px; padding: 26px 18px; text-align: center; }
.led { font-family: var(--font-grid); font-size: 4.4rem; line-height: 1; color: var(--led); direction: ltr; }
.dots { margin-top: 14px; display: flex; gap: 6px; justify-content: center; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--led); opacity: .25; animation: blink 1.4s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: 1; } }

/* ready: the whole page turns red; cream text, never colour alone (the word «جاهز» and the frame) */
body.ready { background: var(--brand); color: var(--red-ink); }
body.ready .card { background: rgba(255,244,236,.12); border-color: rgba(255,244,236,.3); }
body.ready .muted { color: rgba(255,244,236,.88); }
body.ready button { background: var(--red-ink); color: var(--brand); }
body.ready button.secondary { background: transparent; color: var(--red-ink); border-color: rgba(255,244,236,.55); }
body.ready .dots { display: none; }

.tap-to-hear {
  position: fixed; inset: 0; z-index: 10; border-radius: 0; width: 100%;
  background: var(--brand); color: var(--red-ink); font-size: 1.6rem; line-height: 1.6;
}
.tap-to-hear small { font-size: 1rem; font-weight: 500; opacity: .92; }
body.ready .tap-to-hear { background: var(--brand); color: var(--red-ink); }
.status { font-size: 1.15rem; font-weight: 700; margin-top: 14px; text-align: center; }
.pill { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }

/* our name, small, at the foot of a page: the hyphen is the lamp */
.bjar-foot { display: flex; justify-content: center; padding: 18px 0 6px; }
.bjar-foot svg { height: 14px; width: auto; }
.bjar-foot .on { fill: var(--muted); }
.bjar-foot .lamp { fill: var(--amber); }
body.ready .bjar-foot .on { fill: rgba(255,244,236,.7); }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: .6; } }
.support-bar {
  position: fixed;
  z-index: 10;
  inset: auto 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: .2rem 1rem;
  justify-content: center;
  align-items: baseline;
  padding: .6rem 1rem max(.6rem, env(safe-area-inset-bottom));
  background: var(--prep-fill);
  color: var(--ink);
  border-top: 2px solid var(--warn);
  overflow-wrap: anywhere;
}
.support-bar a { color: var(--ink); font-weight: 700; }
