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

:root {
  --text-main: #2d2a3a;
  --text-sub: #6b687e;
  --card-bg: rgba(255, 255, 255, 0.85);
  --accent-1: #7c5cff;
  --accent-2: #ff6bb0;
  --shadow: 0 10px 40px rgba(90, 60, 180, 0.18);
}

html, body {
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background: linear-gradient(135deg, #f9d5ff 0%, #c7f0ff 40%, #fff3c4 100%);
  background-attachment: fixed;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: -20%;
  left: -20%;
  width: 60vw;
  height: 60vw;
  min-width: 400px;
  min-height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.18), transparent 70%);
  animation: float 14s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  bottom: -20%;
  right: -20%;
  width: 60vw;
  height: 60vw;
  min-width: 400px;
  min-height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 176, 0.16), transparent 70%);
  animation: float 18s ease-in-out infinite reverse;
  pointer-events: none;
  z-index: 0;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6%, 8%) scale(1.08); }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header {
  text-align: center;
  margin-bottom: 28px;
  animation: drop-in 0.7s ease both;
}

@keyframes drop-in {
  from { opacity: 0; transform: translateY(-18px); }
  to { opacity: 1; transform: translateY(0); }
}

.logo {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.slogan {
  color: var(--text-sub);
  font-size: 15px;
}

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.filter-btn {
  border: none;
  cursor: pointer;
  padding: 8px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(6px);
  transition: all 0.25s ease;
  box-shadow: 0 2px 10px rgba(90, 60, 180, 0.08);
}

.filter-btn:hover {
  transform: translateY(-2px);
}

.filter-btn.active {
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.35);
}

.card {
  width: 100%;
  min-height: 240px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  position: relative;
  transition: min-height 0.4s ease;
}

.card-empty {
  text-align: center;
  color: var(--text-sub);
  font-size: 16px;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 14px;
  animation: wobble 3s ease-in-out infinite;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

.card-content {
  width: 100%;
  text-align: center;
  animation: pop-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.85) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.card-content.rolling {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-3deg) scale(0.98); }
  40% { transform: rotate(3deg) scale(1.02); }
  60% { transform: rotate(-2deg) scale(0.99); }
  80% { transform: rotate(2deg) scale(1.01); }
}

.tag {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  margin-bottom: 18px;
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.3);
}

.content-body {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.5;
  word-break: break-word;
}

.content-body.quote {
  font-style: italic;
  color: #4a3f8f;
}

.content-body.joke {
  color: #8f3f6d;
  font-size: 22px;
}

.content-body.fact {
  color: #1f7a6d;
  font-size: 22px;
}

.content-body.number {
  font-size: 72px;
  font-weight: 900;
  background: linear-gradient(90deg, #7c5cff, #ff6bb0, #ffb84d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}

.content-body.color {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.color-swatch {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.color-hex {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  font-family: "SF Mono", Consolas, monospace;
}

.content-body.image img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  object-fit: cover;
}

.content-caption {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-sub);
  font-weight: 400;
}

.random-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  cursor: pointer;
  padding: 18px 52px;
  border-radius: 999px;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 10px 30px rgba(124, 92, 255, 0.4);
  transition: all 0.25s ease;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.random-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: shimmer 2.8s ease-in-out infinite;
}

@keyframes shimmer {
  0% { left: -120%; }
  60%, 100% { left: 160%; }
}

.random-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 14px 36px rgba(124, 92, 255, 0.5);
}

.random-btn:active {
  transform: translateY(0) scale(0.97);
}

.random-btn.spinning .btn-icon {
  animation: spin 0.6s ease;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.history {
  width: 100%;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.history-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #4a3f8f;
}

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

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(124, 92, 255, 0.08);
  font-size: 14px;
  animation: pop-in 0.3s ease both;
}

.history-tag {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--accent-1);
  padding: 2px 10px;
  border-radius: 999px;
  margin-top: 2px;
}

.history-text {
  color: var(--text-main);
  word-break: break-word;
  line-height: 1.5;
}

.history-empty {
  color: var(--text-sub);
  font-size: 14px;
  text-align: center;
  padding: 14px 0;
}

.clear-btn {
  display: block;
  margin: 16px auto 0;
  border: none;
  cursor: pointer;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 13px;
  color: #c0392b;
  background: rgba(255, 214, 214, 0.7);
  transition: all 0.2s ease;
}

.clear-btn:hover {
  background: rgba(255, 180, 180, 0.8);
}

.footer {
  margin-top: 36px;
  text-align: center;
  color: var(--text-sub);
  font-size: 13px;
  opacity: 0.8;
}

@media (max-width: 560px) {
  .app { padding: 32px 16px 48px; }
  .logo { font-size: 32px; }
  .card { padding: 24px 18px; min-height: 200px; }
  .content-body { font-size: 22px; }
  .content-body.number { font-size: 56px; }
  .content-body.joke, .content-body.fact { font-size: 19px; }
  .random-btn { padding: 15px 36px; font-size: 19px; }
  .filter-btn { padding: 7px 16px; font-size: 13px; }
}
