/* omoikane ちえのタネ - ブランドトークンは enfant-saitoku/assets/css/style.css を踏襲 */
:root {
  --ink: #1f2421;
  --muted: #6d746e;
  --paper: #f4f1ea;
  --surface: #ffffff;
  --line: #d9d3c8;
  --accent: #a48658;
  /* リンク専用。--accent(#a48658)は小さい文字だとコントラスト3.43:1でWCAG AA未達のため、
     同系色のまま濃くして5.84:1にした値。3アプリで同じ値にそろえること。 */
  --link: #7a6139;
  --error: #b3453d;
  --font-body: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  --font-heading: "Avenir Next", "Avenir", "Poppins", Arial, sans-serif;
  --wm-color: #4a9d6f;
  --inhibit-color: #e0883f;
  --flex-color: #8a6fb0;
  --tane-color: #ffd920;
  /* 5育サマリーの色。3アプリで同じ値にそろえる(同じグラフが違って見えないように)。
     食育・体育はDanDanが持っている色をそのまま使う */
  --sai-color: #00a0d8;
  --toku-color: #f080b0;
  --food-color: #e83030;
  --move-color: #f08030;
  --sprout-color: #59ad51;
}

@font-face {
  font-family: "Oshigo";
  src: url("../fonts/oshigo.otf") format("opentype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 400;
  margin: 0 0 0.6em;
}

/* リンクの色。これが無いとカード内のリンクがブラウザ既定の青(#0000EE)になり、
   さいとくノートと見た目が揃わない(--link はWCAG AAを満たす濃さ)。 */
a {
  color: var(--link);
}

button {
  font-family: inherit;
}

.app-header {
  padding: calc(20px + env(safe-area-inset-top)) 20px 12px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.app-header .brand-logo {
  height: 140px;
  width: auto;
  margin-bottom: 4px;
}

.app-header h1 {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  letter-spacing: 0.06em;
}

.app-header h1 .ttl-chie,
.app-header h1 .ttl-no,
.app-header h1 .ttl-tane {
  font-family: "Oshigo", "Hiragino Mincho ProN", "Yu Mincho", YuMincho, sans-serif;
  font-size: 1.3em;
  letter-spacing: 0;
}

.app-header h1 .ttl-chie {
  color: var(--tane-color);
}

.app-header h1 .ttl-no {
  color: var(--tane-color);
}

.app-header h1 .ttl-tane-icon {
  height: 1em;
  width: auto;
  vertical-align: middle;
  margin-left: 0.06em;
  position: relative;
  top: -0.25em;
}

.app-header h1 .ttl-tane {
  color: var(--sprout-color);
}

.app-main {
  flex: 1;
  /* 下の余白はフッター側(padding-bottom: 96px)で確保するため、ここでは詰める。
     ここに余白を持たせると退会ボタンとフッターのリンクが離れてしまう(さいとくノートと同じ4px) */
  padding: 16px 16px 4px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

/* カード共通 */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

/* ゲーム選択 */
.game-select-heading {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 0.95rem;
  margin: 4px 0 14px;
  text-align: center;
  color: var(--muted);
}

.game-select-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-select-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  color: #fff;
  text-align: left;
  transition: filter 0.15s;
}

.game-select-card:hover,
.game-select-card:focus-visible {
  filter: brightness(0.94);
}

.game-select-card.game-wm {
  background: var(--wm-color);
}

.game-select-card.game-inhibit {
  background: var(--inhibit-color);
}

.game-select-card.game-flex {
  background: var(--flex-color);
}

.game-select-card .game-icon {
  /* クリーム地の正方形画像を円形にマスクして、濃い色のカード上でも絵が沈まないようにする。
     画像が読めなかった場合もクリームの円が残るよう background を指定しておく。 */
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--paper);
  display: block;
}

.game-select-card .game-copy {
  flex: 1;
}

.game-select-card .game-name {
  display: block;
  /* ヘッダーの「ちえのタネ」と同じ書体にそろえる */
  font-family: "Oshigo", "Hiragino Mincho ProN", "Yu Mincho", YuMincho, sans-serif;
  font-size: 1.3rem;
  margin-bottom: 0;
}

/* 自己ベスト。「戻ってくる理由」としてゲーム名の下に小さく出す */
.game-select-card .game-best {
  display: block;
  font-size: 0.74rem;
  opacity: 0.85;
  margin-top: 2px;
}

/* おうちのひとへカード */
.parent-tip-card {
  background: var(--ink);
  color: #fff;
  border-radius: 16px;
  padding: 22px 20px;
  margin-bottom: 20px;
}

.parent-tip-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
}

.parent-tip-text {
  font-size: 0.95rem;
  line-height: 1.8;
  margin-top: 10px;
}

/* ゲームプレイ画面 */
.game-play {
  text-align: center;
}

.game-play-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.78rem;
  color: var(--muted);
}

