:root {
  --bg: #1a1410;
  --card-bg: #2a221c;
  --accent: #f59e0b;
  --accent2: #14b8a6;
  --text: #faf3ea;
  --muted: #a89888;
  --border: #3d342c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  background: linear-gradient(160deg, #1a1410 0%, #0f2824 100%);
  color: var(--text);
}

header {
  padding: 2rem 1.5rem 1rem;
  text-align: center;
}

h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin: 0;
  background: linear-gradient(100deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: pop 0.5s ease-out;
}

@keyframes pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.sub { color: var(--muted); margin: 0.5rem 0 0; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
}

.sidebar {
  background: rgba(42, 34, 28, 0.85);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
}

.sidebar h2 { font-family: "Fraunces", serif; font-size: 1.1rem; margin: 0 0 0.75rem; }

.inline { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; }
.inline input { flex: 1; }

input, button {
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
}

input { background: #1a1410; color: var(--text); }
button {
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s;
}
button:hover { transform: translateY(-1px); }

#deck-list { list-style: none; padding: 0; margin: 0; }
#deck-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 0.25rem;
}
#deck-list li.active { background: rgba(245, 158, 11, 0.15); border: 1px solid var(--accent); }
#deck-list .badge { font-size: 0.75rem; color: var(--muted); }

.io { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.file-btn {
  text-align: center;
  padding: 0.45rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.progress { font-size: 0.85rem; color: var(--accent2); margin-top: 0.75rem; }

.study { min-height: 420px; }

.hidden { display: none !important; }
.empty { color: var(--muted); text-align: center; padding: 4rem 1rem; }

.add-card {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  .add-card { grid-template-columns: 1fr; }
}

.card-scene { perspective: 1200px; display: flex; justify-content: center; margin: 1rem 0; }

.flashcard {
  width: min(100%, 420px);
  min-height: 220px;
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.flashcard.flipped { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  font-family: "Fraunces", serif;
  font-size: 1.35rem;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: linear-gradient(145deg, var(--card-bg), #1f3d38);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.face.back { transform: rotateY(180deg); background: linear-gradient(145deg, #1f3d38, var(--card-bg)); }

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.rate {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
  animation: slide-in 0.35s ease-out;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.rate .again { border-color: #f87171; color: #fecaca; }
.rate .good { border-color: var(--accent2); color: #99f6e4; }

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
