:root {
  color-scheme: dark;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --page: #101820;
  --glass: rgba(255, 255, 255, 0.085);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --glass-dark: rgba(3, 12, 23, 0.32);
  --line: rgba(255, 255, 255, 0.17);
  --line-strong: rgba(150, 205, 255, 0.48);
  --text: #f4f8fb;
  --muted: #8fa8ba;
  --muted-strong: #b5c7d5;
  --blue: #1677ff;
  --blue-hover: #2a83ff;
  --green: #07c160;
  --green-strong: #08a653;
  --danger: #ff8787;
  --warning: #ffd67c;
  --shadow: 0 18px 42px rgba(0, 7, 17, 0.2), inset 0 1px rgba(255, 255, 255, 0.16);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background-color: var(--page);
  background-image: linear-gradient(138deg, #13273a 0%, #0f1c28 34%, #101820 66%, #11171c 100%);
  color: var(--text);
}

body::before,
body::after {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  content: "";
}

body::before {
  width: 76%;
  height: 160%;
  top: -54%;
  left: -18%;
  transform: rotate(24deg);
  background: linear-gradient(90deg, transparent, rgba(120, 188, 255, 0.055), transparent);
}

body::after {
  width: 64%;
  height: 150%;
  right: -22%;
  bottom: -64%;
  transform: rotate(-22deg);
  background: linear-gradient(90deg, transparent, rgba(151, 177, 198, 0.045), transparent);
}

#app,
noscript {
  position: relative;
  z-index: 1;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid #8dc8ff;
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(5, 13, 24, 0.34);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
}

.brand {
  display: flex;
  width: min(100% - 32px, 580px);
  height: 100%;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: #f6f9fc;
  gap: 8px;
}

.brand img {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.brand strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell {
  width: min(100%, 580px);
  margin: 0 auto;
  padding: 22px 12px 32px;
}

.cashier-form {
  display: grid;
  gap: 12px;
}

.form-section,
.state-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.095), rgba(8, 20, 33, 0.36));
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
}

.form-section {
  padding: 20px;
}

.section-heading {
  min-height: 20px;
  margin: 0 0 16px;
}

.section-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.amount-input-wrap {
  height: 84px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 27px 16px 6px;
  margin-bottom: 14px;
  border: 1px solid rgba(110, 194, 255, 0.34);
  border-radius: 7px;
  background: var(--glass-dark);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.amount-input-wrap:focus-within {
  border-color: rgba(112, 185, 255, 0.86);
  background: rgba(3, 12, 23, 0.42);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.15), inset 0 1px rgba(255, 255, 255, 0.1);
}

