/* Umatter 魔改造レイヤー (2026-11-15, Muse)
   本体 style.css には触らず、追加の見た目だけを重ねる。テーマ変数を尊重する。 */

:root {
  --mk-grad: linear-gradient(120deg, #059669, #10b981 45%, #f59e0b 110%);
  --mk-grad-carrot: linear-gradient(120deg, #ea580c, #f59e0b);
}

/* ---- 背景オーロラ ---- */
body::before {
  content: "";
  position: fixed;
  inset: -12% -6% auto -6%;
  height: 62vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(42% 58% at 18% 8%, rgba(16, 185, 129, 0.14), transparent 70%),
    radial-gradient(36% 50% at 82% 0%, rgba(245, 158, 11, 0.12), transparent 70%),
    radial-gradient(30% 44% at 55% 22%, rgba(234, 88, 12, 0.07), transparent 70%);
  animation: mk-aurora 16s ease-in-out infinite alternate;
}
[data-theme="dark"] body::before { opacity: 0.75; }
@keyframes mk-aurora {
  from { transform: translate3d(-1.5%, 0, 0) scale(1); }
  to   { transform: translate3d(1.5%, 2.5%, 0) scale(1.05); }
}
.app-shell { position: relative; z-index: 1; }

/* ---- ブランド ---- */
.brand-title {
  background: var(--mk-grad);
  background-size: 180% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: mk-shine 5.5s linear infinite;
}
@keyframes mk-shine {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.brand-carrot {
  display: inline-block;
  filter: drop-shadow(0 3px 6px rgba(234, 88, 12, 0.45));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.brand-logo:hover .brand-carrot { transform: rotate(-14deg) scale(1.18); }
.brand-logo { border-radius: 14px; }
.brand-logo:hover {
  background: linear-gradient(120deg, rgba(16, 185, 129, 0.10), rgba(245, 158, 11, 0.10));
}

/* ---- ヘッダー: グラス化 ---- */
.sticky-header {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  transition: box-shadow 0.25s;
}
.sticky-header.mk-scrolled { box-shadow: 0 10px 28px -14px rgba(15, 23, 42, 0.35); }
.header-title {
  background: var(--mk-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---- プライマリボタン: グラデ＋光沢 ---- */
.btn-primary {
  background: var(--mk-grad);
  background-size: 160% 100%;
  border: none;
  position: relative;
  overflow: hidden;
  transition: background-position 0.4s, transform 0.15s, box-shadow 0.25s;
  box-shadow: 0 4px 14px -6px rgba(5, 150, 105, 0.55);
}
.btn-primary:hover {
  background-position: 90% 50%;
  box-shadow: 0 8px 22px -8px rgba(5, 150, 105, 0.65);
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -70%;
  width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
  pointer-events: none;
}
.btn-primary:hover::after { left: 130%; }

/* ---- 投稿カード: 登場アニメ＋ホバー ---- */
.post-card { position: relative; }
.post-card::before {
  content: "";
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--mk-grad);
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 0.2s, transform 0.25s;
}
.post-card:hover::before { opacity: 1; transform: scaleY(1); }
.post-card:hover { background: var(--bg-soft); }
.post-card.mk-in { animation: mk-rise 0.5s cubic-bezier(0.22, 0.9, 0.3, 1) both; animation-delay: var(--d, 0ms); }
@keyframes mk-rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.post-card:hover .avatar-circle {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(16, 185, 129, 0.65);
}
.avatar-circle { transition: box-shadow 0.25s; }

/* ---- アクションボタン ---- */
.act-btn .act-icon { display: inline-block; transition: transform 0.2s; }
.act-btn:hover .act-icon { transform: scale(1.22); }
.act-btn.mk-pop .act-icon { animation: mk-pop 0.45s cubic-bezier(0.34, 1.8, 0.5, 1); }
@keyframes mk-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.55) rotate(-10deg); }
  100% { transform: scale(1); }
}
.carrot-btn.active, .carrot-btn.active .act-icon { filter: drop-shadow(0 0 6px rgba(234, 88, 12, 0.55)); }
.repost-btn.active, .repost-btn.active .act-icon { filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.55)); }

