/* ===== RESET & BASE ===== */
:root {
  --bg-outer: #0d0d0d;
  --bg: #1a1a1a;
  --fg: #f0f0f0;
  --accent: #e63946;
  --accent-dim: #a82832;
  --border: #444;
  --input-bg: #222;
  --card-bg: #1e1e1e;
  --muted: #ddd;
  --success: #4caf50;
  --tab-active-bg: #252525;
  --titlebar-bg: #2a2a2a;
  --window-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
  --anim-speed: 0.35s;
  --warn: #f59e0b;
  --info-shell-bg: transparent;
  --info-card-bg: var(--card-bg);
  --info-box-bg: var(--input-bg);
  --info-input-bg: var(--input-bg);
  --tier-active-border: #f59e0b;
  --error: #e63946;
  --error-bg: rgba(230,57,70,0.08);
  /* Footer language switcher — dark mode well */
  --footer-lang-well-bg: #0f0f0f;
  --footer-lang-well-border: rgba(0, 0, 0, 0.6);
  --footer-lang-well-border-top: rgba(0, 0, 0, 0.85);
  --footer-lang-well-inset-shadow: rgba(0, 0, 0, 0.55);
  --footer-lang-well-inset-highlight: rgba(255, 255, 255, 0.03);
  --footer-lang-well-bevel: rgba(255, 255, 255, 0.045);
  --footer-lang-btn-color: #b5b5b5;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg-outer: #ededed;
    --bg: #ffffff;
    --fg: #111111;
    --accent: #111111;
    --accent-dim: #000000;
    --border: #d8d8d8;
    --input-bg: #f7f7f7;
    --card-bg: #ffffff;
    --muted: #666666;
    --success: #16a34a;
    --tab-active-bg: #f2f2f2;
    --titlebar-bg: #f6f6f6;
    --window-shadow: 0 18px 48px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    --warn: #c47b2a;
    --info-shell-bg: #f3f3f3;
    --info-card-bg: #ffffff;
    --info-box-bg: #fafafa;
    --info-input-bg: #ffffff;
    --tier-active-border: #c47b2a;
    --error: #dc2626;
    --error-bg: rgba(220,38,38,0.06);
    /* Footer language switcher — light mode well */
    --footer-lang-well-bg: #e6e6e6;
    --footer-lang-well-border: #c8c8c8;
    --footer-lang-well-border-top: #b4b4b4;
    --footer-lang-well-inset-shadow: rgba(0, 0, 0, 0.12);
    --footer-lang-well-inset-highlight: rgba(255, 255, 255, 0.5);
    --footer-lang-well-bevel: rgba(255, 255, 255, 0.75);
    --footer-lang-btn-color: #8a8a8a;
  }
}

[data-theme="light"] {
  --bg-outer: #ededed;
  --bg: #ffffff;
  --fg: #111111;
  --accent: #111111;
  --accent-dim: #000000;
  --border: #d8d8d8;
  --input-bg: #f7f7f7;
  --card-bg: #ffffff;
  --muted: #666666;
  --success: #16a34a;
  --tab-active-bg: #f2f2f2;
  --titlebar-bg: #f6f6f6;
  --window-shadow: 0 18px 48px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --warn: #c47b2a;
  --info-shell-bg: #f3f3f3;
  --info-card-bg: #ffffff;
  --info-box-bg: #fafafa;
  --info-input-bg: #ffffff;
  --tier-active-border: #c47b2a;
  --error: #dc2626;
  --error-bg: rgba(220,38,38,0.06);
  /* Footer language switcher — light mode well */
  --footer-lang-well-bg: #e6e6e6;
  --footer-lang-well-border: #c8c8c8;
  --footer-lang-well-border-top: #b4b4b4;
  --footer-lang-well-inset-shadow: rgba(0, 0, 0, 0.12);
  --footer-lang-well-inset-highlight: rgba(255, 255, 255, 0.5);
  --footer-lang-well-bevel: rgba(255, 255, 255, 0.75);
  --footer-lang-btn-color: #8a8a8a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-outer);
  color: var(--fg);
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Cascadia Code', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
  font-size: 14px;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 10px 18px;
  border: 2px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  text-transform: uppercase;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s, transform 0.1s, border-color 0.15s;
}
.btn:hover { background: var(--accent); color: var(--bg); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--accent); }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); }
.btn-primary:disabled:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn-default { border-color: var(--border); color: var(--fg); }
.btn-default:hover { background: var(--border); color: var(--fg); }

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  padding: 2px 6px;
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s, transform 0.15s;
}
.btn-icon:hover { opacity: 1; color: var(--accent); transform: scale(1.1); }

/* ===== TERMINAL WINDOW ===== */
.window-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px;
  min-height: 100vh;
}

