:root {
  --bg: #f3efe5;
  --paper: rgba(255, 252, 246, 0.88);
  --ink: #1f2937;
  --muted: #5b6472;
  --line: rgba(31, 41, 55, 0.12);
  --sender: #d97706;
  --receiver: #0f766e;
  --accent: #b91c1c;
  --shadow: 0 20px 50px rgba(31, 41, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 119, 6, 0.16), transparent 30%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.18), transparent 35%),
    linear-gradient(180deg, #f7f2e8 0%, #efe7d8 100%);
}

.page {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  max-width: 900px;
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 0.95;
}

.subtitle {
  max-width: 700px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.workspace {
  display: grid;
  gap: 20px;
}

.apps {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 280px) 1fr;
  gap: 20px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.app-card,
.explainer,
.flow-lane {
  padding: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(31, 41, 55, 0.08);
}

.sender .status-pill {
  color: var(--sender);
}

.receiver .status-pill {
  color: var(--receiver);
}

h2,
h3,
h4 {
  margin: 0 0 12px;
}

.panel-copy {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.code-block {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(31, 41, 55, 0.08);
}

.order-form {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.field input {
  width: 100%;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 14px;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
}

.field input:focus {
  outline: 2px solid rgba(217, 119, 6, 0.22);
  border-color: rgba(217, 119, 6, 0.45);
}

.code-title {
  margin-bottom: 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

code,
pre {
  margin: 0;
  font-family: "Menlo", "Consolas", "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.send-button {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 700;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, #c2410c, #d97706);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  box-shadow: 0 12px 26px rgba(217, 119, 6, 0.28);
}

.send-button:hover {
  transform: translateY(-1px);
}

.send-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.flow-lane {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.flow-header {
  margin-bottom: 20px;
  text-align: center;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.flow-track {
  position: relative;
  height: 140px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(217, 119, 6, 0.12), rgba(15, 118, 110, 0.12)),
    rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(31, 41, 55, 0.16);
  overflow: hidden;
}

.packet {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 148px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #b91c1c, #ea580c);
  color: white;
  box-shadow: 0 14px 24px rgba(185, 28, 28, 0.28);
  opacity: 0;
}

.packet.animate {
  animation: travel 2.2s ease-in-out forwards;
}

@keyframes travel {
  0% {
    transform: translate(0, -50%) scale(0.95);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  50% {
    transform: translate(calc(50% - 74px), -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(calc(100% - 160px), -50%) scale(0.98);
    opacity: 1;
  }
}

.packet-label {
  font-family: "Menlo", "Consolas", "Courier New", monospace;
  font-size: 0.85rem;
}

.flow-steps {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.step.active {
  color: var(--ink);
  font-weight: 700;
}

.receiver-reaction {
  padding: 14px;
  border-radius: 18px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--receiver);
  font-weight: 700;
}

.explainer ul {
  margin: 0 0 18px;
  padding-left: 18px;
  line-height: 1.6;
  color: var(--muted);
}

.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.comparison > div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(31, 41, 55, 0.08);
}

.comparison p {
  margin: 8px 0 0;
  color: var(--muted);
}

.event-log {
  padding: 16px;
  border-radius: 18px;
  background: rgba(31, 41, 55, 0.95);
  color: #f9fafb;
}

#log {
  min-height: 84px;
  font-family: "Menlo", "Consolas", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #d1d5db;
}

.log-entry {
  padding: 2px 0;
}

@media (max-width: 960px) {
  .apps {
    grid-template-columns: 1fr;
  }

  .flow-track {
    height: 96px;
  }

  .packet.animate {
    animation: travelMobile 2s ease-in-out forwards;
  }

  @keyframes travelMobile {
    0% {
      transform: translate(0, -50%) scale(0.95);
      opacity: 0;
    }
    15% {
      opacity: 1;
    }
    100% {
      transform: translate(calc(100vw - 280px), -50%) scale(0.98);
      opacity: 1;
    }
  }

  .comparison {
    grid-template-columns: 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}
