:root {
  --night: #080d26;
  --indigo: #111b4f;
  --indigo-2: #192966;
  --paper: #f3f2e9;
  --ink: #121629;
  --muted: #8f97b9;
  --line: rgba(255, 255, 255, .13);
  --saffron: #ff9d2e;
  --mint: #57d6a5;
  --danger: #ff707b;
  --radius: 22px;
  font-family: "Segoe UI Variable", "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--night); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  background:
    radial-gradient(circle at 14% 12%, rgba(62, 88, 181, .24), transparent 33rem),
    linear-gradient(115deg, #080d26 0%, #0c1438 57%, #080d26 100%);
}
button, textarea, select { font: inherit; }
button, select { cursor: pointer; }

.grain {
  position: fixed;
  inset: 0;
  opacity: .13;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
}

.topbar {
  height: 72px;
  max-width: 1320px;
  margin: auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: .08em; }
.brand-mark { width: 30px; height: 25px; display: flex; align-items: end; gap: 3px; transform: skewX(-10deg); }
.brand-mark i { display: block; width: 8px; background: var(--saffron); border-radius: 2px 2px 0 0; }
.brand-mark i:nth-child(1) { height: 11px; }
.brand-mark i:nth-child(2) { height: 18px; background: var(--paper); }
.brand-mark i:nth-child(3) { height: 25px; background: var(--mint); }
.route-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-family: Consolas, monospace; font-size: 12px; letter-spacing: .12em; }
.route-meta b { color: var(--saffron); }

