:root {
  --bg: #07080c;
  --ink: #f4f0e8;
  --muted: #b7b1a6;
  --gold: #d7b57a;
  --line: rgba(244, 240, 232, 0.16);
  --glass: rgba(8, 9, 12, 0.62);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Manrope, "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Noto Naskh Arabic", "Noto Sans Devanagari", "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.5;
}
body.ready { opacity: 1; }
body { opacity: 0; transition: opacity 0.45s ease; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}
.veil, .grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.veil {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(7, 8, 12, 0.78) 0%, rgba(7, 8, 12, 0.28) 48%, rgba(7, 8, 12, 0.55) 100%),
    linear-gradient(180deg, rgba(7, 8, 12, 0.45), transparent 18%, transparent 72%, rgba(7, 8, 12, 0.82));
}
.grain {
  z-index: 2;
  opacity: 0.18;
  background-image: radial-gradient(rgba(255, 255, 255, 0.45) 0.6px, transparent 0.6px);
  background-size: 3px 3px;
}
body.no-webgl .veil {
  background:
    radial-gradient(circle at 78% 42%, rgba(215, 181, 122, 0.2), transparent 36%),
    radial-gradient(circle at 20% 80%, rgba(120, 150, 180, 0.16), transparent 32%),
    #07080c;
  animation: drift 16s ease-in-out infinite alternate;
}
@keyframes drift {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 4% 6%, -3% -4%, 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  body.no-webgl .veil { animation: none; }
  html { scroll-behavior: auto; }
}

.top, main, .foot, .chat, dialog { position: relative; z-index: 3; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px max(22px, 6vw);
  position: sticky;
  top: 0;
}
.brand {
  font-family: "Bodoni Moda", "Songti SC", "Noto Serif SC", serif;
  font-size: 28px;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}
