/* ===== ベースレイアウト ===== */

.unhappy-wrapper {
  max-width: 720px;
  margin: 3rem auto;
  padding: 1.8rem 2rem 2rem;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.07);
  box-sizing: border-box;
  color: #1f2933;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ページ全体のトーンを少しだけ柔らかく */
body {
  background: #f3f6fb;
}

/* タイトル */
.unhappy-title {
  font-size: 1.35rem;
  margin-bottom: 1rem;
  font-weight: 700;
  color: #1f2933;
}

/* テキストエリア */
.unhappy-textarea {
  width: 100%;
  min-height: 160px;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  box-sizing: border-box;
  font-size: 0.98rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  background: #f9fbff;
}

.unhappy-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  background: #ffffff;
}

/* 送信ボタン */
.unhappy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.unhappy-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.4);
  opacity: 0.96;
}

.unhappy-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* ===== ローディング表示（顔＋ゆらゆら） ===== */

.unhappy-loading {
  margin-top: 1.6rem;
  padding: 1.1rem 1rem;
  border-radius: 16px;
  background: #e0edff;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.unhappy-face {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #ffffff, #3b82f6);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
  position: relative;
  animation: unhappy-bob 1.6s ease-in-out infinite;
}

/* 目 */
.unhappy-face::before,
.unhappy-face::after {
  content: "";
  position: absolute;
  top: 22px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #0f172a;
}

.unhappy-face::before {
  left: 17px;
}

.unhappy-face::after {
  right: 17px;
}

/* 口 */
.unhappy-face span {
  position: absolute;
  left: 50%;
  top: 36px;
  width: 26px;
  height: 14px;
  border-radius: 0 0 999px 999px;
  border-bottom: 3px solid rgba(15, 23, 42, 0.9);
  transform: translateX(-50%);
}

/* ローディング文言 */
.unhappy-loading-text {
  font-size: 0.92rem;
  color: #1f2933;
  line-height: 1.5;
}

/* 顔がふわふわ揺れるアニメーション */
@keyframes unhappy-bob {
  0%   { transform: translateY(0); }
  25%  { transform: translateY(-4px); }
  50%  { transform: translateY(0); }
  75%  { transform: translateY(4px); }
  100% { transform: translateY(0); }
}

/* ===== 結果表示 ===== */

.unhappy-result {
  margin-top: 1.6rem;
  padding: 1.4rem 1.2rem 1.2rem;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  box-sizing: border-box;
  color: #111827;
  font-size: 0.95rem;
  line-height: 1.7;
}

/* 辛さ指数（★） */
.unhappy-stars {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: #f59e0b;
}

/* 深刻度ランク */
.unhappy-rank {
  margin-bottom: 0.6rem;
  font-weight: 600;
  color: #1f2933;
}

/* 共感コメント */
.unhappy-comment {
  margin-top: 0.4rem;
  margin-bottom: 0.9rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: #e5f2ff;
}

/* 今日を乗り切るためのアドバイス */
.unhappy-today {
  margin-bottom: 0.9rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: #fef9c3;
}

/* 名言 */
.unhappy-quote {
  margin-bottom: 0.6rem;
  padding: 0.8rem 1rem;
  border-left: 4px solid #6366f1;
  background: #eef2ff;
  font-style: italic;
}

.unhappy-quote-author {
  display: inline-block;
  margin-left: 0.4rem;
  font-weight: 600;
}

/* 書籍 */
.unhappy-book {
  margin-top: 0.4rem;
  font-size: 0.92rem;
  color: #374151;
}

/* --- KIKUYO BOOKS 連携：おすすめ本ボックス --- */
.unhappy-bookbox {
  margin-top: 0.9rem;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
}

.unhappy-bookbox-inner {
  display: flex;
  gap: 12px;
  padding: 12px;
}

.unhappy-bookbox-cover img {
  width: 84px;
  height: auto;
  border-radius: 10px;
  display: block;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
}

.unhappy-bookbox-meta {
  flex: 1;
  min-width: 0;
}

.unhappy-bookbox-label {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: #6b7280;
  margin-bottom: 0.2rem;
}

.unhappy-bookbox-title {
  font-weight: 700;
  color: #111827;
  line-height: 1.35;
}

.unhappy-bookbox-author {
  margin-top: 0.2rem;
  font-size: 0.9rem;
  color: #374151;
}

.unhappy-bookbox-intro {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  color: #374151;
}

.unhappy-bookbox-link {
  display: inline-block;
  margin-top: 0.7rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff !important;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.unhappy-bookbox-link:hover {
  opacity: 0.92;
}

/* エラー / 注意メッセージ */
.unhappy-error {
  color: #b91c1c;
  font-weight: 600;
}

.unhappy-nudge {
  color: #374151;
}

/* ===== スマホ対応 ===== */

@media (max-width: 640px) {
  .unhappy-wrapper {
    margin: 2rem 1rem;
    padding: 1.4rem 1.1rem 1.7rem;
  }

  .unhappy-title {
    font-size: 1.15rem;
  }

  .unhappy-loading {
    flex-direction: row;
  }

  .unhappy-face {
    width: 52px;
    height: 52px;
  }
}