:root {
  --ink: #0b1a15;
  --ink-soft: #143028;
  --fog: #e8f4ee;
  --mist: rgba(232, 244, 238, 0.78);
  --gold: #c9a84a;
  --gold-bright: #efd27a;
  --line: rgba(232, 244, 238, 0.18);
  --danger: #ff7b7b;
  --ok: #5dca98;
  --font-display: "Noto Serif SC", "Songti SC", serif;
  --font-body: "Outfit", "PingFang SC", "Microsoft YaHei", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--fog);
  background: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(201, 168, 74, 0.16), transparent 55%),
    radial-gradient(700px 480px at 100% 100%, rgba(35, 110, 88, 0.28), transparent 50%),
    linear-gradient(165deg, #06110d 0%, #0b1a15 50%, #10261e 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  /* 不用大范围 filter:blur，改用软渐变，文字更清晰 */
  opacity: 0.9;
  pointer-events: none;
}

.orb-a {
  width: 280px;
  height: 280px;
  top: -40px;
  right: -60px;
  background: radial-gradient(circle, rgba(201, 168, 74, 0.22) 0%, transparent 68%);
}

.orb-b {
  width: 340px;
  height: 340px;
  bottom: -80px;
  left: -100px;
  background: radial-gradient(circle, rgba(45, 130, 100, 0.28) 0%, transparent 70%);
}

.orb-c {
  display: none;
}

.shine {
  display: none;
}

.grid-fade {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(232, 244, 238, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 244, 238, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 15%, transparent 72%);
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 28px;
}

.brand-mark {
  width: 36px;
  height: 3px;
  margin-bottom: 18px;
  background: var(--gold-bright);
  border-radius: 2px;
}

.hero-brand .brand,
.brand {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  line-height: 1.1;
}

.hero-brand h1 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  font-weight: 500;
  line-height: 1.35;
  color: var(--fog);
}

.lede {
  margin: 0;
  max-width: 28ch;
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--mist);
}

.panel {
  padding: 28px 28px 32px;
  border: 1px solid var(--line);
  background: rgba(16, 38, 30, 0.96);
  /* 去掉 backdrop-filter，避免整块发糊 */
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(232, 244, 238, 0.55);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 14px 14px;
  cursor: pointer;
  position: relative;
  transition: color 0.2s ease;
}

.tab.is-active {
  color: var(--gold-bright);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  background: var(--gold);
}

