

@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800&display=swap');

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

:root {
  --primary: #6c63ff;
  --primary-dark: #5a52d5;
  --secondary: #ff6584;
  --accent: #43e97b;
  --bg: #1a1a2e;
  --bg2: #16213e;
  --bg3: #0f3460;
  --card: #1e2a45;
  --card2: #243154;
  --text: #e8eaf6;
  --text2: #b0bec5;
  --border: #2d3a5c;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --radius: 16px;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background animation */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(108,99,255,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255,101,132,0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(67,233,123,0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
}

/* Header */
.header {
  text-align: center;
  padding: 20px 0 30px;
}

.header-emoji {
  font-size: 3rem;
  display: block;
  margin-bottom: 8px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.header h1 {
  font-family: 'Fredoka One', cursive;
  font-size: 2.8rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.header p {
  color: var(--text2);
  font-size: 0.95rem;
  margin-top: 6px;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.card-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Category tags */
.categories-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 40px;
}

.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--primary);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  transition: all 0.2s;
}

.category-tag:hover {
  background: var(--primary);
  transform: translateY(-1px);
}

.category-tag button {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  transition: color 0.2s;
  display: flex;
  align-items: center;
}

.category-tag:hover button {
  color: white;
}

/* Input row */
.input-row {
  display: flex;
  gap: 8px;
}

.input-field {
  flex: 1;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.2);
}

.input-field::placeholder {
  color: var(--text2);
  font-weight: 400;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(108,99,255,0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(108,99,255,0.6);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--card2);
  border-color: var(--primary);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #38c96a);
  color: #1a1a2e;
  box-shadow: 0 4px 15px rgba(67,233,123,0.3);
}

.btn-accent:hover {
  box-shadow: 0 6px 20px rgba(67,233,123,0.5);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--secondary), #e0405e);
  color: white;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 16px;
  font-size: 1.1rem;
  border-radius: 14px;
}

/* Letter section */
.letter-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.letter-input {
  width: 70px;
  text-align: center;
  font-size: 2rem;
  font-family: 'Fredoka One', cursive;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.letter-badge {
  font-family: 'Fredoka One', cursive;
  font-size: 4rem;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 25px rgba(108,99,255,0.5);
  text-transform: uppercase;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  to { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Results */
.results-list {
  list-style: none;
}

.result-item {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.4s ease both;
}

.result-item:last-child {
  border-bottom: none;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.result-icon {
  font-size: 1.4rem;
  margin-right: 12px;
  min-width: 32px;
  text-align: center;
}

.result-category {
  font-size: 0.8rem;
  color: var(--text2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  flex: 1;
}

.result-word {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.result-word .highlight {
  color: var(--accent);
  font-size: 1.25rem;
}

/* Score badge */
.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-left: auto;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 30px;
  color: var(--text2);
}

.empty-state span {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 10px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--card2);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* PWA install banner */
.install-banner {
  background: linear-gradient(135deg, var(--bg3), var(--card2));
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.install-banner .install-text {
  flex: 1;
}

.install-banner .install-text strong {
  display: block;
  color: var(--primary);
  margin-bottom: 2px;
}

/* History section */
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

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

.history-letter {
  font-family: 'Fredoka One', cursive;
  font-size: 1.4rem;
  color: var(--primary);
  min-width: 30px;
}

.history-words {
  flex: 1;
  color: var(--text2);
  font-size: 0.8rem;
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* Step indicator */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.step {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s;
}

.step.active {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  width: 30px;
  border-radius: 5px;
}

.step.done {
  background: var(--accent);
}

/* Responsive */
@media (max-width: 400px) {
  .header h1 { font-size: 2.2rem; }
  .card { padding: 18px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