.terminal-window {
  width: 100%;
  max-width: 800px;
  background: var(--bg);
  border-radius: 10px;
  box-shadow: var(--window-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.3s;
  position: relative;
}

/* Title bar */
.terminal-titlebar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--titlebar-bg);
  border-bottom: 1px solid var(--border);
  min-height: 42px;
  gap: 12px;
  transition: background 0.3s;
}

.traffic-lights { display: flex; gap: 7px; flex-shrink: 0; }

.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: none; padding: 0;
}
.dot-close {
  background: #ff5f57;
  cursor: pointer;
  position: relative;
}
/* Build the × glyph from two rotated line segments instead of a Unicode
 * character. The previous `content: '\00d7'` rendered differently across
 * browsers / platforms because fonts disagree on the × glyph's vertical
 * metric — some place it on the x-height baseline (looks low), others
 * centre it on the em box (looks high). Two absolutely-positioned pseudo
 * bars are pixel-perfect centred via transform and are immune to font
 * fallback drift. */
.dot-close::before,
.dot-close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 1.3px;
  background: #4a0000;
  border-radius: 1px;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(45deg);
}
.dot-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
.dot-close:hover { opacity: 0.7; transform: scale(1.15); }
.dot-minimize { background: #febc2e; }
.dot-maximize { background: #28c840; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.terminal-title .accent, .accent { color: var(--accent); font-weight: 700; }
.terminal-subtitle {
  margin-left: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  opacity: 0.78;
}

.titlebar-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ===== STEP BAR ===== */
.step-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.step {
  color: var(--muted);
  opacity: 0.4;
  font-weight: 600;
  transition: opacity 0.3s, color 0.3s;
}
.step.active { opacity: 1; color: var(--accent); }
.step.done { opacity: 0.7; color: var(--success); }

.step-arrow {
  color: var(--muted);
  opacity: 0.3;
  font-size: 14px;
}

/* ===== SHOP PAGES ===== */
.shop-page {
  display: none;
  animation: pageFadeIn var(--anim-speed) ease;
}
.shop-page.active { display: block; }

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

.shop-content {
  padding: 16px;
}

/* ===== PRODUCT LIST ===== */
.product-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 16px;
  background: var(--card-bg);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
  font: inherit;
  appearance: none;
}
.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}
.product-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.product-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 6px 16px rgba(0,0,0,0.18);
}

.product-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.product-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--fg);
}

.product-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
}
.product-badge.hot { background: var(--warn); }

.product-price {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.product-price .currency { font-size: 14px; opacity: 0.7; }
.product-price-original {
  display: inline-block;
  margin-left: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  letter-spacing: 0;
  vertical-align: middle;
}

.product-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.product-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
}

.feature-tag {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  background: var(--input-bg);
}

.product-select-hint {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  opacity: 0.5;
  margin-top: 4px;
}

/* ===== TOPUP PAGE LAYOUT ===== */
.topup-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: stretch; /* 两列等高，上下完全对齐 */
}

.topup-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.topup-fields .form-group {
  margin-bottom: 0;
}

.tier-card-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tier-card-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: 0;
  margin-left: 3px;
}

.tier-card-inline {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--input-bg);
  min-width: 200px;
  flex: 1; /* 填满剩余空间，底部对齐第二个输入框 */
  display: flex;
  align-items: center;
}

.tier-list {
  display: grid;
  /* 4列: 数字左对齐 | USD纵向对齐 | 箭头 | 结果 */
  grid-template-columns: auto auto auto 1fr;
  row-gap: 7px;
  column-gap: 6px;
  align-items: center;
  font-size: 13px;
}

.tier-val {
  font-weight: 600;
  color: var(--fg);
  text-align: left;
}

.tier-unit {
  color: var(--muted);
  font-weight: 600;
}

.tier-arrow {
  color: var(--muted);
}

.tier-credit {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

/* ===== CREDIT PREVIEW ===== */
.credit-preview {
  text-align: center;
  margin: 16px 0 8px;
  padding: 12px;
  border-radius: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
}

.credit-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.credit-amount {
  display: block;
  font-size: 2.4em;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  margin-bottom: 2px;
}

/* ===== INFO CARD ===== */
.info-card, .pay-card, .done-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  background: var(--card-bg);
  overflow: hidden;
  box-sizing: border-box;
  max-width: 100%;
}

.info-header, .info-row, .pay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pay-meta-row {
  margin-bottom: 6px;
  gap: 16px;
}

.pay-meta-value {
  color: var(--fg);
  font-size: 14px;
  text-align: right;
  word-break: break-word;
}

.pay-product-accent {
  color: var(--error);
  font-weight: 700;
}

.label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.info-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.form-group .muted { opacity: 0.6; font-size: 11px; }

.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--muted); opacity: 0.4; }

/* Hide number input spinners */
.form-group input[type="number"]::-webkit-outer-spin-button,
.form-group input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.form-group input[type="number"] {
  -moz-appearance: textfield;
}