/* 「おしまい」ボタン。子どもの指でも確実に押せるよう当たり判定を44px確保する。
   ただし遊びの主役ではないので、色は控えめ(surfaceの丸+線)にとどめる。 */
.game-quit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
}

.game-quit-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
}

.game-quit-label {
  font-size: 0.68rem;
}

.game-quit:active .game-quit-mark {
  transform: scale(0.94);
}

/* 進捗ドット。3ゲームで単位が違うので「いくつ中いくつ」という共通の見た目にする。
   色はそのゲームの色(--progress-color をJS側で差し込む)。 */
.game-progress {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  max-width: 60%;
}

.game-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}

.game-progress-dot.is-done {
  background: var(--progress-color, var(--ink));
}

/* おしまいの確認。プレイ面に重ねる。 */
.quit-confirm {
  position: fixed;
  inset: 0;
  background: rgba(31, 36, 33, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.quit-confirm-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 22px 20px 18px;
  width: 100%;
  max-width: 300px;
  text-align: center;
}

.quit-confirm-text {
  margin: 0 0 16px;
  font-family: var(--font-heading);
  font-size: 1rem;
}

/* 「よーい」→「スタート!」の前振り。ゲームのアクセント色で表示する。 */
.game-countdown {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.6);
}

.game-countdown.is-pop {
  animation: game-countdown-pop 0.35s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

@keyframes game-countdown-pop {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  60% {
    opacity: 1;
    transform: scale(1.15);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.game-stage {
  min-height: 280px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.game-instruction {
  font-size: 0.95rem;
  color: var(--ink);
  min-height: 1.6em;
}

/* ワーキングメモリ: タイル */
/* タイルは横幅いっぱいに広げる。固定サイズだと画面が余って小さく見える。 */
.wm-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.wm-tile {
  width: 100%;
  aspect-ratio: 1 / 1;
  /* button の既定padding(1px 6px)を消す。残すと中のアイコンの
     縦横比が崩れる(横78%と縦78%の基準がずれるため) */
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--paper);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}

.wm-tile.is-lit {
  background: var(--wm-color);
  border-color: var(--wm-color);
  filter: brightness(1.15);
}

.wm-tile.is-correct {
  background: var(--wm-color);
  border-color: var(--wm-color);
}

.wm-tile.is-wrong {
  background: var(--error);
  border-color: var(--error);
}

.wm-tile:active {
  transform: scale(0.94);
}

/* タイルの絵柄。背景を透過した画像なので、タイルの状態色がそのまま透けて見える。
   画像は tools/normalize-wm-icons.py で「中身が余白なくキャンバスいっぱい」に
   揃えてあるため、object-fit: contain で枠に合わせれば縦横比は崩れない。 */
.wm-tile-icon {
  width: 78%;
  height: 78%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

/* いぬ(耳が横へ張り出す)と うさぎ(耳のぶん縦長)は、他と同じ枠に収めると
   耳が枠を使い切ってしまい顔だけが小さく見える。空いている方向に余裕が
   あるので、枠からはみ出さない範囲で大きめに表示する。 */
.wm-tile-icon[data-animal="dog"],
.wm-tile-icon[data-animal="rabbit"] {
  width: 94%;
  height: 94%;
}

/* 抑制制御: Go/No-Go の丸 */
.inhibit-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.08s;
}

.inhibit-circle:active {
  transform: scale(0.95);
}

.inhibit-circle.is-go {
  background: var(--wm-color);
}

.inhibit-circle.is-nogo {
  background: var(--error);
}

.inhibit-circle.is-empty {
  background: var(--line);
  cursor: default;
}

/* 認知的柔軟性: カードソート */
.flex-rule-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--flex-color);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.flex-card {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.flex-bins {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.flex-bin {
  width: 110px;
  height: 90px;
  border-radius: 14px;
  border: 2px dashed var(--line);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  cursor: pointer;
}

.flex-bin:active {
  transform: scale(0.96);
}

/* 結果画面 */
.game-result {
  text-align: center;
}

.game-result-score {
  font-size: 2.2rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin: 8px 0;
}

.game-result-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.btn-primary {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.btn-secondary {
  width: 100%;
  padding: 13px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-footer {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  /* 下端固定のタブに隠れないよう、さいとくノートと同じく余白を厚めに取る */
  padding: 0 16px 96px;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
}

/* おうちのひとへカード: 何を育てているかの説明(ゲーム前のみ表示) */
.parent-tip-skill {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
}

.parent-tip-skill-note {
  margin: 4px 0 12px;
  font-size: 0.78rem;
  line-height: 1.8;
  color: var(--muted);
}

/* 結果画面の保存状態 */
.save-status {
  margin: 0 0 14px;
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
}

/* 記録・アカウント画面
   表示形式はさいとくノート(enfant-saitoku/assets/css/style.css)に合わせる。
   .card / .field / .entry-item / .form-message / .btn-text はあちらと同じ規則。 */
.card-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.8;
  margin: 0 0 14px;
}

.entry-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entry-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.entry-item .entry-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.entry-item .entry-category {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.entry-item .entry-body {
  white-space: pre-wrap;
  line-height: 1.6;
}

.empty-state {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px 0;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--paper);
  color: var(--ink);
}

.form-message {
  font-size: 0.8rem;
  margin-top: 8px;
  min-height: 1.2em;
}

.form-message.is-error {
  color: var(--error);
}

.form-message.is-success {
  color: var(--accent);
}

/* 通知のオン/オフ(アカウントタブ)。さいとくノートと同じ体裁。 */
.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--ink);
}

.checkbox-field label {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--muted);
}

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px;
  font-family: inherit;
}

.app-footer .btn-text {
  display: block;
  margin: 0 auto 4px;
}

/* タブ(下端固定)とサブ画面。さいとくノートと同じ規則。
   さいとくノートはログイン後だけタブを出すが、ちえのタネは未ログインでも
   遊べて記録も残るため、タブは常に表示する。 */
.tab-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-nav button {
  flex: 1;
  border: none;
  background: none;
  padding: 12px 4px;
  font-size: 0.72rem;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
}

.tab-nav button.is-active {
  color: var(--ink);
  font-weight: bold;
}

.subview {
  display: none;
}

.subview.is-active {
  display: block;
}

/* 5育サマリーの5角形チャート。さいとくノートと同じ規則。 */
.pentagon-chart {
  max-width: 340px;
  margin: 8px auto 4px;
}

.pentagon-chart-note {
  margin-top: 4px;
}

/* ---- 使い方カード(さいとくノートと同じ規則) ---- */
.howto-step {
  display: inline-block;
  margin: 10px 0 5px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.howto-step:first-of-type {
  margin-top: 2px;
}

#howto-card .card-note {
  margin-bottom: 6px;
}

/* 退会(危険操作)。さいとくノートと同じ見た目にそろえる。 */
.account-danger {
  text-align: center;
  margin-top: 4px;
}

/* ---- 姉妹アプリへの導線 ---- */
/* 5育のうちこのアプリが扱わない軸を、どのアプリで育てられるかを示す。
   3アプリ(さいとくノート・ちえのタネ・DanDan)で同じ見た目にそろえること。 */
.sibling-apps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sibling-apps li {
  background: var(--paper);
  border-radius: 10px;
  padding: 10px 12px;
}

.sibling-apps a {
  font-size: 0.88rem;
  font-weight: 700;
}

.sibling-apps span {
  display: block;
  margin-top: 2px;
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--muted);
}

