:root {
  --panel: rgba(255, 249, 242, 0.75);
  --ink: #221b18;
  --muted: #63554e;
  --accent: #df6d2d;
  --accent-2: #1f7a5c;
  --accent-3: #1773b0;
  --allow: #38c786;
  --reject: #e06257;
  --incoming: #f3c060;
  --shadow: 0 20px 60px rgba(109, 60, 23, 0.14);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 205, 130, 0.5), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(63, 173, 122, 0.15), transparent 25%),
    linear-gradient(180deg, #fff9f2 0%, #f4efe8 36%, #eef4f8 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(34, 27, 24, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 27, 24, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
}

.page-shell {
  width: min(1500px, calc(100% - 48px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero { min-height: 100vh; padding: 24px 0 60px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 42px;
  padding: 10px 12px 10px 18px;
  border: 1px solid rgba(34, 27, 24, 0.08);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.68);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(109, 60, 23, 0.1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  margin-right: auto;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #f2b84b);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, 0.46), 0 10px 20px rgba(223, 109, 45, 0.18);
}

.nav-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 5px;
  border: 1px solid rgba(34, 27, 24, 0.07);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
}
.nav-pill, .cta { text-decoration: none; color: inherit; }

.nav-pill {
  border: 1px solid transparent;
  padding: 10px 16px;
  border-radius: 999px;
  background: transparent;
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.nav-pill:hover,
.nav-pill:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(223, 109, 45, 0.18);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 22px rgba(109, 60, 23, 0.1);
  outline: none;
}

.button-pill { font: inherit; cursor: pointer; }

.back-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border: 2px solid rgba(223, 109, 45, 0.28);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #f2b84b);
  color: #fffaf3;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(223, 109, 45, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.back-icon {
  position: relative;
  display: block;
  width: 20px;
  height: 14px;
}

.back-icon::before,
.back-icon::after {
  content: "";
  position: absolute;
  left: 1px;
}

.back-icon::before {
  top: 5px;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.back-icon::after {
  top: 2px;
  width: 9px;
  height: 9px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(45deg);
}

.back-button:hover,
.back-button:focus-visible {
  transform: translateX(-2px) scale(1.04);
  background: linear-gradient(135deg, #c95720, var(--accent));
  color: #fffaf3;
  box-shadow: 0 18px 34px rgba(223, 109, 45, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.34);
  outline: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 36px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.8rem;
  color: var(--accent-2);
  font-weight: 800;
}

.hero-copy h1, .section-heading h2 {
  margin: 0;
  font-family: "DM Serif Display", serif;
  letter-spacing: 0;
  line-height: 0.98;
}

.hero-copy h1 { font-size: clamp(2.8rem, 5.6vw, 4.8rem); max-width: 10ch; }

.hero-text {
  margin: 24px 0 0;
  font-size: 1.08rem;
  line-height: 1.75;
  max-width: 60ch;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.cta {
  padding: 14px 20px;
  border-radius: 999px;
  font-weight: 800;
}

.cta.primary {
  background: linear-gradient(135deg, var(--accent), #f2b84b);
  color: #fffdf9;
  box-shadow: 0 18px 28px rgba(223, 109, 45, 0.2);
}

.cta.secondary {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(34, 27, 24, 0.08);
}

.hero-metrics {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.hero-metrics article,
.panel,
.info-card,
.timeline-step,
.algorithm-card {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: var(--shadow);
}

.hero-metrics article { padding: 18px; border-radius: 18px; }
.hero-metrics strong { display: block; font-size: 1.35rem; }
.hero-metrics span,
.info-card p,
.algorithm-copy p,
.timeline-step p,
.compiler-note,
.visual-note { color: var(--muted); line-height: 1.7; }

.visual-card {
  background:
    radial-gradient(circle at 12% 12%, rgba(243, 192, 96, 0.16), transparent 24%),
    radial-gradient(circle at 86% 76%, rgba(56, 199, 134, 0.14), transparent 28%),
    rgba(34, 27, 24, 0.96);
  color: #fffaf3;
  border-radius: 30px;
  padding: 18px;
  box-shadow: 0 28px 80px rgba(34, 27, 24, 0.26);
  position: relative;
  overflow: hidden;
}

.visual-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background:
    linear-gradient(115deg, transparent 0 38%, rgba(255, 255, 255, 0.18) 46%, transparent 54% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 26px);
  transform: translateX(-70%);
  animation: panelSweep 5.5s ease-in-out infinite;
}

.visual-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -25% auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 184, 75, 0.22), transparent 70%);
  animation: glowDrift 6s ease-in-out infinite alternate;
}

.visual-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 250, 243, 0.8);
  font-size: 0.93rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f2b84b;
  box-shadow: 0 0 18px rgba(242, 184, 75, 0.8);
}

.request-flow,
.algorithm-flow {
  display: grid;
  grid-template-columns: 1fr 40px 1fr 40px 1fr;
  gap: 8px;
  align-items: center;
}

.request-flow { margin: 18px 0; }