.security-grid {
  display: grid;
  grid-template-columns: 1fr 318px;
  gap: 12px;
  margin: 8px 0 0;
  align-items: stretch;
}

.security-grid .grid-full {
  grid-column: 1 / -1;
}

.security-grid .btn-row {
  margin-top: 4px;
}

.security-grid.single-column {
  grid-template-columns: 1fr;
}

.security-box {
  margin-bottom: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  min-height: 96px;
  display: flex;
  flex-direction: column;
}

.security-box label {
  margin-bottom: 8px;
}

.security-box-password {
  justify-content: center;
}

.security-box-password label {
  margin-bottom: 10px;
}

.security-help {
  margin-top: 8px;
  line-height: 1.45;
  min-height: 2.9em;
}

.security-box-turnstile {
  padding: 8px;
  min-width: 0;
  overflow: hidden;
}

.security-box-turnstile .turnstile-label {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin-bottom: 4px;
}

.security-box-turnstile #turnstile-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
}

.security-box-turnstile #turnstile-container iframe {
  display: block;
  pointer-events: auto;
  touch-action: auto;
}

#topup-error, #pay-error {
  color: var(--error);
  font-size: 12px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  transition: all 0.2s ease;
}
#topup-error:not(:empty), #pay-error:not(:empty) {
  padding: 6px 10px;
  margin-top: 4px;
  margin-bottom: 4px;
  background: var(--error-bg);
  border-left: 3px solid var(--error);
  min-height: 1.4em;
}
#topup-error {
  margin-left: 0;
}
#topup-error a {
  color: var(--error);
  text-decoration: underline;
}

#topup-error:empty, #pay-error:empty {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.btn-row .btn {
  flex: 1;
}

/* ===== PAY METHODS ===== */
.pay-methods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.pay-method {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.1s, box-shadow 0.15s;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}
.pay-method:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--input-bg));
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.pay-method.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.pay-method.is-pending {
  cursor: progress;
  opacity: 0.9;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
.pay-method.is-pending::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}
.pay-method-name { font-weight: 600; font-size: 14px; }

/* ===== PAY AREA ===== */
.pay-area { text-align: center; }
.pay-area.hidden { display: none; }

.confirm-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  animation: confirmOverlayIn 0.18s ease;
}

.confirm-overlay.is-leaving {
  animation: confirmOverlayOut 0.18s ease forwards;
}

.confirm-card {
  width: min(460px, 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  padding: 18px;
  animation: confirmCardIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.confirm-overlay.is-leaving .confirm-card {
  animation: confirmCardOut 0.18s ease forwards;
}

.confirm-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
}

.confirm-desc {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.confirm-warning {
  margin: -8px 0 14px;
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.stale-overlay-forced {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px) saturate(0.7);
  -webkit-backdrop-filter: blur(6px) saturate(0.7);
  animation: confirmOverlayIn 0.18s ease;
}

.stale-card .confirm-desc {
  margin-bottom: 12px;
}

.confirm-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.confirm-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
}

.confirm-item-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.confirm-item-value {
  color: var(--fg);
  font-size: 14px;
  text-align: right;
  word-break: break-word;
  max-width: 70%;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

@keyframes confirmOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes confirmOverlayOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes confirmCardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.pay-jump-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 6px auto 12px;
  padding: 9px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
}
.pay-jump-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
}
.pay-jump-btn:active {
  transform: translateY(0);
  opacity: 1;
}

.partner-jump-copy {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-right: 7.8px;
}

.partner-external-icon {
  position: absolute;
  right: -7.8px;
  top: -5px;
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.82);
  pointer-events: none;
}

.partner-external-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pay-crypto-info {
  margin-bottom: 12px;
}
.crypto-amount-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}
.crypto-label {
  font-size: 13px;
  color: var(--muted);
}
.crypto-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.crypto-unit {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.7;
}
.crypto-addr-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
  margin-bottom: 8px;
}
.crypto-addr-row:hover { background: var(--input-bg); }
.crypto-addr {
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--fg);
  word-break: break-all;
  max-width: 320px;
  text-align: center;
  user-select: all;
}

.qr-container {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 4px;
  background: #fff;
  border-radius: 6px;
  margin-bottom: 12px;
}

.qr-container img {
  width: 180px;
  height: 180px;
  image-rendering: pixelated;
  display: block;
}

.pay-address {
  font-size: 11px;
  color: #333;
  word-break: break-all;
  max-width: 220px;
  margin-top: 6px;
  font-family: inherit;
}

.pay-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.pay-hint {
  font-size: 12px;
  margin-bottom: 12px;
}

