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

:root {
  --bg: #0a0a1a;
  --surface: #12122a;
  --accent: #c8a8e9;
  --accent2: #8b6bbf;
  --text: #e8e0f0;
  --text-sub: #9990b0;
  --border: #2a2a4a;
  --radius: 16px;
  --gold: #d4af7a;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 40px;
}

.header {
  width: 100%;
  padding: 24px 20px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.header .logo {
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}

.step-indicator {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 20px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.step-dot.active {
  background: var(--accent);
}

.step-dot.done {
  background: var(--accent2);
}

.container {
  width: 100%;
  max-width: 480px;
  padding: 0 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.label {
  font-size: 12px;
  color: var(--text-sub);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}

.subtitle {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.7;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.select-row {
  display: flex;
  gap: 8px;
}

select, input[type="number"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
}

.select-wrapper {
  position: relative;
  flex: 1;
}

.select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-sub);
  pointer-events: none;
}

.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.2s;
}

.btn:active { opacity: 0.8; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: white;
  letter-spacing: 1px;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 画像選択カード */
.image-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}

.image-choice {
  position: relative;
  cursor: pointer;
}

.image-choice input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.image-choice-inner {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
}

.image-choice input:checked + .image-choice-inner {
  border-color: var(--accent);
  background: rgba(200, 168, 233, 0.1);
}

.image-choice-inner img {
  width: 100%;
  aspect-ratio: 9/16;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  margin-bottom: 8px;
}

.image-choice-inner .name {
  font-size: 13px;
  font-weight: 600;
}

/* 行動質問 */
.behavior-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.behavior-choice {
  position: relative;
  cursor: pointer;
}

.behavior-choice input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.behavior-choice-inner {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.behavior-choice input:checked + .behavior-choice-inner {
  border-color: var(--accent);
  background: rgba(200, 168, 233, 0.1);
}

.choice-key {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.behavior-choice input:checked + .behavior-choice-inner .choice-key {
  background: var(--accent2);
}

/* 結果画面 */
.result-text {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text);
}

.result-text h1 {
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 16px;
}

.result-text h2 {
  font-size: 15px;
  color: var(--gold);
  margin: 20px 0 8px;
}

.loading {
  text-align: center;
  padding: 60px 20px;
}

.loading .spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading p {
  color: var(--text-sub);
  font-size: 14px;
}

.error-msg {
  color: #e88;
  font-size: 13px;
  margin-top: 8px;
  text-align: center;
}

.question-counter {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
