:root {
  color-scheme: light;
  --bg: #faf7f2;
  --ink: #2b2b2b;
  --accent: #4ade80;
  --accent-dark: #16a34a;
  --muted: #6b6b6b;
  --warn: #d97706;
  --card: #ffffff;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP",
    sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  padding: 16px;
  max-width: 720px;
  margin-inline: auto;
}

header h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
}
header .badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7em;
  border-radius: 6px;
  vertical-align: middle;
  margin-left: 4px;
}
header .lead {
  margin: 0 0 24px;
  color: var(--muted);
}

section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
section h2 { margin-top: 0; font-size: 1.15rem; }

button {
  background: var(--accent-dark);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 1rem;
  cursor: pointer;
  min-height: 44px;
}
button:disabled { background: #c2c2c2; cursor: not-allowed; }
button + button { margin-left: 8px; }

#preview {
  width: 100%;
  height: auto;
  background: #000;
  border-radius: 8px;
  display: block;
  margin: 12px 0;
  touch-action: none;        /* ドラッグ中にブラウザがスクロール/拡大しないように */
  cursor: grab;
}
#preview:active { cursor: grabbing; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.5em;
}
.status.error { color: #c0392b; }

.disclaimer {
  margin-top: 16px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.55;
}

footer {
  margin-top: 32px;
  text-align: center;
  color: var(--muted);
}

/* ====== Result page (MBTI / 16Personalities風) ====== */
.plumbline-note {
  margin: 8px 0 16px;
  padding: 10px 12px;
  background: rgba(34, 197, 94, 0.08);
  border-left: 3px solid #22c55e;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}
.plumbline-note strong { color: #16a34a; }
#result-canvas {
  width: 100%;
  height: auto;
  background: #000;
  border-radius: 12px;
  display: block;
  margin: 0 0 8px;
}

#result-body .result-headline {
  text-align: center;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

#result-body .type-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0 20px;
}
#result-body .type-card {
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
  border: 2px solid #fbbf24;
  border-radius: 16px;
  padding: 18px 20px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.18);
}
#result-body .type-card:nth-child(2) {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.18);
}
#result-body .type-card:nth-child(3) {
  background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
  border-color: #d946ef;
  box-shadow: 0 4px 12px rgba(217, 70, 239, 0.18);
}
#result-body .type-card-name {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.3;
  color: #1f2937;
}
#result-body .type-card-desc {
  margin-top: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

#result-body .type-description {
  margin: 12px 0;
  line-height: 1.75;
  font-size: 1.02rem;
  color: #1f2937;
}

#result-body .lifestyle-traits {
  background: #fffbeb;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 12px 0;
  border-left: 4px solid #fbbf24;
}
#result-body .lifestyle-title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #b45309;
}
#result-body .lifestyle-traits ul {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.8;
}

#result-body .share-copy {
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
  border: 1px dashed #06b6d4;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 1.05rem;
  text-align: center;
  color: #0e7490;
  font-weight: 600;
  line-height: 1.6;
}

#result-body .result-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 12px 0;
  font-size: 0.85rem;
  color: var(--muted);
}
#result-body .severity-inline { letter-spacing: 1px; }

/* 詳しく見る アコーディオン */
#result-body .result-details {
  margin: 18px 0 8px;
  border-top: 1px solid #e5e7eb;
  padding-top: 12px;
}
#result-body .result-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 6px 0;
  user-select: none;
}
#result-body .result-details summary:hover { color: var(--ink); }
#result-body .details-body { padding-top: 10px; }
#result-body .details-h4 {
  margin: 14px 0 6px;
  font-size: 0.95rem;
  color: #374151;
}
#result-body .meta-row { font-size: .9rem; color: var(--muted); margin: 4px 0; }
#result-body .narrative { margin: 12px 0; line-height: 1.7; font-size: 0.95rem; }
#result-body .suggestion {
  background: #f1fff1;
  border-left: 4px solid var(--accent);
  padding: 10px 14px;
  border-radius: 4px;
  margin: 12px 0;
}

#result-body .findings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 6px 0;
}
#result-body .findings-table th {
  text-align: left;
  vertical-align: top;
  padding: 6px 8px;
  width: 70px;
  font-weight: 600;
  color: #4b5563;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
#result-body .findings-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
}
#result-body .findings-status { font-weight: 600; color: #1f2937; }
#result-body .findings-sev { margin-left: 8px; letter-spacing: 1px; color: #b45309; }
#result-body .findings-note { color: var(--muted); font-size: 0.82rem; margin-top: 2px; line-height: 1.5; }

#result-body .myofascial-list {
  padding-left: 1.2em;
  font-size: 0.88rem;
  line-height: 1.7;
}
