.we-wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 30px 24px 86px;
}

.we-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  align-items: end;
  padding: 18px 0 26px;
}

.we-kicker {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: #fff4df;
  color: #9b6a05;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
}

.we-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -.04em;
}

.we-hero h1 span {
  color: #a01020;
}

.we-hero p {
  max-width: 680px;
  color: var(--ink-soft);
  font-size: 1rem;
  margin-top: 12px;
}

.we-rules {
  background: #a01020;
  color: #fff7dc;
  border: 1.5px solid #e7bb4a;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 16px 38px rgba(160, 16, 32, .16);
}

.we-rules strong {
  display: block;
  color: #f6d36a;
  font-size: .9rem;
  margin-bottom: 6px;
}

.we-rules span {
  display: block;
  font-size: .82rem;
  line-height: 1.55;
}

.we-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.we-progress-title {
  font-weight: 900;
  font-size: 1.04rem;
}

.we-progress-sub {
  color: var(--ink-mute);
  font-size: .82rem;
  margin-top: 2px;
}

.we-meter {
  height: 9px;
  background: #f1e7dd;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.we-meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #a01020, #d4af37);
  border-radius: inherit;
}

.we-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  background: #fff4df;
  color: #9b6a05;
  font-size: .8rem;
  font-weight: 900;
}

.we-view {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.we-panel {
  padding: 24px;
}

.we-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.we-section-title h2 {
  font-size: 1.16rem;
  font-weight: 900;
}

.we-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 12px;
}

.we-type-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 4px 12px;
  align-items: start;
  padding: 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  transition: all .16s var(--ease);
}

.we-type-card:hover:not(:disabled) {
  border-color: #a01020;
  background: #fff9f0;
  transform: translateY(-2px);
}

.we-type-card:disabled {
  opacity: .56;
  cursor: not-allowed;
}

.we-type-icon {
  grid-row: 1 / span 3;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff4df;
  color: #a01020;
  font-size: 1.2rem;
}

.we-type-name {
  font-weight: 900;
  font-size: .94rem;
  color: var(--ink);
}

.we-type-meta {
  color: var(--ink-mute);
  font-size: .74rem;
  font-weight: 700;
}

.we-type-desc {
  color: var(--ink-soft);
  font-size: .78rem;
  line-height: 1.45;
}

.we-prompt {
  background: linear-gradient(135deg, #fff8ec, #fff);
  border-bottom: 1.5px solid var(--line);
  padding: 24px;
}

.we-prompt-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.we-prompt-label {
  color: #a01020;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.we-timer {
  color: #8a0f1d;
  background: #fff1d1;
  border: 1px solid #e7bb4a;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: .78rem;
  font-weight: 900;
}

.we-prompt h2 {
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  font-weight: 900;
  line-height: 1.3;
}

.we-prompt p {
  color: var(--ink-soft);
  margin-top: 10px;
  font-size: .92rem;
}

.we-exam-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.we-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.we-textarea {
  width: 100%;
  min-height: 430px;
  resize: vertical;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  padding: 16px;
  line-height: 1.7;
  font-family: inherit;
  font-size: .96rem;
  color: var(--ink);
}

.we-textarea:focus,
.we-input:focus {
  outline: none;
  border-color: #a01020;
  box-shadow: 0 0 0 4px #fff1d1;
}

.we-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.we-box {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
}

.we-box h3 {
  font-size: .88rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.we-box ul,
.we-box ol {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: .78rem;
  line-height: 1.55;
}

.we-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.we-stat {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  color: var(--ink-mute);
  font-size: .7rem;
  font-weight: 700;
}

.we-stat strong {
  display: block;
  color: #a01020;
  font-size: 1.15rem;
}

.we-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.we-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 900;
  font-size: .86rem;
  border: 1.5px solid transparent;
  transition: all .16s var(--ease);
}

.we-btn-main {
  background: #a01020;
  color: #fff8dc;
}

.we-btn-main:hover:not(:disabled) {
  background: #7d0c18;
  transform: translateY(-1px);
}

.we-btn-ghost {
  background: #fff;
  color: #8a0f1d;
  border-color: #e7bb4a;
}

.we-btn-ghost:hover:not(:disabled) {
  background: #fff8ec;
}

.we-btn:disabled {
  opacity: .52;
  cursor: not-allowed;
}

.we-result {
  margin-top: 18px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: #fff;
}

.we-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #a01020;
  font-weight: 900;
  font-size: 2.4rem;
  letter-spacing: -.04em;
}

