/* ===== Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

body {
  overflow-x: hidden;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  background: var(--c-bg-page);
  color: var(--c-text);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* ===== 页面色板 ===== */
:root {
  --c-text: #262626;
  --c-text-secondary: #595959;
  --c-text-tertiary: #8c8c8c;
  --c-text-placeholder: #bfbfbf;
  --c-border: #e8e8e8;
  --c-border-light: #f0f0f0;
  --c-border-focus: #039be4;
  --c-bg-input: #fafafa;
  --c-bg-page: #ffffff;
  --c-accent: #039be4;
  --c-accent-light: #29b6f6;
  --c-accent-dark: #0288d1;
  --c-danger: #ff4d4f;
  --c-focus-ring: rgba(3, 155, 228, 0.18);
  --c-accent-shadow: rgba(3, 155, 228, 0.25);
}

/* ===== App ===== */
.app {
  position: relative;
  width: 100%;
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--c-bg-page);
}

/* ===== Lobby login/register page ===== */
.lobby-page {
  min-height: 100vh;
  background: var(--c-bg-page);
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 53px;
  padding: 0 16px;
  background: var(--c-bg-page);
  border-bottom: 1px solid var(--c-border-light);
}

.lobby-header-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-secondary);
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.lobby-header-btn:active {
  color: var(--c-text);
  background: var(--c-border-light);
}

.lobby-header-btn svg {
  width: 20px;
  height: 20px;
}

.lobby-header-title {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

/* 统一 Logo */
.site-logo {
  display: block;
  object-fit: contain;
}

.site-logo--header {
  height: 32px;
  width: auto;
  max-width: 120px;
}

.site-logo--loading {
  height: 64px;
  width: auto;
  margin: 0 auto;
}

.lobby-main {
  padding-bottom: 24px;
}

/* Banner */
.lobby-banner {
  padding: 0 24px;
}

.lobby-banner-wrap {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--c-border-light);
  line-height: 0;
}

.lobby-banner-img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* Tabs */
.lobby-tabs {
  margin-top: 12px;
}

.lobby-tabs-nav {
  position: relative;
  display: flex;
  height: 47px;
  border-bottom: 1px solid var(--c-border);
}

.lobby-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 47px;
  font-size: 16px;
  font-weight: 500;
  color: var(--c-text-tertiary);
  letter-spacing: 0.12em;
  transition: color 0.25s;
}

.lobby-tab span {
  display: inline-block;
}

.lobby-tab.active {
  color: var(--c-text);
  font-weight: 600;
}

.lobby-tab-line {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 50%;
  height: 2px;
  background: var(--c-accent);
  border-radius: 2px 2px 0 0;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  transform: translateX(0%);
  pointer-events: none;
}

.lobby-tab-line.is-login {
  transform: translateX(100%);
}

.lobby-tab-pane {
  display: none;
  padding: 16px 24px 0;
}

.lobby-tab-pane.active {
  display: block;
}

.lobby-form-tip {
  font-size: 12px;
  color: var(--c-text-tertiary);
  margin-bottom: 14px;
}

/* Form fields */
.lobby-field {
  margin-bottom: 16px;
}

.lobby-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-secondary);
  margin-bottom: 8px;
}

.lobby-label .req {
  color: var(--c-danger);
  margin-right: 3px;
}

.lobby-input-wrap {
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 14px;
  background: var(--c-bg-input);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.lobby-input-wrap:focus-within {
  border-color: var(--c-border-focus);
  background: var(--c-bg-page);
  box-shadow: 0 0 0 3px var(--c-focus-ring);
}

.lobby-input-wrap.is-error {
  border-color: var(--c-danger);
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.12);
}

.lobby-input-wrap.is-error:focus-within {
  border-color: var(--c-danger);
  box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.12);
}

.field-error {
  display: none;
  margin-top: 6px;
  padding-left: 2px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-danger);
}

.field-error.visible {
  display: block;
}

.field-error--agree {
  margin-top: -10px;
  margin-bottom: 14px;
}

.form-message {
  margin-bottom: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 8px;
  text-align: center;
}

.form-message.is-success {
  color: #389e0d;
  background: #f6ffed;
  border: 1px solid #b7eb8f;
}

.form-message.is-error {
  color: var(--c-danger);
  background: #fff2f0;
  border: 1px solid #ffccc7;
}

.lobby-input-wrap input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--c-text);
}

.lobby-input-wrap input::placeholder {
  color: var(--c-text-placeholder);
}

.lobby-eye {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-tertiary);
  border-radius: 6px;
  transition: color 0.2s;
}

.lobby-eye:active {
  color: var(--c-text-secondary);
}

.lobby-eye svg {
  width: 18px;
  height: 18px;
}

/* Extra section */
.lobby-extra {
  padding: 8px 24px 0;
}

