/* ============================================
   花はな E-Learning - トップ画面スタイル
   Step 2 修正版
   ============================================ */

/* リセット & ベース */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-primary:      #FF6B9D;  /* ピンク（メインカラー） */
  --color-primary-dk:   #E8527F;  /* 濃いピンク */
  --color-secondary:    #7B61FF;  /* 紫 */
  --color-secondary-dk: #6048E8;
  --color-tertiary:     #4ECDC4;  /* ミントグリーン */
  --color-tertiary-dk:  #38B2AA;
  --color-bg-start:     #FFF0F8;
  --color-bg-end:       #F0F4FF;
  --color-text-dark:    #2D2D4E;
  --color-text-mid:     #5A5A7A;
  --color-text-light:   #9898B0;
  --radius-btn:         20px;
  --transition:         0.2s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* スマホ縦画面操作に最適なタップターゲット最小値 */
  --tap-target-min:     58px;  /* 56px → 58px: タッチ操作性強化 */
}

html, body {
  height: 100%;
  font-family: 'Noto Sans JP', sans-serif;
  background: linear-gradient(160deg, var(--color-bg-start) 0%, var(--color-bg-end) 100%);
  color: var(--color-text-dark);
  overflow-x: hidden;
  /* スマホでの慣性スクロール */
  -webkit-overflow-scrolling: touch;
}

/* ============================================
   背景装飾バブル
   ============================================ */
.bg-decoration {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
  animation: floatBubble 8s ease-in-out infinite;
}

