:root {
  --ink: #efe6d6;
  --muted: #b3a892;
  --gold: #e4c27a;
  --gold-deep: #b8893e;
  --line: rgba(228, 194, 122, 0.28);
  --card: rgba(18, 16, 14, 0.72);
  --good: #8ee0b0;
  --bad: #ff9b92;
  --wait: #f0c56a;
  --mid: #9fd0ea;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: Manrope, sans-serif;
  background: #090b0e;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(228, 194, 122, 0.18), transparent 60%),
    radial-gradient(700px 480px at 100% 0%, rgba(90, 70, 30, 0.25), transparent 55%),
    linear-gradient(180deg, #12151a 0%, #090b0e 40%, #090b0e 100%);
}
.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 4px;
  mask-image: linear-gradient(180deg, #000, transparent 70%);
}

.top, main, footer { position: relative; width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 0 8px;
}
.brand { display: flex; gap: 14px; align-items: center; }
.brand strong {
  display: block;
  font-family: Fraunces, serif;
  font-size: 28px;
  font-weight: 560;
  letter-spacing: -0.03em;
}
.brand small {
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}
.mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #1a140c;
  background: linear-gradient(160deg, #f6e7c4, var(--gold) 45%, var(--gold-deep));
  box-shadow: 0 8px 24px rgba(184, 137, 62, 0.35);
  font-family: Fraunces, serif;
  font-size: 28px;
}
.live {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(142, 224, 176, 0.7);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(142, 224, 176, 0); }
}