.pay-loading {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== DONE CARD ===== */
.done-icon {
  font-size: 48px;
  color: var(--success);
  text-align: center;
  margin-bottom: 8px;
  animation: donePopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes donePopIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.done-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 4px;
}

.done-field {
  margin-bottom: 12px;
}
.done-field .label {
  display: block;
  margin-bottom: 4px;
}

.done-credit-display {
  text-align: center;
  padding: 16px 0;
}

.done-credit-display .credit-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.done-credit-amount {
  display: block;
  font-size: 3em;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
  animation: donePopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.done-recharge-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.selectable { user-select: all; -webkit-user-select: all; cursor: text; }

.mono { font-family: inherit; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ===== FOOTER =====
 *
 * The footer is a real 3-column grid: the language switcher occupies the
 * left column, the "Powered by" label stays centred in the middle column,
 * and the footer-links block (订单查询 / affiliates) sits in the right
 * column. Using grid (instead of the old flex-center + absolute hack)
 * means every item is in the document flow and wraps cleanly on narrow
 * viewports; no element has to be pulled out of the layout with
 * position:absolute any more.
 *
 * Background intentionally uses --bg (NOT --titlebar-bg) so the footer
 * bar merges seamlessly with whichever shop-page is showing above it.
 * With the old titlebar-bg tint the footer looked noticeably brighter
 * on the affiliates page (where the surrounding area is a large solid
 * fill) compared to the products page (where the cards broke up the
 * contrast). A thin border-top line is enough to delimit the footer
 * from the content without painting the whole strip a lighter colour.
 */
.shop-footer {
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 10px 10px;
}
#footer-powered {
  grid-column: 2;
  justify-self: center;
  white-space: nowrap;
}
/* Footer language switcher — flat text style.
 *
 * Two plain text buttons with a thin dot separator between them, styled
 * to sit next to the other footer text (Powered by / 订单查询 / affiliates)
 * with the same visual weight. No background chip, no border, no inset
 * shadow — the switcher reads as an inline footer link pair and
 * automatically picks up both dark and light themes through the same
 * CSS variables (`--muted`, `--accent`) that the rest of the footer
 * uses. Active language takes the accent colour, inactive fades to the
 * muted footer tone. */
.footer-lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  margin: 0 0 0 10px;
  justify-self: start;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.footer-lang-sep {
  color: var(--muted);
  opacity: 0.35;
  font-size: 10px;
  line-height: 1;
  user-select: none;
  pointer-events: none;
}
/* Both buttons MUST render with identical font metrics so the active
 * (red) one doesn't look visually smaller than the inactive (grey) one.
 * Differences are expressed through `color` only — no font-size,
 * font-weight or opacity variation between states, otherwise sub-pixel
 * anti-aliasing gives the impression that the low-opacity button is
 * "fuller" and the full-opacity one is "smaller". */
.footer-lang-btn {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  opacity: 0.75;
  cursor: pointer;
  transition: color 0.18s;
}
.footer-lang-btn:hover {
  color: var(--fg);
}
.footer-lang-btn.active {
  color: var(--accent);
}
.footer-lang-btn.active:hover {
  color: var(--accent);
}
.footer-lang-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.3;
}
.footer-lang-btn[disabled]:hover {
  color: var(--muted);
  background: transparent;
  opacity: 0.3;
}
.footer-links {
  grid-column: 3;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-self: end;
}
.footer-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.footer-link:hover { opacity: 1; text-decoration: underline; }

@media (max-width: 600px) {
  /* Stack the three footer columns vertically on narrow screens so the
   * language switcher, "Powered by" label and link row each get their own
   * row without overflowing. */
  .shop-footer {
    grid-template-columns: 1fr;
    padding-top: 12px;
    row-gap: 8px;
    justify-items: center;
  }
  .footer-lang-switcher {
    justify-self: center;
  }
  .footer-links {
    justify-self: center;
  }
}

/* ===== AFFILIATES ===== */
.aff-page-shell {
  max-width: 640px;
  margin: 0 auto;
}

.aff-panel {
  max-width: 600px;
  margin: 0 auto;
}

.aff-panel-enter {
  animation: affPanelEnter 0.28s cubic-bezier(0.22, 0.86, 0.24, 1);
}

.aff-panel.hidden {
  display: none;
}

.aff-query-entry-btn {
  width: 100%;
  margin-top: 10px;
}

.aff-query-topbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.aff-query-card {
  padding: 20px;
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
}

.aff-query-card-title {
  margin: 0 0 6px;
  font-size: 1.05em;
  font-weight: 700;
}

.aff-query-card-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.86em;
  line-height: 1.65;
}

.aff-query-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aff-query-form .form-group {
  margin-bottom: 0;
}

.aff-query-input {
  width: 100%;
}

.aff-query-error {
  color: var(--error);
  font-size: 0.85em;
  min-height: 18px;
}

.aff-query-results {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aff-query-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.aff-query-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aff-query-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.92em;
}

.aff-query-label {
  color: var(--muted);
  font-size: 0.82em;
}

