.widget {
  margin: 1rem 0;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
  line-height: 1.5
}

.widget-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background-color: #fff;
  box-shadow: 0 1px 3px #0000001a
}

.widget-form>button[type=button]:last-child {
  align-self: flex-start;
  margin-top: .5rem;
  padding: .75rem 1.5rem;
  background-color: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .2s ease
}

.widget-button-group {
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.widget-button-group label {
  font-weight: 500;
  color: #374151;
  margin-bottom: .25rem
}

.widget-button-group div[role=group] {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap
}

.widget-form .widget-button-group button,
.widget-button-group button {
  padding: .5rem 1rem;
  border: 1px solid #d1d5db;
  background-color: #fff;
  color: #374151;
  border-radius: 6px;
  cursor: pointer;
  transition: all .2s ease;
  font-size: .875rem;
  font-weight: 500
}

.widget-form .widget-button-group button:hover,
.widget-button-group button:hover {
  background-color: #f9fafb;
  border-color: #9ca3af
}

.widget-form .widget-button-group button[aria-pressed=true],
.widget-button-group button[aria-pressed=true] {
  background-color: #3b82f6;
  color: #fff;
  border-color: #3b82f6
}

.widget-form .widget-button-group button:focus,
.widget-button-group button:focus {
  outline: none;
  box-shadow: 0 0 0 2px #3b82f6
}

.widget-button {
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.widget-button label {
  font-weight: 500;
  color: #374151
}

.widget-button input[type=text] {
  padding: .75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .875rem;
  background-color: #fff;
  transition: border-color .2s ease, box-shadow .2s ease
}

.widget-button input[type=text]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px #3b82f61a
}

.widget-button input[type=text]::placeholder {
  color: #9ca3af
}

.selector,
.selector-multi {
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.selector label,
.selector-multi-label {
  font-weight: 500;
  color: #374151
}

.selector select {
  padding: .75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .875rem;
  background-color: #fff;
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease
}

.selector select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px #3b82f61a
}

.selector option {
  padding: .5rem
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: .75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: #fff;
  max-height: 200px;
  overflow-y: auto
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  padding: .25rem 0;
  font-weight: 400
}

.checkbox-item input[type=checkbox] {
  margin: 0;
  cursor: pointer
}

.checkbox-item span {
  font-size: .875rem;
  color: #374151
}

.checkbox-item:hover {
  background-color: #f9fafb;
  border-radius: 4px;
  margin: -.25rem 0;
  padding: .5rem .25rem
}

.widget-slider {
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.widget-slider label {
  font-weight: 500;
  color: #374151
}

.slider-container {
  display: flex;
  flex-direction: column;
  gap: .25rem
}

.slider-values {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .75rem;
  color: #6b7280;
  margin-bottom: .25rem
}

.current-value {
  font-weight: 600;
  color: #3b82f6;
  background: #eff6ff;
  padding: .25rem .5rem;
  border-radius: 4px;
  min-width: 2rem;
  text-align: center
}

.min-value,
.max-value {
  font-weight: 500
}

.widget-slider input[type=range] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  outline: none;
  cursor: pointer
}

.widget-slider input[type=range]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  transition: background-color .2s ease
}

.widget-slider input[type=range]::-webkit-slider-thumb:hover {
  background: #2563eb
}

.widget-slider input[type=range]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: none;
  transition: background-color .2s ease
}

.widget-slider input[type=range]::-moz-range-thumb:hover {
  background: #2563eb
}

.widget-form>button[type=button]:last-child:hover {
  background-color: #2563eb
}

.widget-form>button[type=button]:last-child:focus {
  outline: none;
  box-shadow: 0 0 0 2px #3b82f6
}

.widget span[style*="color:red"] {
  color: #ef4444 !important;
  font-weight: 500;
  padding: .75rem;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  display: inline-block
}

.widget-mcq {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background-color: #fff
}

.mcq-question {
  font-weight: 600;
  font-size: 1.1rem;
  color: #1f2937;
  margin-bottom: .5rem
}

.mcq-choices {
  display: flex;
  flex-direction: column;
  gap: .75rem
}

.mcq-choice {
  padding: 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background-color: #fff;
  text-align: left;
  cursor: pointer;
  transition: all .2s ease;
  font-size: .9rem
}

.mcq-choice:hover:not(:disabled) {
  border-color: #9ca3af;
  background-color: #f9fafb
}

.mcq-choice-selected {
  border-color: #3b82f6;
  background-color: #eff6ff
}

.mcq-choice-correct {
  border-color: #10b981;
  background-color: #ecfdf5;
  color: #065f46
}

