:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #1f7a6d;
  --accent-dark: #146257;
  --warn: #9a5b14;
  --good: #2f7d32;
  --soft: #edf4f2;
  --shadow: 0 10px 30px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.subtle,
.message,
.muted {
  color: var(--muted);
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-card h1,
.content-header h1,
.side-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 24px 0;
}

.segmented button {
  border: 0;
  background: #fff;
  padding: 10px;
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.type-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 16px;
}

.type-switch button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
  font-weight: 700;
}

.type-switch button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.form-stack,
.filters {
  display: grid;
  gap: 14px;
}

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

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

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

.primary,
.secondary,
.icon-button {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 12px;
  min-height: 38px;
}

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

.primary:hover {
  background: var(--accent-dark);
}

.secondary,
.icon-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.secondary:hover,
.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 340px 1fr;
}

.sidebar {
  height: 100vh;
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px;
}

.side-header,
.content-header,
.account-line,
.top-actions,
.side-actions,
.detail-toolbar,
.status-grid {
  display: flex;
  align-items: center;
  gap: 10px;
}

.side-header,
.content-header,
.account-line {
  justify-content: space-between;
}

.account-line {
  margin: 16px 0;
  padding: 10px 12px;
  background: var(--soft);
  border-radius: 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  justify-content: flex-start;
}

.side-actions {
  margin: 14px 0;
}

.side-actions .secondary {
  flex: 1;
}

.question-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.question-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.question-item.active {
  border-color: var(--accent);
  background: var(--soft);
}

.question-item strong {
  font-size: 14px;
  line-height: 1.35;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  background: #eef1f5;
  color: #475467;
  padding: 2px 8px;
  font-size: 12px;
}

.chip.good {
  background: #e8f5e9;
  color: var(--good);
}

.chip.warn {
  background: #fff3df;
  color: var(--warn);
}

.content {
  height: 100vh;
  overflow: auto;
}

.content-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(246, 247, 249, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 18px 24px;
}

.question-detail {
  max-width: 1060px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 16px;
}

.empty-state {
  min-height: calc(100vh - 90px);
  place-items: center;
  color: var(--muted);
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.submit-section {
  border-color: #a9d2ca;
  background: #fbfefd;
}

.ai-model-row {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  align-items: end;
  gap: 12px;
}

.ai-model-row select {
  background: #fff;
}

.choice-card {
  display: grid;
  gap: 14px;
}

.choice-stem {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.choice-options {
  display: grid;
  gap: 10px;
}

.choice-option {
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
}

.choice-option:hover {
  border-color: var(--accent);
  background: #fbfefd;
}

.choice-option input {
  width: auto;
}

.choice-letter {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.choice-result {
  border-radius: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fbfcfd;
}

.choice-result p {
  margin: 8px 0 0;
}

.choice-result.correct {
  border-color: #9ccc9c;
  background: #f1faf1;
}

.choice-result.wrong {
  border-color: #e0b36f;
  background: #fff8ed;
}

.section h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.section-heading-row h3 {
  margin: 0;
}

.section p {
  line-height: 1.7;
}

.section ul,
.section ol {
  margin: 0;
  padding-left: 22px;
  line-height: 1.75;
}

.section pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #101828;
  color: #eef4ff;
  border-radius: 6px;
  padding: 14px;
  overflow: auto;
}

.material-download {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid #a9d2ca;
  border-radius: 6px;
  padding: 3px 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.material-download:hover {
  border-color: var(--accent);
  background: #fbfefd;
}

.detail-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
}

.status-grid {
  align-items: end;
  flex-wrap: wrap;
}

.status-grid label {
  min-width: 160px;
}

.notes-area {
  display: grid;
  gap: 10px;
}

.compact-note {
  margin: -2px 0 0;
  font-size: 13px;
}

details.section > summary,
.nested-details > summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 800;
  list-style-position: inside;
}

details.section[open] > summary {
  margin-bottom: 14px;
}

.helper-content {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.nested-details {
  border: 1px dashed #b8c3cf;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.nested-details[open] > summary {
  margin-bottom: 12px;
}

.editor-grid {
  display: grid;
  gap: 12px;
}

.editor-grid textarea {
  min-height: 86px;
}

.editor-grid label:nth-child(8) textarea,
.editor-grid label:nth-child(9) textarea {
  min-height: 160px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.editor-actions {
  margin-top: 12px;
}

.saved-flash {
  color: var(--good);
  font-weight: 700;
  min-height: 22px;
}

.submission-history {
  display: grid;
  gap: 12px;
}

.submission-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
  display: grid;
  gap: 10px;
}

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

.hint-output {
  display: grid;
  gap: 10px;
}

.hint-card {
  border: 1px solid #b8d8d2;
  border-radius: 8px;
  padding: 14px;
  background: #f5fbf9;
  display: grid;
  gap: 10px;
}

.hint-card p {
  margin: 0;
}

.submission-card p {
  margin: 0;
}

.submission-card details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.submission-card summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 700;
}

.mini-list {
  display: grid;
  gap: 6px;
}

.mini-list ul {
  padding-left: 20px;
}

@media (max-width: 920px) {
  .app-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    max-height: 48vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    height: auto;
  }

  .content-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .hint-actions {
    grid-template-columns: 1fr;
  }
}
