*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: Arial, "Helvetica Neue", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #fdf6ec 0, #f4e6d6 40%, #e4d2c0 100%);
  color: #4b3523;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 32px;
}

.app-header {
  text-align: center;
  margin-bottom: 16px;
}

.app-title {
  margin: 0 0 6px;
  font-size: 1.9rem;
  letter-spacing: 0.08em;
}

.app-subtitle {
  margin: 0;
  font-size: 0.95rem;
  color: #85634a;
}

.card {
  width: 100%;
  max-width: 960px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(73, 41, 14, 0.16);
  margin-top: 16px;
  display: none;
}

.card.visible {
  display: block;
}

.card-body {
  padding: 22px 22px 20px;
}

.section-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.section-desc {
  margin: 0 0 18px;
  font-size: 0.95rem;
  color: #7d5a3f;
  line-height: 1.7;
}

.gender-group {
  margin: 18px 0 22px;
}

.field-label {
  display: block;
  font-size: 0.9rem;
  color: #7a5840;
  margin-bottom: 6px;
}

.gender-buttons {
  display: flex;
  gap: 12px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #c79b72;
  color: #fffaf5;
  box-shadow: 0 4px 12px rgba(81, 45, 15, 0.2);
  transition: background-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.05s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.btn:hover:not(:disabled) {
  background-color: #b37e4c;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(81, 45, 15, 0.24);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(81, 45, 15, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, #b0713e, #8b5a33);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #c57e45, #9b6539);
}

.btn-secondary {
  background: #fff4ea;
  color: #8a5a36;
  border: 1px solid #d7b189;
  box-shadow: 0 4px 12px rgba(140, 91, 48, 0.15);
}

.btn-secondary:hover:not(:disabled) {
  background: #ffe9d3;
}

.btn-outline {
  background: #fffaf6;
  color: #7b5233;
  border: 1px solid #d9b38c;
  box-shadow: 0 4px 10px rgba(130, 88, 54, 0.15);
}

.btn-outline.selected {
  background: #b97a47;
  color: #fffaf3;
  border-color: #b97a47;
}

.btn-outline:hover:not(:disabled) {
  background: #f6e3cf;
}

.btn-ghost {
  background: transparent;
  color: #7e5738;
  border-radius: 999px;
  padding-inline: 10px;
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(193, 147, 104, 0.13);
  box-shadow: none;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.82rem;
}

.btn-large {
  margin-top: 6px;
  width: 100%;
  padding-block: 11px;
  font-size: 1rem;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.quiz-progress {
  flex: 1;
  min-width: 0;
}

#progress-text {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: #7b573a;
}

.progress-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #f1dfcd;
  overflow: hidden;
}

.progress-inner {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #b07040, #d9a468);
  transition: width 0.25s ease-out;
}

.question-wrapper {
  margin-bottom: 16px;
}

.question-text {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.question-hint {
  margin: 0;
  font-size: 0.88rem;
  color: #947255;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.option-btn {
  width: 100%;
  justify-content: flex-start;
  background: #fffaf6;
  color: #5b3c25;
  border-radius: 14px;
  padding: 10px 14px;
  text-align: left;
  border: 1px solid transparent;
  box-shadow: 0 4px 10px rgba(141, 93, 53, 0.08);
}

.option-btn span {
  display: inline-block;
}

.option-btn-main {
  font-size: 0.96rem;
}

.option-btn-sub {
  font-size: 0.82rem;
  color: #a47a57;
  margin-left: 4px;
}

.option-btn.selected {
  background: #b97a47;
  color: #fffaf3;
  border-color: #ab6e3d;
  box-shadow: 0 5px 14px rgba(96, 54, 23, 0.3);
}

.option-btn.selected .option-btn-sub {
  color: #fbead8;
}

.quiz-footer {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.overlay.hidden {
  display: none;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 23, 10, 0.3);
}

.overlay-panel {
  position: relative;
  max-width: 640px;
  width: 90%;
  z-index: 41;
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.review-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.review-item {
  width: 38px;
  height: 36px;
  border-radius: 12px;
  font-size: 0.86rem;
  border: 1px solid #d3b58d;
  background: #fdf6ec;
  color: #7b5535;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.review-item.answered {
  background: #b57a49;
  color: #fffaf2;
  border-color: #b57a49;
}

.review-item:hover {
  transform: translateY(-1px);
}

.result-main {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2.1fr);
  gap: 18px;
  align-items: center;
}

.result-figure {
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-image {
  width: 180px;
  max-width: 70%;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  background: linear-gradient(145deg, #c49a6c, #f5e4cf);
  box-shadow: 0 18px 40px rgba(70, 41, 16, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.character-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-image-fallback {
  font-size: 2.8rem;
  color: #fff6ec;
  letter-spacing: 0.1em;
}

.character-name {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.character-meta {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #87644b;
}

.character-desc {
  margin: 0 0 12px;
  font-size: 0.95rem;
  line-height: 1.7;
}

.result-reason-block {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fdf4ea;
  border: 1px solid #e1c4a0;
}

.reason-title {
  margin: 0 0 6px;
  font-size: 0.98rem;
}

.reason-text {
  margin: 0;
  font-size: 0.92rem;
  color: #7a5331;
  line-height: 1.7;
}

.result-footer {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.app-footer {
  margin-top: 18px;
  font-size: 0.8rem;
  color: #9a7a5e;
}

@media (max-width: 768px) {
  .card-body {
    padding: 18px 16px 16px;
  }

  .result-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-figure {
    margin-bottom: 6px;
  }

  .quiz-header {
    align-items: flex-start;
  }

  .gender-buttons {
    width: 100%;
  }

  .gender-buttons .btn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding-inline: 10px;
  }

  .app-title {
    font-size: 1.6rem;
  }

  .section-title {
    font-size: 1.12rem;
  }

  .character-image {
    width: 150px;
  }
}

