:root {
  --primary-gradient: linear-gradient(135deg, #7c4dff 0%, #448aff 100%);
  --bg-dark: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --accent-glow: rgba(124, 77, 255, 0.4);
  --glass-border: rgba(255, 255, 255, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Pretendard', sans-serif; }

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  position: relative;
}

.container { width: 100%; max-width: 500px; position: relative; z-index: 2; }

.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 40px 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.card-header { text-align: center; margin-bottom: 40px; }

.icon-box {
  width: 70px; height: 70px;
  background: var(--primary-gradient);
  border-radius: 20px;
  display: flex; justify-content: center; align-items: center;
  margin: 0 auto 20px; font-size: 2.5rem;
  box-shadow: 0 10px 20px var(--accent-glow);
}

.control-section { margin-bottom: 25px; text-align: left; }
.control-section label { display: block; font-size: 0.9rem; color: var(--text-dim); margin-bottom: 10px; }

.select-wrapper { position: relative; }
.select-wrapper select {
  width: 100%; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border);
  border-radius: 16px; padding: 15px 20px; color: white; font-size: 1rem; appearance: none;
}

.select-wrapper select option {
  background-color: #d3d3d3;
  color: #333;
}

.select-wrapper i { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }

#generate-btn {
  width: 100%; background: var(--primary-gradient); color: white; border: none;
  border-radius: 18px; padding: 20px; font-size: 1.15rem; font-weight: 700; cursor: pointer;
  display: flex; justify-content: center; align-items: center; gap: 12px;
  box-shadow: 0 10px 25px -5px var(--accent-glow); margin-bottom: 30px;
}

.result-area { display: flex; flex-direction: column; gap: 12px; margin-bottom: 30px; }
.result-row { display: flex; justify-content: center; gap: 8px; animation: slideDown 0.3s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.ball {
  width: 40px; height: 40px; border-radius: 10px; background: var(--primary-gradient);
  display: flex; justify-content: center; align-items: center; font-weight: 700;
}

.history-section { border-top: 1px solid var(--glass-border); padding-top: 30px; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.clear-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 0.8rem; }

.history-list { display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow-y: auto; }
.history-item {
  background: rgba(255, 255, 255, 0.03); border-radius: 12px; padding: 12px 15px;
  display: flex; justify-content: space-between; align-items: center;
}
.history-balls { display: flex; gap: 5px; }
.small-ball { background: rgba(124, 77, 255, 0.2); padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; font-weight: 600; }

.delete-btn { background: rgba(255, 77, 77, 0.1); border: none; color: #ff4d4d; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; }
.empty-state { text-align: center; color: var(--text-dim); padding: 20px 0; font-size: 0.9rem; }

.floating-emoji {
  position: absolute;
  font-size: 1.5rem;
  pointer-events: none;
  z-index: 10;
  animation: floatUpFade 1s ease-out forwards;
}

@keyframes floatUpFade {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-100px) scale(1.5); opacity: 0; }
}