.we-score span {
  font-size: 1rem;
  color: var(--ink-mute);
}

.we-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.we-result-mini {
  background: #fff8ec;
  border: 1px solid #efd8a8;
  border-radius: 12px;
  padding: 12px;
  font-size: .82rem;
  color: var(--ink-soft);
}

.we-result-mini strong {
  color: #8a0f1d;
  display: block;
}

.we-alert {
  border-radius: 14px;
  padding: 14px 16px;
  font-size: .88rem;
  line-height: 1.55;
  margin-top: 14px;
}

.we-alert.warn {
  background: #fff1d1;
  border: 1.5px solid #e7bb4a;
  color: #7a5408;
}

.we-alert.bad {
  background: #fde2e2;
  border: 1.5px solid #e05252;
  color: #9d1d1d;
}

.we-alert.good {
  background: #eef9f2;
  border: 1.5px solid #15a35a55;
  color: #0c6f3c;
}

.we-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(30, 0, 5, .56);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.we-modal.show {
  display: flex;
}

.we-modal-box {
  position: relative;
  width: min(620px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  padding: 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  text-align: center;
}

.we-modal-box h2 {
  font-size: 1.25rem;
  font-weight: 900;
}

.we-modal-box p {
  color: var(--ink-soft);
  font-size: .86rem;
  margin: 8px 0 14px;
}

.we-modal-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f3f3f3;
  color: #555;
  font-size: 1.15rem;
}

.we-input {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  border-radius: 13px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
}

.we-cert-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}

.we-cert-preview {
  display: none;
  width: 100%;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  margin: 12px 0;
}

#certDownload {
  display: none;
}

@media (max-width: 760px) {
  .we-wrap {
    padding: 22px 16px 70px;
  }

  .we-hero,
  .we-progress,
  .we-exam-grid {
    grid-template-columns: 1fr;
  }

  .we-rules {
    padding: 15px;
  }

  .we-panel,
  .we-prompt {
    padding: 18px;
  }

  .we-textarea {
    min-height: 340px;
  }
}

/* Thông báo bài thi đang làm dở */
.we-resume {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #fff1d1, #fff8ec);
  border: 1.5px solid #e7bb4a;
  border-radius: 16px;
  padding: 16px 18px;
  margin: 0 0 16px;
  box-shadow: var(--shadow-sm);
}

.we-resume-info {
  display: flex;
  gap: 12px;
  align-items: center;
}

.we-resume-info strong {
  display: block;
  color: #8a0f1d;
  font-size: .96rem;
}

.we-resume-info span {
  display: block;
  color: var(--ink-soft);
  font-size: .8rem;
  margin-top: 2px;
}

.we-resume-dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #a01020;
  animation: wePulse 1.6s infinite;
}

@keyframes wePulse {
  0% { box-shadow: 0 0 0 0 rgba(160, 16, 32, .45); }
  70% { box-shadow: 0 0 0 10px rgba(160, 16, 32, 0); }
  100% { box-shadow: 0 0 0 0 rgba(160, 16, 32, 0); }
}

/* Nhãn đề cố định trong phòng thi */
.we-fixed-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 8px 13px;
  border-radius: 999px;
  background: #fde7c8;
  border: 1px solid #e7bb4a;
  color: #8a5a08;
  font-size: .78rem;
  font-weight: 800;
}

/* Thẻ thể loại đang làm dở */
.we-type-card.is-active {
  border-color: #a01020;
  background: #fff9f0;
  box-shadow: 0 0 0 3px #fff1d1;
}

.we-type-card.is-active .we-type-meta {
  color: #a01020;
}