.form {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.form.is-visible {
  display: flex;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(232, 244, 238, 0.78);
}

.field input {
  width: 100%;
  border: 1px solid rgba(232, 244, 238, 0.2);
  background: #0a1712;
  color: #f3faf6;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  padding: 13px 14px;
  outline: none;
  border-radius: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder {
  color: rgba(232, 244, 238, 0.38);
  font-weight: 400;
}

.field input:focus {
  border-color: rgba(239, 210, 122, 0.7);
  box-shadow: 0 0 0 3px rgba(201, 168, 74, 0.18);
}

.btn-primary {
  margin-top: 8px;
  appearance: none;
  border: 0;
  background: linear-gradient(120deg, #b89445, #efd27a 55%, #c9a84a);
  color: #1a1408;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.985);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.form-msg {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}

.form-msg.is-error { color: var(--danger); }
.form-msg.is-ok { color: var(--ok); }

.form-tip {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(232, 244, 238, 0.55);
}

.btn-secondary {
  appearance: none;
  border: 1px solid rgba(232, 244, 238, 0.22);
  background: transparent;
  color: var(--fog);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
  border-color: rgba(239, 210, 122, 0.45);
  background: rgba(201, 168, 74, 0.08);
}

.reg-status {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(239, 210, 122, 0.22);
  background: rgba(201, 168, 74, 0.08);
  color: rgba(239, 210, 122, 0.95);
  font-size: 0.86rem;
  line-height: 1.5;
  animation: statusIn 0.35s ease;
}

@keyframes statusIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.reg-step {
  display: none;
  flex-direction: column;
  gap: 14px;
  animation: stepIn 0.35s ease;
}

.reg-step.is-active {
  display: flex;
}

@keyframes stepIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.reg-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 4px;
}

.reg-actions.has-back {
  grid-template-columns: 0.85fr 1.15fr;
}

.reg-actions .btn-primary,
.reg-actions .btn-secondary {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
}

.field input.is-locked {
  color: rgba(232, 244, 238, 0.72);
  background: rgba(7, 21, 16, 0.35);
  border-color: rgba(232, 244, 238, 0.12);
  cursor: default;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
  background: rgba(6, 17, 13, 0.92);
}

.loader[hidden] {
  display: none !important;
}

.loader-card {
  width: min(420px, calc(100vw - 40px));
  text-align: center;
  padding: 36px 28px;
  border: 1px solid var(--line);
  background: #10261e;
}

.loader-brand {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--gold-bright);
}

.loader-text {
  margin: 0 0 22px;
  color: var(--mist);
  font-weight: 400;
}

.progress {
  height: 6px;
  background: rgba(232, 244, 238, 0.14);
  overflow: hidden;
  border-radius: 999px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8f6f2e, #efd27a, #c9a84a);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  transition: width 0.2s ease;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.loader-pct {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: rgba(232, 244, 238, 0.6);
  font-variant-numeric: tabular-nums;
}

.page-dash .topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto;
  padding: calc(28px + var(--safe-top)) 24px 0;
}

.brand-sm {
  font-size: 1.55rem !important;
  margin: 0 !important;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  color: var(--mist);
  font-size: 0.95rem;
  font-weight: 500;
}

.btn-ghost {
  color: var(--gold-bright);
  text-decoration: none;
  border: 1px solid rgba(201, 168, 74, 0.45);
  padding: 8px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.2s ease;
}

.btn-ghost:hover {
  background: rgba(201, 168, 74, 0.14);
}

.dash {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 72px 24px calc(80px + var(--safe-bottom));
}

.dash-title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 500;
}

.dash-lede {
  margin: 0 0 28px;
  max-width: 40ch;
  color: var(--mist);
  font-weight: 400;
  line-height: 1.7;
}

.dash-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ok);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 14px;
  border: 1px solid rgba(93, 202, 152, 0.28);
  background: rgba(93, 202, 152, 0.08);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

/* Switch panel */
.switch-panel {
  margin-top: 28px;
  border: 1px solid rgba(239, 210, 122, 0.2);
  background: #122820;
  border-radius: 4px;
  overflow: hidden;
}

.switch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(232, 244, 238, 0.1);
}

.switch-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--gold-bright);
}

.switch-hint {
  font-size: 0.82rem;
  color: rgba(232, 244, 238, 0.55);
  white-space: nowrap;
}

.switch-list {
  display: flex;
  flex-direction: column;
}

.switch-row {
  display: block;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(232, 244, 238, 0.08);
  user-select: none;
  transition: background 0.15s ease;
}

.switch-row:last-child {
  border-bottom: 0;
}

.switch-row.is-pending {
  background: rgba(201, 168, 74, 0.06);
}

.switch-main {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
}

.switch-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.switch-index {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(239, 210, 122, 0.7);
  font-variant-numeric: tabular-nums;
}

.switch-name {
  font-size: 0.98rem;
  font-weight: 500;
  color: #f0faf5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch-state {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(232, 244, 238, 0.4);
  min-width: 3em;
  text-align: right;
}

.switch-row.is-on .switch-state {
  color: var(--gold-bright);
}

.switch-row.is-pending .switch-state {
  color: #efd27a;
}

