/* ----------------------------------------------------
  やさしいナンプレ - CSSスタイルシート
  シニア向けデザイン：高コントラスト、大文字、押しやすいボタン
---------------------------------------------------- */

/* 基本設定 */
:root {
  --bg-color: #faf8f5;           /* 目に優しい暖かみのある背景色 */
  --text-color: #2c2520;         /* コントラストが高く、真っ黒すぎない文字色 */
  --border-color: #635147;       /* 盤面の太い枠線用（焦げ茶系） */
  --border-light: #c2b4a8;       /* 盤面の細い枠線用 */
  
  --btn-primary-bg: #4a6b53;     /* やさしい緑のプライマリボタン */
  --btn-primary-text: #ffffff;
  --btn-secondary-bg: #e6dfd5;   /* セカンダリボタン */
  --btn-secondary-text: #2c2520;

  --cell-bg-given: #e8e3da;      /* ヒント数字（初期値）の背景 */
  --cell-text-given: #2c2520;    /* ヒント数字の文字（太字） */
  --cell-text-user: #004fb0;     /* ユーザーが入力した数字（区別しやすい青） */
  
  --cell-bg-selected: #ffe8cc;   /* 選択中のマス（淡いオレンジ） */
  --cell-bg-highlight: #e6f3ff;  /* 選択中と同じ数字のマス（淡い青） */
  --cell-bg-error: #ffd6d6;      /* 間違いのマス（淡い赤） */
  --cell-text-error: #b30000;    /* 間違い数字の文字色 */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* タップ時の青いハイライトを消す */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  font-size: 18px; /* シニア向けに基本フォントを大きめに */
}

/* ヘッダー */
.app-header {
  background-color: #ffffff;
  border-bottom: 2px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
  padding: 10px 16px;
}

.app-logo {
  font-weight: bold;
  font-size: 20px;
  color: var(--text-color);
}

.header-settings {
  display: flex;
  gap: 8px;
}

.header-btn {
  background: var(--btn-secondary-bg);
  border: 1px solid var(--border-light);
  color: var(--btn-secondary-text);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 40px; /* タップターゲットの最低高さ */
}

/* メインコンテンツ配置 */
.app-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  min-height: calc(100vh - 180px);
}

/* 画面切り替えの制御 */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* トップ画面のデザイン */
.top-hero {
  text-align: center;
  margin-bottom: 24px;
  padding: 16px 0;
}

.top-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--btn-primary-bg);
  margin-bottom: 8px;
}

.top-tagline {
  font-size: 18px;
  color: #665544;
}

/* カード風セクション */
.card-section {
  background: #ffffff;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-desc {
  font-size: 15px;
  color: #665544;
  margin-bottom: 16px;
}

.badge-today {
  background: #ff5e5b;
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.badge-practice {
  background: #0076cc;
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

/* メニューボタンリスト */
.menu-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-list.grid-cols {
  flex-direction: row;
}

.menu-list.grid-cols .btn-menu {
  flex: 1;
}

.btn-menu {
  width: 100%;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  min-height: 56px;
}

.btn-primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: 2px solid var(--btn-primary-bg);
}

.btn-primary:active {
  background-color: #3b5441;
}

.btn-secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border: 2px solid var(--border-light);
}

.btn-secondary:active {
  background-color: #d1c7ba;
}

/* メニューボタン内のレイアウト */
.btn-level {
  justify-content: space-between;
}

.level-badge {
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  color: white;
  font-weight: bold;
}

