/**
 * ゆめまち☆キャンバス 共通スタイル
 * かわいい・ポップなデザイン
 */

/* ========================================
   リセット・基本設定
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
  background: linear-gradient(135deg, #FFE5EC 0%, #E8F4FF 50%, #FFF4E5 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========================================
   画面コンテナ
   ======================================== */
.screen-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 16px;
}

/* ========================================
   画面名（右上表示）
   ======================================== */
.screen-name {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 12px;
  color: #888;
  background: rgba(255, 255, 255, 0.7);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

/* ========================================
   メインコンテンツ
   ======================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
}

/* ========================================
   タイトル
   ======================================== */
.title {
  font-size: 28px;
  font-weight: bold;
  color: #FF6B9D;
  text-shadow: 
    2px 2px 0 #FFD700,
    -1px -1px 0 #FFF;
  margin-bottom: 8px;
  letter-spacing: 2px;
  animation: titleBounce 2s ease-in-out infinite;
}

.subtitle {
  font-size: 16px;
  color: #7B68EE;
  font-weight: 500;
  margin-bottom: 48px;
}

/* タイトルのふわふわアニメーション */
@keyframes titleBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* ========================================
   クラッカーアニメーション
   ======================================== */
.cracker-container {
  position: absolute;
  top: 30%;
  left: 0;
  right: 0;
  pointer-events: none;
}

.cracker {
  position: absolute;
  font-size: 48px;
  opacity: 0;
  transition: all 0.1s;
}

.cracker-left {
  left: 10%;
  transform: rotate(-30deg);
}

.cracker-right {
  right: 10%;
  transform: rotate(30deg) scaleX(-1);
}

/* クラッカーが開くアニメーション */
.cracker.pop {
  animation: crackerPop 0.8s ease-out forwards;
}

@keyframes crackerPop {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-30deg);
  }
  30% {
    opacity: 1;
    transform: scale(1.3) rotate(-15deg);
  }
  50% {
    transform: scale(1) rotate(-30deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-30deg);
  }
}

.cracker-right.pop {
  animation: crackerPopRight 0.8s ease-out forwards;
}

@keyframes crackerPopRight {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(30deg) scaleX(-1);
  }
  30% {
    opacity: 1;
    transform: scale(1.3) rotate(15deg) scaleX(-1);
  }
  50% {
    transform: scale(1) rotate(30deg) scaleX(-1);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(30deg) scaleX(-1);
  }
}

/* ========================================
   紙吹雪
   ======================================== */
.confetti-container {
  position: absolute;
  top: 25%;
  left: 0;
  right: 0;
  height: 200px;
  pointer-events: none;
  overflow: visible;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  opacity: 0;
}

/* 紙吹雪が飛ぶアニメーション */
@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(150px) rotate(720deg);
  }
}

/* ========================================
   スタートボタン
   ======================================== */