.bubble-1 {
  width: 220px; height: 220px;
  background: radial-gradient(circle, #FF6B9D, #FFB3D1);
  top: -70px; right: -50px;
  animation-delay: 0s;
}

.bubble-2 {
  width: 130px; height: 130px;
  background: radial-gradient(circle, #7B61FF, #C4B8FF);
  top: 28%; left: -40px;
  animation-delay: 2s;
}

.bubble-3 {
  width: 90px; height: 90px;
  background: radial-gradient(circle, #4ECDC4, #A8F0EB);
  top: 58%; right: 0px;
  animation-delay: 4s;
}

.bubble-4 {
  width: 160px; height: 160px;
  background: radial-gradient(circle, #FFD93D, #FFF0A0);
  bottom: 80px; left: -60px;
  animation-delay: 1s;
}

.bubble-5 {
  width: 65px; height: 65px;
  background: radial-gradient(circle, #FF6B9D, #FFB3D1);
  bottom: 150px; right: 30px;
  animation-delay: 3s;
}

@keyframes floatBubble {
  0%, 100% { transform: translateY(0px) scale(1); }
  50%       { transform: translateY(-18px) scale(1.04); }
}

/* ============================================
   ヘッダー
   ============================================ */
.top-header {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  /* safe-area対応（ノッチ・パンチホール） */
  padding: max(16px, env(safe-area-inset-top)) 20px 0;
  min-height: 64px;
}

.sound-btn {
  /* タップターゲット48px以上確保 */
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--color-primary);
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
  /* タップハイライト除去 */
  -webkit-tap-highlight-color: transparent;
}

.sound-btn:active {
  transform: scale(0.90);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.sound-btn.muted {
  color: var(--color-text-light);
  background: rgba(235, 235, 242, 0.92);
}

/* ============================================
   メインコンテナ
   ============================================ */
.main-container {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* 左右は画面幅の5%余白（最小16px, 最大28px） */
  padding: 0 clamp(16px, 5vw, 28px);
}

/* ============================================
   ヒーローセクション（タイトル）
   ============================================ */
.hero-section {
  width: 100%;
  display: flex;
  justify-content: center;
  /* 上余白: 画面高さに応じて可変（小さい画面でも詰まらない） */
  padding-top: clamp(28px, 7vh, 56px);
  padding-bottom: clamp(28px, 6vh, 48px);
  animation: fadeInDown 0.55s ease both;
}

.logo-area {
  text-align: center;
}

.logo-icon {
  margin-bottom: 14px;
  animation: floatIcon 3.2s ease-in-out infinite;
}

.flower-icon {
  font-size: clamp(60px, 16vw, 84px);
  filter: drop-shadow(0 6px 14px rgba(255, 107, 157, 0.45));
  display: inline-block;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-9px); }
}

/* -------- アプリタイトル -------- */
.app-title {
  line-height: 1.1;
  margin-bottom: 6px;
}

.title-ja {
  display: block;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 900;
  font-size: clamp(34px, 9vw, 52px);
  background: linear-gradient(135deg, #FF6B9D 0%, #FF90B8 50%, #FF6B9D 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.05em;
}

.title-en {
  display: block;
  font-family: 'Poppins', 'Noto Sans JP', sans-serif;
  font-weight: 900;
  font-size: clamp(28px, 7.5vw, 44px);
  background: linear-gradient(135deg, #7B61FF 0%, #A898FF 50%, #7B61FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.08em;
}

/* -------- Standard バッジ -------- */
.app-version {
  display: block;                        /* inline-block → block：縦並びにする */
  font-family: 'Poppins', sans-serif;
  font-size: 9px;                        /* 11px → 9px：控えめに */
  font-weight: 500;                      /* 700 → 500：細めで目立ちすぎない */
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: #B8B8CC;                        /* --color-text-light より薄く */
  background: rgba(123, 97, 255, 0.05);  /* 0.08 → 0.05：背景も薄く */
  border: 1px solid rgba(123, 97, 255, 0.14); /* 0.22 → 0.14：ボーダーも薄く */
  border-radius: 30px;
  padding: 2px 10px;                     /* 3px 12px → 2px 10px：やや小さく */
  /* 縦並び用：中央揃えで幅はコンテンツに合わせる */
  width: fit-content;
  margin: 0 auto 10px;                   /* 上下：0 auto 10px（下余白10px）で縦並び間隔を確保 */
}

/* -------- サブタイトル -------- */
.app-subtitle {
  font-size: clamp(13px, 3.6vw, 16px);
  color: var(--color-text-mid);
  font-weight: 500;
  letter-spacing: 0.06em;
  display: inline-block;
  padding: 7px 20px;
  background: rgba(255, 107, 157, 0.08);
  border-radius: 30px;
  border: 1.5px solid rgba(255, 107, 157, 0.22);
}

/* ============================================
   ボタンセクション
   ============================================ */
.button-section {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* -------- 共通ボタン -------- */
.btn {
  width: 100%;
  min-height: var(--tap-target-min);   /* スマホ縦画面最小タップ高さ保証 (56px) */
  display: flex;
  align-items: center;
  padding: 20px 22px;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  text-align: left;
  transition: transform var(--transition), box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* タップ輝きオーバーレイ */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.18);
  opacity: 0;
  transition: opacity 0.15s;
  border-radius: inherit;
}

.btn:active::after {
  opacity: 1;
}

.btn:active {
  transform: scale(0.96) !important;
}

/* -------- アイコン枠 -------- */
.btn-icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.25);
  margin-right: 18px;
}

/* -------- テキスト -------- */
.btn-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.btn-label {
  font-size: clamp(17px, 4.8vw, 20px);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.btn-sub {
  font-size: clamp(12px, 3.2vw, 14px);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 400;
}

.btn-arrow {
  color: rgba(255, 255, 255, 0.65);
  font-size: 18px;
  margin-left: 10px;
  flex-shrink: 0;
}

/* ============================================
   メインボタン（学年を選ぶ）- ピンク・大きく目立つ
   ============================================ */
.btn-primary {
  background: linear-gradient(135deg, #FF6B9D 0%, #FF4785 100%);
  box-shadow:
    0 10px 28px rgba(255, 107, 157, 0.50),
    0 2px 6px rgba(255, 107, 157, 0.25);
  /* メインボタンはほんの少し大きく */
  padding: 24px 22px;
}

.btn-primary .btn-icon {
  width: 56px;
  height: 56px;
  font-size: 26px;
  background: rgba(255, 255, 255, 0.28);
}

.btn-primary .btn-label {
  font-size: clamp(19px, 5.2vw, 22px);
}

.btn-primary:active {
  box-shadow: 0 4px 14px rgba(255, 107, 157, 0.40);
}

/* ============================================
   設定ボタン（ミント）
   ============================================ */
.btn-tertiary {
  background: linear-gradient(135deg, #4ECDC4 0%, #38B2AA 100%);
  box-shadow:
    0 8px 22px rgba(78, 205, 196, 0.42),
    0 2px 6px rgba(78, 205, 196, 0.20);
}

.btn-tertiary:active {
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.35);
}

/* ============================================
   フッター
   ============================================ */
.top-footer {
  position: relative;
  z-index: 5;
  text-align: center;
  /* safe-area-inset-bottom対応 */
  padding: 24px 24px max(28px, env(safe-area-inset-bottom));
}

.footer-text {
  font-size: clamp(13px, 3.5vw, 15px);   /* 11-13px → 13-15px：少し大きく */
  color: var(--color-text-mid);          /* --color-text-light → --color-text-mid：少し濃く読みやすく */
  font-weight: 400;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.footer-icon {
  color: var(--color-primary);
  opacity: 0.65;                         /* 0.55 → 0.65：アイコンも少し読みやすく */
  font-size: 14px;                       /* 13px → 14px：文字に合わせて拡大 */
}

/* ============================================
   トースト通知
   ============================================ */
.toast {
  position: fixed;
  top: 72px;
  right: 16px;
  background: rgba(45, 45, 78, 0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-10px) scale(0.94);
  transition: opacity 0.22s, transform 0.22s;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ============================================
   ボタン登場アニメーション
   ============================================ */
.btn-grade    { animation: slideUp 0.5s ease both; animation-delay: 0.15s; }
.btn-settings { animation: slideUp 0.5s ease both; animation-delay: 0.28s; }

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   低画面高さ対応（小型スマホ・横向き等）
   ============================================ */
@media (max-height: 620px) {
  .hero-section {
    padding-top: 16px;
    padding-bottom: 16px;
  }
  .flower-icon {
    font-size: 44px;
  }
  .logo-icon {
    margin-bottom: 8px;
  }
  .btn-primary {
    padding: 18px 20px;
  }
  .btn {
    padding: 16px 20px;
  }
  .button-section {
    gap: 12px;
  }
}

/* ============================================
   大画面スマホ（6.5インチ以上想定）余白拡大
   ============================================ */
@media (min-height: 800px) {
  .hero-section {
    padding-top: 52px;
    padding-bottom: 48px;
  }
  .button-section {
    gap: 18px;
  }
}