.level-badge.easy { background-color: #2b8a3e; }
.level-badge.normal { background-color: #e8590c; }
.level-badge.hard { background-color: #c92a2a; }

.level-name {
  font-size: 18px;
  flex-grow: 1;
  text-align: left;
  margin-left: 12px;
}

.level-status {
  font-size: 14px;
  background-color: rgba(0, 0, 0, 0.05);
  padding: 4px 8px;
  border-radius: 6px;
  color: #665544;
}

.level-status.cleared {
  background-color: #d3f9d8;
  color: #2b8a3e;
  font-weight: bold;
}

/* ストリークカード */
.streak-card {
  background-color: #ffe3e3;
  border: 2px solid #ffa8a8;
  color: #c92a2a;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  margin-bottom: 20px;
  font-weight: bold;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ルール説明カード */
.rules-card {
  background: #f1ede6;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  font-size: 15px;
  color: #665544;
}

.rules-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--text-color);
}

/* ゲーム画面のデザイン */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.btn-icon-text {
  background-color: var(--btn-secondary-bg);
  border: 1px solid var(--border-light);
  color: var(--btn-secondary-text);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
}

.game-info {
  text-align: right;
}

.game-mode-label {
  display: block;
  font-size: 13px;
  color: #887766;
}

.game-level-label {
  font-size: 18px;
  font-weight: bold;
}

/* 盤面コンテナ（横幅いっぱい対応） */
.board-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto 12px auto;
  aspect-ratio: 1 / 1; /* 正方形を維持 */
}

/* 盤面本体（Gridレイアウト） */
.board {
  display: grid;
  width: 100%;
  height: 100%;
  background-color: var(--border-light);
  border: 3px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* 4x4, 6x6, 9x9 各グリッド定義 */
.board.board-4 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.board.board-6 {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
}

.board.board-9 {
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
}

/* マスの基本スタイル */
.cell {
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px; /* 4x4, 6x6 用の初期大サイズ */
  font-weight: bold;
  position: relative;
  cursor: pointer;
  user-select: none;
}

/* 9x9盤面の場合のみ、文字サイズを少し調整 */
.board-9 .cell {
  font-size: 22px; /* スマホ9x9で確実に36px幅以上を想定した読みやすいサイズ */
}

/* 太線によるブロック区切り */
/* 4x4 (ブロック：2×2) */
.board-4 .cell:nth-child(2n) {
  border-right: 3px solid var(--border-color);
}
.board-4 .cell:nth-child(n+5):nth-child(-n+8),
.board-4 .cell:nth-child(n+13):nth-child(-n+16) {
  border-bottom: 3px solid var(--border-color);
}

/* 6x6 (ブロック：縦3×横3) */
.board-6 .cell:nth-child(3n) {
  border-right: 3px solid var(--border-color);
}
.board-6 .cell:nth-child(n+13):nth-child(-n+18) {
  border-bottom: 3px solid var(--border-color);
}

/* 9x9 (ブロック：縦3×横3) */
.board-9 .cell:nth-child(3n) {
  border-right: 3px solid var(--border-color);
}
.board-9 .cell:nth-child(n+19):nth-child(-n+27),
.board-9 .cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 3px solid var(--border-color);
}

/* 右端、下端の重複ボーダーを綺麗にする処理 */
.board-4 .cell:nth-child(4n),
.board-6 .cell:nth-child(6n),
.board-9 .cell:nth-child(9n) {
  border-right: none;
}

/* セルの状態別スタイル */
.cell.given {
  background-color: var(--cell-bg-given);
  color: var(--cell-text-given);
  cursor: not-allowed;
}

.cell.user-input {
  color: var(--cell-text-user);
}

.cell.selected {
  background-color: var(--cell-bg-selected) !important;
}

.cell.highlighted {
  background-color: var(--cell-bg-highlight);
}

/* 重複（間違い）状態 */
.cell.error {
  background-color: var(--cell-bg-error) !important;
  color: var(--cell-text-error) !important;
}

/* 間違いセルの「？」マーク（色覚二重伝達） */
.cell.error::after {
  content: "？";
  position: absolute;
  top: 1px;
  right: 2px;
  font-size: 11px;
  font-weight: bold;
  color: var(--cell-text-error);
  line-height: 1;
}

/* メモ（候補）数字の表示スタイル（9x9限定） */
.cell .notes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 2px;
  pointer-events: none; /* タップイベントを邪魔しない */
}

.cell .note-item {
  font-size: 9px;
  color: #776655;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: normal;
  line-height: 1;
}

