/* 修正開始 */
:root {
  --primary-color: #dda0dd;    /* 撫子色風の柔らかい紫がかったピンク */
  --secondary-color: #b0c4de;  /* 水浅葱風の柔らかい青みのグレー */
  --accent-color: #98d7a5;     /* 若葉色風の柔らかい黄緑 */
  --background-color: #1a1a1a; /* 黒方眼紙風背景は維持 */
  --card-background: #ffffff;
  --text-color: #787878;       /* 優しいミディアムグレー */
  --error-color: #f8d7da;      /* 薄紅色風の非常に優しいピンク */
  --success-color: #d4edda;    /* 白群色風の柔らかいミントグリーン */
  --border-radius: 12px;
  --transition-duration: 0.3s;
  --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --container-width: 1200px;
}

/* リセットとベーススタイル */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--background-color);
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  color: var(--text-color);
  min-height: 100vh;
  line-height: 1.6;
}

/* ヘッダー削除 */

/* メインコンテンツ */
main {
  max-width: var(--container-width);
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  animation: fadeIn 0.5s ease-out;
}

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

/* フォームカード */
.form-card {
  background: rgba(248, 246, 240, 0.7) !important;  /* 砥粉色風の透過色 - ダークモード優先 */
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
}

.form-card h2 {
  margin: 0 0 1.5rem;
  color: #666;  /* 淡いグレー */
  font-family: 'Noto Serif JP', serif;
  font-size: 1.5rem;
  font-weight: 650;  /* 適度な太さで柔らかい印象 */
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8), 0 0 4px rgba(255, 255, 255, 0.3);  /* 柔らかく視認性の高い影 */
}

.form-card h2 i {
  font-size: 1.2em;
  color: var(--primary-color);  /* 撫子色風の桃色 */
}

/* フォームグループ */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #666;  /* 淡いグレー */
  font-weight: 500;
}

.form-group label i {
  margin-right: 0.5rem;
  color: var(--primary-color);  /* 撫子色風の桃色 */
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8), 0 0 4px rgba(255, 255, 255, 0.3);  /* 柔らかく視認性の高い影 */
}

/* 入力フィールド */
input[type="text"],
select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  color: #666;  /* 淡いグレー */
  transition: all var(--transition-duration);
}

input[type="text"]:focus,
select:focus {
  border-color: var(--secondary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(176, 196, 222, 0.4);
}

/* 数値入力 */
.date-inputs {
  display: flex;
  gap: 1rem;
}

.number-input {
  position: relative;
  flex: 1;
}

.number-input select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  color: #666;  /* 淡いグレー */
  background-color: white;
  cursor: pointer;
  transition: all var(--transition-duration);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1em;
  padding-right: 2.5rem;
}

.number-input select:focus {
  border-color: var(--secondary-color);
  outline: none;
  box-shadow: 0 0 0 3px rgba(176, 196, 222, 0.4);
}

/* ファイル入力 */
input[type="file"] {
  display: none;
}

.file-input-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem;
  background: var(--secondary-color);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-duration);
  font-weight: 500;
}

.file-input-label:hover {
  background: #9bb6d6;
  transform: translateY(-1px);
}

.file-input-label i {
  font-size: 1.2em;
}

/* プレビューカード */
.preview-card {
  background: rgba(248, 246, 240, 0.7) !important;  /* 砥粉色風の透過色 - ダークモード優先 */
  border-radius: var(--border-radius);
  padding: 2rem;
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  height: fit-content;
  position: sticky;
  top: 2rem;
}

.card-header {
  font-family: 'Noto Serif JP', serif;
  font-size: 1.5rem;
  font-weight: 650;  /* 適度な太さで柔らかい印象 */
  text-align: center;
  margin-bottom: 1.5rem;
  color: #666;  /* 淡いグレー */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8), 0 0 4px rgba(255, 255, 255, 0.3);  /* 柔らかく視認性の高い影 */
}

.card-header i {
  color: var(--primary-color);  /* 撫子色風の桃色 */
}

