:root{
  --main-bg: #f8fafc;
  --main-card-bg: #ffffff;
  --main-card-border: #e2e8f0;
  --main-card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  --main-text: #0f172a;
  --main-muted: #64748b;
  --primary: #10b981;
  --primary-hover: #059669;
  --danger: #ef4444;
  --input-bg: #f1f5f9;
  --radius-xl: 20px;
  --radius-lg: 12px;
  --font-mono: 'Space Mono', 'Courier New', monospace;
}

.auth-container { 
  max-width: 800px; 
  margin: 40px auto; 
  padding: 0 20px; 
}

.page-title {
  text-align: center;
  font-size: 32px;
  font-weight: 800;
  color: var(--main-text);
  margin-bottom: 8px;
}

.page-desc {
  text-align: center;
  color: var(--main-muted);
  margin-bottom: 32px;
}

.auth-card {
  background: var(--main-card-bg);
  border-radius: var(--radius-xl);
  padding: 40px;
  border: 1px solid var(--main-card-border);
  box-shadow: var(--main-card-shadow);
}

.auth-title { 
  font-size: 24px; 
  font-weight: 700; 
  color: var(--main-text); 
  margin-bottom: 24px;
  text-align: center;
}

.input-group { margin-bottom: 24px; }
.input-label { 
  display: block; 
  font-weight: 600; 
  margin-bottom: 8px; 
  color: var(--main-text); 
  font-size: 14px; 
}

.auth-input {
  width: 100%; 
  padding: 14px 16px; 
  border-radius: var(--radius-lg);
  border: 2px solid var(--border); 
  font-size: 16px; 
  transition: all 0.2s; 
  outline: none; 
  background: var(--input-bg);
  font-family: var(--font-mono);
  padding-right: 40px;
}

.auth-input:focus { 
  border-color: var(--primary); 
  background: #fff;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1); 
}

#demo-secret-key {
  display: block; /* 使元素占据整行，让换行逻辑生效 */
  word-break: break-all; /* 强制长密钥字符串在必要时断行 */
  white-space: normal; /* 确保不禁止换行 */
  padding-right: 16px !important; /* 覆盖 .auth-input 预留给清除按钮的过大边距 */
}

.auth-btn-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-btn {
  width: auto;
  min-width: 180px;
  padding: 12px 32px; 
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white; 
  border: none; 
  border-radius: var(--radius-lg); 
  font-size: 15px; 
  font-weight: 700;
  cursor: pointer; 
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

.auth-btn:hover {
  /* no visual flash on hover — keep same background and shadow */
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

.otp-display-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 32px 0;
  padding: 24px 16px;
  background: #f8fafc;
  border-radius: var(--radius-lg);
  border: 1px solid var(--main-card-border);
  flex-wrap: wrap; /* 防止在窄屏上重叠 */
}

.otp-code { 
  font-size: 48px; 
  font-weight: 800; 
  letter-spacing: 4px; 
  color: var(--main-text); 
  font-family: var(--font-mono);
  cursor: pointer;
  user-select: none;
  min-width: 220px; /* 固定宽度防止文本变化时布局抖动 */
  text-align: center;
}

.otp-code.expired {
  color: var(--danger);
  font-size: 32px;
  letter-spacing: 0;
}

.copy-otp-btn { 
  background: white;
  border: 1px solid var(--main-card-border);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  color: var(--main-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.copy-otp-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.copy-otp-btn:active, .auth-btn:active, #demo-secret-key:active {
  transform: scale(0.95);
}

.timer-container {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timer-svg { width:80px; height:80px; transform:rotate(-90deg); }
.timer-bg { fill:none; stroke:#e2e8f0; stroke-width:6 }
.timer-bar { fill:none; stroke:var(--primary); stroke-width:6; stroke-linecap:round; transition:stroke-dashoffset 1s linear }

.timer-bar.expired { stroke: var(--danger); }

#timer-text {
  font-weight: 700;
  color: var(--main-muted);
  font-size: 14px;
  position: absolute; /* 配合 timer-container 居中 */
  z-index: 2;
  margin: 0;
}

.btn-danger {
  background: none;
  border: 1px solid #fee2e2;
  color: var(--danger);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  font-family: var(--font-mono);
}

#empty-state {
  padding: 20px;
  color: #94a3b8;
  text-align: center;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-clear-btn {
  position: absolute;
  right: 12px;
  background: #cbd5e1;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.input-clear-btn:hover {
  background: var(--danger);
}

/* Toast message styling */
#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 23, 42, 0.85); /* Dark background */
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px; /* Pill shape */
  font-size: 14px;
  z-index: 1000; /* Ensure it's on top */
  opacity: 0; /* Hidden by default */
  transition: opacity 0.3s ease-in-out; /* Smooth fade */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* SEO Section Styles */
.seo-section { margin-top: 30px; }
.seo-card {
  background: var(--main-card-bg);
  border-radius: var(--radius-xl);
  padding: 32px;
  border: 1px solid var(--main-card-border);
  box-shadow: var(--main-card-shadow);
}
.seo-h2 { font-size: 22px; font-weight: 800; color: var(--main-text); margin-bottom: 16px; letter-spacing: -0.02em; }
.seo-h3 { font-size: 20px; font-weight: 700; color: var(--main-text); margin-bottom: 15px; } /* New style */
.seo-p { color: var(--main-muted); line-height: 1.8; font-size: 15px; margin-bottom: 16px; }
.seo-ul { list-style: disc; padding-left: 20px; color: var(--main-muted); line-height: 1.6; margin-bottom: 20px;} /* New style */
.seo-ul li { margin-bottom: 8px; } /* New style */
.seo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.seo-item { padding: 20px; background: #fff; border: 1px solid #eef2f6; border-radius: var(--radius-lg); }

/* subtle page background */
body { background: linear-gradient(180deg, #f6fbff 0%, #ffffff 60%); }

@media (max-width: 640px) {
  .otp-display-wrap { flex-direction: column; }
  .otp-code { font-size: 36px; }
  .auth-card { padding: 24px; }
}