.amount-meta {
  position: absolute;
  top: 11px;
  right: 14px;
  left: 14px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.amount-label {
  grid-column: 2;
  font-weight: 500;
}

.amount-limit {
  grid-column: 3;
  justify-self: end;
  color: #a9c6da;
  font-weight: 400;
  white-space: nowrap;
}

.amount-group {
  max-width: 100%;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
}

.currency {
  color: #edf6fc;
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
}

.amount-input-wrap input {
  width: 214px;
  height: 44px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  caret-color: #6eb1ff;
  font-feature-settings: "tnum" 1, "lnum" 1;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 16px;
  font-weight: 500;
  line-height: 44px;
  text-align: center;
}

.amount-input-wrap.has-value input {
  width: min(var(--amount-width, 3ch), 13ch);
  min-width: 3ch;
  font-size: 36px;
  text-align: left;
}

.amount-input-wrap input::placeholder,
.amount-placeholder {
  color: #8faec4;
  font-size: 22px;
  font-weight: 500;
  opacity: 1;
}

.amount-value {
  max-width: 13ch;
  overflow: hidden;
  color: #fff;
  font-feature-settings: "tnum" 1, "lnum" 1;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 36px;
  font-weight: 500;
  line-height: 44px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount-grid,
.keypad {
  display: grid;
  gap: 8px;
}

.amount-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 14px;
}

.amount-grid:last-child {
  margin-bottom: 0;
}

.keypad {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.amount-grid button,
.keypad button {
  min-width: 0;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: #f1f6fa;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 120ms ease, background-color 120ms ease, transform 80ms ease;
}

.keypad button {
  font-size: 16px;
}

.keypad button.is-delete {
  color: var(--muted-strong);
  font-size: 14px;
}

.amount-grid button:hover,
.keypad button:hover {
  border-color: rgba(150, 205, 255, 0.52);
  background: rgba(255, 255, 255, 0.14);
}

.amount-grid button:active,
.keypad button:active {
  transform: translateY(1px);
}

.amount-grid button.is-selected {
  border-color: #6eb7ff;
  background: rgba(22, 119, 255, 0.24);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(110, 183, 255, 0.14), inset 0 1px rgba(255, 255, 255, 0.13);
}

.amount-grid button.is-selected.is-wechat {
  border-color: #48d789;
  background: rgba(7, 193, 96, 0.17);
}

.amount-grid button:disabled {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.12);
  color: #667887;
  cursor: not-allowed;
  text-decoration: line-through;
}

.adjust-tip {
  width: fit-content;
  margin: 0 auto 14px;
  padding: 6px 10px;
  border: 1px solid rgba(244, 185, 66, 0.45);
  border-radius: 6px;
  background: rgba(244, 185, 66, 0.1);
  color: var(--warning);
  font-size: 12px;
  font-weight: 500;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.payment-methods.is-single {
  grid-template-columns: 1fr;
}

.pay-method {
  min-width: 0;
  min-height: 76px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease, background-color 120ms ease, transform 80ms ease;
}

.pay-method:hover {
  border-color: rgba(150, 205, 255, 0.46);
  background: rgba(255, 255, 255, 0.12);
}

.pay-method:active {
  transform: translateY(1px);
}

.pay-method.is-selected {
  border-color: #72b3ff;
  background: rgba(22, 119, 255, 0.2);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.12);
}

.pay-method.is-selected.is-wechat {
  border-color: #48d789;
  background: rgba(7, 193, 96, 0.17);
}

.method-icon,
.summary-method-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
}

.method-icon {
  width: 44px;
  height: 44px;
}

.method-icon img,
.summary-method-icon img {
  display: block;
  width: 100%;
  height: 100%;
}

.method-icon.is-generic,
.summary-method-icon.is-generic {
  border: 1px solid rgba(144, 204, 255, 0.42);
  background: rgba(22, 119, 255, 0.18);
  color: #ddecfa;
  font-weight: 500;
}

.pay-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.pay-copy strong,
.pay-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pay-copy strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.pay-copy small {
  color: var(--muted-strong);
  font-size: 11px;
}

.radio-mark {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
}

.pay-method.is-selected .radio-mark {
  border-color: var(--blue);
  background: var(--blue);
}

.pay-method.is-selected.is-wechat .radio-mark {
  border-color: var(--green);
  background: var(--green);
}

.pay-method.is-selected .radio-mark::after {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.form-actions {
  padding: 0;
}

.submit-button,
.secondary-button,
.retry-button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 7px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, transform 80ms ease;
}

.submit-button {
  background: rgba(255, 255, 255, 0.14);
  color: #adbecb;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

.submit-button.is-ready {
  background: var(--blue);
  color: #fff;
}

.submit-button.is-ready:hover {
  background: var(--blue-hover);
}

.submit-button.is-ready.is-wechat {
  background: var(--green-strong);
}

.submit-button.is-ready.is-wechat:hover {
  background: #10b55d;
}

.submit-button.is-ready:active {
  transform: translateY(1px);
}

.submit-button:disabled {
  cursor: not-allowed;
}

.secondary-button,
.retry-button {
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: transparent;
  color: var(--muted-strong);
}

.secondary-button:hover,
.retry-button:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--text);
}

.error-banner,
.availability-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 107, 107, 0.42);
  border-radius: 6px;
  background: rgba(255, 107, 107, 0.08);
  color: #ffb0b0;
  font-size: 13px;
  line-height: 1.5;
}

.availability-note {
  margin-top: 12px;
  margin-bottom: 0;
}

.state-panel {
  width: min(100%, 520px);
  margin: 20px auto 0;
  padding: 32px 28px 24px;
  text-align: center;
}