.card-body {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.5rem;
  background: #f8f6f0;  /* 砥粉色風の非常に柔らかいクリーム色 */
  border-radius: 8px;
  padding: 1rem;
  min-height: 300px;
}

#cardCanvas {
  max-width: 100%;
  height: auto;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  display: block;
  background: white;
}

/* ボタン */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-duration);
  font-size: 0.875rem;
  white-space: nowrap;
}

#generateBtn {
  width: 100%;
  margin-top: 1.5rem;
  background: var(--primary-color);
  color: white;
}

#generateBtn:hover {
  background: #c29dc2;
  transform: translateY(-1px);
}

.card-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

#downloadBtn {
  background: var(--accent-color);
  color: white;
}

#downloadBtn:hover {
  background: #89c89b;
  transform: translateY(-1px);
}

#twitterBtn {
  background: #a8bdd6;
  color: white;
}

#twitterBtn:hover {
  background: #97add0;
  transform: translateY(-1px);
}

#lineBtn {
  background: #a8c8a8;
  color: white;
}

#lineBtn:hover {
  background: #97bd97;
  transform: translateY(-1px);
}

#urlBtn {
  background: #a8a8a8;
  color: white;
}

#urlBtn:hover {
  background: #969696;
  transform: translateY(-1px);
}

/* ローディングオーバーレイ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1000;
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

.loading-overlay p {
  color: white;
  font-size: 1.2rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* フッター */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.875rem;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  main {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
    margin: 1rem auto;
  }

  .form-card,
  .preview-card {
    padding: 1.5rem;
  }

  .preview-card {
    position: static;
  }

  .card-body {
    min-height: 200px;
    padding: 0.5rem;
    background: #f8f6f0;  /* レスポンシブ版も砥粉色風の柔らかいクリーム色 */
  }

  .card-footer {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
    padding: 1rem;
  }

  .date-inputs {
    flex-direction: row;
  }

  .number-input {
    flex: 1;
  }

  input[type="text"],
  input[type="number"],
  select {
    font-size: 16px; /* iOSでズームを防ぐ */
    padding: 0.8rem;
  }

  .form-group label {
    font-size: 0.9rem;
  }
}

/* アクセシビリティ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
  .form-card,
  .preview-card {
    background: rgba(248, 246, 240, 0.7) !important;  /* ダークモードでも砥粉色風の透過色に統一 */
    color: #555555;  /* 落ち着いたグレーテキスト */
  }

  input[type="text"],
  input[type="number"],
  select {
    background: #ffffff !important;  /* ダークモードでも白背景で統一 */
    border-color: #e0e0e0 !important;  /* 明るいボーダー */
    color: #666 !important;  /* 淡いグレー */
  }

  .card-body {
    background: #f8f6f0 !important;  /* ダークモードでも砥粉色風の柔らかいクリーム色で統一 */
  }

  .number-input select {
    background-color: #ffffff !important;  /* ダークモードでも白背景で統一 */
    border-color: #e0e0e0 !important;  /* 明るいボーダー */
    color: #666 !important;  /* 淡いグレー */
  }
}
/* 診断結果表示用スタイル */
.diagnosis-result-display {
  padding: 0.75rem !important;
  background: #f8f9fa !important;
  border-radius: 8px !important;
  color: #666 !important;
  border: 2px solid #e0e0e0 !important;
  display: block !important;
  font-weight: 500 !important;
}

.diagnosis-result-display .result-badge {
  font-size: 0.8em;
  color: #999;
  font-weight: 400;
}

/* 診断に戻るボタンのスタイル */
#backToDiagnosisBtn:hover {
  background: linear-gradient(135deg, #89c89b, #97bd97) !important;
  transform: translateY(-1px);
}

/* 修正終了 */ 

/* クリックUIの選択を禁止（見た目は一切変えない） */
button, a, [role="button"], .btn, .answer-option, 
#toGeneratorBtn, #restartBtn, #backToDiagnosisBtn, #viewDiagnosisResultBtn {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
img { -webkit-user-drag: none; }

/* テキストコピーを許可したい要素には .copyable を付ける */
.copyable { user-select: text !important; } 