:root {
  color-scheme: dark;
  --bg: #06101d;
  --panel: rgba(11, 25, 42, 0.82);
  --panel-strong: #0c1a2b;
  --line: rgba(142, 177, 214, 0.16);
  --line-bright: rgba(71, 221, 200, 0.38);
  --text: #eef7ff;
  --muted: #91a4b8;
  --cyan: #49e5cf;
  --cyan-deep: #0ebba7;
  --blue: #3c8dff;
  --danger: #ff7d8c;
  --success: #58e6ad;
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(rgba(86, 162, 229, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 162, 229, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% -20%, #153754 0, var(--bg) 43%);
  background-size: 54px 54px, 54px 54px, auto;
  overflow-x: hidden;
}

button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.ambient {
  position: fixed;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.13;
  pointer-events: none;
}
.ambient-one { top: -160px; left: -130px; background: var(--blue); }
.ambient-two { right: -180px; bottom: -130px; background: var(--cyan); }

.checkout-shell,
.setting-shell {
  position: relative;
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.checkout-shell { width: min(640px, calc(100% - 32px)); }

.brand-bar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.brand-mark {
  position: relative;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 9px;
  transform: rotate(45deg);
  box-shadow: 0 0 24px rgba(73, 229, 207, 0.18);
}

.brand-mark::before,
.brand-mark i {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid var(--cyan);
  border-radius: 3px;
}
.brand-mark i { position: absolute; transform: rotate(45deg); opacity: 0.62; }

.security-badge,
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #b8c9d9;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.security-badge i,
.live-badge i,
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 12px var(--success);
}

.checkout-card,
.options-panel,
.preview-panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(15, 33, 54, 0.94), rgba(7, 18, 31, 0.94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.checkout-card {
  position: relative;
  min-height: 620px;
  padding: 46px 54px 38px;
  border-radius: var(--radius-lg);
  text-align: center;
  overflow: hidden;
}

.checkout-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}
.eyebrow span { width: 18px; height: 1px; background: var(--cyan); }

h1, h2, p { margin-top: 0; }
.checkout-card h1 {
  margin: 15px 0 10px;
  font-size: clamp(30px, 7vw, 42px);
  letter-spacing: -0.035em;
}
.lead { margin-bottom: 16px; color: var(--muted); font-size: 15px; }
.date-pill {
  display: inline-flex;
  margin: 0 0 28px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #b4c6d8;
  background: rgba(255,255,255,0.025);
  font-size: 12px;
}

.qr-frame {
  position: relative;
  width: min(100%, 310px);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 14px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35), 0 0 42px rgba(73,229,207,0.09);
  overflow: hidden;
}
.qr-frame img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: 12px; }
.corner { position: absolute; z-index: 2; width: 28px; height: 28px; border-color: var(--cyan); border-style: solid; }
.top-left { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-radius: 22px 0 0; }
.top-right { top: -1px; right: -1px; border-width: 2px 2px 0 0; border-radius: 0 22px 0 0; }
.bottom-left { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; border-radius: 0 0 0 22px; }
.bottom-right { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; border-radius: 0 0 22px; }

.merchant-line { margin-top: 24px; display: grid; gap: 5px; }
.merchant-line span { color: var(--muted); font-size: 12px; }
.merchant-line strong { font-size: 18px; letter-spacing: 0.02em; }
.scan-tip { margin: 19px 0 0; color: var(--muted); font-size: 12px; }
.pulse-dot { display: inline-block; width: 6px; height: 6px; margin-right: 7px; }

.loading-state,
.empty-state {
  min-height: 330px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.loader {
  width: 34px;
  height: 34px;
  margin-bottom: 17px;
  border: 2px solid rgba(73,229,207,0.16);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-icon { font-size: 56px; color: var(--cyan); transform: rotate(-18deg); }
.empty-state h2 { margin: 12px 0 9px; color: var(--text); font-size: 21px; }
.empty-state p { margin-bottom: 18px; font-size: 14px; }
.text-link { color: var(--cyan); font-size: 14px; font-weight: 700; }

.site-footer {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #63798d;
  font-size: 11px;
}
.checkout-page .site-footer { justify-content: center; }
.site-footer a:hover { color: var(--cyan); }

.outline-button {
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #c6d6e5;
  font-size: 13px;
  transition: 180ms ease;
}
.outline-button:hover { border-color: var(--line-bright); color: var(--cyan); }

.setting-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 34px 0 32px;
}
.setting-heading .eyebrow { justify-content: flex-start; }
.setting-heading h1 { margin: 13px 0 10px; font-size: clamp(32px, 5vw, 48px); letter-spacing: -0.045em; }
.setting-heading p { margin-bottom: 0; color: var(--muted); }
.date-panel {
  min-width: 240px;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.025);
}
.date-panel small { display: block; margin-bottom: 6px; color: var(--muted); }
.date-panel strong { font-size: 14px; }