.loading-panel {
  display: flex;
  min-height: 210px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.loading-panel p,
.state-panel > p {
  margin: 0;
  color: #a9bfd0;
  font-size: 13px;
  line-height: 1.65;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(103, 172, 240, 0.18);
  border-top-color: #78bcff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.result-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--glass-strong);
  color: var(--muted-strong);
  font-size: 25px;
  font-weight: 500;
}

.result-mark.is-success {
  border-color: rgba(39, 196, 153, 0.5);
  background: rgba(39, 196, 153, 0.1);
  color: #80e1c4;
}

.result-mark.is-danger {
  border-color: rgba(255, 107, 107, 0.5);
  background: rgba(255, 107, 107, 0.1);
  color: #ff9c9c;
}

.state-panel h2 {
  margin: 18px 0 6px;
  color: #fff;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.45;
}

.order-confirmed {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
  color: #78d9b1;
  font-size: 13px;
  font-weight: 500;
}

.order-confirmed span {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(120, 217, 177, 0.58);
  border-radius: 50%;
  background: rgba(56, 190, 138, 0.15);
  color: #91e9c5;
  font-size: 12px;
}

.order-confirmed.is-pending {
  visibility: hidden;
}

.countdown {
  width: 84px;
  height: 84px;
  position: relative;
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.countdown::before,
.countdown::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.countdown::before {
  inset: 0;
  border: 3px solid rgba(103, 172, 240, 0.18);
  border-top-color: #78bcff;
  border-right-color: var(--blue);
  animation: spin 900ms linear infinite;
}

.countdown::after {
  inset: 9px;
  border: 1px solid rgba(132, 195, 255, 0.24);
  background: rgba(22, 119, 255, 0.16);
  box-shadow: 0 0 0 6px rgba(22, 119, 255, 0.06), inset 0 1px rgba(255, 255, 255, 0.14);
}

.countdown strong {
  position: relative;
  z-index: 1;
  color: #e9f5ff;
  font-feature-settings: "tnum" 1, "lnum" 1;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.processing-panel .processing-copy {
  max-width: 380px;
  margin: 0 auto;
}

.summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 28px 0 16px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.summary > span {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
}

.summary > span + span {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.summary small {
  color: var(--muted);
  font-size: 12px;
}

.summary strong {
  min-width: 0;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}

.summary-amount {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-feature-settings: "tnum" 1, "lnum" 1;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 24px !important;
}

.summary-amount i {
  font-size: 16px;
  font-style: normal;
}

.summary-method {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
}

.summary-method b {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-method-icon {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

.order-number {
  margin: 0;
  color: #7890a2 !important;
  font-size: 12px !important;
  overflow-wrap: anywhere;
}

.order-number code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.qr-panel {
  margin: 20px auto;
}

.qr-panel h3 {
  font-size: 16px;
  font-weight: 500;
}

.qr-box {
  width: 240px;
  min-height: 240px;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
}

.qr-box canvas {
  max-width: 100%;
  height: auto;
}

.qr-copy {
  max-width: 320px;
  margin: 12px auto 0 !important;
}

noscript {
  display: block;
  margin: 24px;
  color: var(--danger);
  text-align: center;
}

@media (max-width: 520px) {
  .shell {
    padding: 10px 9px 32px;
  }

  .form-section {
    padding: 14px;
  }

  .amount-grid {
    gap: 6px;
  }

  .amount-grid button {
    height: 42px;
    font-size: 13px;
  }

  .keypad button {
    height: 43px;
  }

  .pay-method {
    grid-template-columns: 38px minmax(0, 1fr) 17px;
    gap: 8px;
    padding: 8px;
  }

  .method-icon {
    width: 38px;
    height: 38px;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin: -2px -9px -32px;
    padding: 12px 9px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(8, 19, 30, 0), rgba(8, 19, 30, 0.94) 32%);
  }

  .state-panel {
    margin-top: 14px;
    padding: 28px 18px 22px;
  }

  .summary {
    margin-top: 24px;
  }
}

@media (max-width: 360px) {
  .amount-limit {
    font-size: 11px;
  }

  .payment-methods {
    grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
    gap: 8px;
  }

  .payment-methods.is-single {
    grid-template-columns: 1fr;
  }

  .pay-method {
    min-height: 70px;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 6px;
    padding: 5px;
  }

  .method-icon {
    width: 30px;
    height: 30px;
  }

  .radio-mark {
    display: none;
  }

  .pay-copy small {
    display: none;
  }
}

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