:root {
  --bg: #071426;
  --panel: rgba(255, 255, 255, 0.1);
  --panel-strong: rgba(255, 255, 255, 0.16);
  --text: #f8fbff;
  --muted: #b8c8dc;
  --line: rgba(255, 255, 255, 0.18);
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.22);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(16, 185, 129, 0.14), transparent 30%),
    radial-gradient(circle at 82% 8%, rgba(245, 158, 11, 0.12), transparent 32%),
    linear-gradient(160deg, #06111f 0%, #10243f 52%, #081629 100%);
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
}

body[data-view="startView"] {
  background-image:
    linear-gradient(180deg, rgba(5, 13, 28, 0.46), rgba(5, 13, 28, 0.72)),
    url("./assets/backgrounds/top-mobile.webp");
}

body[data-view="quizView"],
body[data-view="interestView"] {
  background-image:
    linear-gradient(180deg, rgba(5, 13, 28, 0.58), rgba(5, 13, 28, 0.78)),
    url("./assets/backgrounds/quiz-mobile.webp");
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.hero-panel,
.panel,
.question-card,
.summary-panel {
  min-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.1));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
}

#startView .eyebrow {
  display: none;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3.8rem);
  line-height: 1.08;
}

h2 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.35;
}

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

.lead,
.subtle,
.notice {
  color: var(--muted);
  line-height: 1.75;
}

.intro-note {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.intro-note h2 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.intro-note p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.92rem;
}

.saved-results-panel {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.saved-results-head {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.saved-results-head h2 {
  font-size: 1.05rem;
}

.saved-results-head p,
.saved-result-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.82rem;
}

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

.saved-result-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 12, 24, 0.28);
}

.saved-result-open {
  min-width: 0;
  color: var(--text);
  text-align: left;
  background: transparent;
}

