:root {
  --bg: #f4f1fb;
  --card: #ffffff;
  --text: #2a2438;
  --muted: #7a7490;
  --accent: #7c5cff;
  --accent-2: #ff7eb6;
  --border: #e6e1f2;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(92, 70, 160, 0.12);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 10% 0%, #ffe3f1 0, transparent 40%),
    radial-gradient(circle at 90% 10%, #dcd3ff 0, transparent 40%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  padding: 24px 16px 40px;
}

.top {
  max-width: 640px;
  margin: 0 auto 20px;
  text-align: center;
}

.top h1 {
  margin: 8px 0 6px;
  font-size: clamp(22px, 5vw, 30px);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

.card {
  max-width: 640px;
  margin: 0 auto 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.result {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #faf7ff, #fff5fa);
  border: 1px dashed #d8cdf5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  word-break: break-all;
  text-align: center;
}

.result .placeholder {
  color: var(--muted);
  font-family: inherit;
}

.result.pop {
  animation: pop 0.35s ease;
}

@keyframes pop {
  0% { transform: scale(0.97); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  justify-content: center;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  min-height: 44px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(92, 70, 160, 0.15);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(90deg, var(--accent), #9b7bff);
  color: #fff;
  border: none;
  padding-left: 26px;
  padding-right: 26px;
}

.btn.small {
  padding: 6px 12px;
  min-height: 34px;
  font-size: 13px;
}

.btn:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(124, 92, 255, 0.4);
  outline-offset: 2px;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  justify-content: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.options select {
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.history-head h2 {
  margin: 0;
  font-size: 17px;
}

.history {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}

.history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.history li:last-child {
  border-bottom: none;
}

.history li.empty {
  color: var(--muted);
  justify-content: center;
}

.history .link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  min-width: 0;
  flex: 1;
}

.history .mini {
  flex-shrink: 0;
  border: none;
  background: #f1ecff;
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 24px;
}

.foot a {
  color: var(--accent);
}

@media (max-width: 480px) {
  body { padding: 16px 12px 32px; }
  .card { padding: 16px; }
  .btn { flex: 1 1 auto; }
}