.aff-query-code {
  user-select: all;
  -webkit-user-select: all;
  font-size: 0.98em;
}

.aff-query-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.aff-query-stat {
  padding: 12px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-outer);
  text-align: center;
}

.aff-query-stat-label {
  color: var(--muted);
  font-size: 0.74em;
  margin-bottom: 4px;
}

.aff-query-stat-value {
  font-size: 1.02em;
  font-weight: 700;
}

.aff-query-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--input-bg);
  border: 1px solid var(--border);
}

.aff-query-tab {
  min-width: 110px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88em;
  font-weight: 700;
  cursor: pointer;
  transform: translateY(0);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.2s cubic-bezier(0.22, 0.86, 0.24, 1), box-shadow 0.2s ease;
}

.aff-query-tab:hover {
  color: var(--fg);
  transform: translateY(-1px);
}

.aff-query-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}

.aff-query-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aff-query-content-enter {
  animation: affTabContentEnter 0.26s cubic-bezier(0.22, 0.86, 0.24, 1);
}

.aff-query-row {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-outer);
}

.aff-query-row-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.aff-query-row-title {
  font-size: 0.92em;
  font-weight: 700;
}

.aff-query-row-title code {
  font-size: 0.95em;
  user-select: all;
  -webkit-user-select: all;
}

.aff-query-row-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82em;
  line-height: 1.55;
}

.aff-query-row-side {
  text-align: right;
  min-width: 110px;
}

.aff-query-row-amount {
  font-size: 0.95em;
  font-weight: 700;
}

.aff-query-row-status {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.8em;
}

.aff-query-empty {
  padding: 16px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--bg-outer);
  color: var(--muted);
  font-size: 0.85em;
  line-height: 1.6;
}

.aff-query-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.aff-query-pager-text {
  color: var(--muted);
  font-size: 0.82em;
}

.aff-query-pager-actions {
  display: inline-flex;
  gap: 8px;
}

.aff-query-pager-actions .btn {
  min-width: 76px;
}

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

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

@media (prefers-reduced-motion: reduce) {
  .aff-panel-enter,
  .aff-query-content-enter {
    animation: none !important;
  }

  .aff-query-tab {
    transition: none !important;
    transform: none !important;
  }
}

/* ===== QUERY PAGE ===== */
.coupon-section {
  margin-top: 12px;
  margin-bottom: 14px;
}

.coupon-shell {
  position: relative;
  display: flex;
  align-items: flex-start;
}

.coupon-input {
  width: 100%;
  padding-right: 60px;
  text-transform: uppercase;
}

.coupon-apply-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 34px;
  height: 22px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.08);
  background: color-mix(in srgb, var(--accent) 90%, #fff 10%);
  color: #fff;
  font-family: inherit;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
  cursor: pointer;
  overflow: visible;
  transition: width 0.34s cubic-bezier(0.22, 0.86, 0.24, 1), min-width 0.34s cubic-bezier(0.22, 0.86, 0.24, 1), height 0.34s cubic-bezier(0.22, 0.86, 0.24, 1), padding 0.34s cubic-bezier(0.22, 0.86, 0.24, 1), border-radius 0.34s cubic-bezier(0.22, 0.86, 0.24, 1), transform 0.15s, opacity 0.18s, background 0.18s, border-color 0.18s, box-shadow 0.18s;
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}

.coupon-apply-btn-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: opacity 0.18s ease, transform 0.22s ease;
}

.coupon-apply-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.coupon-apply-btn:active {
  transform: translateY(0);
}

.coupon-apply-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

.coupon-apply-btn.is-success {
  min-width: 22px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 1.5px solid var(--success);
  background: transparent;
  color: var(--success);
  font-size: 0;
  cursor: default;
  opacity: 1;
  box-shadow: 0 0 0 0.8px rgba(76,175,80,0.15), 0 0 8px rgba(76,175,80,0.1);
  animation: couponFaceIDMorph 0.38s cubic-bezier(0.22, 0.86, 0.24, 1), couponFaceIDGlow 0.78s ease-out 0.05s;
}

.coupon-apply-btn.is-success .coupon-apply-btn-label {
  opacity: 0;
  transform: scale(0.68);
}

.coupon-apply-btn.is-success::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: inherit;
  border: 1px solid rgba(76,175,80,0.2);
  opacity: 0;
  transform: scale(0.84);
  animation: couponFaceIDHalo 0.36s ease-out 0.04s forwards;
}

.coupon-apply-btn.is-success::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: 7px;
  height: 4px;
  border-left: 1.8px solid var(--success);
  border-bottom: 1.8px solid var(--success);
  transform: translate(-50%, -50%) rotate(-45deg) scale(0.58);
  transform-origin: center;
  opacity: 0;
  animation: couponFaceIDCheck 0.24s ease-out 0.2s forwards;
}

