/* ==========================================================================
   Mehterhane Rare 1st Personality Diagnosis Stylesheet
   ========================================================================== */

:root {
  --ink: #161822;
  --ink-muted: #4b5166;
  --paper: #fffdf7;
  --surface: #ffffff;
  --line: #161822;
  --line-soft: #e2dfd5;

  /* 5 Element Colors */
  --fire: #ff3d2e;
  --water: #0095ff;
  --wind: #00c853;
  --light: #ffb800;
  --dark: #7c3aed;

  /* Theme accent */
  --theme-accent: var(--fire);
  --theme-accent-soft: #ffe8e6;

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-pill: 999px;
  --shadow-pop: 4px 4px 0 var(--line);
  --shadow-pop-lg: 6px 6px 0 var(--line);

  --font-sans: "M PLUS Rounded 1c", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --font-display: "Space Grotesk", "M PLUS Rounded 1c", sans-serif;
}

[hidden] {
  display: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(var(--line-soft) 1.2px, transparent 1.2px);
  background-size: 24px 24px;
  line-height: 1.65;
  overflow-x: hidden;
}

.bg-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.shape {
  position: absolute;
  opacity: 0.14;
  border-radius: 36% 64% 62% 38% / 44% 48% 52% 56%;
  animation: floatShape 18s ease-in-out infinite alternate;
}

.shape-fire {
  width: 260px;
  height: 260px;
  background: var(--fire);
  top: -60px;
  left: -70px;
}

.shape-water {
  width: 220px;
  height: 220px;
  background: var(--water);
  top: 22%;
  right: -60px;
  animation-delay: -3s;
}

.shape-wind {
  width: 200px;
  height: 200px;
  background: var(--wind);
  bottom: 14%;
  left: -50px;
  animation-delay: -6s;
}

.shape-light {
  width: 180px;
  height: 180px;
  background: var(--light);
  top: 62%;
  right: 8%;
  animation-delay: -9s;
}

.shape-dark {
  width: 240px;
  height: 240px;
  background: var(--dark);
  bottom: -80px;
  right: -40px;
  animation-delay: -12s;
}

@keyframes floatShape {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
  }
  100% {
    transform: translate3d(18px, -22px, 0) rotate(14deg) scale(1.06);
  }
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* Header */
.site-header {
  border-bottom: 2px solid var(--line);
  background: var(--paper);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-dots {
  display: inline-flex;
  gap: 4px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
}

.dot-fire { background: var(--fire); }
.dot-water { background: var(--water); }
.dot-wind { background: var(--wind); }
.dot-light { background: var(--light); }
.dot-dark { background: var(--dark); }

.brand-sub {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-muted);
}

/* Main container */
.app-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 36px 20px 72px;
}

.screen {
  animation: fadeSlideUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 800;
  border: 2.5px solid var(--line);
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background-color 0.14s ease;
  box-shadow: var(--shadow-pop);
}

.btn:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-pop-lg);
}

.btn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--line);
}

.btn:focus-visible {
  outline: 3px solid var(--water);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary {
  background: var(--fire);
  color: #ffffff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
}

.btn-x {
  background: #111319;
  color: #ffffff;
}

.btn-lg {
  padding: 16px 40px;
  font-size: 1.15rem;
}

/* ==========================================================================
   START SCREEN
   ========================================================================== */
.screen-start {
  text-align: center;
  padding: 40px 0 24px;
}

.hero-badge-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.el-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  font-weight: 800;
  font-size: 1rem;
  color: #ffffff;
  box-shadow: 3px 3px 0 var(--line);
  animation: popBounce 2.6s ease-in-out infinite;
}

.pill-fire { background: var(--fire); animation-delay: 0s; }
.pill-water { background: var(--water); animation-delay: 0.15s; }
.pill-wind { background: var(--wind); animation-delay: 0.3s; }
.pill-light { background: var(--light); color: var(--ink); animation-delay: 0.45s; }
.pill-dark { background: var(--dark); animation-delay: 0.6s; }

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

.hero-title {
  margin: 0 0 20px;
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.accent-underline {
  background-image: linear-gradient(transparent 62%, var(--light) 62%);
  padding: 0 4px;
}

.hero-lead {
  max-width: 560px;
  margin: 0 auto 28px;
  font-size: 1.05rem;
  color: var(--ink-muted);
}

.hero-meta {
  list-style: none;
  padding: 0;
  margin: 0 auto 36px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px 24px;
  font-size: 0.95rem;
}

.hero-meta li {
  padding: 6px 14px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-pill);
}

.error-banner {
  margin: 24px auto 0;
  max-width: 560px;
  padding: 14px 18px;
  border: 2px solid var(--fire);
  background: #fff0ef;
  color: #9b1c1c;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

/* ==========================================================================
   QUIZ SCREEN
   ========================================================================== */
.progress-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  padding: 14px 0 18px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--line);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.progress-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.progress-count {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink-muted);
}

.progress-track {
  width: 100%;
  height: 16px;
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--fire), var(--light), var(--wind), var(--water), var(--dark));
  background-size: 200% 100%;
  transition: width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  animation: gradientShift 4s linear infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.question-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.question-item {
  padding: 22px 0 26px;
  border-bottom: 2px dashed var(--line-soft);
  transition: background-color 0.2s ease;
}

.question-item.is-unanswered {
  padding: 22px 16px 26px;
  background: #fff2f0;
  border: 2px solid var(--fire);
  border-radius: var(--radius-md);
}

.question-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.question-legend {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.5;
  width: 100%;
}

.question-num {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 3px 10px;
  background: var(--ink);
  color: #ffffff;
  border-radius: var(--radius-pill);
}