.switch-toggle {
  display: inline-flex;
  cursor: pointer;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.switch-ui {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #0a1712;
  border: 1px solid rgba(232, 244, 238, 0.22);
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  flex: 0 0 auto;
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(232, 244, 238, 0.55);
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch-row.is-on .switch-ui {
  background: linear-gradient(120deg, #c9a84a, #efd27a);
  border-color: transparent;
}

.switch-row.is-on .switch-knob {
  transform: translateX(20px);
  background: #1a1408;
}

.switch-row.is-pending .switch-ui {
  opacity: 0.55;
  border-color: rgba(239, 210, 122, 0.45);
}

.switch-input:disabled + .switch-ui {
  cursor: not-allowed;
}

.switch-input:focus-visible + .switch-ui {
  box-shadow: 0 0 0 3px rgba(201, 168, 74, 0.25);
}

.switch-wait {
  margin-top: 12px;
}

.switch-wait-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(232, 244, 238, 0.12);
  overflow: hidden;
}

.switch-wait-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8f6f2e, #efd27a, #c9a84a);
  transition: width 0.9s linear;
}

.switch-field {
  margin-top: 12px;
}

.switch-value {
  width: 100%;
  border: 1px solid rgba(232, 244, 238, 0.18);
  background: #0a1712;
  color: #f5fbf8;
  font-family: var(--font-body);
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.switch-value::placeholder {
  color: rgba(232, 244, 238, 0.35);
}

.switch-value:focus {
  border-color: rgba(239, 210, 122, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 168, 74, 0.14);
}

.switch-value:disabled {
  opacity: 0.55;
}

/* 下注记录 */
.record-panel {
  margin-top: 16px;
  border: 1px solid rgba(239, 210, 122, 0.2);
  background: #122820;
  border-radius: 14px;
  overflow: hidden;
}

.record-success {
  border-color: rgba(93, 202, 152, 0.28);
}

.record-fail {
  border-color: rgba(255, 123, 123, 0.28);
}

.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(232, 244, 238, 0.1);
}

.record-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--gold-bright);
}

.record-success .record-head h2 {
  color: #6fbf9a;
}

.record-fail .record-head h2 {
  color: #ff8d8d;
}

.record-count {
  font-size: 0.8rem;
  color: rgba(232, 244, 238, 0.5);
}

.record-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 8px 0;
}

.record-empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: rgba(232, 244, 238, 0.4);
  font-size: 0.9rem;
}

.record-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(232, 244, 238, 0.06);
}

.record-item:last-child {
  border-bottom: 0;
}

.record-content {
  font-size: 0.92rem;
  color: #eef7f2;
  word-break: break-all;
}

.record-meta {
  font-size: 0.78rem;
  color: rgba(232, 244, 238, 0.45);
  text-align: right;
  white-space: nowrap;
}

.record-amount {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: rgba(239, 210, 122, 0.85);
}