.start-button {
  background: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 50%, #FFA0C0 100%);
  border: none;
  border-radius: 50px;
  padding: 18px 60px;
  font-size: 20px;
  font-weight: bold;
  color: #FFF;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  box-shadow: 
    0 6px 20px rgba(255, 154, 158, 0.4),
    0 3px 6px rgba(0, 0, 0, 0.1),
    inset 0 2px 4px rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.start-button::before {
  content: '✨';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.start-button::after {
  content: '✨';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.start-button:hover {
  transform: translateY(-3px);
  box-shadow: 
    0 8px 25px rgba(255, 154, 158, 0.5),
    0 5px 10px rgba(0, 0, 0, 0.15),
    inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

.start-button:active {
  transform: translateY(0);
  box-shadow: 
    0 4px 15px rgba(255, 154, 158, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

/* ボタンのキラキラアニメーション */
.start-button {
  animation: buttonGlow 2s ease-in-out infinite;
}

@keyframes buttonGlow {
  0%, 100% {
    box-shadow: 
      0 6px 20px rgba(255, 154, 158, 0.4),
      0 3px 6px rgba(0, 0, 0, 0.1),
      inset 0 2px 4px rgba(255, 255, 255, 0.4);
  }
  50% {
    box-shadow: 
      0 6px 30px rgba(255, 154, 158, 0.6),
      0 3px 6px rgba(0, 0, 0, 0.1),
      inset 0 2px 4px rgba(255, 255, 255, 0.5);
  }
}

/* ========================================
   画像表示画面
   ======================================== */
.image-display-content {
  justify-content: flex-start;
  padding-top: 40px;
}

/* 元画像コンテナ */
.image-container {
  width: 100%;
  max-width: 350px;
  margin-bottom: 20px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  background: #FFF;
  padding: 8px;
}

.base-image {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

/* セクションタイトル */
.section-title {
  font-size: 18px;
  font-weight: bold;
  color: #FF6B9D;
  margin-bottom: 20px;
  text-shadow: 1px 1px 0 #FFF;
}

/* オプションフォーム */
.options-form {
  width: 100%;
  max-width: 350px;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  margin-bottom: 6px;
  padding-left: 4px;
}

/* ドロップダウン */
.form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid #FFB6C1;
  border-radius: 12px;
  background: #FFF;
  color: #333;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23FF6B9D' 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 12px center;
  background-size: 20px;
  transition: all 0.3s ease;
}

.form-select:focus {
  outline: none;
  border-color: #FF6B9D;
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.2);
}

/* テキストエリア */
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid #FFB6C1;
  border-radius: 12px;
  background: #FFF;
  color: #333;
  resize: none;
  height: 80px;
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-textarea:focus {
  outline: none;
  border-color: #FF6B9D;
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.2);
}

.form-textarea::placeholder {
  color: #AAA;
}

/* 文字数カウント */
.char-count {
  text-align: right;
  font-size: 12px;
  color: #888;
  margin-top: 4px;
  padding-right: 4px;
}

/* 生成ボタン */
.generate-button {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: bold;
  color: #FFF;
  background: linear-gradient(135deg, #7B68EE 0%, #9B89FF 50%, #7B68EE 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 4px 15px rgba(123, 104, 238, 0.4);
  transition: all 0.3s ease;
}

.generate-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(123, 104, 238, 0.5);
}

.generate-button:active:not(:disabled) {
  transform: translateY(0);
}

.generate-button:disabled {
  background: linear-gradient(135deg, #CCC 0%, #DDD 50%, #CCC 100%);
  cursor: not-allowed;
  box-shadow: none;
}

/* ========================================
   ローディングオーバーレイ
   ======================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

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

.loading-content {
  text-align: center;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #FFE5EC;
  border-top: 4px solid #FF6B9D;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

.loading-text {
  font-size: 18px;
  font-weight: 600;
  color: #FF6B9D;
}

.loading-notice {
  font-size: 14px;
  color: #888;
  margin-top: 16px;
  line-height: 1.6;
  text-align: center;
}

.loading-timer {
  font-size: 16px;
  font-weight: 600;
  color: #7B68EE;
  margin-top: 12px;
}

/* ========================================
   結果画面
   ======================================== */
.result-content {
  justify-content: flex-start;
  padding-top: 40px;
}

.result-image-section {
  width: 100%;
  max-width: 350px;
  margin-bottom: 20px;
}

.result-label {
  font-size: 14px;
  font-weight: 600;
  color: #7B68EE;
  margin-bottom: 8px;
  text-align: left;
  padding-left: 4px;
}

.result-image-container {
  background: #FFF;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.result-image {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

/* 結果画面のボタンエリア */
.result-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 350px;
  margin-top: 10px;
}

.back-button,
.retry-button {
  flex: 1;
  padding: 14px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.back-button {
  background: #FFF;
  color: #FF6B9D;
  border: 2px solid #FF6B9D;
}

.back-button:hover {
  background: #FFF0F5;
}

.retry-button {
  background: linear-gradient(135deg, #FF9A9E 0%, #FECFEF 50%, #FFA0C0 100%);
  color: #FFF;
  box-shadow: 0 4px 15px rgba(255, 154, 158, 0.4);
}

.retry-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 154, 158, 0.5);
}

/* ========================================
   チェックボックス（自動プロンプト用）
   ======================================== */
.checkbox-group {
  margin-top: 8px;
  margin-bottom: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 12px 16px;
  background: #FFF;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  transition: all 0.3s ease;
}

.checkbox-label:hover {
  border-color: #FFB6C1;
  background: #FFF8FA;
}

.checkbox-input {
  display: none;
}

/* カスタムチェックボックス */
.checkbox-custom {
  width: 22px;
  height: 22px;
  border: 2px solid #CCC;
  border-radius: 6px;
  margin-right: 12px;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.checkbox-input:checked + .checkbox-custom {
  background: linear-gradient(135deg, #7B68EE 0%, #9B89FF 100%);
  border-color: #7B68EE;
}

.checkbox-input:checked + .checkbox-custom::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #FFF;
  font-size: 14px;
  font-weight: bold;
}

.checkbox-text {
  font-size: 14px;
  font-weight: 500;
  color: #555;
}

.checkbox-input:checked ~ .checkbox-text {
  color: #7B68EE;
  font-weight: 600;
}