.top-actions, .hero-actions, .foot-links, .chat-row, .methods { display: flex; align-items: center; gap: 12px; }
.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d7b57a;
  box-shadow: 0 0 0 0 rgba(215, 181, 122, 0.7);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(215, 181, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(215, 181, 122, 0); }
}
.lang-btn, .text-btn, .icon-btn, .gold-btn, .method, .lang-grid button {
  background: transparent;
  border: 1px solid transparent;
}
.lang-btn, .icon-btn {
  border-color: var(--line);
  border-radius: 999px;
  padding: 8px 14px;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.lang-word {
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
}
.hero, .services, .foot { padding-inline: max(22px, 6vw); }
.hero { padding-top: 6vh; padding-bottom: 8vh; max-width: 820px; }
.kicker {
  margin: 0 0 14px;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
}
h1, h2, h3 {
  font-family: "Bodoni Moda", "Songti SC", "Noto Serif SC", "Noto Naskh Arabic", serif;
  font-weight: 460;
  letter-spacing: -0.03em;
}
h1 {
  margin: 0;
  font-size: clamp(52px, 8vw, 108px);
  line-height: 0.92;
  max-width: 10ch;
}
.lead, .section-head p, .fine, .chat-head p { color: var(--muted); }
.lead { font-size: 18px; max-width: 38rem; }
.hero-actions { margin-top: 28px; flex-wrap: wrap; }
.gold-btn {
  border-color: rgba(215, 181, 122, 0.75);
  color: #f3e7cf;
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  letter-spacing: 0.04em;
}
.gold-btn:hover, .lang-btn:hover, .method:hover, .lang-grid button:hover { background: rgba(215, 181, 122, 0.1); }
.text-btn { padding: 12px 4px; letter-spacing: 0.04em; }
[dir="rtl"] .arrow { display: inline-block; transform: scaleX(-1); }
.services { padding-bottom: 10vh; }
.section-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}
.section-head h2 { margin: 0; font-size: clamp(28px, 4vw, 42px); }
.lead-row {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}
.services-lead {
  margin: 0;
  max-width: 12em;
  color: var(--ink);
  font-family: "Bodoni Moda", "Songti SC", "Noto Serif SC", "Noto Naskh Arabic", serif;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.todo-open { flex: 0 0 auto; margin-top: 14px; white-space: nowrap; }
.todo { margin: 8px 0 28px; }
.todo-gate { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.todo-gate[hidden], #todo-board[hidden], #todo[hidden] { display: none; }
.todo-empty { margin: 0; color: var(--gold); letter-spacing: 0.04em; }
.todo-code { display: flex; gap: 8px; width: min(420px, 100%); }
.todo-code input { text-transform: uppercase; letter-spacing: 0.12em; }
.todo-title { margin: 0 0 8px; font-size: 22px; }
.track { position: relative; height: 108px; margin: 8px 18px 0; }
.track-line, .track-mid, .track-fill {
  position: absolute;
  top: 68px;
  height: 2px;
  border-radius: 99px;
}
.track-line { left: 0; right: 0; background: rgba(215, 181, 122, 0.28); }
.track-mid { left: 18%; width: 64%; height: 4px; top: 67px; background: rgba(215, 181, 122, 0.9); }
.track-fill { left: 0; width: 0; background: #f3e7cf; transition: width 1.15s cubic-bezier(.2, .7, .2, 1); }
.track-dot {
  position: absolute;
  top: 64px;
  width: 9px;
  height: 9px;
  margin-left: -4px;
  border-radius: 50%;
  background: #07080c;
  border: 2px solid var(--gold);
}
.track-dot.on { background: var(--gold); }
.runner {
  position: absolute;
  top: 8px;
  left: 0;
  width: 56px;
  margin-left: -28px;
  transition: left 1.15s cubic-bezier(.2, .7, .2, 1);
  z-index: 2;
}
.runner svg { width: 56px; height: auto; display: block; }
.runner .leg, .runner .arm { transform-box: fill-box; transform-origin: center top; }
.runner .leg-a, .runner .arm-a { animation: stride 0.36s ease-in-out infinite alternate; }
.runner .leg-b, .runner .arm-b { animation: stride 0.36s ease-in-out infinite alternate-reverse; }
.runner.settled .leg, .runner.settled .arm { animation: none; }
@keyframes stride { from { transform: rotate(-26deg); } to { transform: rotate(22deg); } }
.track-labels {
  display: grid;
  grid-template-columns: 18% minmax(0, 1fr) 16%;
  gap: 8px;
  margin: 4px 18px 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.track-labels span:nth-child(2) { text-align: center; color: var(--gold); }
.track-labels span:nth-child(3) { text-align: end; }
.todo-now { margin: 16px 0 0; font-size: 20px; }
.todo-story { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.todo-story li { border-inline-start: 1px solid rgba(215, 181, 122, 0.4); padding-inline-start: 12px; color: var(--muted); }
.todo-story .current { color: var(--ink); }
.todo-story time, .todo-story button { color: var(--muted); font-size: 12px; }
.todo-pay { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.todo-pay .methods, .todo-pay .field, .todo-pay .due { padding-inline: 0; }
.job-code { font-family: ui-monospace, monospace; font-size: 28px; letter-spacing: 0.14em; color: var(--gold); }
.job-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.job-list button { text-align: start; }
.svc {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.idx { color: var(--gold); font-variant-numeric: tabular-nums; letter-spacing: 0.08em; }
.svc h3 { margin: 0 0 4px; font-size: 28px; letter-spacing: 0; }
.svc p { margin: 0; color: var(--muted); }
.svc-side { text-align: end; }
.price { display: block; color: var(--gold); font-size: 22px; font-variant-numeric: tabular-nums; }
.price-note { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.foot { padding-bottom: max(28px, env(safe-area-inset-bottom)); color: var(--muted); }
.topics { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 14px 0; }
.topics a { color: var(--muted); font-size: 13px; text-decoration: none; }
.topics a:hover { color: var(--gold); }
.foot-links { gap: 18px; }
.foot a { color: var(--muted); }

.chat-toggle {
  position: fixed;
  z-index: 5;
  inset-inline-end: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  border: 1px solid rgba(215, 181, 122, 0.75);
  background: rgba(7, 8, 12, 0.72);
  color: #f3e7cf;
  border-radius: 999px;
  padding: 12px 18px;
  backdrop-filter: blur(16px);
}
.chat {
  position: fixed;
  z-index: 6;
  inset-inline-end: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(380px, calc(100vw - 24px));
  max-height: min(70vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid rgba(215, 181, 122, 0.35);
  border-radius: 18px;
  backdrop-filter: blur(18px);
  overflow: hidden;
}
.chat[hidden] { display: none; }
.chat-head, .sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.chat-head { padding: 16px 16px 0; }
.tg-join { margin: 12px 16px 0; text-align: center; text-decoration: none; }
.tg-here { margin: 8px 16px 0; color: var(--muted); font-size: 13px; }
.chat-head p, .chat-head strong { display: block; }
.chat-log {
  flex: 1;
  overflow: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
}
.bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.visitor { align-self: flex-end; background: rgba(215, 181, 122, 0.16); }
.bubble.agent { align-self: flex-start; background: rgba(255, 255, 255, 0.06); }
.chat-form, .sheet { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-row textarea { flex: 1; }
input, textarea, select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.form-error { color: #e7b4a8; margin: 0; }
dialog {
  width: min(560px, calc(100vw - 24px));
  border: 1px solid rgba(215, 181, 122, 0.35);
  border-radius: 20px;
  background: rgba(10, 11, 14, 0.84);
  color: inherit;
  backdrop-filter: blur(18px);
  padding: 8px 0 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.sheet-head, .fine, .due, .methods, #rail, .field { padding-inline: 18px; }
.sheet-head { padding-top: 10px; }
.due { font-size: 28px; margin: 8px 0; }
.due strong { font-family: "Bodoni Moda", serif; font-weight: 460; }
.methods { padding-bottom: 8px; flex-wrap: wrap; }
.method { border-color: var(--line); border-radius: 999px; padding: 8px 14px; }
.method[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.method:disabled { opacity: 0.45; }
.qr { width: min(220px, 70%); border-radius: 12px; background: white; padding: 8px; }
.addr {
  font-family: ui-monospace, monospace;
  overflow-wrap: anywhere;
  padding: 12px;
  border: 1px dashed rgba(215, 181, 122, 0.45);
  border-radius: 12px;
}
.lang-sheet { width: min(920px, calc(100vw - 24px)); }
dialog.lang-sheet, #langs { width: min(920px, calc(100vw - 24px)); }
.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  max-height: min(60vh, 520px);
  overflow: auto;
  padding: 0 18px 18px;
}
.lang-grid button {
  text-align: start;
  border-color: var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.lang-grid button[aria-current="true"] { border-color: var(--gold); color: var(--gold); }
.lang-grid small { display: block; color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); }

.admin-main { padding: 12px max(22px, 6vw) 8vh; display: grid; gap: 22px; }
.panel {
  background: rgba(8, 9, 12, 0.55);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  backdrop-filter: blur(16px);
}
.panel h2 { margin: 0 0 8px; font-size: 32px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; min-width: 140px; }
.svc-edit { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.svc-edit h3 { margin: 0 0 8px; font-size: 22px; }
.sort-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.sort-actions button { padding: 6px 10px; }
.sort-actions button:disabled { opacity: 0.35; cursor: default; }
.inbox { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px; min-height: 280px; }
.chat-pick { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.chat-pick-row { display: flex; gap: 6px; align-items: stretch; }
.chat-pick button { text-align: start; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: transparent; }
.chat-pick-row .open { flex: 1; min-width: 0; }
.chat-pick-row .open small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pick-row.unread .open { border-color: var(--gold); }
.chat-pick .drop { flex: 0 0 auto; color: #e7b4a8; }
.chat-pick button[aria-current="true"] { border-color: var(--gold); }

@media (max-width: 720px) {
  .section-head, .svc, .inbox, .lead-row, .todo-code { display: flex; flex-direction: column; align-items: stretch; }
  .todo-gate, .todo-open { align-items: stretch; text-align: start; }
  .svc-side, .section-head { text-align: start; }
  h1 { font-size: 48px; }
  .chat { inset-inline: 12px; width: auto; }
}
