/*
 Theme Name: Astra Child Hiragana
 Template: astra
 Version: 1.0.0
*/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
/* 基本的なスタイル */
body {
    font-family: 'Inter', sans-serif;
    background-color: #FFF5F7; /* 淡いピンクの背景 */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}
/* タイトル周りの余白調整 */
#main-content h1 {
    margin-bottom: 0.3rem;  /* 元より少しだけ小さく */
}

#main-content p.text-center.text-gray-600.mb-8.leading-relaxed {
    margin-bottom: 0.9rem;  /* 1.5rem → 0.9remくらいのイメージ */
}


/* コンテナのスタイル */
.container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 1.5rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
/* フラッシュカードのスタイル */
/* カードの入れ物：奥行きを自然にする */
.card-container {
    perspective: 1400px;
    width: 90%;
    max-width: 360px;
    margin: 0 auto;
}

/* カード全体 */
.flashcard {
    width: 100%;
    height: 260px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.65s cubic-bezier(0.4, 0.2, 0.2, 1);
    cursor: pointer;

    /* 影を少しだけ強めに */
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);

    /* 少しだけ丸く */
    border-radius: 1.2rem;

    background-color: #ffffff;
}

/* 裏返し */
.flashcard.is-flipped {
    transform: rotateY(180deg);
}

/* カード共通の面 */
.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 1.2rem;

    /* これがあると裏表のちらつきがなくなる */
    backface-visibility: hidden;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    padding: 1.8rem;
    text-align: center;
}

/* 表面 */
.flashcard-front {
    background: linear-gradient(180deg, #ffffff 0%, #fff5f7 100%);
    color: #d14f8a;
    font-size: 2.2rem;
    font-weight: 700;
}

/* 裏面 */
.flashcard-back {
    /* 以前の設定を少し変更 */
    background: #ffe0ec;      /* 明るめのピンク一色にして柔らかく */
    color: #8c2f54;           /* 少し濃いめのピンク文字で読みやすく */

    font-size: 1.0rem;        /* ほんの少し小さく */
    line-height: 1.2;
    transform: rotateY(180deg);
}

中のテキストだけ、さらに微調整したい場合
/* .flashcard-back span {
    font-size: 1.00rem;
    line-height: 1.6;
} */

/* .flashcard-back p {
    font-size: 1.1rem;
    font-weight: 400;
    margin-top: 0.5rem;
} */
/* .flashcard:active {
    transform: scale(0.98);
} */


/* ナビゲーションボタンのスタイル */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    gap: 1rem;
}
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.1s;
}
.btn:hover {
    transform: translateY(-2px);
}
.btn-primary {
    background-color: #e87a9b; /* プライマリボタンのピンク */
    color: #ffffff;
}
.btn-primary:hover {
    background-color: #d16b8a; /* ホバー時の濃いピンク */
}
.btn-secondary {
    background-color: #fceef2; /* セカンダリボタンの薄いピンク */
    color: #8c4f61; /* セカンダリボタンのテキスト色 */
}
.btn-secondary:hover {
    background-color: #f9dce6;
}
/* =========================================
   共通スピーカーボタン（ピンク統一・SVG版）
   ========================================= */
.sound-btn {
    width: 52px;
    height: 52px;
    background: #e87a9b;      /* タブと同じピンク */
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;

    box-shadow: 0 2px 5px rgba(0,0,0,0.18);
    transition: transform 0.15s ease, background 0.15s ease;
    padding: 0;               /* 中のSVGをぴったり中央に */
}

