/* ==========================================================================
   冒険者の目安箱 - ファンタジーUI コンポーネント & スタイル
   ========================================================================== */

/* --- 全体背景: 王国と城砦の雰囲気をCSSマルチレイヤーグラデーションで表現 --- */
body.fantasy-theme {
  background: 
    linear-gradient(180deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.92) 100%),
    radial-gradient(circle at 50% 20%, rgba(247, 210, 121, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 10% 80%, rgba(46, 111, 64, 0.2) 0%, transparent 50%),
    linear-gradient(135deg, #111827 0%, #1e293b 50%, #0f172a 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  line-height: 1.6;
}

/* --- ヘッダー (背景: header_haikei.jpg ＋ 暗色オーバーレイ) --- */
.fantasy-header {
  background:
    linear-gradient(180deg, rgba(28, 18, 10, 0.68) 0%, rgba(20, 12, 6, 0.82) 100%),
    url('../images/header_haikei.jpg') center center / cover no-repeat;
  border-bottom: 3px solid var(--metal-gold-mid);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.8), 0 0 12px rgba(247, 210, 121, 0.15);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.fantasy-header-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-emblem {
  width: 52px;
  height: 52px;
  background: radial-gradient(circle at 30% 30%, #4a2c13, #1c1007);
  border: 2px solid var(--metal-gold-mid);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px var(--gold-glow), 0 4px 10px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  position: relative;
}

.brand-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform var(--transition-fast);
}

.brand-emblem:hover .brand-icon-img {
  transform: scale(1.08);
}

.brand-title-group h1 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-gold-bright);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(247, 210, 121, 0.4);
  letter-spacing: 0.05em;
}

.brand-title-group .subtitle {
  font-size: 0.72rem;
  color: #cbb28d;
  margin-top: 2px;
  letter-spacing: 0.08em;
}

/* --- 羊皮紙カード (.parchment-card) --- */
.parchment-card {
  background: 
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.6) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(180, 140, 90, 0.15) 0%, transparent 50%),
    linear-gradient(180deg, var(--parchment-light) 0%, var(--parchment-base) 100%);
  border: 2px solid var(--parchment-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-parchment), 0 10px 25px rgba(0, 0, 0, 0.4);
  padding: 1.5rem;
  position: relative;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  margin-bottom: 1.5rem;
}

.parchment-card::before {
  content: '';
  position: absolute;
  top: 4px; left: 4px; right: 4px; bottom: 4px;
  border: 1px dashed rgba(160, 120, 70, 0.35);
  border-radius: calc(var(--radius-md) - 2px);
  pointer-events: none;
}

.parchment-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-parchment), 0 14px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(247, 210, 121, 0.2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(184, 155, 114, 0.3);
  padding-bottom: 0.6rem;
  margin-bottom: 0.9rem;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.author-badge {
  background: linear-gradient(135deg, var(--wood-dark-top), var(--wood-dark-bottom));
  color: var(--text-gold);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--metal-gold-mid);
}

.author-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.post-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-content {
  font-size: 1.02rem;
  color: #1a120b;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  margin-bottom: 1.2rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  border-top: 1px dashed rgba(184, 155, 114, 0.4);
  padding-top: 0.8rem;
}

.card-actions-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-actions-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- ボタンデザイン (木製＋真鍮モールディング) --- */
.btn-fantasy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-serif);
  font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--wood-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.1rem;
  text-decoration: none;
  transition: all var(--transition-fast);
  user-select: none;
  box-shadow: var(--shadow-button);
}

/* 「実現してほしい！」大型ボタン */
.btn-vote {
  background: linear-gradient(180deg, #6e431d 0%, #42250d 100%);
  color: var(--text-gold-bright);
  border: 2px solid var(--metal-gold-mid);
  padding: 0.6rem 1.3rem;
  font-size: 0.95rem;
  position: relative;
  overflow: hidden;
}

.btn-vote::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: 0.5s;
}

.btn-vote:hover {
  background: linear-gradient(180deg, #875426 0%, #543112 100%);
  border-color: #f7d279;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5), 0 0 15px var(--gold-glow);
  transform: translateY(-2px);
}

.btn-vote:hover::after {
  left: 100%;
}

.btn-vote:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-inset-box);
}

.btn-vote.voted {
  background: linear-gradient(180deg, #2e5934 0%, #19381d 100%);
  border-color: #62b36e;
  color: #d1f7d6;
}

.vote-count-badge {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--metal-gold-mid);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  margin-left: 0.2rem;
}

/* コメントボタン・サブボタン */
.btn-secondary-fantasy {
  background: linear-gradient(180deg, #e8dbc3 0%, #d6c4a5 100%);
  color: var(--text-primary);
  border: 1px solid var(--parchment-border);
  font-size: 0.82rem;
  padding: 0.4rem 0.8rem;
}

.btn-secondary-fantasy:hover {
  background: linear-gradient(180deg, #f2e7d3 0%, #dfcea3 100%);
  transform: translateY(-1px);
}

.btn-icon-only {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.btn-icon-only:hover {
  color: var(--accent-red);
}

/* メイン投稿ボタン (Floating or Top CTA) */
.btn-primary-post {
  background: linear-gradient(180deg, var(--metal-gold-top) 0%, var(--metal-gold-bottom) 100%);
  color: #261608;
  border: 2px solid #fff2c4;
  font-size: 1.05rem;
  padding: 0.75rem 1.8rem;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6), 0 0 20px var(--gold-glow);
}

.btn-primary-post:hover {
  background: linear-gradient(180deg, #ffea9f 0%, #a87625 100%);
  transform: scale(1.03);
}

/* --- コメントエリア (折りたたみ式) --- */
.comments-section {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(184, 155, 114, 0.3);
  display: none;
}

.comments-section.open {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

.comment-item {
  background: rgba(255, 255, 255, 0.45);
  border-left: 3px solid var(--metal-gold-mid);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.6rem;
  font-size: 0.88rem;
}

.comment-author {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.8rem;
}

.comment-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.comment-text {
  margin-top: 0.2rem;
  color: #2b1f17;
}

/* コメント入力フォーム */
.comment-form {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fantasy-input, .fantasy-textarea {
  width: 100%;
  box-sizing: border-box;
  background: #fffcf5;
  border: 1px solid var(--parchment-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.fantasy-input:focus, .fantasy-textarea:focus {
  outline: none;
  border-color: var(--metal-gold-mid);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08), 0 0 6px var(--gold-glow);
}

/* --- モーダル (ドラクエ・RPG風ダイアログ) --- */
.fantasy-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.fantasy-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.fantasy-modal-box {
  background: linear-gradient(180deg, #2b1d13 0%, #1a100a 100%);
  border: 3px solid var(--metal-gold-mid);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 30px var(--gold-glow);
  width: 100%;
  max-width: 550px;
  padding: 1.8rem;
  position: relative;
  color: var(--text-gold);
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fantasy-modal-overlay.active .fantasy-modal-box {
  transform: scale(1);
}

.modal-header-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-gold-bright);
  border-bottom: 2px solid var(--metal-gold-mid);
  padding-bottom: 0.5rem;
  margin-top: 0;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  position: absolute;
  top: 1rem; right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-gold);
  font-size: 1.4rem;
  cursor: pointer;
}

/* --- トースト通知 (RPG風インフォメーション) --- */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast-item {
  background: linear-gradient(180deg, #3d2b1d 0%, #24170d 100%);
  border: 2px solid var(--metal-gold-mid);
  color: var(--text-gold-bright);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7), 0 0 15px var(--gold-glow);
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