.flow-column,
.algorithm-stage {
  display: grid;
  gap: 10px;
}

.flow-label {
  color: rgba(255, 250, 243, 0.75);
  font-size: 0.84rem;
}

.flow-stage {
  position: relative;
  min-height: 76px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.flow-stage::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px -35%;
  width: 34%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  animation: stageScan 2.2s ease-in-out infinite;
}

.flow-arrow {
  position: relative;
  text-align: center;
  color: rgba(255, 250, 243, 0.72);
  font-weight: 800;
  animation: arrowPulse 1.4s ease-in-out infinite;
}

.flow-arrow::after {
  content: "";
  position: absolute;
  left: -12px;
  right: -12px;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(243, 192, 96, 0.9), transparent);
  transform: translateY(-50%) scaleX(0);
  transform-origin: left;
  animation: flowLine 2.2s ease-in-out infinite;
}

.coupon-block,
.server-block {
  min-width: 90px;
  padding: 12px 14px;
  border-radius: 14px;
  text-align: center;
  font-weight: 800;
  transition: transform 320ms ease, background 320ms ease, color 320ms ease;
  position: relative;
  z-index: 1;
}

.coupon-block.incoming {
  background: linear-gradient(135deg, #f3c060, #df6d2d);
  color: #2a211d;
  border-radius: 12px;
  box-shadow: 0 16px 30px rgba(223, 109, 45, 0.2);
  animation: ticketFloat 2.6s ease-in-out infinite;
}

.coupon-block.incoming::before,
.coupon-block.incoming::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(34, 27, 24, 0.96);
  transform: translateY(-50%);
}

.coupon-block.incoming::before { left: -6px; }
.coupon-block.incoming::after { right: -6px; }

.coupon-block.incoming,
.coupon-block.allowed,
.coupon-block.rejected,
.server-block {
  overflow: hidden;
}

.coupon-block.incoming::marker {
  content: "";
}

.coupon-block.allowed {
  background: linear-gradient(135deg, #5bdd9d, #229a66);
  color: #f7fffb;
  box-shadow: 0 16px 30px rgba(56, 199, 134, 0.22);
  animation: resultPulse 2.4s ease-in-out infinite;
}

.coupon-block.rejected {
  background: linear-gradient(135deg, #ef847b, #c4443c);
  color: #fff7f6;
  box-shadow: 0 16px 30px rgba(224, 98, 87, 0.22);
  animation: rejectedShake 2.4s ease-in-out infinite;
}

.server-block {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08)),
    rgba(255, 255, 255, 0.12);
  color: #fffaf3;
  box-shadow: inset 0 -12px 0 rgba(255, 255, 255, 0.06);
  animation: strategyLift 2.8s ease-in-out infinite;
}

.server-block::after,
.coupon-block.allowed::after,
.coupon-block.rejected::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 35%, rgba(255, 255, 255, 0.28) 48%, transparent 62% 100%);
  transform: translateX(-120%);
  animation: chipShimmer 2.8s ease-in-out infinite;
}

.turn-console {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

.console-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  animation: rowRise 550ms ease both;
}

.console-row span { color: rgba(255, 250, 243, 0.68); }
.console-row strong { position: relative; z-index: 1; }

.console-row::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(243, 192, 96, 0.12), transparent);
  transform: translateX(-100%);
}

.visual-card.is-updating .coupon-block,
.visual-card.is-updating .server-block {
  animation-name: popIn;
  animation-duration: 520ms;
  animation-timing-function: cubic-bezier(0.2, 0.9, 0.2, 1.2);
}

.visual-card.is-updating .console-row::after {
  animation: dataSweep 700ms ease;
}

@keyframes panelSweep {
  0%, 35% { transform: translateX(-70%); }
  70%, 100% { transform: translateX(70%); }
}

@keyframes glowDrift {
  from { transform: translate(-10px, 6px) scale(0.95); }
  to { transform: translate(18px, -12px) scale(1.08); }
}

@keyframes stageScan {
  0%, 22% { transform: translateX(0); opacity: 0; }
  45% { opacity: 1; }
  78%, 100% { transform: translateX(420%); opacity: 0; }
}

@keyframes arrowPulse {
  0%, 100% { transform: translateX(0); color: rgba(255, 250, 243, 0.62); }
  50% { transform: translateX(3px); color: #f3c060; }
}

@keyframes flowLine {
  0%, 18% { transform: translateY(-50%) scaleX(0); opacity: 0; }
  42% { opacity: 1; }
  78%, 100% { transform: translateY(-50%) scaleX(1); opacity: 0; }
}

@keyframes ticketFloat {
  0%, 100% { transform: rotate(-1deg) translateY(0); }
  50% { transform: rotate(1deg) translateY(-4px); }
}

@keyframes strategyLift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes resultPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@keyframes rejectedShake {
  0%, 100% { transform: translateX(0); }
  45% { transform: translateX(-2px); }
  55% { transform: translateX(2px); }
}

@keyframes chipShimmer {
  0%, 35% { transform: translateX(-120%); }
  70%, 100% { transform: translateX(120%); }
}

@keyframes rowRise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dataSweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@keyframes popIn {
  from { transform: translateY(8px) scale(0.94); }
  to { transform: translateY(0) scale(1); }
}

.section { padding: 72px 0; }

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 26px;
}

