:root {
  --paper: #f2e6cc;
  --paper-2: #e9d9b6;
  --card: #f8efdc;
  --ink: #34240f;
  --ink-soft: #6b5434;
  --sepia: #8a6a43;
  --brass: #a88236;
  --brass-light: #d4b46a;
  --burgundy: #6b1d22;
  --burgundy-deep: #4a1216;
  --alert: #8c2a1c;
  --rule: rgba(84, 60, 28, 0.28);
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.35), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(120,84,40,0.18), transparent 55%);
  color: var(--ink);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.deco { font-family: "Limelight", "Libre Baskerville", serif; letter-spacing: 0.04em; font-weight: 400; }
.caps { font-family: "Poiret One", sans-serif; text-transform: uppercase; letter-spacing: 0.18em; font-weight: 700; }
a { color: var(--burgundy); }

/* ---------- Header and banner ---------- */
.topbar {
  background: var(--burgundy-deep);
  background-image: linear-gradient(180deg, var(--burgundy), var(--burgundy-deep));
  color: var(--brass-light);
  border-bottom: 3px double var(--brass);
  padding: 14px 16px 12px;
  text-align: center;
  position: sticky; top: 0; z-index: 20;
}
.topbar .crest { width: 46px; height: 46px; display: block; margin: 0 auto 4px; }
.topbar h1 { margin: 0; font-size: 21px; color: #f1dca4; }
.topbar .sub { font-size: 10.5px; color: var(--brass-light); margin-top: 2px; }

.banner {
  background: #2b1d0c;
  color: #f4dfa8;
  font-family: "Poiret One", sans-serif;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  padding: 9px 16px;
  display: flex; gap: 10px; align-items: center;
  border-bottom: 1px solid var(--brass);
}
.banner .lamp { width: 10px; height: 10px; border-radius: 50%; background: #e6b84a; box-shadow: 0 0 8px #e6b84a; flex: none; animation: pulse 2.4s infinite; }
.banner.emergency { background: var(--alert); color: #fff3e0; }
.banner.emergency .lamp { background: #ffd2c2; box-shadow: 0 0 10px #ff8a6a; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- Layout ---------- */
main { max-width: 560px; margin: 0 auto; padding: 18px 16px 110px; }
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 2px 10px rgba(70,45,15,0.08);
  position: relative;
}
.card::before {
  content: ""; position: absolute; inset: 5px; border: 1px solid rgba(168,130,54,0.35); border-radius: 3px; pointer-events: none;
}
.card h2 { margin: 0 0 10px; font-size: 19px; color: var(--burgundy); }
.card h3 { margin: 14px 0 4px; font-size: 13px; color: var(--sepia); }
.muted { color: var(--ink-soft); font-size: 13.5px; }
.rule { border: 0; border-top: 1px solid var(--rule); margin: 14px 0; }
.ornament { text-align: center; color: var(--brass); letter-spacing: 0.6em; font-size: 12px; margin: 6px 0 14px; }

/* ---------- Tabs ---------- */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--burgundy-deep);
  border-top: 3px double var(--brass);
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
nav.tabs button {
  background: none; border: 0; color: #d9bf80; flex: 1; padding: 6px 2px 4px;
  font-family: "Poiret One", sans-serif; font-weight: 700; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; position: relative;
}
nav.tabs button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.4; }
nav.tabs button.on { color: #fff1c8; }
nav.tabs button.on::after { content: ""; position: absolute; top: -6px; left: 30%; right: 30%; height: 2px; background: var(--brass-light); }
nav.tabs .dot { position: absolute; top: 2px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: #e8a33a; border: 1px solid var(--burgundy-deep); display: none; }
nav.tabs .dot.show { display: block; }

/* ---------- Ticket ---------- */
.ticket {
  background: linear-gradient(180deg, #fbf3e0, #f1e2bf);
  border: 1px solid var(--sepia);
  border-radius: 8px;
  display: flex; overflow: hidden; margin-bottom: 16px;
  box-shadow: 0 3px 14px rgba(70,45,15,0.15);
}
.ticket .main { flex: 1; padding: 16px 16px 14px; border-right: 2px dashed var(--sepia); }
.ticket .stub { width: 96px; padding: 14px 10px; text-align: center; background: repeating-linear-gradient(135deg, rgba(107,29,34,0.05) 0 6px, transparent 6px 12px); }
.ticket .label { font-size: 10px; color: var(--sepia); }
.ticket .val { font-size: 16px; color: var(--ink); margin-bottom: 8px; }
.ticket .big { font-size: 30px; color: var(--burgundy); line-height: 1; }
.ticket .pname { font-size: 22px; color: var(--burgundy); margin: 2px 0 10px; }
.ticket .route { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 10px; }
.ticket .route .line { flex: 1; border-top: 1px dotted var(--sepia); }

/* ---------- Itinerary ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 74px 18px 1fr; gap: 6px; padding: 7px 0; align-items: start; }
.timeline .t { font-family: "Poiret One", sans-serif; font-weight: 700; color: var(--sepia); font-size: 13.5px; padding-top: 1px; }
.timeline .pin { width: 12px; height: 12px; border: 2px solid var(--brass); border-radius: 50%; margin-top: 5px; background: var(--card); position: relative; }
.timeline li:not(:last-child) .pin::after { content: ""; position: absolute; left: 3px; top: 12px; width: 2px; height: 34px; background: rgba(168,130,54,0.4); }
.timeline .pin.now { background: var(--burgundy); border-color: var(--burgundy); }
.timeline .what b { display: block; font-weight: 700; font-size: 14.5px; }
.timeline .what span { font-size: 13px; color: var(--ink-soft); }
.route-map { width: 100%; height: auto; display: block; margin: 4px 0 6px; }

/* ---------- Messages ---------- */
.telegram {
  background: #fbf4e2;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--brass);
  padding: 12px 14px; margin-bottom: 10px; border-radius: 4px;
}
.telegram.private { border-left-color: var(--burgundy); background: #fbefe4; }
.telegram.mine { border-left-color: var(--sepia); background: #f3ead6; }
.telegram .from { font-size: 10.5px; color: var(--sepia); display: flex; justify-content: space-between; margin-bottom: 4px; }
.telegram .body { font-size: 15px; white-space: pre-wrap; }

/* ---------- Forms ---------- */
label.f { display: block; margin: 12px 0 4px; font-size: 13.5px; font-weight: 700; color: var(--ink); }
label.f small { font-weight: 400; color: var(--ink-soft); }
input[type=text], input[type=number], input[type=password], input[type=datetime-local], textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: #fffaf0; border: 1px solid var(--sepia); border-radius: 4px; padding: 10px 11px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brass); outline-offset: 1px; }
.choices { display: grid; gap: 8px; margin-top: 6px; }
.choice { display: flex; gap: 10px; align-items: center; border: 1px solid var(--rule); border-radius: 4px; padding: 10px 12px; background: #fffaf0; cursor: pointer; font-size: 14px; }
.choice input { accent-color: var(--burgundy); width: 18px; height: 18px; }
.btn {
  display: inline-block; width: 100%; margin-top: 16px; cursor: pointer;
  background: linear-gradient(180deg, var(--burgundy), var(--burgundy-deep));
  color: #f6e3ae; border: 1px solid #3a0e11; border-radius: 4px;
  font-family: "Poiret One", sans-serif; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; font-size: 14px;
  padding: 13px 16px; box-shadow: inset 0 0 0 2px rgba(212,180,106,0.45);
}
.btn.secondary { background: none; color: var(--burgundy); border: 1px solid var(--burgundy); box-shadow: none; }
.btn.small { width: auto; padding: 8px 12px; margin-top: 8px; font-size: 12px; letter-spacing: 0.1em; }
.btn:disabled { opacity: 0.5; }

/* Captcha */
.captcha { margin-top: 18px; padding: 14px; border: 1px dashed var(--sepia); border-radius: 4px; background: rgba(255,250,240,0.6); }
.captcha .prompt { font-weight: 700; margin-bottom: 8px; }
.captcha .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.captcha button { font-size: 30px; padding: 10px 0; background: #fffaf0; border: 1px solid var(--rule); border-radius: 6px; cursor: pointer; filter: sepia(0.55); }
.captcha button.picked { border: 2px solid var(--burgundy); background: #f6e6c8; filter: none; }

.err { color: var(--alert); font-size: 13.5px; margin-top: 10px; min-height: 1em; }

/* Manifest */
.pass { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dotted var(--rule); }
.pass:last-child { border-bottom: 0; }
.pass .who { font-weight: 700; }
.pass .meta { font-size: 13px; color: var(--ink-soft); }
.pass .seat { font-family: "Poiret One", sans-serif; font-weight: 700; color: var(--sepia); font-size: 12.5px; white-space: nowrap; }

.hidden { display: none !important; }
.center { text-align: center; }
.welcome-hero { text-align: center; padding: 6px 0 2px; }
.welcome-hero svg { width: 86px; height: 86px; }
.fine { font-size: 12px; color: var(--ink-soft); margin-top: 10px; }

/* iPhone home-screen tip */
.ios-tip {
  position: fixed; left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 40;
  background: #2b1d0c; color: #f4dfa8; border: 1px solid var(--brass); border-radius: 6px;
  padding: 12px 40px 12px 14px; font-size: 13.5px; line-height: 1.45; box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.ios-tip button { position: absolute; top: 8px; right: 8px; background: none; border: 0; color: #f4dfa8; font-size: 16px; cursor: pointer; }
/* Leave room for the phone's notch when running full screen */
.topbar { padding-top: calc(14px + env(safe-area-inset-top)); }

/* ---------- Period touches ---------- */
.topbar .crest { width: 58px; height: 58px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.topbar .rail { display: flex; align-items: center; justify-content: center; gap: 10px; }
.topbar .rail span { flex: 0 1 46px; height: 0; border-top: 1px solid var(--brass-light); border-bottom: 1px solid var(--brass-light); padding-top: 2px; opacity: .8; }
.topbar h1 { font-size: 23px; letter-spacing: .12em; text-transform: uppercase; }
.topbar .sub { letter-spacing: .3em; margin-top: 4px; }
.topbar .sub2 { font-style: italic; font-size: 11.5px; color: #e9d39a; opacity: .85; margin-top: 2px; }

/* engraved ticket: double rule, corner stars, fine cross-hatch */
.ticket { border: 1px solid var(--burgundy); outline: 1px solid var(--sepia); outline-offset: 3px; margin: 4px 4px 20px; position: relative;
  background:
    repeating-linear-gradient(45deg, rgba(138,106,67,.05) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(-45deg, rgba(138,106,67,.05) 0 1px, transparent 1px 6px),
    linear-gradient(180deg, #fbf3e0, #f1e2bf); }
.ticket::before, .ticket::after { content: "✦"; position: absolute; color: var(--brass); font-size: 11px; top: 4px; }
.ticket::before { left: 6px; } .ticket::after { right: 6px; }
.ticket .pname { letter-spacing: .03em; }
