:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #5b6776;
  --line: #d8e0e8;
  --accent: #0b6f6a;
  --accent-strong: #07524f;
  --warn: #b54708;
  --soft: #f7f9fb;
  --focus: #2f80ed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  max-width: 1180px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

.panel,
.question-list,
.editor {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upload-panel {
  padding: 18px;
}

.dropzone {
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 24px;
  place-items: center;
  text-align: center;
  background: var(--soft);
  border: 1px dashed #9badbd;
  border-radius: 8px;
  cursor: pointer;
}

.dropzone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.drop-title {
  font-size: 20px;
  font-weight: 700;
}

.drop-detail,
.status,
label {
  color: var(--muted);
}

.controls-row {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.quill-editor {
  background: #fff;
}

.ql-toolbar.ql-snow {
  border-color: var(--line);
  border-radius: 6px 6px 0 0;
}

.ql-container.ql-snow {
  min-height: 220px;
  border-color: var(--line);
  border-radius: 0 0 6px 6px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
}

.answer-editor.ql-container {
  min-height: 120px;
}

.ql-editor img {
  max-width: 100%;
  height: auto;
}

.cloze-preview {
  min-height: 220px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
}

.cloze-preview table {
  border-collapse: collapse;
}

.cloze-input {
  min-width: 96px;
  max-width: 100%;
  height: 34px;
  padding: 4px 8px;
  color: var(--ink);
  border: 1px solid #8c98a6;
  border-radius: 2px;
}

.cloze-preview td .cloze-input,
.cloze-preview th .cloze-input {
  width: 100%;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 750;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary,
.secondary {
  min-height: 42px;
  padding: 0 16px;
}

.primary {
  color: #fff;
  background: var(--accent);
}

.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.secondary {
  color: #fff;
  background: #264653;
}

.preview-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  margin-top: 16px;
  height: calc(100vh - 250px);
  min-height: 520px;
}

.hidden {
  display: none;
}

.question-list {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.list-header {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

#questionList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.question-button {
  width: 100%;
  padding: 13px 16px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
}

.question-button.active {
  background: #e7f3f1;
  border-left: 4px solid var(--accent);
}

.question-type {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.editor {
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
}

.editor-header {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 10px;
  margin-bottom: 16px;
}

.assessment-title {
  font-size: 22px;
  font-weight: 750;
}

.icon-button {
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--accent);
  font-size: 24px;
}

.question-editor {
  display: grid;
  gap: 14px;
}

.editor-row {
  display: grid;
  grid-template-columns: 1fr 170px 120px;
  gap: 12px;
}

.answers {
  display: grid;
  gap: 10px;
}

.answer-row {
  display: grid;
  grid-template-columns: 34px 1fr 42px;
  gap: 10px;
  align-items: start;
}

.answer-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.danger {
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--warn);
}

.status {
  min-height: 24px;
  margin: 14px 0 0;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 16px;
  }

  .topbar,
  .controls-row,
  .preview-grid,
  .editor-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }
}
