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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #07080f;
  color: #e0e0f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Top Bar ── */
.topbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  border-bottom: 1px solid #1e2240;
  background: #07080f;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(90deg, #00c9ff, #6effa0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-link {
  color: #8890b0;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}
.topbar-link:hover { color: #e0e0f0; }

.topbar-download {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 100px;
  background: linear-gradient(90deg, #00c9ff, #6effa0);
  color: #07080f;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.2s;
}
.topbar-download:hover { opacity: 0.85; }

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 60px 20px 36px;
  max-width: 700px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid rgba(0,201,255,0.3);
  background: rgba(0,201,255,0.07);
  color: #00c9ff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #f0f2ff;
  margin-bottom: 16px;
}

.grad {
  background: linear-gradient(90deg, #00c9ff, #6effa0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1rem;
  color: #8890b0;
  line-height: 1.65;
}

.hero-download-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}

.hero-download-btn {
  display: inline-block;
  background: linear-gradient(135deg, #00c6ff, #00e676);
  color: #0a0e1a;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 36px;
  border-radius: 50px;
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 0 24px rgba(0,198,255,0.3);
}

.hero-download-btn:hover {
  opacity: 0.88;
  transform: translateY(-2px);
}

.hero-download-hint {
  font-size: 0.8rem;
  color: #555e7a;
}

/* ── Generator ── */
.generator {
  width: 100%;
  max-width: 680px;
  padding: 0 20px;
  margin-bottom: 32px;
}

textarea {
  width: 100%;
  height: 130px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #1e2240;
  background: #141628;
  color: #e0e0f0;
  font-size: 0.97rem;
  resize: vertical;
  outline: none;
  margin-bottom: 12px;
  line-height: 1.6;
}
textarea:focus { border-color: #00c9ff; }

button#generateBtn {
  display: block;
  width: 100%;
  padding: 15px;
  background: linear-gradient(90deg, #00c9ff, #6effa0);
  color: #07080f;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-bottom: 20px;
}
button#generateBtn:disabled { opacity: 0.45; cursor: not-allowed; }
button#generateBtn:hover:not(:disabled) { opacity: 0.88; }

/* ── Status ── */
#status { width: 100%; }
.loading { color: #8890b0; font-style: italic; font-size: 0.92rem; }
.error { color: #ff6b6b; font-size: 0.9rem; }
.success { color: #6effa0; font-weight: 600; margin-bottom: 14px; }

.action-btns { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.preview-btn {
  display: inline-block;
  padding: 11px 22px;
  background: linear-gradient(90deg, #00c9ff, #6effa0);
  color: #07080f;
  font-weight: 700;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.9rem;
}
.preview-btn:hover { opacity: 0.85; }

.download-btn {
  display: inline-block;
  padding: 11px 22px;
  background: #141628;
  border: 1.5px solid #00c9ff;
  color: #00c9ff;
  font-weight: 700;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}
.download-btn:hover { background: #00c9ff; color: #07080f; }

.page-list {
  background: #141628;
  border: 1px solid #1e2240;
  border-radius: 12px;
  padding: 16px 20px;
}
.page-list strong { display: block; margin-bottom: 10px; color: #ccc; font-size: 0.88rem; }
.page-list ul { list-style: none; padding: 0; }
.page-list ul li { margin-bottom: 8px; }
.page-list ul li a { color: #00c9ff; text-decoration: none; font-size: 0.9rem; }
.page-list ul li a:hover { text-decoration: underline; }

/* ── Download Card ── */
.download-card {
  width: 100%;
  max-width: 680px;
  margin: 0 20px 60px;
  padding: 22px 28px;
  background: #141628;
  border: 1px solid #1e2240;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.download-card-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.download-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.download-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f0f2ff;
  margin-bottom: 4px;
}

.download-desc {
  font-size: 0.8rem;
  color: #8890b0;
  line-height: 1.5;
  max-width: 380px;
}

.download-big-btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 100px;
  background: linear-gradient(90deg, #00c9ff, #6effa0);
  color: #07080f;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.download-big-btn:hover { opacity: 0.85; }

/* ── API Banner ── */
.api-banner {
  display: none;
  width: 100%;
  background: rgba(255, 180, 0, 0.1);
  border-bottom: 1px solid rgba(255, 180, 0, 0.25);
  color: #ffc84a;
  text-align: center;
  padding: 10px 20px;
  font-size: 0.88rem;
}

/* ── Settings Button ── */
.topbar-settings {
  background: none;
  border: 1px solid #1e2240;
  border-radius: 100px;
  color: #8890b0;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 7px 16px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.topbar-settings:hover { border-color: #00c9ff; color: #00c9ff; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: #0f1120;
  border: 1px solid #1e2240;
  border-radius: 18px;
  width: 100%;
  max-width: 480px;
  padding: 32px;
  margin: 20px;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f0f2ff;
}

.modal-close {
  background: none;
  border: none;
  color: #8890b0;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}
.modal-close:hover { color: #f0f2ff; }

.setting-group { display: flex; flex-direction: column; gap: 10px; }

.setting-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f0f2ff;
}

.setting-hint {
  font-size: 0.8rem;
  color: #8890b0;
  line-height: 1.5;
}
.setting-hint a { color: #00c9ff; text-decoration: none; }
.setting-hint a:hover { text-decoration: underline; }

.key-status { font-size: 0.85rem; }
.key-set { color: #6effa0; }
.key-missing { color: #ffc84a; }

.key-input-row {
  display: flex;
  gap: 10px;
}

.key-input-row input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid #1e2240;
  background: #141628;
  color: #e0e0f0;
  font-size: 0.92rem;
  outline: none;
  margin-bottom: 0;
}
.key-input-row input:focus { border-color: #00c9ff; }

.show-btn {
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid #1e2240;
  background: #141628;
  color: #8890b0;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.show-btn:hover { border-color: #00c9ff; color: #00c9ff; }

.save-btn {
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(90deg, #00c9ff, #6effa0);
  color: #07080f;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.save-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.save-btn:hover:not(:disabled) { opacity: 0.88; }

.save-msg { font-size: 0.82rem; min-height: 1.2em; }
.save-msg.success { color: #6effa0; }
.save-msg.error { color: #ff6b6b; }
