/* ─── 全局 ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0b0d17;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 16px;
  --font: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body {
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(139, 92, 246, 0.08), transparent);
}

/* ─── Layout ─── */
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

/* ─── Brand ─── */
.brand {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo {
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 24px rgba(99, 102, 241, 0.3));
}

.brand h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* ─── Panel ─── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  text-align: center;
  backdrop-filter: blur(16px);
}

.hidden {
  display: none !important;
}

/* ─── Code Input ─── */
.code-input-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.5rem;
}

.code-char {
  width: 52px;
  height: 62px;
  text-align: center;
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid var(--border);
  border-radius: 12px;
  outline: none;
  text-transform: uppercase;
  caret-color: var(--primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.code-char:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.code-char.filled {
  border-color: var(--primary-hover);
  background: rgba(99, 102, 241, 0.08);
}

.code-sep {
  font-size: 1.2rem;
  color: var(--text-dim);
  user-select: none;
}

/* ─── Error ─── */
.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ─── Buttons ─── */
.btn-primary {
  width: 100%;
  padding: 14px 24px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ─── Spinner ─── */
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Sharing Bar (top) ─── */
.sharing-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
  border-bottom: 1px solid rgba(34, 197, 94, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 1000;
  backdrop-filter: blur(12px);
}

.sharing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--success);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(1.3);
  }
}

.btn-stop {
  padding: 5px 16px;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
  background: var(--danger);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-stop:hover {
  background: #dc2626;
}

/* ─── 共享成功面板 ─── */
.success-icon {
  margin-bottom: 1.5rem;
}

.share-info {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.share-meta {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.meta-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
}

.status-online {
  color: var(--success);
}

/* ─── 断开面板 ─── */
.disconnect-icon {
  width: 64px;
  height: 64px;
  line-height: 64px;
  font-size: 2rem;
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid rgba(239, 68, 68, 0.2);
  border-radius: 50%;
  margin: 0 auto 1.5rem;
}

/* ─── 使用须知 ─── */
.notice-card {
  width: 100%;
  max-width: 440px;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.notice-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 0.6rem;
  opacity: 0.8;
}

.notice-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
}

.notice-list li {
  padding: 0.2rem 0;
  padding-left: 1rem;
  position: relative;
}

.notice-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--primary);
}

.notice-list li strong {
  color: var(--text);
  font-weight: 600;
}

.notice-list li em {
  color: var(--success);
  font-style: normal;
  font-weight: 600;
}

.notice-privacy {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.72rem;
  color: var(--text-dim);
  opacity: 0.7;
}

.notice-privacy svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .code-char {
    width: 44px;
    height: 54px;
    font-size: 1.3rem;
  }

  .panel {
    padding: 1.5rem;
  }
}