:root {
  --ink: #101418;
  --muted: #687078;
  --line: #dce0e2;
  --soft: #f1f3f2;
  --paper: #fbfcfa;
  --white: #fff;
  --lime: #d9ff43;
  --lime-dark: #b8e100;
  --blue: #1747d1;
  --red: #c83232;
  --green: #167c52;
  --radius: 22px;
  --shadow: 0 24px 80px rgba(17, 24, 19, .08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 87% 2%, rgba(217, 255, 67, .2), transparent 24rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(23, 71, 209, .22); outline-offset: 2px; }

.hidden { display: none !important; }

.topbar {
  height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 250, .82);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-size: 14px; font-weight: 720; letter-spacing: -.01em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--ink); color: var(--lime); font-size: 12px; letter-spacing: -.06em; }
.brand-divider { height: 18px; width: 1px; background: var(--line); margin: 0 2px; }
.brand-product { color: var(--muted); font-weight: 520; }
.service-state { display: flex; align-items: center; gap: 8px; color: #545b61; font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(22, 124, 82, .1); }

.shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 72px 0 100px; }
.hero { display: grid; grid-template-columns: 1.25fr .75fr; align-items: end; gap: 64px; margin-bottom: 54px; }
.eyebrow, .section-kicker { margin: 0 0 12px; color: var(--blue); font-size: 11px; font-weight: 780; letter-spacing: .15em; text-transform: uppercase; }
h1 { margin: 0; max-width: 760px; font-size: clamp(42px, 5.2vw, 72px); line-height: 1.03; letter-spacing: -.055em; font-weight: 690; }
.hero-copy { max-width: 690px; margin: 25px 0 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.flow-legend { display: flex; align-items: center; justify-content: flex-end; padding-bottom: 8px; }
.flow-step { min-width: 64px; color: #9a9fa2; font-size: 11px; text-align: center; white-space: nowrap; }
.flow-step b { display: grid; place-items: center; width: 36px; height: 36px; margin: 0 auto 9px; border: 1px solid var(--line); border-radius: 50%; color: #747b80; font-size: 10px; }
.flow-step.active { color: var(--ink); font-weight: 650; }
.flow-step.active b { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.flow-line { width: clamp(30px, 4vw, 62px); height: 1px; background: var(--line); margin: 0 6px 28px; }

.workspace { display: grid; grid-template-columns: minmax(300px, .78fr) minmax(0, 1.4fr); gap: 22px; align-items: start; }
.card-panel, .simulator-panel, .result-section, .history-section { background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-panel, .simulator-panel { padding: clamp(22px, 3vw, 36px); min-height: 620px; }
.panel-heading, .history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.panel-heading h2, .history-heading h2 { margin: 0; font-size: 25px; letter-spacing: -.035em; }
.step-chip { border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; color: var(--muted); font-size: 9px; font-weight: 760; letter-spacing: .12em; }
.lookup-form label, .form-field label { display: block; margin: 0 0 9px; font-size: 12px; font-weight: 700; }
.lookup-form label { color: var(--muted); }
.input-combo { display: grid; grid-template-columns: 1fr 46px; border: 1px solid #cfd4d6; border-radius: 13px; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.input-combo:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 71, 209, .09); }
.input-combo input { min-width: 0; border: 0; background: transparent; padding: 0 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; outline: none; }
.icon-button { border: 0; border-left: 1px solid #cfd4d6; background: var(--ink); color: var(--white); font-size: 20px; }
.icon-button:disabled, .primary-button:disabled { cursor: wait; opacity: .65; }
.field-message { min-height: 18px; margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.field-message.error { color: var(--red); }
.field-message.success { color: var(--green); }

.card-placeholder { min-height: 286px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.placeholder-orbit { width: 104px; height: 104px; display: grid; place-items: center; border: 1px dashed #bfc5c8; border-radius: 50%; position: relative; }
.placeholder-orbit::before, .placeholder-orbit::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid #e5e8e8; }
.placeholder-orbit::before { width: 72px; height: 72px; }
.placeholder-orbit::after { width: 42px; height: 42px; }
.placeholder-orbit span { z-index: 1; color: #aeb4b6; letter-spacing: .25em; }
.card-placeholder p { margin: 20px 0 4px; color: #565d61; font-size: 13px; font-weight: 650; }
.card-placeholder > span { font-size: 11px; }

.payment-card { min-height: 235px; margin-top: 28px; padding: 26px; display: flex; flex-direction: column; justify-content: space-between; border-radius: 20px; color: #f7f8f5; background:
  linear-gradient(135deg, rgba(217,255,67,.13), transparent 42%),
  linear-gradient(135deg, #161b1f, #2d353a);
  box-shadow: 0 22px 50px rgba(16, 20, 24, .25);
  position: relative;
  overflow: hidden;
}
.payment-card::after { content: ""; position: absolute; width: 220px; height: 220px; border: 1px solid rgba(255,255,255,.11); border-radius: 50%; right: -78px; top: -90px; box-shadow: 0 0 0 32px rgba(255,255,255,.025), 0 0 0 64px rgba(255,255,255,.018); }
.payment-card-top, .card-meta { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 1; }
.card-mode { padding: 6px 9px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.contactless { transform: rotate(90deg); color: var(--lime); font-weight: 700; letter-spacing: -4px; }
.card-number { position: relative; z-index: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(18px, 2vw, 24px); letter-spacing: .08em; }
.card-meta { gap: 30px; }
.card-meta div:last-child { text-align: right; }
.card-meta span { display: block; margin-bottom: 5px; color: #aab0b2; font-size: 8px; letter-spacing: .14em; }
.card-meta strong { font-size: 12px; font-weight: 630; }
.card-meta strong.ok { color: var(--lime); }
.card-details { margin: 28px 0 0; padding-top: 6px; border-top: 1px solid var(--line); }
.card-details div { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.card-details dt { color: var(--muted); }
.card-details dd { margin: 0; font-weight: 680; }

.scenario-lock { min-height: 450px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.lock-icon { width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 20px; background: var(--soft); color: #a3a9ac; font-size: 25px; transform: rotate(-25deg); }
.scenario-lock strong { margin-top: 18px; color: #4c5357; font-size: 14px; }
.scenario-lock p { margin: 7px 0 0; font-size: 12px; }
.scenario-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 28px; }
.scenario-tab { min-height: 66px; padding: 9px 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); color: var(--muted); font-size: 10px; font-weight: 660; transition: .18s ease; }
.scenario-tab span { display: block; margin-bottom: 4px; color: #9ba1a4; font-size: 15px; }
.scenario-tab:hover { transform: translateY(-2px); border-color: #aeb4b6; }
.scenario-tab[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: var(--white); }
.scenario-tab[aria-selected="true"] span { color: var(--lime); }
.scenario-intro { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 16px; background: var(--soft); }
.scenario-symbol { width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; background: var(--lime); font-size: 16px; font-weight: 800; }
.scenario-intro h3 { margin: 0 0 5px; font-size: 16px; }
.scenario-intro p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.parameter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 24px; }
.form-field input, .form-field select { width: 100%; height: 48px; border: 1px solid #d1d6d8; border-radius: 11px; background: var(--white); padding: 0 13px; color: var(--ink); outline: none; }
.form-field input:focus, .form-field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23, 71, 209, .08); }
.form-field label span { color: var(--red); }
.form-field small { display: block; min-height: 16px; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.form-field small.warning { color: #a25b00; }
.amount-input { display: grid; grid-template-columns: 1fr 82px; }
.amount-input input { border-radius: 11px 0 0 11px; }
.amount-input select { border-left: 0; border-radius: 0 11px 11px 0; background: var(--soft); font-weight: 680; }
.form-actions { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(190px, 240px) 1fr; align-items: center; gap: 16px; margin-top: 4px; }
.primary-button { height: 52px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 13px; background: var(--lime); color: var(--ink); font-size: 13px; font-weight: 760; box-shadow: inset 0 -2px 0 rgba(0,0,0,.1); }
.primary-button:hover { background: var(--lime-dark); }
.primary-button b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--white); font-size: 13px; }

.result-section, .history-section { margin-top: 22px; padding: clamp(22px, 3vw, 36px); }
.result-card { display: grid; grid-template-columns: 210px 1fr; gap: 26px; padding: 24px; border-radius: 17px; background: var(--soft); }
.result-summary { padding: 22px; display: flex; flex-direction: column; justify-content: space-between; min-height: 180px; border-radius: 14px; background: var(--ink); color: var(--white); }
.result-summary.success { background: #15382b; }
.result-summary.failure { background: #4b2020; }
.result-summary span { color: rgba(255,255,255,.62); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.result-summary strong { margin: 10px 0 auto; font-size: 27px; letter-spacing: -.04em; }
.result-summary em { color: var(--lime); font-size: 11px; font-style: normal; overflow-wrap: anywhere; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.result-item { min-width: 0; padding: 15px 17px; background: var(--white); }
.result-item span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.result-item strong { display: block; overflow-wrap: anywhere; font-size: 12px; line-height: 1.45; }
.history-heading { align-items: center; }
.text-button { border: 0; background: transparent; color: var(--blue); font-size: 11px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 0 14px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 9px; letter-spacing: .1em; text-align: left; text-transform: uppercase; }
td { padding: 16px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td code { font-size: 10px; }
.status-pill { display: inline-flex; padding: 5px 8px; border-radius: 99px; background: rgba(22,124,82,.1); color: var(--green); font-size: 9px; font-weight: 720; }
.status-pill.failed { background: rgba(200,50,50,.1); color: var(--red); }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translateX(-50%); max-width: min(440px, calc(100% - 32px)); padding: 13px 17px; border-radius: 12px; background: var(--ink); color: var(--white); box-shadow: 0 14px 40px rgba(0,0,0,.2); font-size: 12px; }

@media (max-width: 900px) {
  .shell { padding-top: 48px; }
  .hero { grid-template-columns: 1fr; gap: 30px; }
  .flow-legend { justify-content: flex-start; }
  .workspace { grid-template-columns: 1fr; }
  .card-panel, .simulator-panel { min-height: auto; }
  .card-placeholder { min-height: 220px; }
}

@media (max-width: 620px) {
  .topbar { height: 64px; padding: 0 16px; }
  .brand-divider, .brand-product { display: none; }
  .shell { width: min(100% - 24px, 1240px); padding: 38px 0 64px; }
  h1 { font-size: 39px; }
  .hero-copy { font-size: 14px; }
  .flow-step { min-width: 54px; font-size: 9px; }
  .flow-line { width: 22px; }
  .scenario-tabs { grid-template-columns: repeat(3, 1fr); }
  .parameter-grid { grid-template-columns: 1fr; }
  .form-actions { grid-column: auto; grid-template-columns: 1fr; }
  .result-card { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .payment-card { min-height: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
