:root {
  --paper: #F2F4F6;
  --sheet: #FFFFFF;
  --ink: #1C2230;
  --ink-2: #4A5263;
  --ink-3: #7A8292;
  --line: #D9DEE5;
  --p1: #0E7C6B;
  --p2: #3B4CB3;
  --p3: #B9810A;
  --p1-soft: #E1F1EE;
  --p2-soft: #E5E8F7;
  --p3-soft: #F7EDD6;
  --focus: #3B4CB3;
  --radius-chip: 999px;
  --radius-card: 10px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .01em; }
.brand-mark { display: inline-flex; gap: 3px; }
.brand-mark i { display: block; width: 6px; height: 18px; border-radius: 1px; }
.brand-mark .h1 { background: var(--p1); }
.brand-mark .h2 { background: var(--p2); }
.brand-mark .h3 { background: var(--p3); }
.langs { display: flex; gap: 4px; }
.langs button {
  background: transparent; border: 1px solid #ffffff40; color: #fff;
  min-width: 40px; height: 32px; border-radius: 6px; cursor: pointer; font-weight: 600;
}
.langs button[aria-pressed="true"] { background: #fff; color: var(--ink); border-color: #fff; }

main { max-width: 640px; margin: 0 auto; padding: 0 16px 120px; }

/* ---------- setup ---------- */
.intro { padding: 28px 0 8px; }
.intro h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 10px; font-weight: 700; }
.intro p { margin: 0; color: var(--ink-2); max-width: 34em; }

.q { padding: 22px 0 6px; border-bottom: 1px solid var(--line); }
.q:last-of-type { border-bottom: 0; }
.q h2 { font-size: 1.05rem; margin: 0 0 10px; font-weight: 600; }
.q .hint { color: var(--ink-3); font-size: .9rem; margin: -4px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  border: 1.5px solid var(--line); background: var(--sheet);
  border-radius: var(--radius-chip); padding: 7px 14px; cursor: pointer;
  font-size: .95rem; line-height: 1.3; min-height: 40px;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.small { font-size: .88rem; min-height: 34px; padding: 5px 12px; }
.chip.hallchip[aria-pressed="true"][data-hall="P1"] { background: var(--p1); border-color: var(--p1); }
.chip.hallchip[aria-pressed="true"][data-hall="P2"] { background: var(--p2); border-color: var(--p2); }
.chip.hallchip[aria-pressed="true"][data-hall="P3"] { background: var(--p3); border-color: var(--p3); }
.sub { margin: -4px 0 14px; padding-inline-start: 12px; border-inline-start: 3px solid var(--line); }
.sub h3 { font-size: .9rem; font-weight: 500; color: var(--ink-2); margin: 0 0 8px; }
.linkbtn { background: none; border: 0; padding: 4px 0; color: var(--p2); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: .95rem; }
.check { display: flex; gap: 10px; align-items: center; margin: 0 0 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }

.bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 4;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 70%, transparent);
}
.bar .primary { display: block; width: 100%; max-width: 608px; margin: 0 auto; }
.primary {
  background: var(--ink); color: #fff; border: 0; border-radius: 10px;
  padding: 15px 18px; font-size: 1.05rem; font-weight: 600; cursor: pointer;
}
.secondary {
  background: var(--sheet); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 10px;
  padding: 9px 14px; font-weight: 600; cursor: pointer;
}
.disclaimer { color: var(--ink-3); font-size: .85rem; padding: 18px 0; }