.choice-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.choice-label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 58px;
  padding: 10px 6px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, color 0.15s ease, box-shadow 0.12s ease;
}

.choice-label:hover {
  transform: translateY(-2px);
  box-shadow: 2px 2px 0 var(--line);
}

.choice-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-input:focus-visible + .choice-text {
  outline: 3px solid var(--water);
  outline-offset: 4px;
  border-radius: 4px;
}

.choice-label:has(.choice-input:checked) {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--line);
  color: #ffffff;
}

.choice-label[data-score="4"]:has(.choice-input:checked) { background: var(--fire); }
.choice-label[data-score="3"]:has(.choice-input:checked) { background: var(--light); color: var(--ink); }
.choice-label[data-score="2"]:has(.choice-input:checked) { background: var(--wind); }
.choice-label[data-score="1"]:has(.choice-input:checked) { background: var(--water); }
.choice-label[data-score="0"]:has(.choice-input:checked) { background: var(--dark); }

.quiz-warning {
  margin: 20px 0 0;
  padding: 12px 16px;
  background: #fff0ef;
  border: 2px solid var(--fire);
  border-radius: var(--radius-sm);
  color: #9b1c1c;
  font-weight: 700;
  text-align: center;
}

.quiz-nav {
  margin-top: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

/* ==========================================================================
   RESULT SCREEN
   ========================================================================== */
.result-hero {
  padding-bottom: 40px;
  border-bottom: 3px solid var(--line);
}

.result-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.result-badge {
  display: inline-block;
  padding: 6px 16px;
  border: 2.5px solid var(--line);
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.95rem;
  background: var(--theme-accent);
  color: #ffffff;
  box-shadow: 2px 2px 0 var(--line);
}

.result-badge.is-light {
  color: var(--ink);
}

.badge-job {
  background: var(--surface);
  color: var(--ink);
}

.result-cross {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
}

.result-kicker {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}

.result-title {
  margin: 0 0 28px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.2;
  font-weight: 800;
  color: var(--ink);
}

.result-showcase {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  align-items: start;
}

/* Square frame for character image */
.character-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--theme-accent-soft);
  border: 3px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.character-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.character-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--ink-muted);
  gap: 8px;
}

.placeholder-icon {
  font-size: 2.6rem;
  color: var(--theme-accent);
}

.placeholder-text {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.placeholder-file {
  font-size: 0.78rem;
  background: var(--surface);
  border: 1.5px solid var(--line-soft);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.result-description {
  margin: 0 0 20px;
  font-size: 1.05rem;
  line-height: 1.8;
}

.result-callout {
  padding: 14px 18px;
  border-left: 5px solid var(--theme-accent);
  background: var(--surface);
  margin-bottom: 14px;
}

.result-callout h3 {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 800;
}

.result-callout p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-muted);
}

.callout-caution {
  border-left-color: var(--ink);
}

.share-actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* Result sections */
.result-section {
  padding: 40px 0;
  border-bottom: 2px dashed var(--line-soft);
}

.result-section:last-child {
  border-bottom: none;
}

.section-heading {
  margin: 0 0 24px;
  font-size: 1.45rem;
  font-weight: 800;
  display: inline-block;
  background-image: linear-gradient(transparent 65%, var(--theme-accent-soft) 65%);
  padding: 0 6px;
}

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.chart-block {
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-pop);
}

.chart-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  text-align: center;
}

.canvas-wrap {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}

.canvas-wrap canvas {
  width: 100%;
  height: auto;
  display: block;
}

.score-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.score-chip {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  background: var(--paper);
}

.score-chip.is-top {
  background: var(--theme-accent);
  color: #ffffff;
}

.score-chip.is-top.is-light {
  color: var(--ink);
}

/* Concepts */
.concepts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.concept-block {
  padding: 24px;
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
}

.concept-kicker {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-muted);
  margin: 0 0 4px;
}

.concept-name {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 800;
}

.concept-copy {
  margin: 0 0 14px;
  font-weight: 700;
  color: var(--theme-accent);
}

.concept-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.keyword-tag {
  font-size: 0.82rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--theme-accent-soft);
  border: 1.5px solid var(--line);
}

.concept-sub {
  margin: 14px 0 6px;
  font-size: 0.92rem;
  font-weight: 800;
}

.concept-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.92rem;
  color: var(--ink-muted);
}

.concept-list li {
  margin-bottom: 4px;
}

/* Partner */
.partner-block {
  padding: 24px 28px;
  background: var(--surface);
  border: 2.5px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
}

.partner-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.partner-badges {
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--line);
  background: var(--paper);
  font-size: 0.88rem;
  font-weight: 800;
}

.partner-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
}

.partner-description {
  margin: 0;
  font-size: 0.98rem;
  color: var(--ink-muted);
  line-height: 1.8;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 16px 20px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--ink-muted);
  border-top: 2px solid var(--line);
}

.cc {
  text-align: left;
  font-size: 0.7rem;
  margin: 0px 60px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 780px) {
  .result-showcase {
    grid-template-columns: 1fr;
  }

  .character-frame {
    max-width: 300px;
    margin: 0 auto;
  }

  .charts-grid,
  .concepts-grid {
    grid-template-columns: 1fr;
  }

  .choice-group {
    grid-template-columns: 1fr;
  }

  .choice-label {
    min-height: 46px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 10px 16px;
    text-align: left;
  }
}

/* ==========================================================================
   ACCESSIBILITY: REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .shape,
  .el-pill,
  .progress-fill,
  .screen {
    animation: none !important;
  }

  .btn,
  .choice-label,
  .progress-fill {
    transition: none !important;
  }
}