.lobby-agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 12px;
  color: var(--c-text-secondary);
  line-height: 1.65;
  cursor: pointer;
}

.lobby-agree input {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--c-accent);
}

.lobby-agree a {
  color: var(--c-accent);
  font-weight: 500;
}

.lobby-submit {
  width: 100%;
  height: 48px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: #fff;
  background: linear-gradient(180deg, var(--c-accent-light) 0%, var(--c-accent) 100%);
  border: 1px solid var(--c-accent-dark);
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--c-accent-shadow);
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}

.lobby-submit:active {
  opacity: 0.9;
  transform: scale(0.99);
}

.lobby-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-top: 20px;
}

.lobby-link {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--c-text-secondary);
  padding: 8px 4px;
  position: relative;
  transition: color 0.2s;
}

.lobby-link:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 12px;
  background: var(--c-border);
}

.lobby-link:active {
  color: var(--c-accent);
}

/* ===== Overlay ===== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.loading-overlay {
  z-index: 200;
}

.promo-overlay {
  z-index: 150;
}

.device-wait-overlay {
  z-index: 180;
}

.device-success-overlay {
  z-index: 190;
}

/* ===== 白色弹框 ===== */
.modal-card {
  width: 100%;
  background: #ffffff;
  border-radius: 20px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.loading-card {
  max-width: 320px;
  padding: 36px 28px 32px;
  text-align: center;
  animation: modalIn 0.35s ease;
}

.loading-brand {
  margin-bottom: 28px;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 22px;
  border: 3px solid rgba(3, 155, 228, 0.15);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.loading-title {
  font-size: 17px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.loading-tip {
  font-size: 13px;
  color: #888;
  min-height: 20px;
  margin-bottom: 20px;
  transition: opacity 0.3s;
}

.loading-tip.fade {
  opacity: 0;
}

.loading-progress {
  height: 4px;
  background: #f0f0f2;
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 14px;
}

.loading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-light));
  border-radius: 100px;
  transition: width 0.25s ease;
}

.loading-foot {
  font-size: 11px;
  color: #aaa;
}

.promo-card {
  position: relative;
  max-width: 360px;
  padding: 28px 22px 22px;
  animation: modalIn 0.35s ease;
}

.promo-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: #999;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.promo-close:active {
  color: #333;
  background: #f5f5f7;
}

.promo-viewport {
  overflow: hidden;
  margin-bottom: 16px;
}

.promo-track {
  display: flex;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.promo-slide {
  flex: 0 0 100%;
  min-width: 100%;
  padding: 0 4px;
}

.promo-badge {
  display: inline-block;
  padding: 4px 12px;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, var(--c-accent-light), var(--c-accent));
  border-radius: 100px;
}

.promo-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  padding-right: 28px;
}

.promo-desc {
  font-size: 14px;
  line-height: 1.65;
  color: #666;
  margin-bottom: 16px;
}

.promo-desc strong {
  color: var(--c-accent);
  font-weight: 700;
}

.promo-list {
  list-style: none;
  margin-bottom: 18px;
}

.promo-list li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  color: #888;
  line-height: 2;
}

.promo-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  background: var(--c-accent);
  border-radius: 50%;
}

.promo-btn {
  display: block;
  width: 100%;
  height: 46px;
  line-height: 46px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, var(--c-accent-light), var(--c-accent));
  border-radius: 100px;
  transition: opacity 0.15s;
}

.promo-btn:active {
  opacity: 0.88;
}

.promo-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.promo-arrow {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #666;
  background: #f5f5f7;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.15s;
}

.promo-arrow:active {
  background: #ebebed;
}

.promo-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.promo-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.promo-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border-radius: 50%;
  background: #ddd;
  transition: width 0.25s, background 0.25s;
}

.promo-dot.active {
  width: 18px;
  border-radius: 100px;
  background: var(--c-accent);
}

.promo-dismiss {
  display: block;
  width: 100%;
  height: 40px;
  font-size: 13px;
  color: #999;
}

.promo-dismiss:active {
  color: #666;
}

/* ===== 设备注册成功弹框 ===== */
.device-success-card {
  max-width: 320px;
  padding: 36px 28px 28px;
  text-align: center;
  animation: modalIn 0.35s ease;
}

.device-success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  color: var(--c-accent);
}

.device-success-icon svg {
  width: 100%;
  height: 100%;
}

.device-success-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.device-success-desc {
  font-size: 14px;
  color: #888;
  line-height: 1.6;
  margin-bottom: 24px;
}

.device-success-btn {
  display: block;
  width: 100%;
  height: 46px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(90deg, var(--c-accent-light), var(--c-accent));
  border-radius: 100px;
  transition: opacity 0.15s;
}

.device-success-btn:active {
  opacity: 0.88;
}