body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; transition: padding-right 0.25s ease; }
body.scratch-open { padding-right: var(--scratch-width); }
.option-btn { transition: all 0.2s; }
.option-btn:hover:not(.disabled) { transform: translateX(4px); }
.option-correct { background: #dcfce7 !important; border-color: #16a34a !important; }
.option-wrong { background: #fef2f2 !important; border-color: #dc2626 !important; }
.option-selected { border-color: #2563eb !important; background: #eff6ff !important; }
.fade-in { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.tab-active { border-bottom: 3px solid #2563eb; color: #2563eb; font-weight: 600; }
.progress-ring { transform: rotate(-90deg); }
/* Question tables */
.question-text table { border-collapse: collapse; margin: 12px 0; width: auto; font-size: 0.9em; }
.question-text th, .question-text td { border: 1px solid #d1d5db; padding: 6px 12px; text-align: center; }
.question-text th { background: #f3f4f6; font-weight: 600; }
.question-text td:first-child, .question-text th:first-child { text-align: left; }
.question-text img { max-width: 100%; height: auto; margin: 12px 0; border-radius: 4px; }
/* Scratch paper */
:root { --scratch-width: clamp(280px, 25vw, 520px); }
.scratch-panel {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: var(--scratch-width);
  background: #ffffff;
  box-shadow: -4px 0 16px rgba(0,0,0,0.1);
  z-index: 99;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.scratch-panel.open { transform: translateX(0); }
.scratch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
  flex-shrink: 0;
}
.scratch-textarea {
  flex: 1;
  width: 100%;
  border: none;
  resize: none;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  outline: none;
  font-family: inherit;
  background: #ffffff;
  color: #1f2937;
}
.scratch-toggle-btn {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  writing-mode: vertical-rl;
  background: #2563eb;
  color: white;
  padding: 14px 7px;
  border-radius: 8px 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: -2px 0 8px rgba(37,99,235,0.25);
  transition: right 0.25s ease, background 0.15s;
  border: none;
  letter-spacing: 0.05em;
}
.scratch-toggle-btn:hover { background: #1d4ed8; }
.scratch-toggle-btn.open { right: var(--scratch-width); }
/* Custom modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; animation: modalFadeIn 0.2s ease-out; }
.modal-box { background: white; border-radius: 16px; padding: 28px; max-width: 380px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.2); animation: modalSlideUp 0.25s ease-out; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideUp { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
