#mf-app.mf-container {
  all: initial;
  display: block;
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background-color: #f5f5f4;
  color: #292524;
  padding: 2rem;
  border-radius: 8px;
  margin: 2rem auto;
  box-sizing: border-box;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  letter-spacing: 0.05em;
  line-height: 1.6;
  text-align: left;
}

#mf-app * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- ヘッダー --- */
#mf-app .mf-header {
  text-align: center;
  margin-bottom: 1.5rem;
  line-height: 1.5;
  width: 100%;
}

#mf-app .mf-title {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
  margin: 0 auto;
  color: #292524;
  line-height: 1.4;
  width: 100%;
}

#mf-app .mf-title .mf-icon {
  width: 1.3em;
  height: 1.3em;
  margin-right: 0.2em;
  flex-shrink: 0;
}

#mf-app .mf-title-part {
  display: inline-block;
  white-space: nowrap;
}

#mf-app .mf-subtitle {
  font-size: 0.875rem;
  color: #78716c;
  margin-top: 0.5rem;
  display: block;
  text-align: center;
}

/* --- カードエリア --- */
#mf-app .mf-scene {
  width: 100%;
  max-width: 450px;
  min-height: 400px;
  margin: 0 auto;
  perspective: 1000px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

#mf-app .mf-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-height: inherit;
  position: relative;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

#mf-app .mf-card.is-flipped {
  transform: rotateY(180deg);
}

#mf-app .mf-card-face {
  grid-area: 1 / 1;
  min-width: 0;
  position: relative;
  width: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  top: 0;
  left: 0;
  background-color: #fff;
}

/* --- 表面 --- */
#mf-app .mf-front {
  border: 2px solid #e7e5e4;
  position: relative;
}

/* 画像エリア */
#mf-app .mf-image-area {
  height: 220px;
  flex-shrink: 0;
  width: 100%;
  background-color: #e7e5e4;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  opacity: 1; /* JSでフェード制御 */
}

/* キャラクター名 */
#mf-app .mf-speaker-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: 4px;
  line-height: 1.4;
  z-index: 2;
  opacity: 1; /* JSでフェード制御 */
}

/* 質問エリア */
#mf-app .mf-question-area {
  flex-grow: 1;
  width: 100%;
  padding: 1.5rem 1.5rem 3.5rem 1.5rem;
  background-color: #fafaf9;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow-y: visible;
  position: relative;
}

/* 質問テキスト */
#mf-app .mf-question-text {
  font-size: 1.25rem;
  font-weight: bold;
  margin: 0;
  color: #292524;
  width: 100%;
  line-height: 1.6;
  text-align: center;
  opacity: 1;
  word-break: normal;
  line-break: strict;
  overflow-wrap: break-word;
}

#mf-app .mf-question-text .mf-text-wrapper {
  word-break: inherit;
  line-break: inherit;
  overflow-wrap: inherit;
}

#mf-app .mf-question-text.is-multiline {
  text-align: justify !important;
  text-justify: inter-ideograph !important;
  text-align-last: left !important;
}

/* 穴埋め箇所（通常） */
#mf-app .mf-hidden-word {
  display: inline-block;
  border-bottom: 3px solid #10b981;
  color: transparent;
  margin: 0 0.2rem 0 0; 
  min-width: 3rem;
  background-color: #ecfdf5;
  animation: mf-pulse 2s infinite;
  vertical-align: bottom;
	position: relative; 
}
#mf-app .mf-hidden-word--with-punc::after {
  content: attr(data-punc);
	position: absolute;
	right: -1.25em; 
	bottom:-0.85em;
  color: #292524;
  font-weight: bold;
}
/* 最後の空欄を少し細くするバリエーション */
#mf-app .mf-hidden-word--compact {
  min-width: 2.7rem !important;
margin-right: 0.2rem; 
}

/* 「最後の空欄＋句読点」をひとまとめにするグループ */
#mf-app .mf-blank-punc-group {
  display: inline-block;
  white-space: nowrap;      /* グループ内部では折り返さない */
  vertical-align: bottom;
}

/* グループ内の句読点 */
#mf-app .mf-punc {
  margin-left: 0.05em;      /* 空欄との間をほんの少しだけ空ける */
}

/* ヒントバッジ */
#mf-app .mf-hint-badge {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background-color: transparent;
  color: #9ca3af;
  padding: 0;
  border: none;
  box-shadow: none;
  font-size: 0.75rem;
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
  margin: 0;
  width: auto;
  white-space: nowrap;
  pointer-events: none;
}

#mf-app .mf-hint-badge .mf-icon {
  color: #9ca3af;
}

/* --- 裏面 --- */
#mf-app .mf-back {
  background-color: #047857;
  color: white;
  transform: rotateY(180deg);
  border: 2px solid #065f46;
  padding: 1.5rem;
  text-align: center;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#mf-app .mf-back-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#mf-app .mf-back-bg-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  opacity: 0.15;
  width: 48px;
  height: 48px;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

#mf-app .mf-back-speaker {
  font-size: 1rem;
  font-weight: bold;
  color: #a7f3d0;
  margin-bottom: 0.5rem;
  display: block;
  line-height: 1.5;
}

#mf-app .mf-back-answer {
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1.4;
  display: block;
  margin-bottom: 1rem;
}