/* バースト粒子 */
.mk-particle {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  font-size: 15px;
  line-height: 1;
  user-select: none;
  will-change: transform, opacity;
}

/* ---- ナビ ---- */
.nav-item { transition: background 0.2s, transform 0.15s; }
.nav-item:hover { transform: translateX(3px); }
.nav-item:hover .nav-icon { animation: mk-bounce 0.5s ease; }
@keyframes mk-bounce {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-4px); }
  70% { transform: translateY(1px); }
}
.nav-item.active {
  background: linear-gradient(120deg, rgba(16, 185, 129, 0.14), rgba(245, 158, 11, 0.12));
}

/* ---- タブ ---- */
.tab-btn { position: relative; }
.tab-btn.active::after {
  content: "";
  position: absolute;
  left: 18%; right: 18%; bottom: -1px;
  height: 3px;
  border-radius: 3px;
  background: var(--mk-grad-carrot);
  animation: mk-tab-in 0.35s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}
@keyframes mk-tab-in {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

/* ---- ウィジェット ---- */
.widget-card { position: relative; overflow: hidden; }
.widget-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--mk-grad);
  opacity: 0.85;
}
.widget-title {
  background: var(--mk-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ---- コンポーザー ---- */
.inline-composer:focus-within,
#inlineComposer:focus-within {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.14);
}
.inline-composer, #inlineComposer { transition: box-shadow 0.25s, border-color 0.25s; }

/* ---- モーダル／トースト／バナー ---- */
.modal-card { animation: mk-modal-in 0.28s cubic-bezier(0.22, 0.9, 0.3, 1) both; }
@keyframes mk-modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.toast:not(.hidden) { animation: mk-toast-in 0.3s cubic-bezier(0.22, 0.9, 0.3, 1) both; }
@keyframes mk-toast-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.new-posts-banner:not(.hidden) { animation: mk-pulse 1.8s ease-in-out infinite; }
@keyframes mk-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50% { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0); }
}

/* ---- その他 ---- */
.ai-badge {
  background: linear-gradient(120deg, var(--ai-badge-bg), rgba(245, 158, 11, 0.18));
}
.loading-spinner { border-top-color: var(--carrot) !important; }
::selection { background: rgba(245, 158, 11, 0.35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #10b981, #f59e0b);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-track { background: transparent; }
.mobile-bottom-nav {
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
}
.mnav-btn.active .nav-icon { animation: mk-bounce 0.5s ease; }

@media (prefers-reduced-motion: reduce) {
  body::before, .brand-title, .post-card.mk-in, .modal-card,
  .toast:not(.hidden), .new-posts-banner:not(.hidden),
  .nav-item:hover .nav-icon, .mnav-btn.active .nav-icon,
  .act-btn.mk-pop .act-icon, .tab-btn.active::after { animation: none !important; }
  .btn-primary::after { display: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ---- リプライ文脈チップ: 2行まで表示して読みやすく (2026-11-15 追記) ---- */
.post-reply-context {
  align-items: flex-start;
  white-space: normal;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 12px;
  margin: 6px 0 10px;
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  color: var(--text);
}
.post-reply-context .reply-target-name { color: var(--primary); }
.post-reply-context .reply-arrow { margin-top: 1px; }
.reply-snippet {
  color: var(--text);
  opacity: 0.85;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* スレッド表示では本投稿を面で目立たせる */
#mainContent > div[style*="border-left"] {
  background: var(--primary-soft);
  border-radius: 0 12px 12px 0;
}

/* ---- スレッド表示: 時系列ツリーの段差インデント (2026-11-15 追記) ---- */
.mk-thread-node { margin-left: calc(var(--d, 0) * 12px); }
.mk-thread-node.mk-ind > .post-card {
  border-left: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
}
@media (max-width: 820px) {
  .mk-thread-node { margin-left: calc(var(--d, 0) * 9px); }
}