/* アシスト機能ボタン群（もどす、ヒント、メモ切り替え） */
.control-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.btn-control {
  flex: 1;
  background-color: var(--btn-secondary-bg);
  border: 2px solid var(--border-light);
  color: var(--btn-secondary-text);
  padding: 12px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
}

.btn-control:active {
  background-color: #d1c7ba;
}

.btn-control.active {
  background-color: #635147;
  color: #ffffff;
  border-color: #635147;
}

/* テンキー（数字キーパッド） */
.keypad-container {
  background-color: #ffffff;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.keypad {
  display: grid;
  gap: 8px;
  width: 100%;
}

/* 4x4 のテンキー配置 (1列に4つ + けす) */
.keypad-4 {
  grid-template-columns: repeat(4, 1fr);
}
.keypad-4 .btn-delete {
  grid-column: span 4;
}

/* 6x6 のテンキー配置 */
.keypad-6 {
  grid-template-columns: repeat(3, 1fr);
}
.keypad-6 .btn-delete {
  grid-column: span 3;
}

/* 9x9 のテンキー配置 */
.keypad-9 {
  grid-template-columns: repeat(3, 1fr);
}
.keypad-9 .btn-delete {
  grid-column: span 3;
}

.btn-key {
  background-color: #f7f5f0;
  border: 1px solid var(--border-light);
  color: var(--text-color);
  font-size: 24px;
  font-weight: bold;
  padding: 14px 0;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px; /* シニア向け押しやすい高さ */
  user-select: none;
}

.btn-key:active {
  background-color: #e5dfd2;
}

.btn-key.btn-delete {
  background-color: #f1ede6;
  font-size: 18px;
  color: #8b3c3c;
}

.btn-key.btn-delete:active {
  background-color: #dfd8cf;
}

/* やりなおすボタンの行 */
.restart-row {
  text-align: center;
  margin-top: 8px;
  margin-bottom: 24px;
}

.btn-restart {
  background: none;
  border: none;
  color: #8b3c3c;
  font-size: 16px;
  font-weight: bold;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 16px;
}

/* 完成画面 */
.complete-card {
  background: #ffffff;
  border: 3px solid var(--btn-primary-bg);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.celebration-icon {
  font-size: 64px;
  margin-bottom: 12px;
}

.complete-title {
  font-size: 32px;
  color: var(--btn-primary-bg);
  margin-bottom: 12px;
  font-weight: 900;
}

.complete-message {
  font-size: 18px;
  color: #554433;
  margin-bottom: 20px;
  line-height: 1.6;
}

/* スタンプ */
.stamp-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.stamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #fff9db;
  border: 2px dashed #fcc419;
  padding: 10px 16px;
  border-radius: 50px;
  color: #f59f00;
  font-weight: bold;
}

.stamp-icon {
  font-size: 24px;
}

.stamp-text {
  font-size: 16px;
}

.streak-display {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 24px;
}

/* シェアセクション */
.share-section {
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
  margin-top: 20px;
  margin-bottom: 24px;
}

.share-title {
  font-size: 16px;
  color: #665544;
  margin-bottom: 12px;
}

.btn-share-main {
  width: 100%;
  background-color: #0076cc;
  color: white;
  border: none;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  box-shadow: 0 4px 6px rgba(0, 118, 204, 0.2);
}

.btn-share-main:active {
  background-color: #005fa3;
}

/* コピートースト */
.share-toast {
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  display: inline-block;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.share-toast.show {
  opacity: 1;
}

.share-sns-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-sns {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  text-decoration: none;
  color: white;
  min-height: 48px;
}

.btn-x {
  background-color: #000000;
}
.btn-x:active {
  background-color: #222222;
}

.btn-line {
  background-color: #06c755;
}
.btn-line:active {
  background-color: #05b04b;
}

.complete-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
}

/* 広告プレースホルダー */
.ad-placeholder-container {
  margin: 16px 0;
  text-align: center;
}

.ad-box {
  background-color: #f1ede6;
  border: 1px dashed var(--border-light);
  border-radius: 8px;
  padding: 10px;
  max-width: 100%;
}