.hero { padding: 28px 0 8px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-family: Fraunces, serif;
  font-size: clamp(42px, 5vw, 68px);
  font-weight: 560;
  letter-spacing: -0.045em;
  line-height: 0.95;
}
.lede { max-width: 46ch; color: var(--muted); font-size: 16px; line-height: 1.6; }
[hidden] { display: none !important; }
.modes {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}
.modes button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 4px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.modes button.on {
  background: linear-gradient(180deg, #f6e7c4, #e4c27a);
  color: #1a140c;
}
.modes button:hover { transform: translateY(-1px); }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--muted);
}
.check input { width: 18px; height: 18px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.fact {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(228, 194, 122, 0.16);
  animation: cardUp 0.45s both;
}
.fact b { display: block; margin-bottom: 4px; color: var(--gold); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-top: 1px solid rgba(255, 255, 255, 0.06); white-space: nowrap; }
th { color: var(--gold); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
tbody tr { animation: rowIn 0.4s both; }

.board {
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding-bottom: 48px;
}
.ticket, .results {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.ticket, .results, .field, .captcha-row, input, select { min-width: 0; }
.ticket { padding: 22px 20px 18px; }
.ticket::before, .ticket::after {
  content: "";
  position: absolute;
  top: 58px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #090b0e;
}
.ticket::before { left: -9px; }
.ticket::after { right: -9px; }
.ticket-head, .result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}
.result-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
.ticket-head {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(228, 194, 122, 0.35);
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.field { display: flex; flex-direction: column; gap: 7px; position: relative; margin-bottom: 14px; }
.field span { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
input, select {
  width: 100%;
  border: 1px solid rgba(228, 194, 122, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px;
  color-scheme: dark;
}
input:focus, select:focus, .picker-face:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(228, 194, 122, 0.12);
}
.native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.picker { position: relative; }
.field:has(.picker-menu:not([hidden])) { z-index: 40; }
.picker-face {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(228, 194, 122, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  text-align: left;
}
.picker-face::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: 12px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg) translateY(-2px);
}
.picker-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #1c1814;
  border: 1px solid rgba(228, 194, 122, 0.45);
  border-radius: 16px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45);
  transform-origin: top center;
  animation: menuPop 0.32s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.picker-menu button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 11px 12px;
  border-radius: 11px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.picker-menu button.in { animation: rowIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.picker-menu button:hover, .picker-menu button.on {
  background: linear-gradient(180deg, #f6e7c4, #e4c27a);
  color: #1a140c;
}
.split { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: end; }
.split.two { grid-template-columns: 1fr 1fr; }
.swap {
  height: 48px;
  width: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--gold);
  cursor: pointer;
  font-size: 18px;
  transition: transform 0.35s ease, background 0.2s ease;
}
.swap:hover { background: rgba(228, 194, 122, 0.12); transform: rotate(180deg); }
.field:has(.suggest:not([hidden])) { z-index: 35; }
.field:has(#train-list:not([hidden])) { z-index: 36; }
.suggest {
  position: absolute;
  z-index: 35;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #16130f;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow: auto;
}
.split .suggest { width: min(340px, 78vw); right: auto; }
.split .field:last-child .suggest { left: auto; right: 0; }
.suggest button {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 9px 10px;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
}
.suggest button b {
  flex: 0 0 4.6em;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.suggest button span { min-width: 0; }
.suggest button:hover, .suggest button:focus { background: rgba(228, 194, 122, 0.12); }
.captcha-row { display: grid; gap: 10px; }
.captcha-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7f1e6;
  border-radius: 14px;
  padding: 6px;
  min-height: 64px;
}
.captcha-box img { height: 52px; width: auto; background: #fff; border-radius: 6px; }
#refresh, .go { border: 0; cursor: pointer; font: inherit; font-weight: 700; }
#refresh {
  background: #1a140c;
  color: #f6e7c4;
  border-radius: 10px;
  padding: 10px 12px;
}
.grow { flex: 1; }
.note, .route { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 12px; }
.banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(228, 194, 122, 0.12);
  color: var(--gold);
  border: 1px solid var(--line);
}
.banner.bad { background: rgba(255, 155, 146, 0.1); color: var(--bad); border-color: rgba(255, 155, 146, 0.3); }
.banner.ok { background: rgba(142, 224, 176, 0.1); color: var(--good); border-color: rgba(142, 224, 176, 0.28); }
.go {
  position: relative;
  overflow: hidden;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
  background: linear-gradient(180deg, #f6e7c4 0%, #e4c27a 42%, #b8893e 100%);
  color: #1a140c;
  border-radius: 16px;
  padding: 15px 16px;
  font-size: 16px;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 30px rgba(184, 137, 62, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.go::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.55) 48%, transparent 72%);
  transform: translateX(-130%);
}
.go:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(184, 137, 62, 0.4); }
.go:hover::after { animation: shine 0.8s ease; }
.go:active { transform: translateY(1px) scale(0.985); }
.go:disabled { cursor: wait; }
.go.is-loading::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 2px solid rgba(26, 20, 12, 0.25);
  border-top-color: #1a140c;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.results { padding: 22px; min-height: 280px; overflow: auto; }
.results.is-live::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(180deg, transparent, rgba(228, 194, 122, 0.16), transparent);
  animation: scan 0.9s ease;
  pointer-events: none;
}
h2 {
  margin: 0;
  font-family: Fraunces, serif;
  font-weight: 560;
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.quotas { display: grid; gap: 12px; }
.quota {
  border: 1px solid rgba(228, 194, 122, 0.16);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.025);
}
.quota header {
  display: flex;
  justify-content: space-between;
  padding: 11px 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.quota.GN header { background: rgba(142, 224, 176, 0.12); color: var(--good); }
.quota.TQ header { background: rgba(240, 197, 106, 0.12); color: var(--wait); }
.quota.PT header { background: rgba(255, 155, 146, 0.12); color: var(--bad); }
.quota.HO header { background: rgba(159, 208, 234, 0.12); color: var(--mid); }
.quota.LD header { background: rgba(228, 194, 122, 0.14); color: var(--gold); }
.quota.SS header { background: rgba(239, 230, 214, 0.08); color: var(--ink); }
.days { margin: 0; padding: 0; list-style: none; }
.days li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.days li.picked, .pop-row.picked { background: rgba(228, 194, 122, 0.12); }
.status { font-weight: 700; text-align: right; letter-spacing: 0.02em; }
.status.good { color: var(--good); }
.status.wait { color: var(--wait); }
.status.mid { color: var(--mid); }
.status.bad { color: var(--bad); }
.empty { color: var(--muted); padding: 14px; margin: 0; }
footer { color: #7d7468; font-size: 12px; letter-spacing: 0.04em; padding: 4px 0 32px; }

.hero, .ticket, .results, .passes li { animation: rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.passes li:nth-child(2) { animation-delay: 0.05s; }
.passes li:nth-child(3) { animation-delay: 0.1s; }
.passes li:nth-child(4) { animation-delay: 0.15s; }
.ticket { animation-delay: 0.08s; }
.results { animation-delay: 0.16s; }
.results.is-live { animation: lift 0.55s cubic-bezier(0.2, 0.8, 0.2, 1); }
.captcha-box img.pop { animation: pop 0.35s ease; }
#refresh.spin { animation: spin 0.45s linear; }
.banner { animation: rowIn 0.35s ease both; }
.quota.reveal { animation: cardUp 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.days li { animation: rowIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.status.good, .status.wait, .status.bad, .status.mid { animation: pop 0.4s ease both; }
.skeleton {
  height: 12px;
  margin: 14px 12px;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 20%, rgba(228,194,122,0.28) 50%, rgba(255,255,255,0.04) 80%);
  background-size: 200% 100%;
  animation: shimmer 1.15s linear infinite;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes lift {
  from { transform: translateY(10px); }
  to { transform: none; }
}
@keyframes cardUp {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@keyframes shine {
  from { transform: translateX(-130%); }
  to { transform: translateX(130%); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
.result-pop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 6, 8, 0.66);
  backdrop-filter: blur(8px);
}
.pop-card {
  position: relative;
  width: min(460px, 100%);
  padding: 26px 22px 18px;
  border-radius: 26px;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(228, 194, 122, 0.22), transparent 55%),
    #14110d;
  border: 1px solid rgba(228, 194, 122, 0.45);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: spring 0.55s cubic-bezier(0.16, 1.2, 0.3, 1);
}
#pop-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}
.pop-card h3 {
  margin: 0 0 6px;
  font-family: Fraunces, serif;
  font-size: 32px;
  font-weight: 560;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
#pop-note { margin: 0 0 14px; color: var(--muted); }
#pop-body { max-height: min(52vh, 420px); overflow: auto; }
.pop-quota { margin-bottom: 12px; }
.pop-quota > b { display: block; margin: 0 0 6px; color: var(--gold); letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; }
.pop-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(228, 194, 122, 0.14);
  animation: cardUp 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.pop-row b { font-size: 15px; }
@keyframes menuPop {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes spring {
  0% { opacity: 0; transform: translateY(28px) scale(0.82); }
  70% { opacity: 1; transform: translateY(-4px) scale(1.03); }
  100% { opacity: 1; transform: none; }
}
@keyframes scan {
  from { top: 0; }
  to { top: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 900px) {
  .hero, .board { grid-template-columns: 1fr; }
  h1 { max-width: none; }
  .captcha-row { grid-template-columns: 1fr; }
  .ticket::before, .ticket::after { display: none; }
}