.mcq-choice-incorrect {
  border-color: #ef4444;
  background-color: #fef2f2;
  color: #991b1b
}

.mcq-choice:disabled {
  cursor: not-allowed;
  opacity: .8
}

.mcq-feedback {
  padding: .75rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: .9rem
}

.mcq-feedback.correct {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0
}

.mcq-feedback.incorrect {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca
}

.widget-saq {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background-color: #fff
}

.saq-question {
  font-weight: 600;
  font-size: 1.1rem;
  color: #1f2937;
  margin-bottom: .5rem
}

.saq-input-container {
  display: flex;
  gap: .75rem;
  align-items: stretch
}

.saq-input {
  flex: 1;
  padding: .75rem;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  font-size: .9rem;
  background-color: #fff;
  transition: border-color .2s ease, box-shadow .2s ease
}

.saq-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px #3b82f61a
}

.saq-input-correct {
  border-color: #10b981;
  background-color: #ecfdf5
}

.saq-input-incorrect {
  border-color: #ef4444;
  background-color: #fef2f2
}

.saq-submit {
  padding: .75rem 1.25rem;
  background-color: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .2s ease;
  white-space: nowrap
}

.saq-submit:hover:not(:disabled) {
  background-color: #2563eb
}

.saq-submit:disabled {
  opacity: .5;
  cursor: not-allowed
}

.saq-feedback {
  padding: .75rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: .9rem
}

.saq-feedback.correct {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0
}

.saq-feedback.incorrect {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca
}

@media (max-width: 640px) {
  .widget-button-group div[role=group] {
    flex-direction: column
  }

  .widget-button-group button {
    width: 100%
  }

  .widget-form {
    padding: 1rem
  }

  .saq-input-container {
    flex-direction: column
  }

  .widget-mcq,
  .widget-saq{
    padding: 1rem
  }
}

.widget-quiz {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 2px 8px #0000001a
}

.quiz-header {
  padding: 1rem 1rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  border-radius: 12px 12px 0 0
}

.quiz-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0px;
  text-align: center;
  color: #fff !important
}

.quiz-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  color: #fff
}

.quiz-progress {
  flex: 1;
  min-width: 200px
}

.quiz-progress-text {
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: .5rem;
  display: block;
  color: #fff
}

.quiz-progress-bar {
  width: 100%;
  height: 8px;
  background: #fff3;
  border-radius: 4px;
  overflow: hidden
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 4px;
  transition: width .3s ease
}

.quiz-score {
  text-align: right
}

.quiz-score-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff
}

.quiz-questions {
  padding: 10px
}

.quiz-question {
  margin-bottom: 1.5rem;
  padding: 10px;
  border: 2px solid #f1f5f9;
  border-radius: 12px;
  background: #fafbfc;
  transition: all .2s ease
}

.quiz-question:hover {
  border-color: #e2e8f0;
  box-shadow: 0 2px 4px #0000000d
}

.quiz-question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 1rem
}

.quiz-question-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
  flex: 1
}

.quiz-question-points {
  background: #3b82f6;
  color: #fff;
  padding: .25rem .75rem;
  border-radius: 10px;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: .75rem
}

.quiz-choice {
  padding: 1rem 1.25rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: all .2s ease;
  font-size: .95rem;
  font-weight: 500
}

.quiz-choice:hover:not(:disabled) {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateY(-1px)
}

.quiz-choice-selected {
  border-color: #3b82f6;
  background: #eff6ff
}

.quiz-choice-correct {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46
}

.quiz-choice-incorrect {
  border-color: #ef4444;
  background: #fef2f2;
  color: #991b1b
}

.quiz-choice:disabled {
  cursor: not-allowed;
  opacity: .9
}

.quiz-input-container {
  display: flex;
  gap: 10px;
  align-items: stretch
}

.quiz-input {
  flex: 1;
  padding: 10px;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  font-size: .95rem;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease
}

.quiz-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px #3b82f61a
}

.quiz-input-correct {
  border-color: #10b981;
  background: #ecfdf5
}

.quiz-input-incorrect {
  border-color: #ef4444;
  background: #fef2f2
}

.quiz-submit {
  padding: 10px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s ease;
  white-space: nowrap
}

.quiz-submit:hover:not(:disabled) {
  background: #2563eb
}

.quiz-submit:disabled {
  opacity: .5;
  cursor: not-allowed
}

.quiz-feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: .95rem
}

.quiz-feedback.correct {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0
}

.quiz-feedback.incorrect {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca
}

.quiz-summary {
  margin-top: 2rem;
  padding: 2rem;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
  border-radius: 8px;
  text-align: center;
  border: 2px solid #e2e8f0
}