.ad-label {
  display: block;
  font-size: 11px;
  color: #887766;
  margin-bottom: 6px;
}

.ad-content-mock {
  background-color: #e5dfd2;
  color: #665544;
  font-size: 14px;
  padding: 30px 10px;
  border-radius: 4px;
  font-weight: bold;
}

/* モーダルダイアログ */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: #ffffff;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-title {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 20px;
  text-align: center;
}

.settings-group {
  margin-bottom: 20px;
  border-bottom: 1px solid #f1ede6;
  padding-bottom: 16px;
}

.settings-group:last-of-type {
  border-bottom: none;
}

.settings-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
}

.settings-desc {
  font-size: 14px;
  color: #665544;
  margin-top: 6px;
}

/* チェックボックススイッチ風 */
.toggle-checkbox {
  width: 52px;
  height: 32px;
  appearance: none;
  background-color: #ccc;
  border-radius: 16px;
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.toggle-checkbox:checked {
  background-color: var(--btn-primary-bg);
}

.toggle-checkbox::before {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.toggle-checkbox:checked::before {
  transform: translateX(20px);
}

/* フッター */
.app-footer {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  text-align: center;
  border-top: 2px solid var(--border-light);
}

.footer-info {
  margin-top: 12px;
  font-size: 12px;
  color: #887766;
}

/* テストモードバナー */
.test-mode-banner {
  background-color: #fff3bf;
  border: 1px solid #f59f00;
  color: #d9480f;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  margin-bottom: 20px;
  font-weight: bold;
}

/* ----------------------------------------------------
  報酬機能用（スタンプ帳・賞状）のスタイル追加
---------------------------------------------------- */

/* 広告の非表示設定（買い手が有効化できるようにコメントアウト相当として非表示化） */
.ad-box {
  display: none !important;
}

/* トップ画面スタンプ帳ボタン配置用 */
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  width: 100%;
}

.section-header-row .section-title {
  margin-bottom: 0;
}

.btn-stampbook-trigger {
  background-color: #f7f5f0;
  border: 2px solid var(--border-light);
  color: var(--text-color);
  font-size: 16px;
  font-weight: bold;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-stampbook-trigger:active {
  background-color: #e5dfd2;
}

/* 設定画面用入力フィールド */
.settings-input {
  width: 100%;
  padding: 12px;
  font-size: 18px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  margin-top: 8px;
  background-color: #faf8f5;
  color: var(--text-color);
  font-weight: bold;
}

.settings-input:focus {
  border-color: var(--btn-primary-bg);
  outline: none;
}

/* スタンプ帳画面 */
.stamp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.stamp-screen-title {
  font-size: 24px;
  font-weight: bold;
}

.stamp-card-outer {
  background: #ffffff;
  border: 3px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.calendar-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.calendar-month-label {
  font-size: 20px;
  font-weight: bold;
  color: var(--text-color);
}

.btn-cal-nav {
  background: var(--btn-secondary-bg);
  border: 1px solid var(--border-light);
  color: var(--btn-secondary-text);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  min-height: 44px;
}

.btn-cal-nav:active {
  background: #d1c7ba;
}

.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: bold;
  font-size: 14px;
  color: #887766;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-day {
  aspect-ratio: 1 / 1;
  border: 1px solid #e8e3da;
  border-radius: 6px;
  background-color: #faf8f5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 12px;
  color: #aa9988;
}

.calendar-day.empty {
  background-color: transparent;
  border: none;
}

.calendar-day.current-month {
  color: var(--text-color);
  font-weight: bold;
}

.calendar-day-num {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 11px;
}

.calendar-stamp {
  font-size: 22px;
  margin-top: 8px;
  line-height: 1;
}

.stamp-summary-card {
  background: #ffffff;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-item {
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 賞状モーダル (プレミアム和風デザイン) */
.certificate-modal .certificate-content {
  background-color: #faf6ee;
  border-radius: 16px;
  max-width: 540px;
  width: 100%;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.certificate-border-outer {
  border: 6px double #d4af37; /* 金色の豪華な二重枠 */
  padding: 10px;
  border-radius: 8px;
}

.certificate-border-inner {
  border: 2px solid #d4af37;
  padding: 24px 16px;
  border-radius: 4px;
  background-color: #ffffff;
  background-image: radial-gradient(#faf6ee 1px, transparent 0), radial-gradient(#faf6ee 1px, transparent 0);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px; /* 賞状の和紙っぽい風合い */
}

.cert-title {
  font-size: 38px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  color: #332211;
  letter-spacing: 12px;
  margin-bottom: 24px;
  text-indent: 12px;
  font-weight: bold;
}

.cert-name {
  font-size: 22px;
  font-weight: bold;
  border-bottom: 2px solid #887766;
  display: inline-block;
  padding: 0 16px 4px 16px;
  margin-bottom: 24px;
  color: var(--text-color);
}

.cert-body {
  font-size: 17px;
  line-height: 2.2;
  color: #332211;
  text-align: center;
  margin-bottom: 24px;
  font-weight: bold;
}

.cert-highlight {
  font-size: 24px;
  color: #c92a2a;
  margin: 8px 0;
}

.cert-footer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 14px;
  color: #554433;
  margin-top: 24px;
  border-top: 1px dashed var(--border-light);
  padding-top: 16px;
}

.cert-date {
  margin-bottom: 4px;
}

.cert-signer {
  font-weight: bold;
}

.cert-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  width: 100%;
}

.cert-actions .btn-menu {
  flex: 1;
}

/* ----------------------------------------------------
  初心者向け追加機能のスタイル
  (あそびかた、れんしゅうチュートリアル、ヒント改善、はじめの一歩)
---------------------------------------------------- */

/* あそびかた常設ボタン */
.rules-trigger-container {
  max-width: 600px;
  margin: 0 auto 16px auto;
  padding: 0 16px;
}

.btn-rules-main {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #4dabf7, #228be6);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(34, 139, 230, 0.25);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn-rules-main:active {
  transform: scale(0.98);
  box-shadow: 0 2px 5px rgba(34, 139, 230, 0.2);
}

/* ウェルカムモーダル */
.welcome-content {
  text-align: center;
  border: 4px solid var(--btn-primary-bg);
}

.welcome-header-icon {
  font-size: 64px;
  margin-bottom: 12px;
}

.welcome-intro-text {
  font-size: 18px;
  line-height: 1.6;
  color: #554433;
  margin-bottom: 24px;
}

.welcome-question-card {
  background-color: #fdfaf2;
  border: 2px solid #ebdcb9;
  border-radius: 12px;
  padding: 16px;
}

.question-text {
  font-size: 20px;
  font-weight: bold;
  color: #332211;
  margin-bottom: 16px;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* あそびかた説明スライドモーダル */
.rules-modal-content {
  max-width: 520px;
  padding: 20px;
}

.rules-modal-header {
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.rules-slides {
  min-height: 380px;
  position: relative;
  overflow: hidden;
}

.rules-slide {
  display: none;
}

.rules-slide.active {
  display: block;
}

.slide-title {
  font-size: 20px;
  color: var(--text-color);
  margin-bottom: 8px;
  font-weight: bold;
}

.slide-desc {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.slide-visual-container, .slide-visual-row {
  background-color: #fcf9f2;
  border: 1px dashed #d9ccb6;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.slide-visual-row {
  flex-direction: row;
  justify-content: space-around;
  gap: 12px;
}

.visual-half {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.status-badge {
  font-size: 14px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.status-badge.ok {
  background-color: #d3f9d8;
  color: #2b8a3e;
}

.status-badge.ng {
  background-color: #ffe3e3;
  color: #c92a2a;
}

.visual-caption {
  font-size: 14px;
  color: #665544;
  margin-top: 8px;
  font-weight: bold;
  text-align: center;
}

/* ミニ盤面 */
.mini-board {
  display: grid;
  width: 140px;
  height: 140px;
  background-color: #ffffff;
  border: 2px solid #332211;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.mini-board.size-4 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.mini-board .cell {
  border: 1px solid var(--border-light);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
  font-weight: bold;
  color: #554433;
}

/* 4x4太線枠のシミュレート */
.mini-board.size-4 .cell:nth-child(4n) { border-right: none; }
.mini-board.size-4 .cell:nth-child(2n) { border-right: 2px solid #332211; }
.mini-board.size-4 .cell:nth-child(n+13) { border-bottom: none; }
.mini-board.size-4 .cell:nth-child(n+5):nth-child(-n+8) { border-bottom: 2px solid #332211; }

.mini-board .cell.highlight-target {
  background-color: #ffdeeb;
  color: #e64980;
  animation: pulse-soft 1.5s infinite;
}

/* 行・ブロックのハイライト */
.mini-board .cell.row-highlight {
  background-color: #e7f5ff;
}
.mini-board .cell.row-highlight-error {
  background-color: #fff0f6;
}
.mini-board .cell.error-cell {
  color: #e64980;
  background-color: #ffe3e3;
  border: 2px dashed #e64980;
}

.mini-board.block-highlight-ok .cell:nth-child(1),
.mini-board.block-highlight-ok .cell:nth-child(2),
.mini-board.block-highlight-ok .cell:nth-child(5),
.mini-board.block-highlight-ok .cell:nth-child(6) {
  background-color: #e6fcf5;
}

.mini-board.block-highlight-ng .cell:nth-child(1),
.mini-board.block-highlight-ng .cell:nth-child(2),
.mini-board.block-highlight-ng .cell:nth-child(5),
.mini-board.block-highlight-ng .cell:nth-child(6) {
  background-color: #fff0f6;
}

/* あそびかたモーダルナビ */
.rules-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0;
}

.rules-indicators {
  display: flex;
  gap: 8px;
}

.rules-indicators .indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #dee2e6;
  cursor: pointer;
}

.rules-indicators .indicator.active {
  background-color: var(--btn-primary-bg);
}

.rules-modal-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
}

/* チュートリアル案内バナー */
.tutorial-guide-banner {
  background-color: #e8f4fd;
  border: 3px solid #228be6;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  animation: pulse-border 2s infinite;
}

.tutorial-guide-text {
  font-size: 20px;
  font-weight: bold;
  color: #1c7ed6;
  line-height: 1.5;
  text-align: center;
  margin: 0;
}

/* はじめの一歩吹き出し */
.first-step-guide {
  position: relative;
  max-width: 320px;
  margin: 8px auto;
  z-index: 10;
  animation: bounce-slow 2s infinite;
}

.guide-bubble {
  background-color: #fcc419;
  color: #332211;
  font-weight: bold;
  font-size: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* チュートリアル用点滅ハイライト */
.tutorial-highlight {
  animation: cell-glow 1s infinite alternate !important;
  border: 4px solid #fcc419 !important;
  z-index: 5;
}

.key-highlight {
  animation: key-glow 1s infinite alternate !important;
  box-shadow: 0 0 15px #fcc419 !important;
}

/* ヒント解説モーダル */
.hint-modal-content {
  border: 4px solid #fcc419;
  padding: 24px;
}

.hint-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  justify-content: center;
}

.hint-title-icon {
  font-size: 28px;
}

.hint-card {
  background-color: #fff9db;
  border: 1px solid #ffe066;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.hint-reason-text {
  font-size: 22px;
  font-weight: bold;
  color: #f59f00;
  line-height: 1.6;
  text-align: center;
  margin: 0;
}

.hint-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* アニメーション定義 */
@keyframes pulse-soft {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); background-color: #ffb3d1; }
  100% { transform: scale(1); }
}

@keyframes pulse-border {
  0% { border-color: #228be6; }
  50% { border-color: #74c0fc; }
  100% { border-color: #228be6; }
}

@keyframes bounce-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes cell-glow {
  0% { background-color: #fff3bf; }
  100% { background-color: #ffe066; }
}

@keyframes key-glow {
  0% { background-color: #ffec99; transform: scale(1); }
  100% { background-color: #fcc419; transform: scale(1.05); }
}