.coupon-apply-btn.is-success:hover,
.coupon-apply-btn.is-success:active,
.coupon-apply-btn.is-success:disabled {
  transform: none;
  opacity: 1;
  background: transparent;
  color: var(--success);
}

.coupon-result {
  margin-top: 8px;
  min-height: 22px;
  font-size: 12px;
  line-height: 1.5;
}

.coupon-result-success {
  color: var(--success);
}

.coupon-result-copy {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.coupon-result-title {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.coupon-result-meta {
  color: color-mix(in srgb, var(--success) 78%, var(--fg) 22%);
}

.coupon-result-error {
  color: var(--error);
}

@keyframes couponFaceIDMorph {
  0% { transform: scale(1); }
  30% { transform: scale(0.94); }
  55% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes couponFaceIDHalo {
  0% { opacity: 0.34; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(1.08); }
}

@keyframes couponFaceIDCheck {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-45deg) scale(0.45); }
  65% { opacity: 1; transform: translate(-50%, -50%) rotate(-45deg) scale(1.06); }
  100% { opacity: 1; transform: translate(-50%, -50%) rotate(-45deg) scale(1); }
}

@keyframes couponFaceIDGlow {
  0% { box-shadow: 0 0 0 0 rgba(76,175,80,0), 0 0 0 rgba(76,175,80,0); }
  40% { box-shadow: 0 0 0 0.8px rgba(76,175,80,0.16), 0 0 10px rgba(76,175,80,0.12); }
  100% { box-shadow: 0 0 0 0.8px rgba(76,175,80,0.12), 0 0 6px rgba(76,175,80,0.08); }
}

.query-empty {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  opacity: 0.6;
}
.query-order-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 12px;
}
.query-order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.query-order-header code { font-size: 12px; opacity: 0.7; }
.query-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.status-paid { background: var(--success); color: #fff; }
.status-expired { background: var(--border); color: var(--muted); }
.status-pending { background: var(--warn); color: #000; }
.query-order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 13px;
}
.query-order-row .label { min-width: 70px; }

/* ===== SCROLLBAR ===== */

/* ===== TURNSTILE CAPTCHA ===== */
#turnstile-box.hidden { display: none; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ===== AD FOOTER ===== */
.site-credits {
  width: 100%;
  max-width: 800px;
  margin-top: 12px;
  padding-bottom: 20px;
}

.site-credits-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 10px 20px;
  border-radius: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.credits-link {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  transition: color 0.2s, opacity 0.2s;
  opacity: 0.7;
}
.credits-link:hover {
  color: var(--accent);
  opacity: 1;
}

.cl-label {
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 9px;
  opacity: 0.6;
}

.cl-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  object-fit: contain;
}

.cl-name {
  font-weight: 700;
  font-size: 12px;
}

.cl-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  opacity: 0.5;
}

