:root {
  --primary: #fbad19;
  --primary-dark: #d88900;
  --primary-soft: #fff4dc;
  --accent: #47472c;
  --accent-soft: #f4f1e8;
  --ink: #47472c;
  --muted: #77745d;
  --line: #e7dfcf;
  --white: #ffffff;
  --green: #36b37e;
  --red: #47472c;
  --shadow: 0 18px 45px rgba(71, 71, 44, 0.12);
  --blue: var(--primary);
  --blue-dark: var(--accent);
  --blue-soft: var(--accent-soft);
  --yellow: var(--primary);
  --yellow-soft: var(--primary-soft);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 34px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  text-align: left;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
}

.brand-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  background: var(--white);
  border: 2px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(71, 71, 44, 0.08);
}

.brand-logo-wrap img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.nav-actions,
.result-actions,
.quiz-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ghost-btn,
.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.ghost-btn {
  color: var(--accent);
  background: var(--white);
  border: 1px solid var(--line);
}

.ghost-btn.active,
.ghost-btn:hover {
  background: var(--primary);
  color: var(--accent);
}

.primary-btn {
  color: var(--accent);
  background: var(--primary);
  box-shadow: 0 12px 26px rgba(251, 173, 25, 0.24);
}

.primary-btn:hover,
.secondary-btn:hover,
.danger-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.secondary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.secondary-btn {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--line);
}

.danger-btn {
  color: #ffffff;
  background: var(--red);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  align-items: center;
  gap: 28px;
  min-height: calc(100vh - 160px);
}

.hero-copy {
  padding: 40px 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary-dark);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-size: clamp(2.1rem, 6vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: 1.45rem;
}

h3 {
  margin: 22px 0 12px;
  font-size: 1.08rem;
}

.lead {
  max-width: 690px;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.7;
}

.type-strip,
.career-tags,
.top-types {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.type-strip {
  margin-top: 28px;
}

.type-pill,
.career-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--accent);
  font-weight: 900;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.type-pill.r,
.type-pill.i,
.type-pill.a,
.type-pill.s,
.type-pill.e,
.type-pill.c {
  border-color: rgba(251, 173, 25, 0.48);
  background: var(--primary-soft);
}

.start-panel,
.question-panel,
.student-card,
.chart-panel,
.score-panel,
.analysis-panel,
.table-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.start-panel {
  padding: 26px;
}

.start-logo {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin: 0 auto 12px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

label + label {
  margin-top: 16px;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(251, 173, 25, 0.18);
}

.start-panel .primary-btn {
  width: 100%;
  margin-top: 22px;
}

.quiz-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 22px;
  align-items: start;
}

.student-card {
  position: sticky;
  top: 18px;
  padding: 22px;
}

.student-card span,
.student-card small {
  display: block;
  color: var(--muted);
}

.student-card strong {
  display: block;
  margin: 6px 0 3px;
  font-size: 1.5rem;
}

.mini-scoreboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 22px;
}

.mini-scoreboard div {
  padding: 10px 6px;
  text-align: center;
  background: var(--primary-soft);
  border-radius: 8px;
}

.mini-scoreboard strong {
  margin: 0;
  font-size: 1.05rem;
}

.question-panel {
  padding: 30px;
}

.progress-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  color: var(--blue-dark);
  font-weight: 900;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  background: var(--accent-soft);
  border-radius: 999px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: inherit;
  transition: width 0.24s ease;
}

.question-type {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 6px 10px;
  color: var(--blue-dark);
  font-weight: 900;
  background: var(--yellow-soft);
  border-radius: 8px;
}

#questionText {
  min-height: 74px;
  margin-bottom: 14px;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1.35;
}

.question-example {
  margin-bottom: 22px;
  padding: 16px 18px;
  background: var(--primary-soft);
  border: 1px solid rgba(251, 173, 25, 0.42);
  border-left: 6px solid var(--yellow);
  border-radius: 8px;
}

.question-example span {
  display: block;
  margin-bottom: 6px;
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.question-example p {
  margin: 0;
  color: var(--accent);
  line-height: 1.65;
}

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

.answer-btn {
  display: grid;
  align-content: center;
  min-height: 122px;
  padding: 16px 10px;
  color: var(--ink);
  background: var(--white);
  border: 2px solid transparent;
  border-radius: 8px;
  text-align: center;
  touch-action: manipulation;
}

.answer-btn:hover,
.answer-btn.selected {
  background: var(--primary-soft);
  border-color: var(--blue);
  box-shadow: 0 14px 28px rgba(251, 173, 25, 0.18);
}

.answer-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  margin: 0 auto 10px;
  color: var(--blue-dark);
  font-weight: 900;
  background: var(--yellow);
  border-radius: 50%;
}

.answer-btn strong,
.answer-btn small {
  display: block;
}

.answer-btn small {
  margin-top: 5px;
  color: var(--muted);
}

.quiz-actions {
  justify-content: space-between;
  margin-top: 24px;
}

.result-header,
.sheet-status {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 0 14px;
  color: var(--muted);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.sheet-status.success {
  color: var(--accent);
  background: var(--primary-soft);
  border-color: rgba(251, 173, 25, 0.48);
}

.sheet-status.warning,
.sheet-status.error {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
}

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

.result-header h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.6rem);
}