#mf-app .mf-back-desc {
  background-color: rgba(6, 95, 70, 0.6);
  padding: 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.7;
  border: 1px solid rgba(167, 243, 208, 0.2);
  margin-bottom: 1.5rem;
  width: 100%;
  text-align: justify;
}

#mf-app .mf-back-btn {
  display: inline-flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.2);
  color: white !important;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: bold;
  border: 1px solid rgba(255, 255, 255, 0.4);
  margin-bottom: 1rem;
  transition: background-color 0.2s;
  line-height: 1.5;
}

#mf-app .mf-back-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

#mf-app .mf-back-full {
  font-size: 0.75rem;
  color: #6ee7b7;
  border-top: 1px solid rgba(110, 231, 183, 0.2);
  padding-top: 0.5rem;
  width: 100%;
  display: block;
  line-height: 1.5;
}

/* --- コントロール --- */
#mf-app .mf-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

#mf-app .mf-btn {
  background-color: white;
  border: 1px solid #e7e5e4;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #57534e;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

#mf-app .mf-btn-primary {
  background-color: #059669;
  color: white;
  border: none;
}

#mf-app .mf-counter {
  font-size: 0.875rem;
  color: #78716c;
  min-width: 3rem;
  text-align: center;
  line-height: 1.5;
}

/* --- リストセクション --- */
#mf-app .mf-list-section {
  margin-top: 2rem;
  border-top: 1px solid #e7e5e4;
  padding-top: 1rem;
  width: 100%;
}

#mf-app .mf-list-title {
  font-size: 0.875rem;
  font-weight: bold;
  color: #78716c;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  line-height: 1.5;
}

#mf-app .mf-quote-list-container {
  display: none;
  width: 100% !important;
  margin: 15px 0 0 0 !important;
  padding: 0 !important;
}

#mf-app .mf-quote-list-container.is-open {
  display: block !important;
  animation: mf-fade-in 0.3s ease;
}

/* リストアイテム */
#mf-app .mf-quote-item {
  display: table !important;
  width: 100% !important;
  padding: 0.5rem 0 !important;
  border-bottom: 1px dashed #e7e5e4;
  margin: 0 !important;
  background: none !important;
  text-decoration: none !important;
  color: #292524 !important;
  transition: color 0.2s;
  box-sizing: border-box !important;
  font-size: 0.875rem;
}

#mf-app .mf-quote-item:hover .mf-list-item-text {
  color: #059669 !important;
  text-decoration: underline;
}

/* アイコン（左側セル） */
#mf-app .mf-quote-icon-cell {
  display: table-cell !important;
  width: 24px !important;
  min-width: 24px !important;
  vertical-align: top !important;
  padding-right: 8px !important;
  color: #059669 !important;
  line-height: 2.0 !important;
}

/* テキスト（右側セル） */
#mf-app .mf-quote-text-cell {
  display: table-cell !important;
  width: auto !important;
  vertical-align: top !important;
  text-align: left !important;
  color: #292524 !important;
}

#mf-app .mf-list-item-text {
  display: block !important;
  white-space: normal !important;
  word-break: break-all !important;
  overflow-wrap: break-word !important;
  line-height: 2.0 !important;
}

/* 共通アイコン */
#mf-app .mf-icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* 計測用ダミー要素（非表示） */
#mf-app .mf-measure-box {
  position: absolute;
  top: -9999px;
  left: 0;
  visibility: hidden;
  width: auto;
  white-space: nowrap;
}

/* アニメーション */
@keyframes mf-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes mf-fade-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* スマホ調整 */
@media (max-width: 640px) {
  #mf-app.mf-container {
    padding: 1.5rem 1rem;
    width: 100%;
  }
  #mf-app .mf-image-area {
    height: 180px;
  }
  #mf-app .mf-scene {
    min-height: 300px;
  }
}

/* 開いたリスト内で使うヒントテキスト用 */
#mf-app .mf-list-hint {
  font-size: 0.9em !important;
  line-height: 1.5;
  color: #6b7280;
  margin: 4px 0 8px;
  text-align: center;
}

@media (min-width: 768px) {
  #mf-app .mf-list-hint {
    font-size: 1em !important;
    text-align: left;
  }
}
/* 「全文: ○○」行の基本スタイル */
#mf-app #mf-full-quote {
  display: inline;            /* ラベル「全文:」の直後から始めるため常に inline */
}

/* 複数行になったときだけ両端揃えにする（コンテナ側にフラグが付く） */
#mf-app .mf-back-full.is-multiline {
  text-align: justify;
  text-justify: inter-ideograph;
  text-align-last: left;
}

#mf-app .mf-list-item-text .spacing-left { display:inline-block; margin-left:-.5em; }
#mf-app .mf-list-title[aria-expanded="true"] .mf-icon { transform:rotate(180deg); }
#mf-app .mf-front:focus-visible,
#mf-app .mf-btn:focus-visible,
#mf-app .mf-list-title:focus-visible,
#mf-app .mf-back-btn:focus-visible { outline:2px solid currentColor; outline-offset:-3px; }
@media (prefers-reduced-motion:reduce) {
  #mf-app .mf-card { transition:none; }
  #mf-app .mf-hidden-word, #mf-app .mf-quote-list-container.is-open { animation:none; }
}