.saved-result-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.saved-result-delete {
  width: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.field-label {
  display: block;
  margin: 26px 0 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.text-input,
textarea {
  width: 100%;
  min-height: 52px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 12, 24, 0.42);
  padding: 14px 16px;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.6;
}

.primary-button,
.secondary-button,
.ghost-button {
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-button {
  color: #06111f;
  background: linear-gradient(135deg, var(--accent), #ffffff);
}

.secondary-button {
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.ghost-button {
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.topbar {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.topbar .ghost-button {
  margin: 0;
}

.progress-wrap {
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-track {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-bar {
  width: 5%;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.question-card {
  min-height: calc(100vh - 112px);
  justify-content: flex-start;
}

.axis-label {
  color: var(--accent);
  font-weight: 700;
}

.answer-list {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.answer-button,
.check-item {
  min-height: 58px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
}

.answer-button.is-selected,
.check-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.check-grid {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.check-item input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.sticky-actions {
  display: grid;
  gap: 8px;
  padding: 10px 0 18px;
}

.sticky-actions button {
  margin-top: 0;
}

.ai-copy-note {
  margin: -4px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.86rem;
  line-height: 1.65;
}

.status-card {
  width: min(100%, 540px);
  margin: 0 auto 28px;
  padding: clamp(16px, 4vw, 22px);
  display: grid;
  gap: 12px;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--accent);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 22%, var(--accent-soft), transparent 38%),
    linear-gradient(180deg, rgba(255, 250, 232, 0.96), rgba(255, 246, 220, 0.94)),
    linear-gradient(140deg, rgba(8, 20, 38, 0.96), rgba(12, 34, 58, 0.96));
  box-shadow:
    0 0 0 7px rgba(255, 255, 255, 0.06),
    0 0 34px var(--accent-soft),
    var(--shadow);
  color: #203048;
}

.status-card::before,
.status-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  pointer-events: none;
}

.status-card::after {
  inset: 18px;
  border-color: rgba(255, 255, 255, 0.72);
}

.status-header {
  position: relative;
  z-index: 1;
  text-align: center;
  border-bottom: 1px solid var(--accent);
  padding: 4px 12px 8px;
}

.status-header h2 {
  color: var(--accent);
  font-size: clamp(1.55rem, 6.7vw, 2.35rem);
  line-height: 1.08;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.62);
}

.participant-result {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 6px;
  padding: 3px 12px;
  border: 1px solid rgba(32, 48, 72, 0.14);
  border-radius: 999px;
  color: #4b5568;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
}

.detail-type-name {
  width: fit-content;
  max-width: 100%;
  margin: 6px auto 0;
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #203048;
  background: rgba(255, 255, 255, 0.72);
  font-size: 1.08rem;
  font-weight: 800;
}

.result-comment {
  margin: 6px 0 0;
  color: #4b5568;
  line-height: 1.45;
  font-size: 0.78rem;
  font-weight: 700;
}

.keyword-list {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.keyword-list span,
.work-list span {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.balance-area {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: 9px;
  align-items: center;
}

.chart-panel,
.feature-panel {
  min-width: 0;
  border: 1px solid rgba(32, 48, 72, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 9px 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.chart-panel h3,
.feature-panel h3 {
  color: var(--accent);
  font-size: 0.72rem;
  text-align: center;
  margin-bottom: 6px;
}

.rate-row {
  display: grid;
  gap: 4px;
  margin-bottom: 5px;
}

.radar-graphic {
  width: 100%;
  aspect-ratio: 1;
}

.radar-graphic svg {
  display: block;
  width: 100%;
  height: 100%;
}

.radar-grid {
  fill: rgba(255, 255, 255, 0.24);
  stroke: rgba(32, 48, 72, 0.2);
  stroke-width: 1.3;
}

.radar-grid.outer {
  fill: rgba(255, 255, 255, 0.38);
}

.radar-axis {
  stroke: rgba(32, 48, 72, 0.2);
  stroke-width: 1;
}

.radar-shape {
  fill: var(--accent-soft);
  stroke: var(--radar-color);
  stroke-width: 4;
  stroke-linejoin: round;
}

.radar-graphic text {
  fill: #f59e0b;
  font-size: 10px;
  font-weight: 700;
}

.rate-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #203048;
  font-size: 0.67rem;
  font-weight: 700;
}

.rate-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(32, 48, 72, 0.12);
}

.rate-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--bar-color, var(--accent));
}

.type-portrait-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 2 / 3;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  overflow: hidden;
  box-shadow: inset 0 0 34px var(--accent-soft);
}

.type-portrait {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0;
  filter: none;
}

.image-fallback {
  display: none;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 12px;
  color: var(--text);
  text-align: center;
  font-weight: 700;
  line-height: 1.4;
}

.detail-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.detail-grid .feature-panel:first-child,
.detail-grid .full-panel,
.detail-grid .role-panel {
  grid-column: 1 / -1;
}

.description-text {
  margin: 0;
  color: #4b5568;
  font-size: 0.68rem;
  line-height: 1.52;
  font-weight: 700;
}

.feature-panel ul {
  margin: 0;
  padding-left: 1.2em;
  color: #4b5568;
  line-height: 1.42;
  font-size: 0.66rem;
  font-weight: 700;
}

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

.work-list span {
  display: grid;
  place-items: center;
  min-height: 30px;
  line-height: 1.25;
  white-space: normal;
}

.message-text {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #2f3d54;
  line-height: 1.45;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
}

.notice {
  position: relative;
  z-index: 1;
  margin: 4px 0 6px;
  padding: 9px 10px;
  border: 1px solid rgba(32, 48, 72, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: #5f6b7f;
  font-size: 0.62rem;
  line-height: 1.5;
  text-align: center;
}

.summary-panel {
  justify-content: flex-start;
}

.summary-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.summary-head .ghost-button {
  width: auto;
  min-width: 120px;
  margin: 0;
  padding: 0 14px;
}

.summary-content,
.memo-fields,
.guardian-content {
  display: grid;
  gap: 14px;
}

.summary-block,
.guardian-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.07);
}

.summary-block p,
.guardian-block p {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.7;
}

.guardian-block {
  display: grid;
  gap: 10px;
}

.guardian-block h3 {
  color: var(--text);
  font-size: 1rem;
}

.guardian-block p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.9;
}

.guardian-block strong {
  color: var(--text);
}

.guardian-points {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guardian-points li {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  width: min(calc(100% - 36px), 420px);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(4, 12, 24, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 18px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 720px) {
  body[data-view="startView"] {
    background-image:
      linear-gradient(90deg, rgba(5, 13, 28, 0.78), rgba(5, 13, 28, 0.38) 42%, rgba(5, 13, 28, 0.72)),
      url("./assets/backgrounds/top-desktop.webp");
  }

  body[data-view="quizView"],
  body[data-view="interestView"] {
    background-image:
      linear-gradient(90deg, rgba(5, 13, 28, 0.82), rgba(5, 13, 28, 0.48) 50%, rgba(5, 13, 28, 0.82)),
      url("./assets/backgrounds/quiz-desktop.webp");
  }

  .sticky-actions {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding: 12px;
  }

  body[data-view="startView"] {
    background-image:
      linear-gradient(180deg, rgba(5, 13, 28, 0.06) 0%, rgba(5, 13, 28, 0.18) 38%, rgba(5, 13, 28, 0.74) 100%),
      url("./assets/backgrounds/top-mobile.webp");
    background-position: center top;
  }

  body[data-view="startView"] .app-shell {
    padding-top: clamp(140px, 34vh, 250px);
  }

  .hero-panel,
  .panel,
  .question-card,
  .summary-panel {
    padding: 20px;
  }

  body[data-view="startView"] .hero-panel {
    min-height: auto;
    justify-content: flex-start;
    border-color: rgba(255, 255, 255, 0.22);
    background: linear-gradient(180deg, rgba(38, 49, 72, 0.62), rgba(28, 36, 54, 0.48));
    backdrop-filter: blur(10px);
  }

  .status-card {
    gap: 8px;
    padding: 14px;
  }

  .status-header h2 {
    font-size: 1.42rem;
  }

  .result-comment {
    font-size: 0.68rem;
  }

  .detail-grid {
    gap: 7px;
  }

  .description-text,
  .feature-panel ul,
  .message-text {
    font-size: 0.6rem;
  }
}