.code-badge {
  display: grid;
  min-width: 150px;
  min-height: 120px;
  place-items: center;
  color: var(--blue-dark);
  font-size: 2.7rem;
  font-weight: 1000;
  background: var(--yellow);
  border: 5px solid var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.chart-panel,
.score-panel,
.analysis-panel,
.table-panel {
  padding: 22px;
}

.chart-wrap {
  position: relative;
  min-height: 360px;
}

.score-bars {
  display: grid;
  gap: 12px;
}

.score-row {
  display: grid;
  grid-template-columns: 52px 1fr 42px;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  background: var(--accent-soft);
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: inherit;
}

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

.type-card {
  flex: 1 1 230px;
  padding: 16px;
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.type-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--blue-dark);
  font-size: 1.08rem;
}

.type-card p,
.analysis-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.result-actions {
  margin-top: 18px;
}

.floating-form-btn {
  position: fixed;
  top: 52%;
  left: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 54px;
  min-height: 238px;
  padding: 13px 8px;
  color: var(--accent);
  background: var(--primary);
  border: 2px solid var(--accent);
  border-left: 0;
  border-radius: 0 14px 14px 0;
  box-shadow: 0 0 0 0 rgba(251, 173, 25, 0.55), 0 14px 30px rgba(71, 71, 44, 0.22);
  font-weight: 1000;
  line-height: 1.18;
  text-align: center;
  text-decoration: none;
  writing-mode: vertical-rl;
  transform: translateY(-50%);
  animation: floatingCtaBounce 1.75s ease-in-out infinite, floatingCtaGlow 1.75s ease-in-out infinite;
}

.floating-form-btn span {
  padding-left: 5px;
  border-left: 1px solid rgba(71, 71, 44, 0.35);
  font-size: 0.78rem;
}

.floating-form-btn strong {
  font-size: 0.94rem;
}

.floating-form-btn:hover {
  animation-play-state: paused;
  transform: translate(4px, -50%) scale(1.03);
}

@keyframes floatingCtaBounce {
  0%,
  100% {
    transform: translateY(-50%);
  }

  50% {
    transform: translateY(calc(-50% - 8px));
  }
}

@keyframes floatingCtaGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(251, 173, 25, 0.55), 0 14px 30px rgba(71, 71, 44, 0.22);
  }

  50% {
    box-shadow: 0 0 0 9px rgba(251, 173, 25, 0.16), 0 18px 36px rgba(251, 173, 25, 0.38);
  }
}

.stat-box {
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(71, 71, 44, 0.08);
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.stat-box strong {
  display: block;
  margin-top: 5px;
  font-size: 1.75rem;
}

.table-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.table-toolbar label {
  width: min(360px, 100%);
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

tbody tr:hover {
  background: var(--primary-soft);
}

.empty-state {
  display: none;
  margin: 18px 0 0;
  padding: 18px;
  color: var(--muted);
  background: var(--primary-soft);
  border: 1px dashed rgba(251, 173, 25, 0.6);
  border-radius: 8px;
  text-align: center;
}

.empty-state.show {
  display: block;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 18px, 1120px);
    padding-top: 10px;
  }

  .floating-form-btn {
    top: 58%;
    width: 48px;
    min-height: 218px;
    padding: 11px 7px;
    border-radius: 0 12px 12px 0;
  }

  .floating-form-btn span {
    font-size: 0.7rem;
  }

  .floating-form-btn strong {
    font-size: 0.82rem;
  }

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

  .topbar {
    gap: 10px;
    margin-bottom: 18px;
  }

  .brand-logo-wrap {
    width: 48px;
    height: 48px;
  }

  .brand-logo-wrap img {
    width: 42px;
    height: 42px;
  }

  .nav-actions {
    width: 100%;
  }

  .nav-actions button {
    flex: 1;
  }

  .hero-grid,
  .quiz-layout,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    min-height: auto;
  }

  .hero-copy {
    padding: 16px 0 0;
  }

  .student-card {
    position: static;
    padding: 14px;
  }

  .student-card strong {
    margin-bottom: 0;
    font-size: 1.2rem;
  }

  .mini-scoreboard {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin-top: 12px;
  }

  .mini-scoreboard div {
    padding: 7px 4px;
  }

  .answer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #questionText {
    min-height: auto;
    font-size: 1.45rem;
  }

  .chart-wrap {
    min-height: 300px;
  }

  .code-badge {
    width: 100%;
    min-height: 92px;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 2.25rem;
  }

  .floating-form-btn {
    top: 62%;
    width: 42px;
    min-height: 196px;
    padding: 10px 5px;
  }

  .floating-form-btn span {
    font-size: 0.65rem;
  }

  .floating-form-btn strong {
    font-size: 0.74rem;
  }

  .question-panel,
  .start-panel,
  .student-card,
  .chart-panel,
  .score-panel,
  .analysis-panel,
  .table-panel {
    padding: 14px;
  }

  .question-panel {
    padding: 16px 14px;
  }

  .progress-row {
    grid-template-columns: auto 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .score-row {
    grid-template-columns: 1fr;
  }

  .question-type {
    margin-bottom: 10px;
    font-size: 0.85rem;
  }

  #questionText {
    margin-bottom: 10px;
    font-size: 1.28rem;
    line-height: 1.38;
  }

  .question-example {
    margin-bottom: 14px;
    padding: 12px 12px;
    border-left-width: 4px;
  }

  .question-example p {
    font-size: 0.94rem;
    line-height: 1.55;
  }

  .answer-grid {
    gap: 7px;
  }

  .answer-btn {
    min-height: 98px;
    padding: 10px 4px;
  }

  .answer-icon {
    width: 34px;
    height: 34px;
    margin-bottom: 7px;
    font-size: 0.95rem;
  }

  .answer-btn strong {
    font-size: 0.98rem;
  }

  .answer-btn small {
    margin-top: 3px;
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .quiz-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
  }

  .quiz-actions .primary-btn,
  .quiz-actions .secondary-btn {
    padding: 0 10px;
  }
}
