:root {
  --bg: #0a0a0a;
  --bg-2: #141414;
  --bg-3: #1c1c1c;
  --orange: #ff7a18;
  --orange-2: #ffa94d;
  --orange-soft: #ff7a1833;
  --text: #f5f5f5;
  --text-dim: #b8b8b8;
  --green: #4ade80;
  --red: #ef4444;
  --border: #2a2a2a;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top, #1a0d00 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.topbar {
  background: var(--bg-2);
  border-bottom: 2px solid var(--orange);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(255, 122, 24, 0.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  font-size: 2rem;
  color: var(--orange);
  filter: drop-shadow(0 0 8px var(--orange));
}

.brand h1 {
  font-size: 1.5rem;
  background: linear-gradient(90deg, var(--orange), var(--orange-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tab {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.tab:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.tab.active {
  background: var(--orange);
  color: #000;
  border-color: var(--orange);
  font-weight: 600;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view h2 {
  color: var(--orange);
  font-size: 2rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--orange-soft);
  padding-bottom: 0.5rem;
}

/* HOME */
.hero {
  text-align: center;
  padding: 2rem 0;
}

.hero h2 {
  font-size: 2.8rem;
  border: none;
  background: linear-gradient(90deg, var(--orange), var(--orange-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero > p {
  color: var(--text-dim);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.25s;
  text-align: left;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--orange);
  box-shadow: 0 8px 24px rgba(255, 122, 24, 0.25);
}

.card h3 {
  color: var(--orange);
  margin-bottom: 0.5rem;
}

.card p { color: var(--text-dim); font-size: 0.9rem; }

.stats-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.stat {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  min-width: 140px;
}

.stat span {
  display: block;
  font-size: 2rem;
  color: var(--orange);
  font-weight: 700;
}

.stat label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* NOTES */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.note-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange);
  padding: 1.25rem;
  border-radius: 8px;
}

.note-card h3 {
  color: var(--orange);
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
}

.note-card ul { padding-left: 1.25rem; }
.note-card li { margin-bottom: 0.4rem; color: var(--text-dim); font-size: 0.92rem; }
.note-card li strong { color: var(--text); }

/* FLASHCARDS */
.flash-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.flash-controls button {
  background: var(--bg-2);
  color: var(--orange);
  border: 1px solid var(--orange);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.flash-controls button:hover { background: var(--orange); color: #000; }

#flash-progress {
  color: var(--text-dim);
  padding: 0 1rem;
  font-weight: 600;
}

.flashcard {
  perspective: 1000px;
  width: 100%;
  max-width: 600px;
  height: 320px;
  margin: 0 auto;
  cursor: pointer;
}

.flash-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

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

.flash-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  background: var(--bg-2);
  border: 2px solid var(--orange);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  font-size: 1.3rem;
  box-shadow: 0 8px 32px rgba(255, 122, 24, 0.2);
}

.flash-back {
  transform: rotateY(180deg);
  background: linear-gradient(135deg, #1a0d00, var(--bg-2));
  color: var(--orange-2);
}

.hint {
  text-align: center;
  color: var(--text-dim);
  margin-top: 1rem;
  font-size: 0.85rem;
}

/* QUIZ */
.quiz-start, #quiz-end {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--bg-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.btn-primary {
  background: var(--orange);
  color: #000;
  border: none;
  padding: 0.75rem 1.75rem;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  margin-top: 1rem;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--orange-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 122, 24, 0.4);
}

.quiz-bar {
  display: flex;
  justify-content: space-between;
  background: var(--bg-2);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quiz-bar strong { color: var(--orange); }

.progress {
  background: var(--bg-3);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-2));
  width: 0%;
  transition: width 0.3s;
}

#q-text {
  background: var(--bg-2);
  padding: 1.5rem;
  border-radius: 10px;
  border-left: 4px solid var(--orange);
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
}

.choices {
  display: grid;
  gap: 0.75rem;
}

.choice {
  background: var(--bg-2);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  transition: all 0.2s;
}

.choice:hover:not(:disabled) {
  border-color: var(--orange);
  background: var(--bg-3);
}

.choice.correct {
  background: rgba(74, 222, 128, 0.15);
  border-color: var(--green);
  color: var(--green);
}

.choice.wrong {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--red);
  color: var(--red);
}

.feedback {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 8px;
  display: none;
}

.feedback.show { display: block; }
.feedback.correct { background: rgba(74, 222, 128, 0.1); color: var(--green); border: 1px solid var(--green); }
.feedback.wrong { background: rgba(239, 68, 68, 0.1); color: var(--red); border: 1px solid var(--red); }

.hidden { display: none !important; }

/* MATCH */
.match-bar {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  background: var(--bg-2);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

.match-bar strong { color: var(--orange); }

.match-bar button {
  margin-left: auto;
  background: var(--orange);
  color: #000;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.match-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.match-item {
  background: var(--bg-2);
  border: 2px solid var(--border);
  padding: 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.match-item:hover { border-color: var(--orange); }
.match-item.selected { border-color: var(--orange); background: var(--orange-soft); }
.match-item.matched { background: rgba(74, 222, 128, 0.15); border-color: var(--green); color: var(--green); cursor: default; pointer-events: none; }
.match-item.wrong-flash { animation: shake 0.4s; border-color: var(--red); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* CASES */
.case-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--orange);
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.case-card h3 { color: var(--orange); margin-bottom: 0.5rem; }
.case-card p { color: var(--text-dim); margin-bottom: 0.75rem; }

.case-card input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem;
  border-radius: 6px;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  width: 200px;
}

.case-card input:focus { outline: none; border-color: var(--orange); }

.case-output {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-3);
  border-radius: 8px;
  border-left: 3px solid var(--orange);
}

.case-output ul { margin-left: 1.25rem; margin-top: 0.5rem; }
.case-output strong { color: var(--orange); }

/* ANATOMY */
.anatomy-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 768px) {
  .anatomy-wrap { grid-template-columns: 1fr; }
  .match-grid { grid-template-columns: 1fr; }
}

.heart-svg {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: block;
  filter: drop-shadow(0 0 20px rgba(255, 122, 24, 0.3));
}

.heart-svg .hot {
  cursor: pointer;
  transition: all 0.2s;
}

.heart-svg .hot:hover {
  r: 18;
  filter: drop-shadow(0 0 8px var(--orange));
}

.anatomy-info {
  background: var(--bg-2);
  padding: 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.anatomy-info h3 { color: var(--orange); margin-bottom: 0.5rem; }
.anatomy-info hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.anatomy-info ul { padding-left: 1.25rem; }
.anatomy-info li { margin-bottom: 0.4rem; color: var(--text-dim); font-size: 0.9rem; }
.anatomy-info li strong { color: var(--text); }

footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
