:root {
  --bg: #08080b;
  --panel: #121216;
  --panel-2: #17171d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f5;
  --muted: #8b8b95;
  --accent: #ff2c55;
  --accent-2: #25f4ee;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Segoe UI", Roboto, "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  padding: clamp(20px, 4vw, 56px) 18px 48px;
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: -30% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(45% 40% at 20% 20%, rgba(37, 244, 238, 0.10), transparent 70%),
    radial-gradient(40% 40% at 80% 10%, rgba(255, 44, 85, 0.13), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

.shell {
  width: 100%;
  max-width: 720px;
  position: relative;
  z-index: 1;
}

/* ------------------------------- header ------------------------------- */
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

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

.mark {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(255, 44, 85, 0.9), rgba(255, 90, 60, 0.85));
  box-shadow: 0 8px 24px rgba(255, 44, 85, 0.28);
  color: #fff;
}

h1 { margin: 0; font-size: 20px; letter-spacing: -0.3px; }
.brand p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

.badge {
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.badge.ok { color: #4ade80; border-color: rgba(74, 222, 128, 0.25); }
.badge.bad { color: #fb7185; border-color: rgba(251, 113, 133, 0.3); }

/* -------------------------------- panel -------------------------------- */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.input-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0d0d11;
  transition: border-color .18s, box-shadow .18s;
}
.input-wrap:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(255, 44, 85, 0.10);
}

textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  padding: 14px 16px;
  font-family: inherit;
}
textarea::placeholder { color: #5b5b66; }

.toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  flex-wrap: wrap;
}

.ghost {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, border-color .15s;
}
.ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--line-strong); }

.primary {
  margin-left: auto;
  height: 36px;
  padding: 0 20px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(135deg, #ff3a63, #ff6a3d);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 26px rgba(255, 58, 99, 0.28);
  transition: transform .12s, box-shadow .18s, opacity .18s;
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(255, 58, 99, 0.34); }
.primary:active { transform: translateY(0); }
.primary:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint { margin: 12px 2px 0; font-size: 12px; color: #6b6b76; }

/* -------------------------------- result -------------------------------- */
.result { margin-top: 18px; }

.card {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise .34s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.cover {
  width: 118px;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  object-fit: cover;
  background: #1b1b22;
  display: block;
}

.meta { min-width: 0; display: flex; flex-direction: column; }
.title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.avatar {
  width: 22px; height: 22px; border-radius: 50%;
  object-fit: cover; background: #22222a;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  font-size: 12px;
  color: #b9b9c4;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(255,255,255,.03);
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.dl {
  height: 42px;
  padding: 0 22px;
  border-radius: 12px;
  border: 0;
  background: linear-gradient(135deg, #ff3a63, #ff6a3d);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 12px 30px rgba(255, 58, 99, 0.3);
}
.dl:hover { filter: brightness(1.06); }

.again {
  height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.err {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(251, 113, 133, 0.28);
  background: rgba(251, 113, 133, 0.07);
  color: #fecdd3;
  font-size: 14px;
  line-height: 1.6;
  animation: rise .3s ease;
}

/* -------------------------------- history -------------------------------- */
.history { margin-top: 30px; }
.history-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.history-head h2 { font-size: 13px; color: var(--muted); font-weight: 500; margin: 0; }
.link-btn {
  background: none; border: 0; color: #6b6b76; font-size: 12px; cursor: pointer;
}
.link-btn:hover { color: var(--muted); }

.history-list { display: flex; flex-direction: column; gap: 8px; }

.h-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.h-item:hover { background: rgba(255,255,255,.05); border-color: var(--line-strong); }
.h-item img { width: 34px; height: 48px; object-fit: cover; border-radius: 7px; background: #1b1b22; }
.h-item .t { font-size: 13.5px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; flex: 1; min-width: 0; }
.h-item .d { font-size: 12px; color: #6b6b76; white-space: nowrap; }

/* -------------------------------- footer -------------------------------- */
.foot { margin-top: 34px; text-align: center; }
.foot p { font-size: 12px; color: #5b5b66; line-height: 1.7; margin: 0; }

/* --------------------------------- toast --------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  background: rgba(28, 28, 34, 0.96);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13.5px;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  z-index: 50;
  animation: rise .25s ease;
}

@media (max-width: 560px) {
  .card { grid-template-columns: 92px 1fr; gap: 12px; padding: 13px; }
  .cover { width: 92px; }
  .primary { width: 100%; margin-left: 0; justify-content: center; }
  .toolbar .ghost { flex: 1; justify-content: center; }
  .actions .dl, .actions .again { flex: 1; justify-content: center; }
}