/* ===== SPINNER OVERLAY ===== */
.spinner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 100;
  border-radius: 10px;
  backdrop-filter: blur(2px);
}
.spinner-overlay.hidden { display: none; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.spinner-text {
  font-size: 13px;
  color: #fff;
  letter-spacing: 0.5px;
}

/* ===== CARD KEY PAGE ===== */
.cardkey-product-info {
  margin-bottom: 8px;
}
.cardkey-product-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}
.cardkey-product-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.cardkey-quantity-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 8px;
}
.cardkey-quantity-group {
  flex: 1;
}
.quantity-selector {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
}
.qty-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--card-bg);
  color: var(--fg);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.qty-btn:hover {
  background: var(--accent);
  color: var(--bg);
}
.cardkey-quantity-group input[type="number"] {
  width: 48px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  font-weight: 600;
  height: 36px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.cardkey-quantity-group input[type="number"]::-webkit-outer-spin-button,
.cardkey-quantity-group input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cardkey-price-display {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.cardkey-price-label {
  font-size: 12px;
  color: var(--muted);
}
.cardkey-price-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

/* Sold Out */
.product-card.sold-out {
  opacity: 0.6;
  cursor: not-allowed;
}
.product-card:disabled {
  cursor: not-allowed;
}
.product-card.sold-out:hover {
  border-color: var(--border);
  transform: none;
  box-shadow: none;
}
.sold-out-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--warn, #e74c3c);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 4px;
}

/* Done Page - Card Keys */
.done-cardkeys-section {
  margin-top: 4px;
}
.done-cardkeys-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.done-cardkeys-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cardkey-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.cardkey-index {
  font-size: 12px;
  color: var(--muted);
  min-width: 24px;
}
.cardkey-content {
  flex: 1;
  font-size: 13px;
  word-break: break-all;
  user-select: all;
}
.btn-small {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  cursor: pointer;
}
.btn-small:hover {
  background: var(--accent);
  color: var(--bg);
}
.btn-tiny {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.btn-tiny:hover {
  background: var(--accent);
  color: var(--bg);
}

/* Query - Card Keys */
.query-cardkeys {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.query-cardkeys-header {
  margin-bottom: 6px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .window-container { padding: 10px; }
  .terminal-window { border-radius: 0; max-width: 100%; }
  .terminal-titlebar { padding: 10px 12px; gap: 8px; }
  .terminal-title { font-size: 12px; }
  .step-bar { flex-wrap: wrap; gap: 6px; font-size: 11px; padding: 10px 12px; }
  .shop-content { padding: 12px; }
  .info-card, .pay-card, .done-card { padding: 16px; }
  .product-list { grid-template-columns: 1fr; }
  .product-price { font-size: 18px; }
  .topup-input-row { grid-template-columns: 1fr; }
  .tier-card-inline { max-width: 100%; min-width: 0; }
  .credit-amount { font-size: 1.8em; }
  .done-credit-amount { font-size: 2.2em; }
  .security-grid { grid-template-columns: 1fr; margin-bottom: 0; }
  .security-box-turnstile {
    padding: 8px 0;
    border: none;
    background: transparent;
  }
  .confirm-card { padding: 16px; }
  .pay-methods { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .pay-method { font-size: 12px; padding: 9px 8px; }
  .pay-status { flex-direction: column; gap: 4px; }
  .crypto-addr { max-width: 100%; }
  .qr-container img { width: 150px; height: 150px; }
  .btn-row { flex-direction: column; }
  .cardkey-quantity-row { flex-direction: column; align-items: stretch; }
  .cardkey-price-display { align-items: flex-start; flex-direction: row; gap: 8px; }
  .query-order-header,
  .query-order-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .query-order-row .label { min-width: 0; }
  .site-credits-inner { padding: 8px 12px; gap: 12px; }
  .pay-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .pay-meta-value {
    text-align: left;
  }
  .aff-query-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aff-query-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .aff-query-tab { min-width: 0; }
  .aff-query-row-side {
    min-width: 0;
    width: 100%;
    text-align: left;
  }
  .aff-query-pager { align-items: stretch; }
  .aff-query-pager-actions { width: 100%; }
  .aff-query-pager-actions .btn { flex: 1; }
}

/* ===== ULTRA-SMALL SCREENS (≤370px) ===== */
@media (max-width: 370px) {
  .window-container { padding: 0; }
  .terminal-window { border-radius: 0; }
  .shop-content { padding: 8px; }
  .info-card, .pay-card, .done-card { padding: 10px; }
  .step-bar { font-size: 10px; gap: 4px; padding: 8px 6px; }
  .step-arrow { font-size: 10px; }
  .btn { font-size: 12px; padding: 8px 12px; letter-spacing: 0.5px; }
  .security-box { padding: 10px; min-height: 80px; }
  .security-box-turnstile { padding: 4px 0; }
  .confirm-overlay { padding: 12px; }
  .confirm-item {
    flex-direction: column;
    gap: 6px;
  }
  .confirm-item-value {
    max-width: 100%;
    text-align: left;
  }
  .confirm-actions {
    flex-direction: column-reverse;
  }
  .pay-methods { grid-template-columns: 1fr; }
  .pay-method { font-size: 11px; padding: 8px 6px; }
  .qr-container img { width: 120px; height: 120px; }
  .crypto-addr { font-size: 10px; max-width: 100%; }
  .credit-amount { font-size: 1.5em; }
  .done-credit-amount { font-size: 1.8em; }
  .tier-list { font-size: 11px; column-gap: 4px; }
  .product-card { padding: 10px; }
  .product-price { font-size: 16px; }
}

/* ===== ANNOUNCEMENT NOTES WINDOW ===== */
.notes-window {
  width: 100%;
  max-width: 680px;
  background: var(--bg);
  border-radius: 10px;
  box-shadow: var(--window-shadow);
  overflow: hidden;
  margin-bottom: 16px;
  transition: box-shadow 0.3s;
}

.notes-titlebar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--titlebar-bg);
  border-bottom: 1px solid var(--border);
}

.notes-titlebar .traffic-lights {
  flex-shrink: 0;
}

.notes-titlebar-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.notes-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s, background 0.15s;
}
.notes-close-btn:hover {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
}

.notes-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  opacity: 0.85;
}

.notes-action {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s;
  white-space: nowrap;
}
.notes-action:hover {
  opacity: 1;
  color: var(--accent);
}

.notes-arrow {
  font-weight: 700;
}

.notes-body {
  padding: 14px 20px 18px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg);
  opacity: 0.9;
}

.notes-body h1,
.notes-body h2,
.notes-body h3 {
  margin: 0.6em 0 0.3em;
  font-weight: 600;
}
.notes-body h1 { font-size: 1.3em; }
.notes-body h2 { font-size: 1.15em; }
.notes-body h3 { font-size: 1.05em; }