/* ========== H5 / 手机端 ========== */
@media (max-width: 860px) {
  .ambient {
    background:
      radial-gradient(420px 280px at 90% 0%, rgba(201, 168, 74, 0.2), transparent 65%),
      radial-gradient(380px 320px at 0% 100%, rgba(35, 110, 88, 0.32), transparent 60%),
      linear-gradient(180deg, #06110d 0%, #0b1a15 50%, #0f241c 100%);
  }

  .orb-a {
    width: 200px;
    height: 200px;
    top: -20px;
    right: -40px;
  }

  .orb-b {
    width: 240px;
    height: 240px;
    bottom: 40px;
    left: -70px;
  }

  .grid-fade {
    background-size: 36px 36px;
    opacity: 0.28;
  }

  .shell {
    grid-template-columns: 1fr;
    gap: 12px;
    align-content: center;
    justify-items: stretch;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    padding:
      calc(16px + var(--safe-top))
      16px
      calc(20px + var(--safe-bottom));
  }

  .hero-brand {
    text-align: center;
    padding: 0 6px 4px;
  }

  .brand-mark {
    margin: 0 auto 12px;
    width: 28px;
  }

  .hero-brand .brand {
    margin: 0 0 8px;
    font-size: clamp(2.1rem, 9.5vw, 2.55rem);
  }

  .hero-brand h1 {
    margin: 0 0 6px;
    font-size: clamp(1.08rem, 4.5vw, 1.22rem);
    color: #f0faf5;
  }

  .hero-brand h1 br {
    display: none;
  }

  .lede {
    max-width: 24ch;
    margin: 0 auto;
    font-size: 0.88rem;
    line-height: 1.5;
    color: rgba(232, 244, 238, 0.68);
  }

  .panel {
    margin-top: 0;
    padding: 18px 16px 20px;
    border-radius: 18px;
    border: 1px solid rgba(239, 210, 122, 0.22);
    background: #122820;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  }

  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 18px;
    padding: 4px;
    border: 0;
    border-radius: 12px;
    background: #0a1712;
  }

  .tab {
    padding: 11px 10px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(232, 244, 238, 0.65);
    transition: background 0.2s ease, color 0.2s ease;
  }

  .tab.is-active {
    color: #1a1408;
    background: linear-gradient(120deg, #c9a84a, #efd27a);
  }

  .tab.is-active::after {
    display: none;
  }

  .form {
    gap: 12px;
  }

  .field span {
    font-size: 0.8rem;
    color: rgba(232, 244, 238, 0.82);
  }

  .field input {
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid rgba(232, 244, 238, 0.22);
    background: #0a1712;
    color: #f5fbf8;
  }

  .field input::placeholder {
    color: rgba(232, 244, 238, 0.42);
  }

  .field input:focus {
    border-color: #efd27a;
    box-shadow: 0 0 0 3px rgba(201, 168, 74, 0.2);
  }

  .btn-primary {
    margin-top: 6px;
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    font-size: 1.02rem;
    letter-spacing: 0.1em;
  }

  .reg-actions .btn-primary,
  .reg-actions .btn-secondary {
    margin-top: 0;
  }

  .form-msg {
    text-align: center;
  }

  .loader-card {
    border-radius: 16px;
    padding: 30px 20px;
  }

  .progress {
    height: 8px;
  }

  .page-dash .topbar {
    padding: calc(16px + var(--safe-top)) 16px 0;
  }

  .brand-sm {
    font-size: 1.35rem !important;
  }

  .user-chip {
    max-width: 28vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-ghost {
    border-radius: 10px;
    padding: 9px 12px;
  }

  .dash {
    padding: 36px 16px calc(36px + var(--safe-bottom));
  }

  .dash-title {
    font-size: clamp(1.45rem, 6.5vw, 1.75rem);
    margin-bottom: 8px;
  }

  .dash-lede {
    margin-bottom: 18px;
    font-size: 0.9rem;
  }

  .switch-panel {
    margin-top: 8px;
    border-radius: 16px;
  }

  .switch-head {
    padding: 14px 14px;
  }

  .switch-head h2 {
    font-size: 1.05rem;
  }

  .switch-row {
    padding: 13px 14px;
  }

  .switch-main {
    gap: 10px;
  }

  .switch-name {
    font-size: 0.95rem;
  }

  .record-panel {
    margin-top: 14px;
    border-radius: 14px;
  }

  .record-list {
    max-height: 200px;
  }

  .dash-status {
    border-radius: 10px;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero-brand .brand {
    font-size: 2rem;
  }

  .panel {
    padding: 16px 12px 18px;
    border-radius: 16px;
  }
}

/* 高屏也保持居中，不要把卡片顶到底部 */
@media (max-width: 860px) and (min-height: 780px) {
  .shell {
    align-content: center;
    gap: 16px;
  }

  .hero-brand {
    padding-bottom: 8px;
  }
}

@media (max-width: 860px) and (max-height: 700px) {
  .shell {
    align-content: start;
    padding-top: calc(12px + var(--safe-top));
    gap: 8px;
  }

  .hero-brand {
    padding-top: 0;
    padding-bottom: 0;
  }

  .lede {
    display: none;
  }

  .hero-brand h1 {
    font-size: 1.02rem;
  }
}

