*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: "STKaiti", "KaiTi", "FangSong", "Songti SC", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #f2e7da 0, #e5d3bf 40%, #d6c0a6 80%);
  color: #3b2b20;
}

.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
}

.app-header {
  text-align: center;
  margin-bottom: 16px;
}

.app-header h1 {
  font-weight: 600;
  letter-spacing: 0.12em;
  font-size: 1.8rem;
  color: #3d2a1a;
}

.subtitle {
  margin-top: 6px;
  font-size: 0.95rem;
  color: #6e5645;
}

.app-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 0.8rem;
  color: #8f7665;
}

main#app {
  width: 100%;
  max-width: 900px;
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.card {
  width: 100%;
  background: rgba(255, 252, 247, 0.96);
  border-radius: 18px;
  box-shadow: 0 16px 35px rgba(83, 55, 30, 0.18);
  padding: 22px 20px 18px;
  display: none;
}

.card.visible {
  display: block;
}

.card h2 {
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn.primary {
  background: linear-gradient(135deg, #c08b4f, #9f6a3b);
  color: #fffaf4;
  box-shadow: 0 8px 20px rgba(137, 89, 45, 0.45);
}

.btn.primary:hover {
  background: linear-gradient(135deg, #b57c3f, #915f35);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(117, 76, 40, 0.5);
}

.btn.primary:disabled {
  background: #c9a882;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn.secondary {
  background: rgba(165, 120, 79, 0.1);
  color: #7b5433;
  border: 1px solid rgba(165, 120, 79, 0.5);
}

.btn.secondary:hover {
  background: rgba(165, 120, 79, 0.16);
}

.btn.ghost {
  background: transparent;
  border: 1px dashed rgba(141, 104, 69, 0.5);
  color: #7b5433;
}

.btn.ghost:hover {
  background: rgba(165, 120, 79, 0.06);
}

.btn.small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.gender-select {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}

.gender-btn {
  flex: 1;
  background: rgba(255, 248, 237, 0.9);
  border: 1px solid rgba(176, 130, 88, 0.6);
  color: #6b4b30;
}

.gender-btn.selected {
  background: linear-gradient(135deg, #c08b4f, #9f6a3b);
  color: #fffaf4;
}

.hint {
  font-size: 0.85rem;
  color: #8b6b52;
  margin-bottom: 14px;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.progress-wrapper {
  flex: 1;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(206, 178, 142, 0.3);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

#progress-inner {
  height: 100%;
  background: linear-gradient(90deg, #c9955b, #8e623c);
  width: 0;
  transition: width 0.25s ease;
}

#progress-text {
  font-size: 0.9rem;
  color: #6d513a;
}

.question-area {
  margin-top: 4px;
}

#question-title {
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.question-desc {
  font-size: 0.9rem;
  color: #7c624e;
  margin-bottom: 16px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(173, 132, 90, 0.5);
  background: rgba(255, 248, 240, 0.9);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}

.option-btn:hover {
  background: rgba(255, 244, 230, 0.96);
  box-shadow: 0 8px 18px rgba(150, 110, 72, 0.18);
  transform: translateY(-1px);
}

.option-btn.selected {
  border-color: #c58a4b;
  box-shadow: 0 10px 22px rgba(141, 98, 61, 0.26);
  background: linear-gradient(135deg, rgba(199, 149, 91, 0.12), rgba(238, 210, 173, 0.95));
}

.option-index {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(141, 104, 69, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #7a563a;
  margin-top: 2px;
  flex-shrink: 0;
}

.option-text-main {
  font-size: 0.95rem;
  color: #4f3827;
}

.option-text-sub {
  font-size: 0.8rem;
  color: #8b6a51;
  margin-top: 2px;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(48, 33, 20, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}

.overlay.visible {
  display: flex;
}

.overlay-content {
  max-width: 520px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.filled-list {
  overflow: auto;
  padding-right: 4px;
}

.filled-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
}

.filled-item {
  border-radius: 999px;
  padding: 6px 0;
  font-size: 0.85rem;
  text-align: center;
  border: 1px solid rgba(149, 112, 78, 0.7);
  color: #6e4c2e;
  background: rgba(255, 248, 238, 0.95);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filled-item.answered {
  background: linear-gradient(135deg, #c08b4f, #9f6a3b);
  color: #fffaf4;
}

.filled-item.current {
  box-shadow: 0 0 0 2px rgba(72, 45, 23, 0.65);
}

.result-character {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 14px;
  align-items: stretch;
}

.char-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.char-avatar {
  width: 160px;
  height: 200px;
  border-radius: 18px;
  background: radial-gradient(circle at 20% 20%, #ffe9c9, #c8925a);
  box-shadow: 0 20px 30px rgba(118, 79, 46, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.char-avatar::before {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 999px;
  border: 2px solid rgba(255, 250, 241, 0.8);
  box-shadow: 0 0 20px rgba(255, 250, 241, 0.85) inset;
}

.char-avatar span {
  position: relative;
  z-index: 1;
  font-size: 2.8rem;
  color: #4b311d;
  letter-spacing: 0.2em;
}

.char-basic {
  text-align: center;
}

.char-basic h3 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.char-tagline {
  font-size: 0.9rem;
  color: #7e5f45;
}

.char-meta {
  font-size: 0.9rem;
  color: #6c513b;
}

.char-meta p + p {
  margin-top: 4px;
}

.char-reason {
  background: rgba(255, 247, 237, 0.95);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.9rem;
  box-shadow: inset 0 0 0 1px rgba(179, 132, 87, 0.22);
  color: #5a402a;
}

.char-reason strong {
  color: #8b5e33;
}

.result-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .card {
    padding: 16px 14px 14px;
    border-radius: 16px;
  }

  .app-header h1 {
    font-size: 1.4rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  .gender-select {
    flex-direction: row;
  }

  .result-character {
    grid-template-columns: 1fr;
  }

  .char-avatar {
    width: 140px;
    height: 180px;
  }

  .quiz-footer {
    flex-direction: column-reverse;
    gap: 10px;
  }
}