.notes-body > p {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

/* Link cards */
.notes-body ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notes-body ul li {
  background: var(--input-bg);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
  transition: background 0.15s, border-color 0.15s;
}
.notes-body ul li:hover {
  background: var(--tab-active-bg);
}

.notes-body ul li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  color: var(--fg);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
}
.notes-body ul li a::after {
  content: '\203A';
  font-size: 18px;
  font-weight: 300;
  color: var(--muted);
  opacity: 0.5;
  transition: opacity 0.15s, transform 0.15s;
}
.notes-body ul li:hover a::after {
  opacity: 1;
  transform: translateX(2px);
}

.notes-body ol {
  padding-left: 1.5em;
  margin: 0.4em 0;
}

.notes-body code {
  background: var(--input-bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.92em;
}

.notes-body pre {
  background: var(--input-bg);
  padding: 10px 14px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.5em 0;
}

.notes-body pre code {
  background: none;
  padding: 0;
}

.notes-body blockquote {
  border-left: 3px solid var(--border);
  padding-left: 12px;
  margin: 0.5em 0;
  color: var(--muted);
}

.notes-body img {
  max-width: 100%;
  border-radius: 6px;
}

/* ===== SPLIT PAYMENT — segment list ===== */
.pay-segments-list {
  margin: 4px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pay-segments-head {
  margin-bottom: 4px;
}
.pay-segments-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  margin-bottom: 6px;
}
.pay-segments-title {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.4px;
}
.pay-segments-progress {
  color: var(--fg);
  font-weight: 700;
  font-family: 'SF Mono', 'Menlo', monospace;
}
.pay-segments-bar {
  width: 100%;
  height: 6px;
  background: var(--input-bg);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.pay-segments-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 3px;
  transition: width 0.3s ease;
}
.pay-segment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.pay-segment-card.seg-active {
  border-color: var(--accent);
  background: var(--error-bg);
  box-shadow: 0 0 0 1px var(--accent);
}
.pay-segment-card.seg-done {
  opacity: 0.55;
}
.pay-segment-card.seg-failed {
  border-color: var(--error);
}
.pay-segment-card.seg-expired {
  border-style: dashed;
}
/* 段切换过渡动画：当前段 paid 后自动推进到下一段时使用 */
#pay-area.seg-transitioning {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}
#pay-area.seg-fade-in {
  animation: segFadeIn 0.36s ease;
}
@keyframes segFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* 段卡片刚 paid 时的高亮脉冲 */
.pay-segment-card.seg-done {
  animation: segDonePulse 0.6s ease 1;
}
@keyframes segDonePulse {
  0%   { box-shadow: 0 0 0 0 var(--success, #16a34a); }
  60%  { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.0); }
  100% { box-shadow: none; }
}

.pay-methods-locked-hint {
  margin: 0 0 10px 0;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--warn, #b45309);
  background: var(--warn-bg, rgba(245, 158, 11, 0.08));
  border: 1px solid var(--warn, #b45309);
  border-radius: 6px;
}

.pay-segment-card.seg-locked {
  opacity: 0.5;
  background: var(--bg);
}
.pay-segment-card.seg-locked .pay-segment-amt {
  color: var(--muted);
}
.pay-segment-locked-hint {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}
.pay-segment-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: 1;
}
.pay-segment-seq {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.pay-segment-amt {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.pay-segment-card.seg-done .pay-segment-amt {
  color: var(--success);
}
.pay-segment-tail {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pay-segment-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}
.seg-status-paid    { background: rgba(76,175,80,0.15);  color: var(--success); }
.seg-status-paying  { background: var(--error-bg);       color: var(--accent); }
.seg-status-expired { background: rgba(255,255,255,0.04); color: var(--muted); }
.seg-status-failed  { background: var(--error-bg);       color: var(--error); }
.seg-status-pending { background: rgba(255,255,255,0.04); color: var(--muted); }

.pay-segment-retry-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.pay-segment-retry-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pay-segment-retry-picker {
  flex: 0 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--input-bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.pay-segment-retry-label {
  font-size: 11px;
  color: var(--muted);
  margin-right: 4px;
}
.pay-segment-method-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.pay-segment-method-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pay-segment-cancel-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
  margin-left: auto;
}
.pay-segment-cancel-btn:hover { color: var(--fg); }

/* Info dialog (replaces window.alert) */
.confirm-overlay.info-overlay {
  z-index: 70;
}
.info-card.confirm-card {
  max-width: 440px;
}
.split-info-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--input-bg);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 12px 0;
  border: 1px solid var(--border);
}
.split-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.split-info-label { color: var(--muted); }
.split-info-value {
  color: var(--accent);
  font-weight: 700;
  font-family: 'SF Mono', 'Menlo', monospace;
}
.confirm-desc-emph {
  color: var(--warn) !important;
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 6px;
}