.shell { width: min(1264px, calc(100% - 40px)); margin: auto; }
.intro { min-height: 330px; padding: 68px 4px 54px; display: flex; align-items: end; }
.intro-copy { width: 100%; }
.eyebrow, .section-tag { margin: 0 0 14px; color: var(--saffron); font-family: Consolas, monospace; font-size: 12px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; max-width: 820px; font-size: clamp(45px, 6.1vw, 82px); line-height: .97; letter-spacing: -.055em; font-weight: 800; }
h1 em { color: var(--mint); font-style: normal; font-weight: 500; }
.lead { max-width: 760px; margin: 28px 0 0; color: #b8bfda; font-size: 17px; line-height: 1.8; }

.activity-panel { margin: 0 0 18px; padding: 25px 28px 21px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(125deg, rgba(25,41,102,.74), rgba(10,16,45,.9)); box-shadow: 0 24px 65px rgba(0,0,0,.2); overflow: hidden; position: relative; }
.activity-panel::after { content: "SIGNAL"; position: absolute; right: -8px; top: -19px; color: rgba(255,255,255,.025); font: 900 78px/1 Arial Black, sans-serif; pointer-events: none; }
.activity-heading { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: start; gap: 28px; }
.activity-title { display: flex; align-items: center; gap: 15px; }
.activity-title .section-tag { margin-bottom: 4px; }
.activity-title h2 { font-size: 21px; }
.activity-title p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.signal-icon { width: 42px; height: 42px; flex: none; display: flex; align-items: end; justify-content: center; gap: 3px; padding: 10px; border: 1px solid rgba(87,214,165,.27); border-radius: 13px; background: rgba(87,214,165,.075); }
.signal-icon i { width: 4px; border-radius: 4px; background: var(--mint); }
.signal-icon i:nth-child(1) { height: 7px; opacity: .45; }
.signal-icon i:nth-child(2) { height: 12px; opacity: .65; }
.signal-icon i:nth-child(3) { height: 17px; opacity: .82; }
.signal-icon i:nth-child(4) { height: 22px; }
.activity-controls { display: flex; align-items: center; gap: 9px; }
.method-chip { min-height: 36px; padding: 0 13px; display: inline-flex; align-items: center; border: 1px solid rgba(255,157,46,.35); border-radius: 10px; color: var(--saffron); background: rgba(255,157,46,.06); font: 700 11px Consolas, monospace; letter-spacing: .08em; }
.window-tabs { display: flex; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(5,10,32,.45); }
.window-tabs button { min-height: 28px; padding: 0 11px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 11px; }
.window-tabs button:hover { color: var(--paper); }
.window-tabs button.active { color: #10251e; background: var(--mint); font-weight: 800; }
.activity-summary { margin: 20px 0 14px; display: flex; align-items: end; gap: 26px; }
.activity-summary div { display: grid; grid-template-columns: auto; }
.activity-summary span { color: var(--paper); font: 700 25px Consolas, monospace; }
.activity-summary div:first-child span { color: var(--mint); }
.activity-summary small { color: var(--muted); font-size: 10px; }
.activity-summary p { margin: 0 0 2px auto; color: var(--muted); font-size: 11px; }
.heatmap-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: #39456f transparent; }
.activity-heatmap { min-width: 760px; display: grid; grid-auto-flow: column; grid-template-rows: repeat(4, 10px); grid-auto-columns: minmax(6px, 1fr); gap: 4px; }
.activity-cell { border-radius: 2px; background: rgba(255,255,255,.055); box-shadow: inset 0 0 0 1px rgba(255,255,255,.025); transition: transform .15s, filter .15s; }
.activity-cell:hover { z-index: 2; transform: scale(1.55); filter: brightness(1.16); }
.activity-cell.danger { background: var(--danger); }
.activity-cell.warm { background: var(--saffron); }
.activity-cell.good { background: #39b990; }
.activity-cell.great { background: var(--mint); box-shadow: 0 0 8px rgba(87,214,165,.18); }
.activity-legend { margin-top: 13px; display: flex; justify-content: end; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.activity-legend i { width: 10px; height: 10px; border-radius: 2px; background: rgba(255,255,255,.055); }
.activity-legend i.danger { background: var(--danger); }
.activity-legend i.warm { background: var(--saffron); }
.activity-legend i.good { background: #39b990; }
.activity-legend i.great { background: var(--mint); }
.activity-legend b { width: 14px; }

.workspace { display: grid; grid-template-columns: minmax(420px, .9fr) minmax(520px, 1.1fr); gap: 18px; align-items: start; }
.control-panel, .rail-panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(14, 22, 58, .8); box-shadow: 0 30px 70px rgba(0, 0, 0, .24); backdrop-filter: blur(18px); }
.control-panel { padding: 30px; }
.rail-panel { min-height: 704px; padding: 30px; overflow: hidden; position: relative; }
.rail-panel::after { content: "UPI"; position: absolute; right: -20px; bottom: -50px; color: rgba(255,255,255,.025); font: 900 210px/.8 Arial Black, sans-serif; pointer-events: none; }
.panel-heading, .rail-head { display: flex; justify-content: space-between; gap: 18px; align-items: start; margin-bottom: 26px; }
.section-tag { margin-bottom: 6px; }
h2 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.status-light { display: flex; align-items: center; gap: 7px; color: var(--mint); font-size: 12px; }
.status-light i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 6px rgba(87,214,165,.1); }

.license-box { padding: 17px; border: 1px solid rgba(255,157,46,.28); border-radius: 15px; background: rgba(255,157,46,.045); }
.license-title-row { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.license-kicker { margin: 0 0 3px; color: var(--saffron); font: 700 10px Consolas, monospace; letter-spacing: .14em; }
.license-title-row h3 { margin: 0; font-size: 16px; }
.license-state { padding: 5px 8px; border-radius: 99px; color: #b8bfd8; background: rgba(255,255,255,.07); font-size: 10px; }
.license-state.valid { color: #0c2a20; background: var(--mint); }
.license-state.invalid { color: #351014; background: #ff8e97; }
.cdk-field { display: block; margin-top: 14px; }
.cdk-field > span:first-child { display: block; margin-bottom: 7px; color: #c5cbe0; font-size: 12px; }
.cdk-input-row { display: flex; gap: 7px; }
.cdk-input-row input { min-width: 0; width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--paper); background: rgba(5,10,32,.72); font: 11px Consolas, monospace; }
.cdk-input-row input:focus { border-color: var(--saffron); box-shadow: 0 0 0 3px rgba(255,157,46,.12); }
.cdk-input-row button, .device-row button { flex: none; border: 1px solid var(--line); border-radius: 8px; color: #c9cfe4; background: rgba(255,255,255,.04); font-size: 11px; }
.cdk-input-row button { width: 48px; }
.device-row { display: flex; align-items: center; gap: 8px; margin-top: 11px; color: var(--muted); font-size: 11px; }
.device-row code { min-width: 0; flex: 1; color: var(--mint); font-family: Consolas, monospace; overflow-wrap: anywhere; }
.device-row button { padding: 5px 8px; }
.verify-button { width: 100%; height: 38px; margin-top: 12px; border: 1px solid rgba(87,214,165,.42); border-radius: 9px; color: var(--mint); background: rgba(87,214,165,.07); font-size: 12px; font-weight: 700; }
.verify-button:hover { color: var(--night); background: var(--mint); }
.license-hint { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.license-balance { display: inline-flex; align-items: baseline; gap: 5px; margin: 12px 0 0 10px; color: var(--muted); font-size: 11px; }
.license-balance strong { color: var(--mint); font: 700 22px Consolas, monospace; }

.field { display: block; margin-top: 22px; }
.label-row { display: flex; justify-content: space-between; margin-bottom: 9px; }
.label-row b { font-size: 14px; }
.label-row small, .hint { color: var(--muted); font-size: 12px; }
textarea, select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.14);
  color: var(--paper);
  background: rgba(5, 10, 32, .72);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
textarea { resize: vertical; min-height: 118px; padding: 14px 15px; border-radius: 14px; font-family: Consolas, "SFMono-Regular", monospace; font-size: 12px; line-height: 1.65; }
textarea:focus, select:focus { border-color: var(--saffron); box-shadow: 0 0 0 3px rgba(255,157,46,.12); }
textarea::placeholder { color: #687196; }
.hint { display: block; margin-top: 8px; line-height: 1.5; }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.mini-field, .switch-row { min-height: 72px; border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; background: rgba(255,255,255,.025); }
.mini-field { grid-row: span 2; display: flex; flex-direction: column; justify-content: space-between; color: #c1c7dc; font-size: 12px; }
select { height: 34px; padding: 0 8px; border-radius: 8px; font-size: 13px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; }
.switch-row span b, .switch-row span small { display: block; }
.switch-row b { font-size: 13px; }
.switch-row small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.switch-row input { position: absolute; opacity: 0; }
.switch-row > i { width: 38px; height: 22px; padding: 3px; border-radius: 99px; background: #414a6b; flex: none; transition: background .2s; }
.switch-row > i::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; transition: transform .2s; }
.switch-row input:checked + i { background: var(--mint); }
.switch-row input:checked + i::after { transform: translateX(16px); }
.switch-row input:focus-visible + i { outline: 2px solid var(--saffron); outline-offset: 3px; }
.form-error { margin-top: 16px; padding: 11px 13px; border: 1px solid rgba(255,112,123,.4); border-radius: 10px; color: #ffadb4; background: rgba(255,112,123,.08); font-size: 13px; line-height: 1.5; }
.launch { width: 100%; min-height: 56px; margin-top: 22px; padding: 0 20px; border: 0; border-radius: 14px; display: flex; justify-content: space-between; align-items: center; color: #24160a; background: var(--saffron); font-weight: 800; transition: transform .16s, filter .16s; }
.launch:hover { transform: translateY(-2px); filter: brightness(1.07); }
.launch:disabled { cursor: wait; opacity: .62; transform: none; }
.launch i { font-size: 22px; font-style: normal; }

.ghost-button, .secondary-button { border: 1px solid var(--line); color: var(--paper); background: transparent; border-radius: 10px; padding: 9px 12px; font-size: 12px; }
.ghost-button:hover, .secondary-button:hover { border-color: var(--saffron); color: var(--saffron); }
.route-map { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin: 44px 6px 36px; }
.route-line { position: absolute; z-index: 0; left: 8%; right: 8%; top: 16px; height: 2px; background: #2e385e; }
.route-line span { display: block; width: 0; height: 100%; background: var(--mint); transition: width .5s ease; box-shadow: 0 0 12px rgba(87,214,165,.55); }
.route-stop { z-index: 1; text-align: center; color: #7580a7; }
.route-stop i { width: 34px; height: 34px; margin: auto auto 10px; display: grid; place-items: center; border: 2px solid #354064; border-radius: 50%; color: #818bad; background: #111a46; font: normal 12px Consolas, monospace; transition: all .25s; }
.route-stop b, .route-stop small { display: block; }
.route-stop b { font-size: 13px; }
.route-stop small { margin-top: 3px; font-size: 10px; }
.route-stop.active { color: var(--paper); }
.route-stop.active i { border-color: var(--mint); color: var(--night); background: var(--mint); box-shadow: 0 0 0 7px rgba(87,214,165,.08); }
.stats-strip { display: grid; grid-template-columns: repeat(4,1fr); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.stats-strip div { padding: 15px 16px; border-right: 1px solid var(--line); }
.stats-strip div:last-child { border: 0; }
.stats-strip span, .stats-strip small { display: block; }
.stats-strip span { font: 600 25px Consolas, monospace; }
.stats-strip small { color: var(--muted); font-size: 11px; }
.stats-strip div:nth-child(3) span { color: var(--mint); }
.stats-strip div:nth-child(4) span { color: var(--danger); }
.empty-state { min-height: 350px; padding: 58px 14%; display: grid; justify-items: center; align-content: center; text-align: center; }
.upi-glyph { width: 74px; height: 74px; display: grid; place-items: center; transform: rotate(45deg); border: 1px solid rgba(255,157,46,.5); background: rgba(255,157,46,.08); }
.upi-glyph span { transform: rotate(-45deg); color: var(--saffron); font: 600 32px Georgia, serif; }
.empty-state h3 { margin: 30px 0 8px; font-size: 18px; }
.empty-state p { max-width: 380px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.task-list { position: relative; z-index: 2; margin-top: 20px; max-height: 410px; overflow: auto; padding-right: 4px; }
.task-card { margin-bottom: 9px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 13px; background: rgba(7,12,36,.58); }
.task-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.task-name { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.task-name i { width: 8px; height: 8px; border-radius: 50%; background: #6a7498; }
.task-card.running .task-name i { background: var(--saffron); box-shadow: 0 0 0 5px rgba(255,157,46,.09); }
.task-card.success .task-name i { background: var(--mint); }
.task-card.failed .task-name i { background: var(--danger); }
.task-slot { color: var(--muted); font: 11px Consolas, monospace; }
.task-message { margin: 9px 0 8px; color: #abb3d0; font-size: 12px; line-height: 1.4; }
.bar { height: 3px; overflow: hidden; border-radius: 99px; background: #2c365a; }
.bar span { display: block; height: 100%; width: 0; background: var(--saffron); transition: width .3s; }
.success .bar span { background: var(--mint); }
.failed .bar span { background: var(--danger); }
.link-row { display: flex; gap: 8px; margin-top: 11px; }
.link-row input { min-width: 0; flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: #cbd2eb; background: rgba(255,255,255,.035); font: 11px Consolas, monospace; }
.copy-one { border: 0; border-radius: 8px; padding: 0 11px; color: #10251e; background: var(--mint); font-size: 11px; font-weight: 700; }
.result-actions { position: relative; z-index: 2; display: flex; gap: 8px; margin-top: 14px; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 26px; transform: translateX(-50%); padding: 11px 16px; border-radius: 10px; color: var(--night); background: var(--paper); box-shadow: 0 12px 40px rgba(0,0,0,.35); font-size: 13px; font-weight: 700; }
footer { width: min(1264px, calc(100% - 40px)); margin: 30px auto 0; padding: 22px 4px 34px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: #697397; font: 11px Consolas, monospace; letter-spacing: .08em; }

@media (max-width: 980px) {
  .activity-heading { flex-direction: column; gap: 16px; }
  .activity-controls { width: 100%; justify-content: space-between; }
  .workspace { grid-template-columns: 1fr; }
  .rail-panel { min-height: 620px; }
}
@media (max-width: 640px) {
  .topbar { height: 62px; padding: 0 18px; }
  .route-meta span:last-child, .route-meta b:last-of-type { display: none; }
  .shell { width: min(100% - 24px, 1264px); }
  .intro { min-height: auto; padding: 44px 2px 38px; }
  .activity-panel { padding: 20px 16px 17px; border-radius: 18px; }
  .activity-controls { align-items: stretch; flex-direction: column; }
  .method-chip { width: max-content; }
  .window-tabs button { flex: 1; padding-inline: 7px; }
  .activity-summary { gap: 18px; }
  .activity-summary p { display: none; }
  h1 { font-size: 44px; }
  .lead { font-size: 15px; }
  .rules { grid-template-columns: 1fr; }
  .rules > div { padding-right: 0; }
  .control-panel, .rail-panel { padding: 21px 17px; border-radius: 18px; }
  .options-grid { grid-template-columns: 1fr; }
  .mini-field { grid-row: auto; }
  .route-map { margin-inline: -8px; }
  .route-stop small { display: none; }
  .stats-strip div { padding: 12px 9px; }
  .stats-strip span { font-size: 20px; }
  .empty-state { padding-inline: 7%; }
  footer { width: calc(100% - 24px); flex-direction: column; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