.account-danger .card {
  text-align: left;
  margin-top: 10px;
}

.btn-quiet {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  padding: 6px 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-quiet:hover,
.btn-quiet:focus-visible {
  color: var(--ink);
}

.btn-danger {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--error);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: default;
}

.delete-warning {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--error);
  border-radius: 10px;
  color: var(--error);
}

/* 規約・プライバシーポリシーのページ。さいとくノートと同じ規則。 */
.legal-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.legal-page h1 {
  font-size: 1.3rem;
  margin: 0 0 6px;
  text-wrap: balance;
}

.legal-page .legal-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0 0 28px;
}

.legal-page h2 {
  font-size: 0.98rem;
  margin: 32px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.legal-page p,
.legal-page li {
  font-size: 0.86rem;
  line-height: 1.9;
  color: var(--ink);
}

.legal-page ul,
.legal-page ol {
  padding-left: 1.3em;
  margin: 0 0 14px;
}

.legal-page li {
  margin-bottom: 8px;
}

.legal-page a {
  color: var(--link);
  word-break: break-all;
}

.legal-page .legal-contact {
  margin-top: 32px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.legal-page .legal-contact p {
  margin: 0 0 4px;
  font-size: 0.82rem;
}

.legal-back {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.legal-back::before {
  content: "\2190";
  margin-right: 6px;
}

.auth-consent {
  margin: 10px 0 0;
  font-size: 0.72rem;
  line-height: 1.8;
  color: var(--muted);
}

.app-footer-links {
  margin: 0 0 6px;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.app-footer-links a {
  color: var(--muted);
  /* さいとくノートに合わせる: ふだんは下線なし、ホバー/キーボード操作時だけ下線 */
  font-size: 0.76rem;
  text-decoration: none;
}

.app-footer-links a:hover,
.app-footer-links a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

.app-footer-owner {
  width: 100%;
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
}

/* お名前とご案内メール(3アプリ共通。assets/js/profile.js) */
.name-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.88rem;
  line-height: 1.6;
}

.name-banner p {
  margin: 0 0 8px;
}

.name-banner-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.name-banner-actions .btn-primary {
  width: auto;
  padding: 8px 18px;
}

.name-banner-actions .btn-text {
  margin: 0;
}

.profile-newsletter {
  margin-top: 20px;
  margin-bottom: 4px;
}

#newsletter-note {
  margin-top: 0;
}