/* ---------- results ---------- */
.summary { padding: 22px 0 6px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.summary h1 { font-size: 1.4rem; margin: 0; font-weight: 700; }
.route-note { color: var(--ink-2); font-size: .92rem; margin: 6px 0 4px; }

.hall { margin-top: 26px; }
.hall-sign {
  display: flex; align-items: stretch; gap: 0; border-radius: 8px; overflow: hidden; color: #fff;
}
.hall-sign .code { font-size: 2rem; font-weight: 700; padding: 6px 16px; line-height: 1.1; display: flex; align-items: center; }
.hall-sign .name { display: flex; flex-direction: column; justify-content: center; padding: 6px 14px; background: #00000022; flex: 1; }
.hall-sign .name strong { font-weight: 600; }
.hall-sign .name span { font-size: .88rem; opacity: .9; }
.hall[data-hall="P1"] .hall-sign { background: var(--p1); }
.hall[data-hall="P2"] .hall-sign { background: var(--p2); }
.hall[data-hall="P3"] .hall-sign { background: var(--p3); }
.hall[data-hall="X"] .hall-sign { background: var(--ink-2); }

.stand {
  display: grid; grid-template-columns: 76px 1fr; margin-top: 12px;
  background: var(--sheet); border-radius: var(--radius-card); overflow: hidden;
  border: 1px solid var(--line);
}
.stand .booth {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 14px 4px; gap: 6px; font-weight: 700;
}
.stand .booth .num { font-size: 1.45rem; line-height: 1; letter-spacing: -.01em; direction: ltr; }
.stand .booth .seq { font-size: .8rem; font-weight: 500; opacity: .75; }
.hall[data-hall="P1"] .booth { background: var(--p1-soft); color: var(--p1); }
.hall[data-hall="P2"] .booth { background: var(--p2-soft); color: var(--p2); }
.hall[data-hall="P3"] .booth { background: var(--p3-soft); color: #8A5F00; }
.hall[data-hall="X"] .booth { background: var(--paper); color: var(--ink-2); }
.stand .body { padding: 12px 14px 12px; min-width: 0; }
.stand h3 { margin: 0; font-size: 1.05rem; line-height: 1.35; font-weight: 600; }
.stand .why { margin: 4px 0 8px; color: var(--ink-2); font-size: .9rem; }
.stand .wild { display: inline-block; font-size: .82rem; font-weight: 600; color: var(--p2); margin-bottom: 4px; }
.stand.done { opacity: .55; }
.stand.done h3 { text-decoration: line-through; text-decoration-thickness: 1.5px; }

.books { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.books li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.books li:last-child { border-bottom: 0; }
.books .t { font-weight: 600; font-size: .95rem; line-height: 1.35; overflow-wrap: anywhere; }
.books .m { color: var(--ink-3); font-size: .84rem; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.books .price { color: var(--ink-2); font-weight: 500; }
.stand .actions { display: flex; gap: 14px; align-items: center; justify-content: space-between; margin-top: 8px; }
.toggle-visit {
  border: 1.5px solid var(--line); background: none; border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: .88rem;
}
.toggle-visit[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.state { padding: 48px 0; text-align: center; color: var(--ink-2); }
.state p { max-width: 30em; margin: 0 auto 16px; }

@media (prefers-reduced-motion: no-preference) {
  .stand { transition: opacity .2s; }
}
@media (min-width: 560px) {
  .intro h1 { font-size: 2.1rem; }
  .stand { grid-template-columns: 92px 1fr; }
  .stand .booth .num { font-size: 1.7rem; }
}

/* ---------- AI mode ---------- */
.field {
  display: block; width: 100%; font: inherit; color: var(--ink); background: var(--sheet);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 16px; resize: vertical;
}
.field:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px #3B4CB333; }
.q h2 + .hint { margin-top: -4px; }
.error { color: #A3261A; font-weight: 500; margin: -6px 0 10px; min-height: 0; }
.error:empty { display: none; }
.flash { background: var(--p3-soft); border-inline-start: 4px solid var(--p3); padding: 10px 12px; border-radius: 6px; margin: 4px 0 8px; }
.steps { list-style: none; padding: 0; margin: 12px 0; }
.steps li { position: relative; padding: 12px 0 12px 34px; color: var(--ink-3); border-bottom: 1px solid var(--line); }
[dir="rtl"] .steps li { padding: 12px 34px 12px 0; }
.steps li::before {
  content: ""; position: absolute; inset-inline-start: 4px; top: 15px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--line); box-sizing: border-box;
}
.steps li.done { color: var(--ink-2); }
.steps li.done::before { background: var(--p1); border-color: var(--p1); }
.steps li.now { color: var(--ink); font-weight: 600; }
.steps li.now::before { border-color: var(--p2); border-top-color: transparent; }
@media (prefers-reduced-motion: no-preference) {
  .steps li.now::before { animation: spin .9s linear infinite; }
}
@keyframes spin { to { transform: rotate(360deg); } }
.ai-intro { font-size: 1.02rem; line-height: 1.6; margin: 10px 0 4px; padding: 12px 14px; background: var(--sheet); border-radius: 10px; border: 1px solid var(--line); }
.book-why { margin: 3px 0 0; font-size: .88rem; color: var(--ink-2); }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; color: #fff; background: var(--p2); border-radius: 4px; padding: 1px 6px; vertical-align: 2px; }

/* ---------- floor plans ---------- */
.hall-sign .map-btn {
  align-self: center; margin-inline-end: 10px; background: #fff; color: var(--ink); border: 0; border-radius: 6px;
  padding: 6px 12px; font-weight: 600; cursor: pointer;
}
button.booth { border: 0; font: inherit; cursor: pointer; width: 100%; }
button.booth .num { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
body.noscroll { overflow: hidden; }
.mapov { position: fixed; inset: 0; z-index: 20; background: var(--sheet); display: flex; flex-direction: column; }
.mapbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--ink); color: #fff; }
.mapbar strong { flex: 1; font-weight: 600; }
.mapbar button { background: #fff; color: var(--ink); border: 0; border-radius: 6px; min-width: 40px; height: 36px; font-weight: 700; cursor: pointer; padding: 0 12px; }
.mapbar .zoom { display: flex; gap: 6px; }
.mapscroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; background: #fff; touch-action: pan-x pan-y; }
.mapcanvas { position: relative; line-height: 0; }
.mapcanvas img { width: 100%; height: auto; display: block; user-select: none; }
.mapcanvas svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mapcanvas polyline { fill: none; stroke: var(--p2); stroke-width: 3; stroke-dasharray: 8 6; vector-effect: non-scaling-stroke; opacity: .85; }
.mapov[data-hall="P1"] polyline { stroke: var(--p1); }
.mapov[data-hall="P3"] polyline { stroke: var(--p3); }
.mk circle { fill: var(--ink); stroke: #fff; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.mk text { fill: #fff; font: 700 12px var(--font); text-anchor: middle; }
.mk.done circle { fill: var(--ink-3); }
.mk.focus circle { fill: #C0362C; r: 14; }
.mapnote { margin: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); font-size: .85rem; color: var(--ink-2); border-top: 1px solid var(--line); }
