:root {
  --bg: #f5f5f5;
  --panel: #ffffff;
  --text: #333333;
  --muted: #666666;
  --line: #e0e0e0;
  --soft: #f8f9fa;
  --accent: #6c8d71;
  --accent-strong: #4d6a53;
  --shadow: 0 0 20px rgba(0,0,0,0.1);
  --radius: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Microsoft YaHei', Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.shell {
  max-width: 800px;
  margin: 50px auto;
  padding: 30px;
  background-color: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: slideIn 0.5s ease-in-out;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--soft);
}

.hero {
  text-align: center;
}

h1, h2, h3, p { margin: 0; }
.hero h1 {
  color: var(--accent-strong);
  text-align: center;
  margin-bottom: 20px;
  font-size: 2.5em;
}
.hero .description {
  text-align: center;
  margin-bottom: 30px;
  font-size: 1.1em;
  color: var(--muted);
}

.test-info {
  background-color: var(--soft);
  padding: 20px;
  border-radius: 5px;
  margin-bottom: 30px;
  text-align: left;
}

.test-info ul {
  list-style-position: inside;
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 30px;
}

.hero-minimal {
  min-height: 48vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 42px 20px;
}

.hero-actions-single {
  justify-content: center;
  margin-top: 30px;
}

button {
  border: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  font: inherit;
  position: relative;
  overflow: hidden;
}

button:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
button:active { transform: translateY(0); box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
button:disabled { cursor: not-allowed; opacity: 0.55; transform: none; box-shadow: none; }

.btn-primary {
  background-color: var(--accent-strong);
  color: white;
  padding: 12px 24px;
  border-radius: 5px;
  font-size: 1em;
  font-weight: 700;
  transition: all 0.3s ease;
}

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

.btn-secondary {
  background-color: white;
  color: var(--accent-strong);
  padding: 12px 24px;
  border-radius: 5px;
  border: 1px solid var(--line);
  font-size: 1em;
  font-weight: 700;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background-color: var(--soft);
  border-color: var(--accent-strong);
}

.start-btn {
  display: block;
  width: 200px;
  margin: 0 auto;
  padding: 15px;
  background-color: var(--accent-strong);
  color: white;
  text-align: center;
  text-decoration: none;
  border-radius: 5px;
  font-size: 1.1em;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border: none;
  font-weight: 700;
}

.start-btn:hover {
  background-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.start-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.screen { display: none; }
.screen.active { display: block; }

.test-wrap,
.result-wrap {
  margin-top: 20px;
  padding: 20px;
  background-color: var(--soft);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

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

.progress {
  flex: 1;
  min-width: 240px;
  height: 10px;
  background-color: #e9ecef;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.progress > span {
  display: block;
  width: 0;
  height: 100%;
  background-color: var(--accent-strong);
  border-radius: inherit;
  transition: width .3s ease;
}

.progress-text {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.question-list {
  display: grid;
  gap: 20px;
}

.question {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background-color: white;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 5px;
  padding: 6px 10px;
  background-color: var(--soft);
  border: 1px solid var(--line);
}

.question-title {
  font-size: 1.1em;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 15px;
}

.options {
  margin-top: 20px;
}

.option {
  margin-bottom: 15px;
}

.option label {
  display: block;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 5px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.option label:hover {
  background-color: var(--soft);
  border-color: var(--accent-strong);
}

.option input {
  margin-right: 15px;
  transform: scale(1.2);
  cursor: pointer;
  vertical-align: middle;
}

.option input:checked + span {
  font-weight: bold;
  color: var(--accent-strong);
}

.option span {
  vertical-align: middle;
}

.actions-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.actions-bottom > div {
  display: flex;
  gap: 12px;
  align-items: center;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.options {
  margin-top: 20px;
}

.option {
  margin-bottom: 10px;
}

.option label {
  display: block;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 5px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.option label:hover {
  background-color: var(--soft);
  border-color: var(--accent-strong);
}

.option input {
  margin-right: 15px;
  transform: scale(1.2);
  cursor: pointer;
  vertical-align: middle;
}

.option input:checked + span {
  font-weight: bold;
  color: var(--accent-strong);
}

.result-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  align-items: stretch;
}

.type-box,
.score-box,
.dim-box,
.top3-box,
.about-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff, #fbfdfb);
}

.type-kicker {
  font-size: 12px;
  color: var(--accent-strong);
  margin-bottom: 8px;
  letter-spacing: .05em;
}

.type-name {
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.type-subname {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.match {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-weight: 700;
}

.type-desc {
  margin-top: 18px;
  line-height: 1.85;
  font-size: 15px;
  color: #304034;
}

.score-box h3,
.dim-box h3,
.top3-box h3,
.about-box h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

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

.score-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.score-item .k {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.score-item .v {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-strong);
}

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

.dim-pill {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.dim-pill .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.dim-pill .value {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-strong);
}

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

.top3-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.top3-item strong {
  display: block;
  margin-bottom: 4px;
}

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

.top3-score {
  color: var(--accent-strong);
  font-weight: 800;
  white-space: nowrap;
}

.about-box p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.footer-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}


.result-layout {
  display: grid;
  gap: 20px;
}
.result-top {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 20px;
  align-items: stretch;
}
.poster-box, .type-box, .analysis-box, .dim-box, .note-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background-color: white;
}
.poster-box {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 280px;
  overflow: hidden;
  position: relative;
  background-color: white;
}
.poster-box::after {
  display: none;
}
.poster-image {
  width: 100%;
  min-height: 220px;
  max-height: 460px;
  object-fit: contain;
  border-radius: var(--radius);
  background-color: var(--soft);
}
.poster-box.no-image .poster-image {
  display: none;
}
.poster-caption {
  margin-top: 15px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}
.type-kicker {
  font-size: 12px;
  color: var(--accent-strong);
  margin-bottom: 10px;
  letter-spacing: .06em;
}
.type-name {
  font-size: 2em;
  line-height: 1.1;
  margin-bottom: 10px;
}
.type-subname {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.match {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 5px;
  padding: 10px 14px;
  background-color: var(--soft);
  border: 1px solid var(--line);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
}
.analysis-box h3, .dim-box h3, .note-box h3 {
  font-size: 16px;
  margin-bottom: 15px;
  color: var(--text);
}
.analysis-box p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.dim-list {
  display: grid;
  gap: 15px;
}
.dim-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  background-color: var(--soft);
}
.dim-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.dim-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.dim-item-score {
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}
.dim-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.note-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.author-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: white;
  overflow: hidden;
}
.author-box summary {
  list-style: none;
  cursor: pointer;
  padding: 20px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.author-box summary::-webkit-details-marker { display: none; }
.author-box summary::after {
  content: '展开';
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-strong);
  border: 1px solid var(--line);
  background-color: var(--soft);
  padding: 6px 10px;
  border-radius: 5px;
  flex-shrink: 0;
}
.author-box[open] summary::after {
  content: '收起';
}
.author-content {
  border-top: 1px solid var(--line);
  padding: 0 20px 20px;
}
.author-content p {
  margin: 15px 0 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.result-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.footer {
    margin-top: 30px;
    text-align: center;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.footer-links a {
    color: #4d6a53;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: #6c8d71;
    text-decoration: underline;
}
@media (max-width: 860px) {
  .result-top { grid-template-columns: 1fr; }
  .hero-grid,
  .result-hero {
    grid-template-columns: 1fr;
  }
  .dim-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .shell {
    padding: 20px;
    margin: 20px;
  }
  
  .hero h1 {
    font-size: 2em;
  }
  
  .result-top {
    grid-template-columns: 1fr;
  }
  
  .test-wrap,
  .result-wrap {
    padding: 15px;
  }
  .footer-links {
      flex-direction: column;
      gap: 10px;
  }
}

@media (max-width: 600px) {
  .shell {
    padding: 15px;
    margin: 10px;
  }
  
  .hero h1 {
    font-size: 1.8em;
  }
  
  .question-title {
    font-size: 1em;
  }
  
  .dim-grid,
  .score-grid {
    grid-template-columns: 1fr;
  }
  
  .actions-bottom {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn-primary,
  .btn-secondary {
    width: 100%;
    text-align: center;
  }
}

/* 弹窗样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.modal-header h4 {
  margin: 0;
  font-size: 1.5em;
  color: var(--text);
}

.close-btn {
  color: var(--muted);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text);
  text-decoration: none;
}

/* 加载动画 */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 50px;
}

.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.poster-image {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  margin-bottom: 20px;
}

/* 海报内容样式 */
.poster-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px;
  border-radius: 15px;
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
  color: white;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.poster-content h2 {
  color: white;
  margin-bottom: 30px;
  font-size: 2em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.poster-content .result-card {
  background-color: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 10px;
  box-shadow: none;
  margin-bottom: 30px;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.poster-content .personality-type {
  font-size: 1.8em;
  color: var(--accent);
  margin-bottom: 20px;
  font-weight: bold;
}

.poster-content .personality-description {
  font-size: 1.2em;
  color: var(--muted);
  margin-bottom: 30px;
  line-height: 1.6;
}

.poster-content .dimensions {
  text-align: left;
  margin-top: 30px;
}

.poster-content .dimensions h4 {
  margin-bottom: 20px;
  font-size: 1.4em;
  color: var(--text);
}

.poster-content .dimension-item {
  margin-bottom: 15px;
  font-size: 1.1em;
  color: var(--muted);
}

.poster-content .qr-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #ddd;
}

.poster-content .qr-section p {
  margin-bottom: 20px;
  font-size: 1.1em;
  color: white;
  font-weight: bold;
}

/* 维度部分的样式 */
.poster-content .dimension-section {
  background-color: rgba(108, 141, 113, 0.1);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid var(--accent);
}

.poster-content h4 {
  color: var(--text);
  margin-bottom: 15px;
  font-size: 1.3em;
}

.share-button {
  display: inline-block;
  padding: 12px 24px;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.share-button:hover {
  background-color: var(--accent-strong);
}