/* SVGアイコンのスタイル（白いスピーカー） */
.sound-btn svg {
    width: 26px;
    height: 26px;
    stroke: #ffffff;          /* 線の色＝白 */
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* PCホバー時：少し大きく */
.sound-btn:hover {
    transform: scale(1.07);
}

/* クリック時：押し込まれる感じ＋少し濃いピンクに */
.sound-btn:active {
    transform: scale(0.95);
    background: #d7688c;
}

/* グループ選択ボタンのグリッドスタイル */
.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    width: 100%;
}
/* ひらがな行選択ボタン */
.group-btn {
    background-color: #fceef2;   /* 薄いピンク */
    color: #8c4f61;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    text-align: center;
    padding: 0.8rem 0.4rem;
    min-height: 80px;            /* ✅ 全部の高さをそろえる */
    width: 100%;
    
    display: flex;               /* ✅ 中身を縦に並べて中央寄せ */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
    transition: background-color 0.2s, transform 0.08s, box-shadow 0.08s;
}

.group-btn:hover {
    background-color: #f9dce6;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}

/* 中の「かな」と「ローマ字」のスタイル */
.kana {
    font-size: 1.6rem;   /* 大きめ */
    line-height: 1;
}

.romaji {
    font-size: 0.9rem;   /* 小さめ */
    opacity: 0.85;
}

/* New style for Quiz button */
.quiz-btn-prominent {
    background-color: #e87a9b; /* クイズボタンのピンク */
    color: #ffffff;
    margin-top: 0.8rem;          /* 元より少し小さめに */
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}
.quiz-btn-prominent:hover {
    background-color: #d16b8a;
}

.group-btn:hover {
    background-color: #f9dce6;
    transform: translateY(-2px);
}
.btn:disabled, .btn[disabled]{
    background-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
/* クイズ選択肢のスタイル（テキストのみの古いほうはそのままでもOK） */
.quiz-option {
    background-color: #f3f4f6;
    padding: 1rem;
    border-radius: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quiz-option:hover {
    background-color: #e5e7eb;
}

.quiz-option.correct {
    background-color: #86c166; /* 正解時の若葉色 */
    color: #ffffff;
}

.quiz-option.incorrect {
    background-color: #ef4444;
    color: #ffffff;
}

/* ひらがなグリッド（クイズの4択ボタン用） */
.hiragana-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));  /* 📱スマホは2列 */
    gap: 0.75rem;
    width: 100%;
    max-width: 420px;   /* 真ん中に程よい幅で寄せる */
    margin: 0 auto;
}

/* 選択肢ひとつひとつの見た目 */
.hiragana-cell {
    background-color: #fceef2;   /* 薄いピンク */
    color: #8c4f61;
    padding: 0.9rem 0.5rem;
    border-radius: 0.75rem;
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.05s, box-shadow 0.05s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.hiragana-cell:hover {
    background-color: #f9dce6;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

/* 正解／不正解の色 */
.hiragana-cell.correct {
    background-color: #86c166;  /* 正解：若葉色 */
    color: #ffffff;
}

.hiragana-cell.incorrect {
    background-color: #ef4444;  /* 不正解：赤 */
    color: #ffffff;
}

/* 📺 画面幅が広いとき（タブレット〜PC）は4列にする */
@media (min-width: 640px) {
    .hiragana-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
/* クイズのスコア・問題文・フィードバックの見た目調整 */
#quiz-score {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

#quiz-question {
    font-size: 1.1rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

#quiz-feedback {
    font-size: 1rem;
    margin-top: 0.75rem;
    min-height: 2.8em;  /* 高さを確保して画面がガタガタ動かないようにする */
    min-width: 250px;
}
/* Next Question ボタンのレイアウト調整 */
#nextQuizBtn {
    min-width: 180px;
    text-align: center;
}

/* Next Question のエリア全体 */
.next-quiz-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.2rem;
    min-height: 48px; /* ボタンが出たり消えたりしてもガタつかないように高さ確保 */
}

/* ---------------------------
   Quiz Result - Floating Card
   --------------------------- */
#quiz-result-screen {
    background: #fff7fb;                  /* やわらかい薄いピンク */
    border-radius: 1.25rem;               /* カードの角をしっかり丸める */
    padding: 1.8rem 1.6rem;
    max-width: 420px;
    width: 100%;
    margin: 2rem auto 0 auto;
    text-align: center;
    box-shadow:
        0 4px 12px rgba(0,0,0,0.08),
        0 6px 20px rgba(0,0,0,0.05);       /* 薄い二段影で浮いて見える */
    
    /* アニメーション初期状態 */
    transform: translateY(18px);
    opacity: 0;

    /* 出現アニメーション */
    animation: fadeUpCard 0.45s ease-out forwards;
}