.setting-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.8fr);
  gap: 22px;
  padding-bottom: 60px;
  align-items: start;
}
.options-panel,
.preview-panel { border-radius: var(--radius-md); }
.options-panel { padding: 26px; }
.preview-panel { position: sticky; top: 22px; padding: 26px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.panel-heading h2 { margin-bottom: 5px; font-size: 18px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.step-badge {
  display: grid;
  place-items: center;
  width: 38px;
  height: 28px;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  color: var(--cyan);
  font: 700 11px ui-monospace, monospace;
}
.live-badge { color: var(--cyan); font-size: 10px; font-weight: 800; }

.qr-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.qr-option {
  position: relative;
  min-height: 66px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.018);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.qr-option:hover { border-color: rgba(73,229,207,0.28); background: rgba(73,229,207,0.035); transform: translateY(-1px); }
.qr-option:has(input:checked) { border-color: var(--cyan-deep); background: rgba(73,229,207,0.075); box-shadow: inset 0 0 0 1px rgba(73,229,207,0.08); }
.qr-option input { position: absolute; opacity: 0; pointer-events: none; }
.radio-indicator {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 1px solid #587187;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.radio-indicator::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); transform: scale(0); transition: transform 150ms ease; }
.qr-option input:checked + .radio-indicator { border-color: var(--cyan); }
.qr-option input:checked + .radio-indicator::after { transform: scale(1); }
.qr-option input:focus-visible + .radio-indicator { outline: 3px solid rgba(60,141,255,0.35); outline-offset: 3px; }
.option-text { min-width: 0; display: grid; gap: 4px; }
.option-text strong { overflow: hidden; color: #dceaf6; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.option-text small { overflow: hidden; color: #617a90; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }

.preview-stage {
  min-height: 390px;
  padding: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(rgba(99,151,193,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,151,193,0.035) 1px, transparent 1px),
    rgba(4,13,23,0.55);
  background-size: 26px 26px;
}
.preview-empty { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.7; }
.preview-empty span { display: block; margin-bottom: 12px; color: var(--cyan); font-size: 44px; transform: rotate(-18deg); }
.preview-content { width: 100%; text-align: center; }
.preview-image-wrap { width: min(100%, 240px); aspect-ratio: 1; margin: 0 auto 18px; padding: 10px; border-radius: 15px; background: #fff; overflow: hidden; }
.preview-image-wrap img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: 8px; }
.preview-content small { display: block; margin-bottom: 5px; color: var(--muted); }
.preview-content strong { font-size: 16px; }

.admin-auth {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}
.admin-auth span { color: #b6c8d9; font-size: 12px; font-weight: 700; }
.admin-auth input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: rgba(4,13,23,0.62);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.admin-auth input::placeholder { color: #546b80; }
.admin-auth input:focus { border-color: var(--cyan-deep); box-shadow: 0 0 0 3px rgba(73,229,207,0.1); }

.primary-button {
  width: 100%;
  min-height: 50px;
  margin-top: 12px;
  border: 0;
  border-radius: 12px;
  color: #04120f;
  background: linear-gradient(110deg, var(--cyan), #7ef0df);
  box-shadow: 0 12px 30px rgba(14,187,167,0.18);
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
.primary-button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 16px 36px rgba(14,187,167,0.28); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.45; }
.save-hint { margin: 12px 0 0; color: #62778b; font-size: 11px; line-height: 1.6; text-align: center; }

.inline-status { margin-top: 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,0.025); font-size: 12px; text-align: center; }
.inline-status[data-type="success"] { border-color: rgba(88,230,173,0.28); color: var(--success); background: rgba(88,230,173,0.055); }
.inline-status[data-type="error"] { border-color: rgba(255,125,140,0.28); color: var(--danger); background: rgba(255,125,140,0.055); }

@media (max-width: 900px) {
  .setting-grid { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .setting-heading { align-items: stretch; flex-direction: column; }
  .date-panel { min-width: 0; }
}

@media (max-width: 620px) {
  .setting-shell { width: min(100% - 28px, 1180px); }
  .brand-bar { min-height: 74px; }
  .brand { font-size: 11px; }
  .brand-mark { width: 27px; height: 27px; }
  .security-badge { display: none; }
  .outline-button { padding: 9px 11px; font-size: 12px; }
  .checkout-card { min-height: calc(100vh - 134px); padding: 36px 20px 28px; border-radius: 22px; }
  .checkout-card h1 { margin-top: 13px; }
  .lead { font-size: 14px; }
  .date-pill { margin-bottom: 22px; }
  .qr-frame { width: min(100%, 280px); }
  .site-footer { min-height: 60px; }
  .setting-heading { padding: 26px 0 24px; }
  .setting-heading h1 { font-size: 34px; }
  .setting-heading p { font-size: 14px; line-height: 1.6; }
  .options-panel, .preview-panel { padding: 19px; }
  .qr-options { grid-template-columns: 1fr; }
  .preview-stage { min-height: 350px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
