body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f8fa;
  color: #1f2937;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.hidden {
  display: none !important;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  font-size: 14px;
  color: #374151;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-secondary {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #f3f4f6;
}

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.auth-card h1 {
  margin-top: 0;
}

.google-signin-mount {
  display: flex;
  justify-content: center;
  margin: 20px 0 12px;
  min-height: 44px;
}

.auth-gate-status {
  font-size: 14px;
  color: #b45309;
  min-height: 1.25em;
}

h1 {
  margin-bottom: 8px;
}

.sub {
  margin-top: 0;
  color: #4b5563;
}

.panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  margin: 16px 0;
}

.row,
.row-between {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.row-between {
  justify-content: space-between;
}

.gap {
  gap: 8px;
}

.align-center {
  align-items: center;
}

.quiz-meta {
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.quiz-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
  align-items: start;
}

.quiz-col-main,
.quiz-col-feedback {
  min-width: 0;
}

.quiz-col-feedback {
  border-left: 1px solid #e5e7eb;
  padding-left: 24px;
}

.quiz-actions {
  margin-top: 4px;
}

.explanation-panel {
  margin-top: 0;
}

.explanation-panel:not([open]) > :not(summary) {
  display: none;
}

.explanation-panel:not([open]) summary {
  color: #9ca3af;
}

.explanation-panel summary {
  font-weight: 700;
  font-size: 15px;
  color: #374151;
  cursor: pointer;
  margin-bottom: 8px;
}

#answerText {
  margin: 0 0 8px;
  font-weight: 700;
  color: #059669;
}

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

  .quiz-col-feedback {
    border-left: none;
    padding-left: 0;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
  }
}

.question-tags {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #6b7280;
  word-break: break-word;
}

.jump-row input[type="number"] {
  width: 4.25rem;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
}

.jump-label {
  margin: 0;
}

.jump-hint {
  font-size: 12px;
  color: #b45309;
  max-width: 200px;
}

.favorite-btn {
  font-size: 1.15rem;
  line-height: 1;
  padding: 6px 10px;
  min-width: 2.25rem;
}

.favorite-btn[aria-pressed="true"] {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #b45309;
}

label {
  font-size: 14px;
  color: #374151;
}

select,
button {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

button {
  cursor: pointer;
}

button:hover {
  background: #f3f4f6;
}

.danger-btn {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.danger-btn:hover {
  background: #fee2e2;
}

#questionText {
  font-size: 1.1rem;
  line-height: 1.6;
}

.md-content strong {
  font-weight: 700;
}

.md-content code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.95em;
}

#explanationText.md-content {
  margin: 8px 0 0;
  white-space: normal;
}

.choice-text {
  vertical-align: baseline;
}

.choice-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin: 8px 0;
  padding: 10px;
  background: #fff;
}

.choice-item.correct {
  border-color: #10b981;
  background: #ecfdf5;
}

.choice-item.wrong {
  border-color: #ef4444;
  background: #fef2f2;
}

.choice-item label {
  display: block;
  cursor: pointer;
}

.result {
  margin-top: 12px;
  font-weight: 700;
}

.ok {
  color: #059669;
}

.ng {
  color: #dc2626;
}

.status {
  color: #374151;
  font-size: 14px;
}

.hidden {
  display: none;
}

details {
  margin-top: 12px;
}

.editor-grid {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 10px;
  align-items: center;
  margin-bottom: 10px;
}

#editorPanel label {
  display: block;
  margin-top: 10px;
  margin-bottom: 4px;
}

#editorPanel textarea,
#editorPanel input,
#editorPanel select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}