/* タイトル */
#quiz-result-screen h2 {
    font-size: 1.45rem;
    margin-bottom: 0.75rem;
    color: #444;
}

/* スコア表示 */
#final-score {
    font-size: 1.15rem;
    margin-bottom: 1.2rem;
    color: #6b4f5a;
}


/* ---------------------------
   Animation Keyframes
   --------------------------- */
@keyframes fadeUpCard {
    0% {
        opacity: 0;
        transform: translateY(22px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ================================
   ひらがなアプリ共通レイアウト調整
   ================================ */

/* コンテンツ幅をスマホ寄りに統一 */
#main-content {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}

/* 上のアイコン＋タイトル＋説明文の余白を少し締める */
#main-content > .flex.flex-col.items-center.mb-4 {
  margin-bottom: 0.75rem;
}

#main-content h1.text-3xl {
  margin-bottom: 0.15rem;
}

/* サブテキスト（英語の説明文） */
#main-content p.text-center.text-gray-600.mb-8.leading-relaxed {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* 行ボタン（あ・か・さ…）の見た目を微調整 */
#selection-screen .group-btn {
  font-size: 1rem;
}

#selection-screen .group-btn .kana {
  font-size: 1.15rem;
}

#selection-screen .group-btn .romaji {
  font-size: 0.8rem;
}

/* ナビゲーションボタン（Previous / Next / Flip）の幅統一 */
.nav-buttons .btn {
  flex: 1 1 0;
  text-align: center;
}

/* クイズ画面の見出し・スコアの統一感 */
#quiz-screen h1.text-2xl {
  font-size: 1.3rem;
}

#quiz-score {
  font-size: 0.95rem;
}
/* カテゴリタブ（清音/濁音/半濁音/拗音） */
.category-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  width: 100%;
}

.category-tab {
  flex: 1 1 0;
  padding: 0.45rem 0.2rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  background-color: #fceef2;
  color: #8c4f61;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.category-tab:hover {
  background-color: #f9dce6;
  transform: translateY(-1px);
}

.category-tab.active {
  background-color: #e87a9b;
  color: #ffffff;
  transform: none;
}
/* ==========================
   Custom Tooltip for Category Tabs
   ========================== */
.category-tab {
  position: relative;
}

.category-tab[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: -2.2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.35rem 0.6rem;
  background: #333;
  color: #fff;
  font-size: 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0.9;
  z-index: 10;
}

.category-tab[data-tip]:hover::before {
  content: "";
  position: absolute;
  bottom: -0.6rem;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #333;
  z-index: 9;
}
/* スマホでは hover を無効化（クリック時のみ表示） */
@media (hover: none) {
  .category-tab[data-tip]:hover::after,
  .category-tab[data-tip]:hover::before {
    display: none;
  }
}
.tooltip-mobile {
  position: fixed;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 9999;
  opacity: 0.95;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -4px); }
  to { opacity: 0.95; transform: translate(-50%, 0px); }
}


/* 裏面レイアウト：学習しやすい構成 */
.flashcard-back .flashcard-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;   /* 縦中央 */
  align-items: center;       /* 横中央 */
  gap: 0.6rem;
  text-align: center;
  padding: 0 1.2rem;
}

/* Example ラベル */
.example-label {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9ca3af;
}

/* 日本語の例文：主役なので少し大きめ＆濃い色 */
.example-ja {
  font-size: 1.05rem;
  color: #374151;
}

/* 英語訳：少し小さめ＆グレーで補助的に */
.example-en {
  font-size: 0.9rem;
  color: #6b7280;
}

/* 裏面の音声ボタン：少し上に余白 */
.flashcard-back .sound-btn {
  margin-top: 0.8rem;
}