.quiz-summary h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 1rem
}

.quiz-final-score {
  font-size: 1.2rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 1rem
}

.quiz-result {
  font-size: 1.1rem;
  font-weight: 700;
  padding: .75rem 1.5rem;
  border-radius: 6px;
  display: inline-block
}

.quiz-result.passed {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0
}

.quiz-result.failed {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca
}

.markdown-preview {
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  background: #fff;
  overflow: hidden
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e1e5e9
}

.preview-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #24292f
}

.preview-info {
  display: flex;
  gap: 8px
}

.feature-badge {
  padding: 4px 8px;
  font-size: 11px;
  background: #ddf4ff;
  color: #0969da;
  border: 1px solid #b6e3ff;
  border-radius: 12px;
  font-weight: 500
}

.updating-badge {
  padding: 4px 8px;
  font-size: 11px;
  background: #fff8dc;
  color: #9a6700;
  border: 1px solid #d1ac00;
  border-radius: 12px;
  font-weight: 500;
  animation: pulse 1s infinite
}

@keyframes pulse {

  0%,
  to {
    opacity: 1
  }

  50% {
    opacity: .6
  }
}

.preview-content {
  flex: 1;
  padding: 10px;
  padding-top: 0px;
  overflow-y: auto;
  background: #fff
}

.empty-preview {
  text-align: center;
  color: #6e7681;
  padding: 40px 20px
}

.empty-preview p {
  margin: 8px 0
}

.empty-preview pre {
  background: #f6f8fa;
  border: 1px solid #d1d9e0;
  border-radius: 6px;
  padding: 16px;
  margin: 16px 0;
  text-align: left;
  font-size: 13px;
  color: #24292f
}

.empty-preview code {
  font-family: SFMono-Regular, Monaco, Inconsolata, Roboto Mono, monospace
}

.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
  margin-top: 24px;
  margin-bottom: 16px;
  font-weight: 600;
  line-height: 1.25;
  color: #24292f
}

.preview-content h1 {
  font-size: 2em;
  border-bottom: 1px solid #d1d9e0;
  padding-bottom: 10px
}

.preview-content h2 {
  font-size: 1.5em;
  border-bottom: 1px solid #d1d9e0;
  padding-bottom: 8px
}

.preview-content p {
  margin-bottom: 16px;
  line-height: 1.6;
  color: #24292f;
  margin-block-end: 10px;
  margin-block-start: 10px;
}

.preview-content pre {
  background: #f6f8fa;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.45
}

.preview-content code {
  background: #f6f8fa;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 85%
}

.preview-content pre code {
  background: transparent;
  padding: 0
}

.preview-content blockquote {
  padding: 0 16px;
  margin: 0 0 16px;
  color: #6e7681;
  border-left: 4px solid #d1d9e0
}

.preview-content ul,
.preview-content ol {
  margin-bottom: 16px;
  padding-left: 2em
}

.preview-content li {
  margin-bottom: 4px
}

.preview-content table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 16px
}

.preview-content th,
.preview-content td {
  border: 1px solid #d1d9e0;
  padding: 8px 12px;
  text-align: left
}

.preview-content th {
  background: #f6f8fa;
  font-weight: 600
}

.loading-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #6e7681;
  font-size: 14px;
  background: #f8f9fa;
  border-radius: 6px;
  margin: 10px 0
}

.loading-preview:before {
  content: "";
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border: 2px solid #e1e5e9;
  border-top: 2px solid #0969da;
  border-radius: 50%;
  animation: spin 1s linear infinite
}

@keyframes spin {
  0% {
    transform: rotate(0)
  }

  to {
    transform: rotate(360deg)
  }
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #f6f8fa
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column
}

.app-header {
  background: #fff;
  border-bottom: 1px solid #e1e5e9;
  padding: 16px 24px;
  text-align: center;
  box-shadow: 0 1px 3px #0000001a
}

.app-header h1 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 600;
  color: #24292f
}

.app-header p {
  margin: 0;
  font-size: 14px;
  color: #6e7681
}

.app-main {
  flex: 1;
  display: flex;
  min-height: 0
}

.preview-container {
  min-height: 0
}

.preview-container.full-width {
  flex: 1;
  width: 100%
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px
}

::-webkit-scrollbar-track {
  background: #f1f3f4;
  border-radius: 4px
}

::-webkit-scrollbar-thumb {
  background: #c1c8cd;
  border-radius: 4px
}

::-webkit-scrollbar-thumb:hover {
  background: #a8b2b9
}

* {
  scrollbar-width: thin;
  scrollbar-color: #c1c8cd #f1f3f4
}