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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.6;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #16213e;
}

h1 {
  font-size: 1.5rem;
  color: #00d9ff;
}

.settings-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
  transition: color 0.2s;
}

.settings-btn:hover {
  color: #00d9ff;
}

.settings {
  background: #16213e;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  gap: 20px;
}

.settings.hidden {
  display: none;
}

.settings label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.settings input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

main {
  background: #16213e;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 20px;
}

.question-header {
  margin-bottom: 20px;
  color: #00d9ff;
  font-weight: 600;
}

.question-content {
  margin-bottom: 25px;
}

.question-text {
  margin-bottom: 20px;
}

.question-text p {
  margin-bottom: 10px;
}

.code-block {
  margin-bottom: 20px;
}

.code-block pre {
  background: #0f0f23;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  border: 1px solid #333;
}

.code-block code {
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.9rem;
}

/* Override highlight.js background to match our theme */
.code-block pre code.hljs {
  background: transparent;
  padding: 0;
}

/* Drag-and-drop blanks */
.blank {
  display: inline-block;
  background: #2a2a4e;
  border: 2px dashed #ffcc00;
  border-radius: 4px;
  padding: 2px 12px;
  margin: 0 2px;
  color: #ffcc00;
  font-weight: bold;
  min-width: 60px;
  text-align: center;
}

/* Blanks in code blocks - highlight via CSS */
.code-block code {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.options-block {
  background: #1a1a2e;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #333;
}

.options-block ul {
  list-style: none;
  padding-left: 0;
}

.options-block li {
  padding: 8px 0;
  border-bottom: 1px solid #333;
}

.options-block li:last-child {
  border-bottom: none;
}

.options-block pre {
  background: #0f0f23;
  padding: 10px;
  border-radius: 6px;
  margin: 8px 0;
  overflow-x: auto;
}

.options-block code {
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
}

.options-block pre code.hljs {
  background: transparent;
  padding: 0;
}

.spoilers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spoiler {
  background: #1a1a2e;
  border-radius: 8px;
  border: 1px solid #333;
  overflow: hidden;
}

.spoiler summary {
  padding: 12px 15px;
  cursor: pointer;
  font-weight: 600;
  color: #ffcc00;
  transition: background 0.2s;
}

.spoiler summary:hover {
  background: #222244;
}

.spoiler summary::-webkit-details-marker {
  color: #ffcc00;
}

.spoiler-content {
  padding: 15px;
  border-top: 1px solid #333;
  background: #0f0f23;
}

.spoiler-content p {
  margin-bottom: 10px;
}

.spoiler-content p:last-child {
  margin-bottom: 0;
}

.spoiler-content strong {
  color: #00d9ff;
}

.spoiler-content code {
  background: #1a1a2e;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  color: #a9dc76;
}

.spoiler-content pre {
  background: #1a1a2e;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 10px 0;
}

.spoiler-content ol,
.spoiler-content ul {
  padding-left: 20px;
  margin: 10px 0;
}

.spoiler-content li {
  margin-bottom: 5px;
}

.image-container img {
  max-width: 100%;
  border-radius: 8px;
  cursor: pointer;
}

.image-container img:hover {
  opacity: 0.9;
}

.navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 15px;
  background: #16213e;
  border-radius: 12px;
}

.nav-btn {
  background: #00d9ff;
  color: #1a1a2e;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}

.nav-btn:hover {
  background: #00b8d9;
}

.nav-btn:active {
  transform: scale(0.98);
}

.nav-btn:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
}

.nav-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-input input {
  width: 60px;
  padding: 8px;
  text-align: center;
  border: 2px solid #333;
  border-radius: 6px;
  background: #1a1a2e;
  color: #eee;
  font-size: 1rem;
}

.nav-input input:focus {
  outline: none;
  border-color: #00d9ff;
}

.nav-input span {
  color: #888;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 10px;
  }

  header h1 {
    font-size: 1.2rem;
  }

  main {
    padding: 15px;
  }

  .settings {
    flex-direction: column;
    gap: 10px;
  }

  .navigation {
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav-btn {
    padding: 8px 15px;
  }
}

/* Loading state */
.loading {
  text-align: center;
  padding: 50px;
  color: #888;
}

/* Error state */
.error {
  background: #ff4444;
  color: white;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
}

/* Lightbox Modal */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.lightbox.hidden {
  display: none;
}

.lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: #16213e;
  border-bottom: 1px solid #333;
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lightbox-btn {
  background: #2a2a4e;
  color: #eee;
  border: 1px solid #444;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.lightbox-btn:hover {
  background: #3a3a5e;
}

#zoomLevel {
  color: #00d9ff;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
}

.lightbox-close {
  background: none;
  border: none;
  color: #ff6666;
  font-size: 2rem;
  cursor: pointer;
  padding: 0 10px;
  line-height: 1;
  transition: color 0.2s;
}

.lightbox-close:hover {
  color: #ff4444;
}

.lightbox-content {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: grab;
}

.lightbox-content.dragging {
  cursor: grabbing;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 100%;
  transition: transform 0.1s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-content img.zoomed {
  max-width: none;
  max-height: none;
}

/* Drag-and-drop interactive styles */
.drag-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 15px;
  background: #1a1a2e;
  border-radius: 8px;
  margin-bottom: 15px;
}

.draggable-item {
  background: #00d9ff;
  color: #1a1a2e;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: move;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.1s;
  user-select: none;
}

.draggable-item:hover {
  transform: scale(1.02);
}

.draggable-item.dragging {
  opacity: 0.5;
}

.drop-zone {
  min-width: 80px;
  min-height: 1.5em;
  transition: all 0.2s;
}

.drop-zone.drag-over {
  border-color: #00d9ff;
  background: #333355;
  box-shadow: 0 0 8px rgba(0, 217, 255, 0.3);
}

.drop-zone.filled {
  background: #2a4a2a;
  border-style: solid;
  color: #a9dc76;
}

.drop-zone.correct {
  background: #1a4a1a;
  border-color: #4a4;
}

.drop-zone.incorrect {
  background: #4a1a1a;
  border-color: #a44;
}

.drag-drop-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.drag-drop-controls button {
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.drag-drop-controls .check-btn {
  background: #4a4;
  color: white;
}

.drag-drop-controls .check-btn:hover {
  background: #3a3;
}

.drag-drop-controls .reset-btn {
  background: #666;
  color: white;
}

.drag-drop-controls .reset-btn:hover {
  background: #555;
}
