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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
  padding: 1.5rem;
}

header {
  text-align: center;
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: 2.5rem;
  color: #e94560;
  letter-spacing: 0.05em;
}

.subtitle {
  color: #888;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Topic navigation */
nav#topic-nav {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

#topic-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #16213e;
  color: #e0e0e0;
  border: 1px solid #2a2a4a;
  padding: 0.6rem 1.2rem;
  border-radius: 0.6rem;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
  width: 320px;
  justify-content: space-between;
}

#topic-toggle:hover {
  border-color: #e94560;
}

#topic-toggle[aria-expanded="true"] {
  border-color: #e94560;
  border-radius: 0.6rem 0.6rem 0 0;
}

#topic-toggle .chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
}

#topic-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

#topic-list {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  max-height: 60vh;
  overflow-y: auto;
  background: #16213e;
  border: 1px solid #e94560;
  border-top: none;
  border-radius: 0 0 0.6rem 0.6rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

#topic-list.hidden {
  display: none !important;
}

#topic-list::-webkit-scrollbar {
  width: 6px;
}
#topic-list::-webkit-scrollbar-track {
  background: transparent;
}
#topic-list::-webkit-scrollbar-thumb {
  background: #2a2a4a;
  border-radius: 3px;
}

.topic-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: transparent;
  color: #a0a0b0;
  border: none;
  border-bottom: 1px solid #1e2e50;
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.88rem;
  text-align: left;
  transition: all 0.15s;
}

.topic-btn:last-child {
  border-bottom: none;
}

.topic-btn:hover {
  background: #1a2b4e;
  color: #fff;
}

.topic-btn.active {
  background: #1e1e3e;
  color: #e94560;
  font-weight: 600;
}

.topic-name {
  flex: 1;
  min-width: 0;
}

.topic-count {
  flex-shrink: 0;
  background: #0f1e3d;
  color: #7eb8da;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  min-width: 1.6rem;
  text-align: center;
}

.topic-btn.active .topic-count {
  background: #e94560;
  color: #fff;
}

/* Mode toggle */
#mode-toggle {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.mode-btn {
  background: transparent;
  color: #888;
  border: 1px solid #333;
  padding: 0.4rem 1.2rem;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.mode-btn.active {
  color: #fff;
  border-color: #e94560;
}

/* Card */
#card {
  max-width: 600px;
  margin: 0 auto 1.5rem;
  background: #16213e;
  border-radius: 1rem;
  padding: 2.5rem 2rem;
  text-align: center;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

#card-topic {
  font-size: 0.75rem;
  color: #e94560;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#card-prompt {
  font-size: 1.8rem;
  color: #fff;
  line-height: 1.4;
}

#card-answer {
  font-size: 1.4rem;
  color: #53d8a8;
  border-top: 1px solid #333;
  padding-top: 1rem;
  line-height: 1.4;
}

#card-context {
  font-size: 0.85rem;
  color: #777;
  font-style: italic;
}

.hidden {
  display: none !important;
}

/* Controls */
#controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

#controls button {
  padding: 0.7rem 2rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

#btn-reveal {
  background: #e94560;
  color: #fff;
}

#btn-reveal:hover {
  background: #d63850;
}

#btn-next {
  background: #0f3460;
  color: #fff;
}

#btn-next:hover {
  background: #1a4a80;
}

#score {
  text-align: center;
  color: #666;
  font-size: 0.85rem;
}

/* Read mode */
#read-view {
  max-width: 800px;
  margin: 0 auto;
}

#notes-content {
  background: #16213e;
  border-radius: 1rem;
  padding: 2rem 2.5rem;
  line-height: 1.7;
  font-family: inherit;
  font-size: 0.95rem;
}

/* Headings */
#notes-content h2 {
  color: #e94560;
  font-size: 1.4rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #2a2a4a;
}

#notes-content h2:first-child {
  margin-top: 0;
}

#notes-content h3 {
  color: #53d8a8;
  font-size: 1.15rem;
  margin: 1.8rem 0 0.6rem;
}

#notes-content h4 {
  color: #7eb8da;
  font-size: 1.02rem;
  margin: 1.4rem 0 0.5rem;
}

#notes-content h5 {
  color: #b0a0d0;
  font-size: 0.95rem;
  margin: 1rem 0 0.4rem;
}

/* Paragraphs */
#notes-content p {
  margin: 0.6rem 0;
  color: #c8c8d8;
}

/* Bold / strong — used for grammar terms */
#notes-content strong {
  color: #f0c040;
  font-weight: 600;
}

/* Inline code */
#notes-content code {
  background: #0d1a30;
  color: #7eb8da;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.88rem;
  font-family: "JetBrains Mono", "Fira Code", monospace;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 0.8rem 0;
  border-radius: 0.5rem;
  border: 1px solid #2a2a4a;
}

#notes-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

#notes-content th {
  background: #0f1e3d;
  color: #e94560;
  font-weight: 600;
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 2px solid #2a2a4a;
  white-space: nowrap;
}

#notes-content td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid #1e2e50;
  color: #d0d0e0;
}

#notes-content tr:last-child td {
  border-bottom: none;
}

#notes-content tr:hover td {
  background: #1a2b4e;
}

/* Georgian text in tables gets a slightly larger size */
#notes-content td:first-child {
  font-size: 0.95rem;
}

/* Lists */
#notes-content ul,
#notes-content ol {
  margin: 0.5rem 0 0.5rem 1.5rem;
  color: #c8c8d8;
}

#notes-content li {
  margin: 0.3rem 0;
  padding-left: 0.3rem;
}

#notes-content ul li::marker {
  color: #e94560;
}

#notes-content ol li::marker {
  color: #53d8a8;
}

/* Responsive */
@media (max-width: 600px) {
  body {
    padding: 1rem;
  }
  header h1 {
    font-size: 2rem;
  }
  #card {
    padding: 1.5rem 1rem;
  }
  #card-prompt {
    font-size: 1.4rem;
  }
  #notes-content {
    padding: 1.2rem 1rem;
  }
  #notes-content th,
  #notes-content td {
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
  }
}
