:root {
  --bg: #eef6ff;
  --card: #ffffff;
  --ink: #173b5c;
  --muted: #5f7d9c;
  --line: #d7e6f5;
  --accent: #1769b8;
  --accent-deep: #0d4f91;
  --accent-soft: #e3f0fd;
  --danger: #c0392b;
  --radius: 18px;
  --shadow: 0 12px 32px rgba(23, 105, 184, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 420px at 15% -8%, #d9ecff 0%, rgba(217, 236, 255, 0) 60%),
    radial-gradient(900px 360px at 110% 6%, #e5f3ff 0%, rgba(229, 243, 255, 0) 55%),
    var(--bg);
  min-height: 100vh;
}

.shell {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 18px calc(40px + env(safe-area-inset-bottom));
}

.masthead {
  text-align: center;
  padding: 18px 4px 24px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 12px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 13px;
  letter-spacing: 0.06em;
}

h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  line-height: 1.15;
}

.subtitle {
  margin: 10px 0 0;
  font-size: 18px;
  color: var(--muted);
  letter-spacing: 0.12em;
}

.tagline {
  margin: 16px auto 0;
  max-width: 320px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.card {
  background: var(--card);
  border: 1px solid rgba(215, 230, 245, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px;
  margin: 0 0 20px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 15px;
  font-weight: 600;
}

.field label i {
  color: var(--danger);
  font-style: normal;
  margin-left: 2px;
}

.field label em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 16px;
  color: var(--ink);
  background: #fbfdff;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  resize: vertical;
  min-height: 128px;
  line-height: 1.65;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 105, 184, 0.12);
  background: #ffffff;
}

input::placeholder,
textarea::placeholder {
  color: #9bb2c9;
}

.countline {
  text-align: right;
  color: #9bb2c9;
  font-size: 12px;
  margin-top: 4px;
}

.honeypot {
  position: absolute;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

button {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #2e86de);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 14px 18px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(23, 105, 184, 0.28);
  transition: transform 0.12s, opacity 0.12s;
  font-family: inherit;
}

button:active {
  transform: translateY(1px) scale(0.995);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.form-error {
  color: var(--danger);
  font-size: 14px;
  line-height: 1.5;
  margin: 12px 0 0;
  min-height: 0;
  display: none;
}

.result-card {
  text-align: center;
  padding-top: 30px;
  padding-bottom: 28px;
}

.result-title {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  color: var(--accent-deep);
  letter-spacing: 0.04em;
}

.result-lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.result-block {
  margin: 20px 0 0;
  background: #f7fbfe;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 15px;
  text-align: left;
}

.block-label {
  display: block;
  font-size: 12px;
  color: #88a4bf;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.result-keyword {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-deep);
}

.result-content {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.gift {
  margin: 22px 0 0;
  padding: 16px 15px;
  border-radius: 14px;
  background: linear-gradient(160deg, #f0f7ff, #e3f0fd);
  border: 1px solid #cde4fa;
}

.gift-label {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--accent-deep);
  letter-spacing: 0.2em;
}

.gift-message {
  margin: 0;
  font-size: 16px;
  line-height: 1.85;
  color: #134d85;
  font-weight: 500;
}

.result-footer {
  margin: 22px 0 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.9;
}

.pagefoot {
  text-align: center;
  color: #93adc6;
  font-size: 13px;
  padding: 4px 0 0;
}

/* ---------- 管理后台 ---------- */
.admin-body {
  background: #f3f7fb;
}

.admin-shell {
  max-width: 980px;
}

.admin-card {
  padding: 24px 22px 30px;
}

.admin-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-actions button {
  flex: 1;
  min-width: 150px;
}

#exportBtn {
  background: linear-gradient(135deg, #168a5e, #27ae60);
  box-shadow: 0 8px 18px rgba(22, 138, 94, 0.24);
}

#exportBtn:disabled {
  opacity: 0.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.stat {
  background: #f7fbfe;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 8px 12px;
  text-align: center;
}

.stat span {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-deep);
}

.stat label {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.top-keywords {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
  word-break: break-all;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}

th,
td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid #e8f0f8;
  vertical-align: top;
}

th {
  background: var(--accent-soft);
  color: var(--accent-deep);
  position: sticky;
  top: 0;
  white-space: nowrap;
}

td {
  color: #26486b;
}

.table-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: #93adc6;
}

@media (max-width: 480px) {
  .shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .card {
    padding: 20px 16px;
  }

  h1 {
    font-size: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
