:root {
  --ink: #1d2433;
  --muted: #6b7280;
  --line: #d8dee8;
  --panel: #ffffff;
  --wash: #f4f7fb;
  --blue: #1f5eff;
  --green: #1b8a5a;
  --orange: #c56a17;
  --red: #b42318;
  --shadow: 0 18px 45px rgba(29, 36, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--wash);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button,
select,
input {
  min-height: 40px;
  border-radius: 8px;
}

button {
  border: 0;
  padding: 0 16px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

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

button.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button.full-button {
  width: 100%;
}

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

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef3f9, #ffffff 54%, #eaf1ff);
}

.login-card {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 26px;
}

.login-brand {
  margin-bottom: 20px;
}

.login-card label {
  display: block;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-card input {
  margin-top: 7px;
}

.login-card button {
  width: 100%;
  margin-top: 8px;
}

.login-tip {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #eef3f9;
  padding: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.role-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.role-nav button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.role-nav button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.question-band h3,
.section-head p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
}

.brand p,
.topbar p,
.record-head p,
.question-meta,
.timer-grid span,
.score-summary span,
.metric-row span,
.section-head p,
.attempt-row span,
.attempt-row small {
  color: var(--muted);
}

.workspace {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
}

.actions,
.record-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.panel,
.question-band,
.score-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel.compact {
  margin-bottom: 14px;
  box-shadow: none;
}

.panel.compact label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}

.question-band {
  padding: 22px;
  margin-bottom: 18px;
}

.question-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
}

.question-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #f8fafc;
}

.question-band h3 {
  min-height: 76px;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.28;
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.timer-grid div {
  border-left: 4px solid var(--line);
  padding: 8px 12px;
  background: #f8fafc;
}

.timer-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.answer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.85fr);
  gap: 18px;
}

.record-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.voice-meter {
  width: 120px;
  height: 12px;
  border-radius: 999px;
  background: #e6ebf2;
  overflow: hidden;
}

.voice-meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width 90ms linear;
}

textarea {
  width: 100%;
  min-height: 250px;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  resize: vertical;
  line-height: 1.65;
  color: var(--ink);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.25fr);
  gap: 18px;
}

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

.section-head h3 {
  margin-bottom: 4px;
}

.search-input {
  max-width: 260px;
}

.question-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
  padding-right: 4px;
}

.question-row {
  min-height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  padding: 12px;
  text-align: left;
  font-weight: 400;
}

.question-row.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(31, 94, 255, 0.12);
}

.question-row strong,
.question-row span,
.question-row p {
  display: block;
}

.question-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.question-row p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.editor-panel textarea {
  min-height: 110px;
  margin: 8px 0 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.form-grid label,
.full-field {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-grid input,
.form-grid select {
  margin-top: 7px;
}

button.danger {
  background: var(--red);
}

.status-text {
  min-height: 24px;
  color: var(--orange);
  font-weight: 700;
}

.attempts-panel {
  margin-top: 18px;
}

.attempt-list {
  display: grid;
  gap: 10px;
}

.attempt-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
  color: var(--ink);
  text-align: left;
  font-weight: 400;
}

.attempt-row-compact:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(31, 94, 255, 0.1);
}

.attempt-score {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: #eaf1ff;
  color: var(--blue);
  font-size: 22px;
  font-weight: 800;
}

.attempt-row strong,
.attempt-row span,
.attempt-row p,
.attempt-row small {
  display: block;
}

.attempt-row p {
  margin: 6px 0;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.attempt-row small {
  line-height: 1.45;
}

.attempt-detail {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.attempt-open {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-card {
  width: min(920px, 100%);
  max-height: min(82vh, 840px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.modal-head h3 {
  margin: 4px 0 0;
}

.modal-body {
  overflow: auto;
  padding: 20px;
}

.icon-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.detail-metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.detail-metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.detail-metric strong {
  display: block;
  margin-top: 5px;
}

.dimension-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dimension-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.attempt-answer,
.attempt-suggestion {
  border-left: 3px solid var(--line);
  padding-left: 12px;
}

.attempt-answer h4,
.attempt-suggestion h4,
.attempt-feedback h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.attempt-answer p,
.attempt-suggestion p {
  margin: 0;
  white-space: pre-wrap;
}

.attempt-feedback {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.attempt-feedback ul {
  margin: 0;
}

.empty-state {
  color: var(--muted);
}

.rubric h3 {
  margin-top: 0;
  font-size: 16px;
}

.rubric {
  position: relative;
  overflow: hidden;
}

.rubric-mask {
  position: absolute;
  inset: 44px 14px 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.82);
  backdrop-filter: blur(5px);
  color: var(--muted);
  font-weight: 800;
}

.blurred {
  filter: blur(5px);
  opacity: 0.54;
  user-select: none;
  pointer-events: none;
}

.rubric h3 + ul {
  margin-top: 8px;
}

ul {
  padding-left: 20px;
}

li {
  margin: 8px 0;
  line-height: 1.55;
}

.score-panel {
  margin-top: 18px;
  padding: 20px;
}

.hidden {
  display: none;
}

.score-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.score-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 42px;
  color: var(--blue);
}

.dimension-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.dimension {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.dimension span {
  color: var(--muted);
  font-size: 13px;
}

.dimension strong {
  display: block;
  margin-top: 6px;
}

.feedback-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.suggestion {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 14px;
}

.suggestion p {
  line-height: 1.7;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 130px 86px 78px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}

.active-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.active-toggle input {
  width: auto;
  min-height: auto;
}

@media (max-width: 920px) {
  .app-shell,
  .answer-layout,
  .feedback-grid,
  .admin-grid,
  .form-grid,
  .user-row {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .timer-grid,
  .dimension-grid,
  .attempt-feedback,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .attempt-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .attempt-open {
    grid-column: 2;
  }

  .section-head {
    display: block;
  }

  .search-input {
    max-width: none;
    margin-top: 12px;
  }
}