.section-heading h2 {
  font-size: clamp(2.1rem, 4vw, 3.8rem);
  max-width: 760px;
}

.logic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.info-card {
  border-radius: var(--radius);
  padding: 24px;
  border-top: 5px solid var(--accent);
}

.info-card h3,
.algorithm-copy h3,
.timeline-step h3,
.code-panel h3 {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.accent-green { border-top-color: var(--accent-2); }
.accent-blue { border-top-color: var(--accent-3); }

pre {
  position: relative;
  margin: 18px 0 0;
  padding: 18px;
  border-radius: 18px;
  background: rgba(34, 27, 24, 0.96);
  color: #fff7ee;
  overflow-x: auto;
}

code { font-family: "Courier New", monospace; font-size: 0.94em; }

.snippet-expand-button {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.14);
  color: #fffaf3;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.timeline { display: grid; gap: 14px; }

.timeline-step {
  border-radius: 24px;
  padding: 20px;
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 18px;
}

.step-number {
  font-family: "DM Serif Display", serif;
  font-size: 2.2rem;
  color: var(--accent);
  line-height: 1;
}

.algorithm-stack { display: grid; gap: 18px; }

.algorithm-card {
  border-radius: var(--radius);
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 18px;
}

.algorithm-tag {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.algorithm-copy h3 { margin: 0 0 12px; font-size: 1.3rem; }

.algorithm-visual {
  border-radius: 22px;
  padding: 18px;
  background: rgba(34, 27, 24, 0.95);
  color: #fffaf3;
  min-height: 260px;
}

.visual-title { font-weight: 800; margin-bottom: 18px; }

.reason-card,
.flow-map span {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 250, 243, 0.86);
}

.flow-map {
  display: grid;
  gap: 10px;
}

.flow-map span {
  margin: 0;
  font-weight: 800;
}

.compiler-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.code-panel,
.compiler-panel {
  border-radius: var(--radius);
  padding: 24px;
  min-height: 820px;
}

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

.code-panel-header h3 { margin-bottom: 4px; }
.compiler-note { margin: 0; }

.code-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.copy-button {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--accent), #f2b84b);
  color: #fffaf3;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 24px rgba(223, 109, 45, 0.18);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  border: 1px solid rgba(34, 27, 24, 0.1);
  box-shadow: none;
}

.code-textarea {
  width: 100%;
  min-height: 680px;
  resize: vertical;
  border-radius: 20px;
  border: 1px solid rgba(34, 27, 24, 0.12);
  background: rgba(34, 27, 24, 0.96);
  color: #fff7ee;
  padding: 18px;
  line-height: 1.55;
  font-size: 0.92rem;
  font-family: "Courier New", monospace;
}

.compiler-frame {
  width: 100%;
  min-height: 710px;
  margin-top: 14px;
  border: 1px solid rgba(34, 27, 24, 0.1);
  border-radius: 20px;
  background: #fff;
}

.code-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  grid-template-rows: auto 1fr;
  background: rgba(18, 15, 13, 0.98);
  padding: 18px;
}

.code-modal.open { display: grid; }

.modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: #fffaf3;
  padding-bottom: 14px;
}

.modal-code {
  width: 100%;
  min-height: 0;
  resize: none;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0f1512;
  color: #f5fff9;
  padding: 22px;
  line-height: 1.58;
  font-size: 1rem;
  font-family: "Courier New", monospace;
}

body.modal-open { overflow: hidden; }

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .hero-grid,
  .logic-grid,
  .algorithm-card,
  .compiler-layout,
  .request-flow,
  .algorithm-flow {
    grid-template-columns: 1fr;
  }

  .hero { min-height: auto; }
}

@media (max-width: 720px) {
  .page-shell { width: min(100% - 18px, 1500px); }

  .topbar {
    gap: 14px;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 34px;
    border-radius: 24px;
    padding: 14px;
  }

  .nav-group {
    width: 100%;
    justify-content: flex-start;
    border-radius: 20px;
  }

  .hero-copy h1 { font-size: 2.4rem; }
  .hero-metrics { grid-template-columns: 1fr; }
  .timeline-step { grid-template-columns: 1fr; }
  .code-panel, .compiler-panel { min-height: auto; }
  .code-panel-header { align-items: flex-start; flex-direction: column; }
  .code-actions { justify-content: flex-start; }
  .code-textarea { min-height: 520px; }
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
}

.expand-icon {
  position: relative;
  width: 16px;
  height: 16px;
  display: inline-block;
}

.expand-icon::before,
.expand-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-color: currentColor;
}

.expand-icon::before {
  top: 0;
  right: 0;
  border-top: 2px solid;
  border-right: 2px solid;
}

.expand-icon::after {
  left: 0;
  bottom: 0;
  border-left: 2px solid;
  border-bottom: 2px solid;
}
