@import url("/assets/components-93a65a93.css");
@import url("/assets/components/_stat_card-07659b65.css");
@import url("/assets/components/_unit_stats-df3d67d0.css");
@import url("/assets/components/_recent_records-307c466c.css");
@import url("/assets/components/_confetti-1da35853.css");
@import url("/assets/components/_level_up-528f9a88.css");
@import url("/assets/login_page-90bdeb65.css");
@import url("/assets/big_button-7be69642.css");
@import url("/assets/home_page-28ca06ff.css");
@import url("/assets/mini_games-2386bdfa.css");
@import url("/assets/subject_card-703e0e8c.css");
@import url("/assets/progress_bar-9fc5a69f.css");
@import url("/assets/subject_page-0512ee07.css");
@import url("/assets/quiz_page-cd58744c.css");
@import url("/assets/my_page-0318b930.css");
@import url("/assets/badge_icon-34053337.css");
@import url("/assets/teacher_dashboard-f0295dbf.css");
@import url("/assets/dashboard_page-be57f22f.css");
@import url("/assets/result_page-f75b6759.css");

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ==============================================
   小学生向け学習アプリ - デザインシステム
   ============================================== */

/* --- CSS Custom Properties (デザイントークン) --- */
:root {
  /* 
   * カラースキーム: パステル & フレンドリー
   * 【設計意図】
   * 小学生が直感的に「安全・楽しい」と感じる彩度の高いパステルカラーを中心とし、
   * 「国語(赤系)」「算数(青系)」といった学校でよく使われる色分けを踏襲することで認知負荷を下げる。
   */
  --color-primary: #ff9f43; /* あたたかみのあるオレンジ */
  --color-primary-light: #feca57; /* 明るいイエロー */
  --color-primary-dark: #ee7b30;
  --color-primary-ink: #8a3d00;

  --color-kokugo: #ff6b81; /* 国語: ピンク系 */
  --color-kokugo-light: #ffb3c1;
  --color-kokugo-bg: #fff0f3;
  --color-kokugo-ink: #9f1239;

  --color-sansu: #54a0ff; /* 算数: 水色系 */
  --color-sansu-light: #a3d5ff;
  --color-sansu-bg: #eff8ff;
  --color-sansu-ink: #0056a6;

  --color-success: #2ed573; /* 正解 */
  --color-success-light: #7bed9f;
  --color-error: #ff6b6b; /* 不正解 */
  --color-error-light: #ff9f9f;

  /*
   * フィードバックモーダル用のセマンティックカラー
   * 正解時は安心感のある緑系、不正解時は注意を促すアンバー系。
   * Tailwind の green-100/300/700, amber-100/300/700 相当。
   */
  --color-success-bg: #f0fdf4;
  --color-success-border: #bbf7d0;
  --color-success-fg: #166534;
  --color-error-bg: #fff1f2;
  --color-error-border: #fecdd3;
  --color-error-fg: #9f1239;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #fde68a;
  --color-warning-fg: #b45309;
  --color-info-bg: #eff6ff;
  --color-info-border: #bfdbfe;
  --color-info-fg: #1e40af;
  --color-focus: #0b57d0;
  --color-disabled-bg: #eceff1;
  --color-disabled-fg: #596268;

  --color-bg: #fffdf7; /* 背景: やわらかいクリーム */
  --color-bg-card: #ffffff;
  --color-text: #2d3436;
  --color-text-light: #636e72;
  --color-border: #dfe6e9;
  --color-on-accent: var(--color-text);

  --color-xp: #f9ca24;
  --color-xp-bg: #fdf2d0;
  --color-xp-ink: #765600;
  --color-badge: #6c5ce7;

  /*
   * タイポグラフィ: 端末内の読みやすい日本語フォントを優先する。
   * 閲覧情報を第三者へ送らないよう、外部フォントは読み込まない。
   */
  --font-family:
    "BIZ UDPGothic", "UD Digi Kyokasho N-R", "Hiragino Maru Gothic ProN",
    "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui,
    sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-size-3xl: 2.5rem;

  /* スペーシング */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* ボーダー */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* シャドウ */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  /* 
   * タッチ操作: 最小タップ領域
   * 【設計意図】
   * iPadやChromebookなどの学校支給タブレットでのタッチ操作を前提としている。
   * 指で押し間違えないよう、標準タップ領域（44px）以上を確保し、推奨値（60px）をメインに使用。
   */
  --tap-min: 44px;
  --tap-recommended: 60px;

  /* 画面端のノッチ・ホームインジケーターを避ける共通値 */
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --z-sticky-actions: 100;

  /* アニメーション */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-lg);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.7;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;

  /* タブレットスクロール最適化 */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* --- ルビ (ふりがな) スタイル --- */
ruby {
  ruby-align: center;
}

rt {
  font-size: var(--font-size-xs);
  color: var(--color-text-light);
}

/* --- ボタン基本スタイル --- */
button {
  font-family: var(--font-family);
  font-size: var(--font-size-lg);
  cursor: pointer;
  border: none;
  outline: none;
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

button:active {
  transform: scale(0.95) translateY(2px);
}

/* --- リンク --- */
a {
  color: var(--color-primary-ink);
  text-decoration: none;
}

:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 4px solid var(--color-focus);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px rgba(191, 219, 254, 0.65);
}

:where(button, input:not([type="hidden"]), select, textarea) {
  min-height: var(--tap-min);
}

:where(button, input, select, textarea):disabled,
:where([role="button"], a)[aria-disabled="true"] {
  color: var(--color-disabled-fg);
  background: var(--color-disabled-bg);
  border-color: var(--color-border);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.72;
  transform: none;
}

/* --- カードベース --- */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-lg);
}

/* --- ユーティリティ --- */
.text-center {
  text-align: center;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.gap-sm {
  gap: var(--space-sm);
}

.gap-md {
  gap: var(--space-md);
}

.gap-lg {
  gap: var(--space-lg);
}

/* --- モバイル共通ユーティリティ --- */
.touch-target {
  min-width: var(--tap-min);
  min-height: var(--tap-min);
}

.primary-touch-target {
  min-height: var(--tap-recommended);
}

.safe-area-inline {
  padding-right: max(var(--space-md), var(--safe-area-right));
  padding-left: max(var(--space-md), var(--safe-area-left));
}

.safe-area-bottom {
  padding-bottom: max(var(--space-md), var(--safe-area-bottom));
}

/* 主操作を固定する要素に付ける。親に overflow を指定しないこと。 */
.sticky-action-area {
  position: sticky;
  z-index: var(--z-sticky-actions);
  bottom: 0;
  padding-top: var(--space-sm);
  padding-bottom: max(var(--space-sm), var(--safe-area-bottom));
  background: var(--color-bg);
  border-top: 2px solid var(--color-border);
  box-shadow: 0 -6px 16px rgba(45, 52, 54, 0.08);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  :where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
    outline-color: Highlight;
    box-shadow: none;
  }
}
