:root {
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: #161616;
  background: #c5c5c5;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
.hidden { display: none !important; }

/* Preparation screen */
.setup-layout {
  min-height: 100vh;
  padding: 28px;
  background: #c5c5c5;
}

.setup-main {
  max-width: 1080px;
  min-height: calc(100vh - 56px);
  margin: 0 auto;
  background: #e8e8e8;
  border: 2px solid;
  border-color: #fff #777 #777 #fff;
  box-shadow: 1px 1px 0 #555;
}

.setup-content { padding: 0 29px 20px; }
.legacy-title {
  display: flex;
  align-items: baseline;
  gap: 15px;
  margin: 0 -29px 27px;
  padding: 15px 19px 14px;
  background: #12316b;
  border-bottom: 3px solid #7b7b7b;
  color: #fff;
}
.legacy-title span { font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.legacy-title strong { font-size: 17px; }
.legacy-title small { margin-left: auto; color: #dce4f2; font-size: 11px; }
.module-switch { display: flex; gap: 0; margin: 0 0 23px; border-bottom: 1px solid #929292; }
.module-switch a { padding: 9px 19px; border: 1px solid #929292; border-bottom: 0; background: #d9d9d9; color: #242424; font-size: 12px; font-weight: 700; text-decoration: none; }
.module-switch a + a { border-left: 0; }
.module-switch a.active { background: #f7f7f7; box-shadow: inset 0 3px #12316b; }
.module-switch a:hover { background: #fff; }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 17px;
  padding: 0 1px 11px;
  border-bottom: 1px solid #919191;
}
.section-heading > div { display: flex; align-items: center; gap: 11px; }
.section-heading h2 { margin: 0; font-size: 15px; }
.section-heading p { margin: 0; color: #4d4d4d; font-size: 11px; }
.step-number {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1px solid #777;
  background: #f6f6f6;
  font-size: 11px;
  font-weight: 700;
}

.task-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.task-card {
  min-width: 0;
  min-height: 275px;
  padding: 18px;
  border: 2px solid;
  border-color: #fff #898989 #898989 #fff;
  background: #ededed;
}
.task-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-badge {
  padding: 3px 6px;
  border: 1px solid #7a7a7a;
  background: #d8d8d8;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.task-meta { color: #4d4d4d; font-size: 10px; text-align: right; }
.task-card h3 { margin: 20px 0 6px; font-size: 16px; }
.task-card > p { margin: 0 0 19px; color: #4c4c4c; font-size: 11px; line-height: 1.5; }
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 142px;
  border: 2px dashed #808080;
  background: #fafafa;
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover { border-color: #184385; background: #eef3fa; }
.upload-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 27px;
  border: 1px solid #777;
  background: #dedede;
  font-size: 19px;
  font-weight: 700;
}
.upload-zone strong { font-size: 12px; }
.upload-zone small { color: #555; font-size: 10px; }
.image-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 13px; }
.image-list:empty { display: none; }
.image-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 5px 4px 7px;
  border: 1px solid #888;
  background: #f8f8f8;
  font-size: 10px;
}
.image-chip-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-chip button { padding: 0 3px; border: 0; background: transparent; color: #333; font-size: 16px; }

.start-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 21px;
  padding: 16px 18px;
  border: 2px solid;
  border-color: #fff #898989 #898989 #fff;
  background: #dedede;
}
.start-panel strong { font-size: 13px; }
.start-panel p { margin: 5px 0 0; color: #505050; font-size: 11px; }
.start-controls { display: flex; gap: 10px; }
.start-controls select {
  min-width: 145px;
  height: 34px;
  padding: 0 8px;
  border: 2px solid;
  border-color: #777 #fff #fff #777;
  border-radius: 0;
  background: #fff;
  color: #111;
  font-size: 11px;
}
.primary-button, .outline-button {
  height: 34px;
  padding: 0 13px;
  border: 2px solid;
  border-color: #fff #686868 #686868 #fff;
  border-radius: 0;
  background: #d6d6d6;
  color: #111;
  box-shadow: none;
  font-size: 11px;
  font-weight: 700;
}
.primary-button:hover, .outline-button:hover { background: #e4e4e4; }
.primary-button:active, .outline-button:active { border-color: #686868 #fff #fff #686868; }
.primary-button:disabled, .outline-button:disabled { background: #d7d7d7; color: #858585; }
.setup-message { min-height: 16px; margin: 7px 0; color: #9d2020; font-size: 11px; text-align: right; }
.setup-footer { margin-top: 18px; padding-top: 8px; border-top: 1px solid #aaa; color: #555; font-size: 10px; }

/* Writing test */
.exam-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 520px;
  overflow: hidden;
  background: #e9edf7;
  color: #171a1f;
}
.exam-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 17px;
  border-bottom: 3px solid #63707b;
  background: linear-gradient(#13151b, #333741 53%, #111318);
  box-shadow: inset 0 1px #666b73;
  color: #f7f7f7;
}
.candidate-label { min-width: 210px; color: #e6e8ed; font-size: 12px; letter-spacing: .02em; }
.exam-header-center { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; }
.exam-header-center strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.exam-header-center.urgent, .exam-header-center.urgent strong { color: #ffb5b5; }
.clock-icon { font-size: 19px; }
.exam-header-actions { display: flex; justify-content: flex-end; gap: 7px; min-width: 210px; }
.header-tool {
  min-width: 58px;
  height: 29px;
  padding: 0 10px;
  border: 1px solid #737880;
  border-radius: 3px;
  background: linear-gradient(#fff, #d4d8de);
  box-shadow: inset 0 1px #fff, 0 1px 1px #0008;
  color: #242830;
  font-size: 12px;
  font-weight: 700;
}
.header-tool:hover { background: #fff; }
.part-banner {
  flex: none;
  margin: 11px 14px 0;
  padding: 13px 16px 16px;
  border: 1px solid #d4d7df;
  background: #fff;
}
.part-banner h1 { margin: 0 0 20px; font-size: 23px; line-height: 1.2; }
.part-banner p { margin: 0; color: #222; font-size: 14px; line-height: 1.5; }
.exam-workspace { display: flex; flex: 1; min-height: 0; margin: 10px 14px 0; border: 1px solid #d5d9e4; background: #fff; }
.question-pane { display: flex; flex-direction: column; width: 50%; min-width: 280px; min-height: 0; background: #fff; }
.question-scroll { flex: 1; overflow: auto; padding: 15px 17px; scrollbar-color: #b5b8bf #f4f4f4; }
.question-images { display: grid; gap: 14px; }
.question-image-card img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.empty-question { margin: 50px auto; color: #666; font-size: 12px; text-align: center; }
.pane-divider { position: relative; flex: none; width: 8px; border-inline: 1px solid #d3d6dd; background: #e9ebf0; cursor: col-resize; }
.pane-divider::before { position: absolute; top: 50%; left: 2px; height: 34px; border-left: 2px solid #aeb3bb; content: ""; transform: translateY(-50%); }
.answer-pane { display: flex; flex: 1; flex-direction: column; min-width: 280px; min-height: 0; padding: 13px 12px 0 4px; background: #fff; }
.answer-editor-wrap { display: flex; flex: 1; min-height: 0; }
.answer-editor-wrap textarea {
  width: 100%;
  height: 100%;
  padding: 11px;
  resize: none;
  border: 2px solid #a9aeb3;
  outline: none;
  background: #fff;
  color: #111;
  font: 15px/1.5 Arial, sans-serif;
}
.answer-editor-wrap textarea:focus { border-color: #737d8a; }
.answer-footer { display: flex; flex: none; align-items: center; height: 27px; padding: 0 1px; font-size: 12px; }
.word-count { color: #333; }
.word-count strong { font-size: 12px; font-weight: 400; }
.exam-bottom {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  margin: 8px 14px 0;
  padding: 0 7px;
  border-top: 2px solid #d3d8e4;
  background: #eef2fa;
}
.task-switcher { display: flex; align-items: flex-end; height: 100%; }
.task-tab { display: flex; align-items: center; gap: 5px; height: 38px; padding: 0 11px; border: 1px solid transparent; border-radius: 0; background: transparent; color: #111; font-size: 14px; font-weight: 700; }
.task-tab.active { border-color: #a6b3c4; background: #c9e9ff; }
.task-tab-count { display: none; }
.next-button {
  width: 44px;
  height: 38px;
  border: 1px solid #c4cbd6;
  border-radius: 8px;
  background: linear-gradient(#fff, #e0e4ec);
  color: #111;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
.next-button:hover { background: #fff; }
.next-button:disabled { color: #999; }

/* Dialogs */
.modal { position: fixed; z-index: 20; inset: 0; display: flex; align-items: center; justify-content: center; padding: 40px; background: #152136e8; }
.modal img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 12px 60px #0005; }
.modal-close { position: absolute; top: 16px; right: 22px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: #ffffff20; color: #fff; font-size: 32px; }
.dialog-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 20px; background: #15213699; }
.finish-dialog { width: min(100%, 480px); padding: 30px; border: 2px solid; border-color: #fff #777 #777 #fff; background: #e7e7e7; box-shadow: 3px 3px 0 #555; }
.dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; background: #d2d2d2; color: #222; font-size: 21px; font-weight: 800; }
.finish-dialog h2 { margin: 18px 0 7px; font-size: 20px; }
.finish-dialog > p { color: #555; font-size: 12px; line-height: 1.7; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 20px 0; font-size: 13px; }
.setting-row select { min-width: 120px; height: 30px; padding: 0 7px; border: 1px solid #888; background: #fff; }
.finish-summary { display: grid; gap: 7px; margin: 18px 0; padding: 14px; border: 1px solid #999; background: #f7f7f7; color: #444; font-size: 12px; }
.summary-row { display: flex; justify-content: space-between; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

@media (max-width: 700px) {
  .setup-layout { padding: 0; }
  .setup-main { min-height: 100vh; border: 0; box-shadow: none; }
  .setup-content { padding: 0 13px 18px; }
  .legacy-title { flex-wrap: wrap; gap: 5px 11px; margin: 0 -13px 22px; padding: 12px 13px; }
  .legacy-title span, .legacy-title small { font-size: 10px; }
  .legacy-title strong { font-size: 13px; }
  .section-heading { align-items: flex-start; }
  .section-heading p { max-width: 140px; text-align: right; }
  .task-grid { grid-template-columns: 1fr; }
  .task-card { min-height: 0; }
  .start-panel { align-items: stretch; flex-direction: column; }
  .start-controls { flex-wrap: wrap; }
  .start-controls .primary-button { flex: 1; }
  .exam-layout { height: auto; min-height: 100vh; overflow: visible; }
  .exam-header { height: 52px; padding: 0 7px; }
  .candidate-label { display: none; }
  .exam-header-actions { min-width: 0; gap: 3px; }
  .header-tool { min-width: 43px; padding: 0 5px; font-size: 10px; }
  .part-banner { margin: 5px 5px 0; padding: 10px; }
  .part-banner h1 { margin-bottom: 8px; font-size: 19px; }
  .part-banner p { font-size: 11px; }
  .exam-workspace { display: block; margin: 5px 5px 0; }
  .question-pane { width: 100% !important; min-width: 0; max-height: 43vh; border-bottom: 4px solid #d5d9e4; }
  .question-scroll { min-height: 150px; }
  .pane-divider { display: none; }
  .answer-pane { min-width: 0; min-height: 290px; height: 42vh; padding: 6px; }
  .exam-bottom { position: sticky; bottom: 0; margin: 0 5px; }
}
