:root {
  --ink: #16213a;
  --ink-soft: #405272;
  --muted: #7585a2;
  --line: #dce4f1;
  --page: #f3f6ff;
  --panel: #ffffff;
  --soft-blue: #edf5ff;
  --soft-blue-2: #e2f3ff;
  --blue: #4c8ee8;
  --blue-dark: #2f6fcb;
  --green: #2fae72;
  --red: #c23b3b;
  --amber: #9a5b00;
  --shadow: 0 22px 54px rgba(43, 71, 125, .09);
}

* { box-sizing: border-box; }
html {
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

body { margin: 0; min-width: 320px; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
.shell { width: min(100%, 1280px); margin: 0 auto; padding: 0 28px; }

.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.site-brand { display: inline-flex; align-items: center; gap: 8px; color: #5969ff; font-size: 16px; font-weight: 800; text-decoration: none; }
.brand-bolt { color: #f2bd22; font-size: 22px; line-height: 1; }
.site-nav { display: flex; align-items: center; gap: 4px; padding: 7px; border: 1px solid #dce4f1; border-radius: 13px; background: #e8eef9; }
.site-nav .nav-btn { min-height: 38px; padding: 0 15px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-soft); }
.site-nav .nav-btn.active { background: #ced9eb; color: var(--ink); }
.nav-divider { width: 1px; height: 28px; margin: 0 4px; background: #c4d0e2; }
.utility-btn { width: 38px; height: 38px; border: 1px solid #c6d3e6; border-radius: 9px; background: #e5edf9; color: var(--ink-soft); font-size: 14px; font-weight: 750; }
.theme-btn { width: 42px; border-radius: 50%; background: #f7fbff; color: #e4a80d; font-size: 20px; }
.notice-stack { display: grid; gap: 10px; margin: 7px 0 26px; }
.notice { min-height: 45px; display: flex; align-items: center; gap: 10px; padding: 0 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.notice-icon { width: 20px; height: 20px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #5e8ce1; color: #fff; font-size: 12px; font-weight: 800; }
.notice-warn .notice-icon { background: #da9b45; }

.page-header {
  min-height: 138px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.title-block { padding: 24px 0 18px; }
.eyebrow, .panel-kicker {
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}
.title-block h1 {
  margin: 5px 0 7px;
  color: var(--ink);
  font-size: 52px;
  line-height: 1.08;
  letter-spacing: 0;
}
.title-block p { margin: 0; color: var(--muted); font-size: 14px; }
.header-tools { display: flex; align-items: center; gap: 24px; }
.nav-btn {
  border: 1px solid #c9d7ec;
  background: rgba(255, 255, 255, .5);
  color: var(--ink-soft);
  min-height: 38px;
  padding: 0 15px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}
.nav-btn:hover { border-color: var(--blue); color: var(--blue-dark); background: #fff; }
.visual-stepper { list-style: none; display: flex; align-items: center; margin: 0; padding: 0; }
.step { display: flex; align-items: center; gap: 9px; color: var(--muted); white-space: nowrap; }
.step span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 2px solid #8d9ab0;
  border-radius: 50%;
  font-size: 25px;
  font-weight: 700;
}
.step b { font-size: 16px; font-weight: 750; }
.step.active { color: var(--ink-soft); }
.step.active span { border-color: var(--blue); background: var(--blue); color: #fff; }
.step.done { color: var(--green); }
.step.done span { border-color: #9fdbbd; background: #e2f7eb; color: var(--green); }
.step-line { width: 76px; height: 1px; margin: 0 13px; background: #8d9ab0; }

.redeem-card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid #e2e8f3;
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) 218px; gap: 18px; align-items: start; }
.main-column { min-width: 0; }
.page-layout.without-contact-rail { grid-template-columns: minmax(0, 1fr); }
.contact-rail[hidden] { display: none !important; }
.card-summary {
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--line);
}
.summary-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.summary-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e2eafa;
  color: var(--blue-dark);
  font-size: 16px;
  font-weight: 800;
}
.summary-icon.success { background: #d9f5e7; color: var(--green); }
.summary-icon.error { background: #fde4e4; color: var(--red); }
.summary-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.summary-main span:not(.summary-icon) { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.summary-actions { display: flex; align-items: center; gap: 12px; }
.state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.state-badge.success { color: var(--green); border-color: #a9dfc2; background: #effbf5; }
.state-badge.error { color: var(--red); border-color: #f1c2c2; background: #fff7f7; }
.outline-button {
  min-height: 40px;
  padding: 0 17px;
  border: 1px solid #c9d7ec;
  border-radius: 22px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 13px;
}
.outline-button:hover { border-color: var(--blue); color: var(--blue-dark); }
.card-entry { padding: 24px 30px 4px; }
.card-form { display: block; }
.card-field { display: grid; gap: 8px; }
label { display: grid; gap: 8px; color: var(--ink-soft); font-size: 14px; font-weight: 750; }
.field-help { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.card-form-actions { display: flex; gap: 12px; margin-top: 20px; }
input, textarea {
  width: 100%;
  border: 1px solid #cdd9e9;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  outline: 0;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input { min-height: 54px; padding: 0 15px; font-size: 15px; }
input:focus, textarea:focus { border-color: #73a7ed; background: #fff; box-shadow: 0 0 0 3px rgba(76, 142, 232, .14); }
.primary-button, .secondary-button, .purchase-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 19px;
  font-size: 14px;
  font-weight: 750;
}
.primary-button.compact, .outline-button.compact { min-height: 50px; }
.primary-button { background: var(--blue); color: #fff; }
.primary-button:hover { background: var(--blue-dark); }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: wait; }
.secondary-button { background: #e8f2ff; color: var(--blue-dark); }
.secondary-button:hover { background: #dcecff; }
.guide-panel { margin: 24px 30px 28px; padding: 24px 26px 22px; border-radius: 14px; background: var(--soft-blue); }
.guide-heading { display: flex; align-items: flex-start; gap: 13px; }
.guide-icon {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #299bd7;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}
.guide-heading h2 { margin: 0; font-size: 25px; line-height: 1.25; }
.guide-heading p { margin: 7px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.guide-card {
  min-height: 205px;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid #e4ecf7;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 7px 16px rgba(48, 92, 151, .06);
}
.guide-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--soft-blue-2); color: #1682c6; font-size: 16px; font-weight: 800; }
.guide-card h3 { margin: 13px 0 6px; font-size: 18px; }
.guide-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.guide-action {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 0 12px;
  border: 1px solid #9ad8fb;
  border-radius: 7px;
  background: #e4f6ff;
  color: #1682c6;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}
.guide-action:hover { background: #d4efff; }
.guide-shortcut { display: flex; align-items: center; justify-content: center; min-height: 46px; margin-top: auto; border-radius: 7px; background: #141b32; color: #b6eaff; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.security-note { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 58px; margin-top: 16px; padding: 14px 18px; border-radius: 9px; background: #fff1c7; color: var(--amber); font-size: 16px; font-weight: 750; line-height: 1.5; text-align: center; box-shadow: 0 5px 14px rgba(154, 91, 0, .08); }
.security-note strong { white-space: nowrap; }

.panel { margin: 0 30px 18px; padding: 24px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.panel.locked { opacity: .62; }
.panel.locked form { pointer-events: none; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.section-heading-main { display: flex; align-items: flex-start; gap: 11px; }
.section-number { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #edf3ff; color: var(--blue-dark); font-size: 14px; font-weight: 800; }
.panel h2 { margin: 5px 0 0; color: var(--ink); font-size: 21px; line-height: 1.2; }
.account-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; margin-top: 20px; }
.credential-form { min-width: 0; }
textarea { min-height: 182px; resize: vertical; padding: 14px; line-height: 1.6; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.form-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.65; }
.account-status { min-height: 218px; padding: 20px; border-radius: 12px; background: #f0f5ff; }
.status-label { display: block; color: #93a3bf; font-size: 12px; font-weight: 700; }
.account-status > strong { display: block; margin-top: 14px; font-size: 25px; }
.account-status > p { margin: 10px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.65; }
.account-status .result { margin-top: 13px; }
.order-inline { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.order-inline[hidden] { display: none; }
.panel-copy { margin: 12px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.order-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.order-form input { font-weight: 400; }
.full { width: 100%; margin-top: 15px; }
.result { margin-top: 15px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; line-height: 1.6; }
.result.success { border-color: #b8e5d2; background: #f0fbf6; color: #146b4f; }
.result.error { border-color: #f0caca; background: #fff7f7; color: var(--red); }
.result.info { border-color: #cad9fb; background: #f5f8ff; color: #244b9b; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 10px; }
.result-grid div { padding: 9px; border: 1px solid rgba(37, 99, 235, .1); border-radius: 6px; background: rgba(255, 255, 255, .75); }
.result-grid small { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; }
.result-grid strong { font-size: 12px; }
.progress-track { height: 7px; margin: 20px 0 11px; overflow: hidden; border-radius: 99px; background: #edf0f4; }
.progress-fill { height: 100%; width: 12%; border-radius: 99px; background: var(--blue); transition: width .3s; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.progress-meta span { color: var(--muted); font-size: 11px; }
.receipt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.receipt div { padding: 11px; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; }
.receipt dt { margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.receipt dd { margin: 0; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.contact-strip { display: flex; align-items: center; gap: 22px; margin: 24px 30px 30px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbff; }
.contact-text { min-width: 0; margin-right: auto; }
.contact-text h2 { margin: 5px 0 4px; font-size: 19px; }
.contact-text p { margin: 0; color: var(--muted); font-size: 12px; }
.contact-qr { width: 66px; height: 100px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 6px; }
.purchase-button { display: inline-flex; align-items: center; justify-content: center; background: var(--blue); color: #fff; text-decoration: none; white-space: nowrap; }
.purchase-button:hover { background: var(--blue-dark); }
.contact-rail { position: sticky; top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 16px 34px rgba(43, 71, 125, .07); }
.contact-rail-heading h2 { margin: 6px 0 5px; font-size: 19px; }
.contact-rail-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.contact-rail .contact-qr { display: block; width: 100%; height: auto; aspect-ratio: 964 / 1478; object-fit: contain; margin: 18px auto; border: 1px solid var(--line); border-radius: 7px; }
.contact-rail .purchase-button { width: 100%; min-height: 44px; }

.query-view { max-width: 780px; margin: 24px auto 0; }
.main-column > .query-view { max-width: none; margin: 0; }
.query-panel { margin: 0; }
.query-panel h2 { margin-top: 7px; }
.query-mode-toggle { display: inline-flex; gap: 4px; margin-top: 16px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: #f2f6fc; }
.query-mode-button { min-width: 86px; min-height: 36px; padding: 0 16px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.query-mode-button.active { background: #fff; color: var(--blue-dark); box-shadow: 0 2px 7px rgba(43, 71, 125, .12); }
.query-panel .inline-form { display: flex; gap: 10px; margin-top: 18px; }
.inline-form input { flex: 1; }
.query-history { margin-top: 16px; }
.query-history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.query-history-head strong { font-size: 14px; }
.query-history-count { color: var(--muted); font-size: 12px; }
.query-history-row { padding: 12px 0; border-top: 1px solid rgba(37, 99, 235, .12); }
.query-history-row:first-of-type { border-top: 0; padding-top: 2px; }
.query-history-row > strong { display: block; margin-bottom: 7px; color: var(--ink); font-size: 14px; }
.query-history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; color: var(--ink-soft); font-size: 12px; }
.query-history-grid span { min-width: 0; overflow-wrap: anywhere; }
.query-history-grid b { color: var(--muted); font-weight: 650; }
.query-history-message { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.query-result-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.query-result-item:last-child { border-bottom: 0; }
.query-result-item strong { display: block; margin-bottom: 4px; }
.query-result-item span { color: var(--muted); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
footer { display: flex; justify-content: space-between; padding: 25px 0 34px; color: #8b96a5; font-size: 11px; }

@media (max-width: 1000px) {
  .page-header { align-items: flex-start; flex-direction: column; gap: 0; padding: 18px 0 20px; }
  .title-block { padding: 0; }
  .header-tools { width: 100%; justify-content: space-between; }
  .account-grid { grid-template-columns: minmax(0, 1fr) 240px; }
  .page-layout { grid-template-columns: minmax(0, 1fr) 190px; gap: 14px; }
}

@media (max-width: 760px) {
  .shell { padding: 0 16px; }
  .topbar { align-items: flex-start; flex-direction: column; padding: 14px 0 8px; }
  .site-nav { width: 100%; justify-content: space-between; }
  .site-nav .nav-btn { flex: 1; }
  .title-block h1 { font-size: 40px; }
  .visual-stepper { flex: 1; justify-content: flex-end; }
  .step span { width: 42px; height: 42px; font-size: 20px; }
  .step b { font-size: 13px; }
  .step-line { width: 38px; margin: 0 7px; }
  .card-summary, .card-entry { padding-left: 18px; padding-right: 18px; }
  .guide-panel { margin-left: 18px; margin-right: 18px; padding: 20px 16px; }
  .guide-grid { grid-template-columns: 1fr; }
  .panel { margin-left: 18px; margin-right: 18px; padding: 18px; }
  .contact-strip { margin-left: 18px; margin-right: 18px; }
  .card-form, .account-grid { grid-template-columns: 1fr; }
  .account-status { min-height: 0; }
  .page-layout { grid-template-columns: 1fr; }
  .contact-rail { order: -1; position: static; display: grid; grid-template-columns: minmax(0, 1fr) 90px; align-items: center; gap: 14px; }
  .contact-rail-heading { min-width: 0; }
  .contact-rail .contact-qr { grid-column: 2; grid-row: 1 / span 2; width: 90px; margin: 0; }
  .contact-rail .purchase-button { grid-column: 1 / -1; }
}

/* ==== support notice modal ==== */
.support-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(17, 29, 54, .56);
}
.support-modal[hidden] { display: none; }
.support-dialog {
  position: relative;
  width: min(100%, 440px);
  padding: 30px 28px 24px;
  border: 1px solid #f0d7b4;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(25, 43, 82, .28);
  text-align: center;
}
.support-modal-icon { margin-bottom: 10px; font-size: 32px; line-height: 1; }
.support-dialog h2 { margin: 0; color: var(--ink); font-size: 22px; line-height: 1.35; }
.support-dialog p { margin: 12px auto 20px; max-width: 34em; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.support-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f1f4f9;
  color: var(--ink-soft);
  font-size: 24px;
  line-height: 1;
}
.support-modal-close:hover { background: #e5ebf5; color: var(--ink); }
.support-copy-button { min-width: 160px; }
.support-copy-button.copied { background: var(--green); }
.support-copy-status { display: block; min-height: 19px; margin-top: 8px; color: var(--green); font-size: 12px; }
.support-dismiss-button { width: 100%; margin-top: 10px; }
@media (max-width: 520px) {
  .support-modal { padding: 16px; }
  .support-dialog { padding: 28px 20px 20px; }
  .support-dialog h2 { font-size: 20px; }
}

@media (max-width: 520px) {
  .header-tools { align-items: flex-start; flex-direction: column-reverse; gap: 14px; }
  .visual-stepper { width: 100%; justify-content: space-between; }
  .step-line { flex: 1; width: auto; }
  .step b { font-size: 12px; }
  .summary-actions { align-items: flex-end; flex-direction: column-reverse; gap: 7px; }
  .summary-main strong { max-width: 190px; }
  .card-form-actions, .query-panel .inline-form { display: grid; }
  .two-col, .result-grid, .receipt, .query-history-grid { grid-template-columns: 1fr; }
  .form-row { align-items: stretch; flex-direction: column; }
  .secondary-button, .primary-button { width: 100%; }
  .contact-strip { align-items: flex-start; flex-wrap: wrap; }
  .contact-text { flex: 1 1 180px; }
  .contact-qr { width: 58px; height: 88px; }
  .purchase-button { flex: 1 1 100%; }
  footer { display: block; line-height: 2; }
}

/* ==== top alert banner ==== */
.top-alert {
  background: linear-gradient(90deg, #e63b2e 0%, #f4781f 55%, #e63b2e 100%);
  color: #ffffff;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: .02em;
  padding: 11px 18px;
  box-shadow: 0 2px 10px rgba(190, 50, 30, .28);
}
@media (max-width: 640px) {
  .top-alert { font-size: 13.5px; padding: 9px 14px; }
}
