@charset "UTF-8";
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Hiragino Maru Gothic Pro', 'Hiragino Sans', 'BIZ UDPGothic', sans-serif;
    background: #FFF8F2; min-height: 100dvh; color: #3a2e28;
  }
  .screen { display: none; min-height: 100dvh; }
  .screen.active { display: flex; flex-direction: column; align-items: center; padding: 2rem 1rem; }
  #screen-loading { justify-content: center; }
  .loading-icon { font-size: 48px; animation: spin 1s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .page-title { font-size: 26px; font-weight: 700; color: #c05f8a; text-align: center; margin-bottom: 0.5rem; }
  .page-sub { font-size: 14px; color: #a07060; text-align: center; margin-bottom: 1.5rem; }

  /* ログイン */
  #screen-login { justify-content: center; }
  .login-card { background:#fff; border-radius:20px; border:2px solid #f4d0e4; padding:2.5rem 2rem; text-align:center; max-width:360px; width:100%; }
  .login-logo { font-size:56px; margin-bottom:1rem; }
  .login-title { font-size:22px; font-weight:700; color:#c05f8a; margin-bottom:0.5rem; }
  .login-desc { font-size:14px; color:#a07060; margin-bottom:2rem; line-height:1.6; }
  .google-btn { display:flex; align-items:center; justify-content:center; gap:10px; width:100%; padding:14px 20px; background:#fff; border:2px solid #e0c0d4; border-radius:999px; font-size:16px; font-family:inherit; font-weight:600; color:#3a2e28; cursor:pointer; transition:background 0.15s; }
  .google-btn:hover { background:#fef5fa; }

  /* 子供選択 */
  .child-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:16px; width:100%; max-width:400px; margin-bottom:1.5rem; }
  .child-card { background:#fff; border:2.5px solid #f4d0e4; border-radius:20px; padding:1.5rem 1rem; text-align:center; cursor:pointer; transition:transform 0.15s,border-color 0.15s,background 0.15s; border:none; font-family:inherit; }
  .child-card:hover { background:#fef5fa; border:2.5px solid #c05f8a; transform:translateY(-2px); }
  .child-card:active { transform:scale(0.96); }
  .child-emoji { font-size:48px; margin-bottom:0.5rem; }
  .child-name { font-size:18px; font-weight:700; color:#c05f8a; }
  .child-age { font-size:13px; color:#a07060; margin-top:4px; }
  .add-child-btn { background:#fff; border:2px dashed #e0c0d4; border-radius:20px; padding:1.5rem 1rem; text-align:center; cursor:pointer; transition:background 0.15s; color:#c05f8a; font-size:14px; font-family:inherit; width:100%; }
  .add-child-btn:hover { background:#fef5fa; }
  .add-child-btn .plus { font-size:28px; display:block; margin-bottom:4px; }

  /* 迷路 */
  .maze-header { width:100%; max-width:480px; display:flex; align-items:center; justify-content:space-between; margin-bottom:1rem; }
  .back-btn { padding:8px 14px; border-radius:999px; border:1.5px solid #e0c0d4; background:#fff; color:#c05f8a; font-size:13px; font-family:inherit; font-weight:600; cursor:pointer; }
  .back-btn:hover { background:#fef5fa; }
  .maze-child-name { font-size:16px; font-weight:700; color:#c05f8a; }
  .diff-group { display:flex; gap:8px; justify-content:center; margin-bottom:1rem; flex-wrap:wrap; }
  .diff-btn { padding:10px 18px; border-radius:999px; border:2.5px solid #e8c8d8; background:#fff; color:#c05f8a; font-size:14px; font-family:inherit; font-weight:600; cursor:pointer; }
  .diff-btn.active { background:#c05f8a; border-color:#c05f8a; color:#fff; }
  .maze-container { display:flex; justify-content:center; margin-bottom:1rem; }
  canvas { border-radius:16px; border:3px solid #e8c8d8; background:#fff; touch-action:none; display:block; max-width:100%; }
  .status-area { text-align:center; min-height:40px; margin-bottom:0.75rem; }
  .status-text { font-size:16px; color:#a07060; }
  .status-clear { font-size:22px; font-weight:700; color:#c05f8a; animation:popIn 0.4s cubic-bezier(0.34,1.56,0.64,1); }
  @keyframes popIn { 0%{transform:scale(0.5);opacity:0} 100%{transform:scale(1);opacity:1} }
  .confetti { position:fixed; top:-10px; font-size:20px; pointer-events:none; animation:fall linear forwards; z-index:999; }
  @keyframes fall { to{transform:translateY(110vh) rotate(720deg);opacity:0} }
  .action-area { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }
  .action-btn { padding:12px 24px; border-radius:999px; border:2.5px solid #e8c8d8; background:#fff; color:#c05f8a; font-size:15px; font-family:inherit; font-weight:600; cursor:pointer; }
  .action-btn:hover { background:#fef0f6; }
  .action-btn.primary { background:#f9d8eb; border-color:#c05f8a; }
  .seal-area { margin-top:1rem; text-align:center; }
  .seal-title { font-size:13px; color:#a07060; margin-bottom:6px; }
  .seal-list { display:flex; gap:6px; justify-content:center; flex-wrap:wrap; font-size:24px; }

  /* 管理 */
  .admin-section { width:100%; max-width:400px; margin-bottom:1.5rem; }
  .admin-section-title { font-size:15px; font-weight:700; color:#a07060; margin-bottom:10px; border-bottom:1.5px solid #f4d0e4; padding-bottom:6px; }
  .child-row { display:flex; align-items:center; gap:12px; background:#fff; border:1.5px solid #f4d0e4; border-radius:12px; padding:12px 16px; margin-bottom:8px; }
  .child-row-emoji { font-size:28px; }
  .child-row-info { flex:1; }
  .child-row-name { font-size:16px; font-weight:700; color:#3a2e28; }
  .child-row-age { font-size:12px; color:#a07060; }
  .row-btn { padding:6px 12px; border-radius:999px; border:1.5px solid #e0c0d4; background:#fff; color:#c05f8a; font-size:12px; font-family:inherit; font-weight:600; cursor:pointer; }
  .row-btn.danger { color:#d84040; border-color:#f4b0b0; }
  .row-btn.on { color:#2e8f5e; border-color:#9adcbb; background:#eefaf3; }

  /* いえづくり */
  .hcell { border-radius:4px; box-sizing:border-box; }
  .hcell.todo { background:#fff; border:1.5px dashed #e4cddc; cursor:pointer; }
  .hcell.blank { background:transparent; border:1.5px solid transparent; }
  .block-btn { display:inline-flex; align-items:center; gap:6px; padding:7px 13px; border-radius:999px;
               border:2px solid #e0c0d4; background:#fff; font-family:inherit; font-size:13px;
               font-weight:700; color:#a07060; cursor:pointer; }
  .block-btn.active { border-color:#c05f8a; background:#fdf0f7; color:#c05f8a; }
  .block-swatch { width:16px; height:16px; border-radius:4px; border:1px solid rgba(0,0,0,0.18); }
  .house-step-card { background:#fff; border:2.5px solid #e8c8d8; border-radius:14px; padding:8px 8px 6px;
                     display:flex; flex-direction:column; align-items:center; gap:4px; cursor:pointer;
                     transition:transform .15s, background .15s, border-color .15s; }
  .house-step-label { font-size:13px; font-weight:700; color:#a07060; }

  /* 読み上げできる要素（タップで聞き直し） */
  .speakable { cursor:pointer; -webkit-tap-highlight-color:rgba(192,95,138,0.15); }
  .speakable::after { content:' 🔊'; font-size:0.7em; opacity:0.4; vertical-align:middle; }
  .speakable:active { opacity:0.6; }
  body.speech-off .speakable { cursor:default; }
  body.speech-off .speakable::after { content:''; }

  /* モーダル */
  .modal-overlay { display:none; position:fixed; inset:0; background:rgba(60,30,40,0.35); z-index:100; align-items:center; justify-content:center; padding:1rem; }
  .modal-overlay.open { display:flex; }
  .modal { background:#fff; border-radius:20px; padding:2rem 1.5rem; max-width:360px; width:100%; border:2px solid #f4d0e4; }
  .modal-title { font-size:18px; font-weight:700; color:#c05f8a; margin-bottom:1.25rem; }
  .form-group { margin-bottom:1rem; }
  .form-label { font-size:13px; color:#a07060; display:block; margin-bottom:6px; font-weight:600; }
  .form-input { width:100%; padding:10px 14px; border-radius:10px; border:1.5px solid #e0c0d4; font-size:16px; font-family:inherit; background:#fff; color:#3a2e28; }
  .form-input:focus { outline:none; border-color:#c05f8a; }
  .emoji-grid { display:flex; gap:8px; flex-wrap:wrap; }
  .emoji-opt { font-size:28px; cursor:pointer; padding:6px; border-radius:8px; border:2px solid transparent; }
  .emoji-opt.selected { border-color:#c05f8a; background:#fef0f6; }
  .modal-actions { display:flex; gap:8px; margin-top:1.25rem; }
  .modal-btn { flex:1; padding:12px; border-radius:999px; border:1.5px solid #e0c0d4; font-size:15px; font-family:inherit; font-weight:600; cursor:pointer; background:#fff; color:#c05f8a; }
  .modal-btn.primary { background:#c05f8a; border-color:#c05f8a; color:#fff; }

  /* クリアオーバーレイ */
  #clear-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 240, 250, 0.85);
    z-index: 200;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
  }
  #clear-overlay.show { display: flex; }
  .clear-icon {
    font-size: 80px;
    animation: bounce 0.5s cubic-bezier(0.34, 1.8, 0.64, 1) forwards;
  }
  @keyframes bounce {
    0%   { transform: scale(0) translateY(40px); opacity: 0; }
    60%  { transform: scale(1.2) translateY(-20px); opacity: 1; }
    80%  { transform: scale(0.95) translateY(5px); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
  }
  .clear-bounce-loop {
    animation: bounceLoop 0.7s ease-in-out infinite alternate;
  }
  @keyframes bounceLoop {
    from { transform: translateY(0); }
    to   { transform: translateY(-18px); }
  }
  .clear-text {
    font-size: 36px;
    font-weight: 700;
    color: #c05f8a;
    animation: popIn 0.4s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }
  .clear-sub {
    font-size: 18px;
    color: #a07060;
    animation: popIn 0.4s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }
  .clear-seal {
    font-size: 48px;
    animation: popIn 0.5s 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }
  .clear-next-btn {
    margin-top: 8px;
    padding: 14px 36px;
    border-radius: 999px;
    border: none;
    background: #c05f8a;
    color: #fff;
    font-size: 18px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    animation: popIn 0.4s 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    box-shadow: 0 4px 16px rgba(192, 95, 138, 0.35);
  }
  .clear-next-btn:active { transform: scale(0.96); }

  /* PDFボタン */
  .pdf-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 0;
    border-radius: 999px;
    border: 2px solid #c05f8a;
    background: #fff;
    color: #c05f8a;
    font-size: 16px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
  }
  .pdf-btn:active { background: #fff0f7; }
  .pdf-btn:disabled { opacity: 0.5; cursor: not-allowed; }

  /* シールコレクション画面 */
  .seal-screen-header { text-align:center; padding: 24px 16px 8px; }
  .seal-screen-icon { font-size: 56px; margin-bottom: 4px; }
  .seal-screen-name { font-size: 20px; font-weight: 700; color: #c05f8a; }
  .seal-total {
    margin: 8px auto 20px;
    display: inline-block;
    background: #fff0f7;
    border: 2px solid #f4d0e4;
    border-radius: 999px;
    padding: 8px 24px;
    font-size: 18px;
    font-weight: 700;
    color: #c05f8a;
  }
  .seal-collection-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 0 16px 16px;
    max-width: 480px;
    margin: 0 auto;
  }
  .seal-cell {
    aspect-ratio: 1;
    background: #fff8fb;
    border: 2px solid #f4d0e4;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    animation: sealPop 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
  }
  @keyframes sealPop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
  }
  .seal-empty {
    text-align: center;
    color: #c8a0b8;
    font-size: 15px;
    padding: 40px 16px;
    line-height: 2;
  }
  .seal-empty-icon { font-size: 48px; display: block; margin-bottom: 8px; }

  /* 図形ドリル */
  .shape-select-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 1.5rem;
  }
  .shape-card {
    background: #fff;
    border: 2.5px solid #f4d0e4;
    border-radius: 20px;
    padding: 1.5rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    font-family: inherit;
  }
  .shape-card:hover { background: #fef5fa; border-color: #c05f8a; transform: translateY(-2px); }
  .shape-card:active { transform: scale(0.96); }
  .shape-card-icon { font-size: 40px; margin-bottom: 0.5rem; }
  .shape-card-name { font-size: 16px; font-weight: 700; color: #c05f8a; }

  .shape-drill-area {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .shape-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
  }
  .shape-guide {
    font-size: 15px;
    color: #a07060;
    text-align: center;
    margin-bottom: 4px;
  }
  #shape-canvas {
    border-radius: 20px;
    border: 3px solid #e8c8d8;
    background: #fff;
    touch-action: none;
    display: block;
    max-width: 100%;
  }
  .shape-progress-bar {
    width: 100%;
    height: 16px;
    background: #f4d0e4;
    border-radius: 999px;
    overflow: hidden;
    margin: 4px 0;
  }
  .shape-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c05f8a, #f9a8d4);
    border-radius: 999px;
    transition: width 0.2s ease;
  }
  .shape-progress-label {
    font-size: 13px;
    color: #a07060;
    text-align: center;
  }
  .shape-action-area {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 4px;
  }

  /* ひらがなドリル */
  .hira-select-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 1.5rem;
  }
  .hira-card {
    background: #fff;
    border: 2.5px solid #f4d0e4;
    border-radius: 20px;
    padding: 1.2rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    font-family: inherit;
  }
  .hira-card:hover { background: #fef5fa; border-color: #c05f8a; transform: translateY(-2px); }
  .hira-card:active { transform: scale(0.96); }
  .hira-card-char { font-size: 42px; font-weight: 700; color: #c05f8a; margin-bottom: 0.3rem; }
  .hira-card-name { font-size: 13px; font-weight: 700; color: #a07060; }

  /* すうじドリル */
  .num-select-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 1.5rem;
  }
  .num-card {
    background: #fff;
    border: 2.5px solid #f4d0e4;
    border-radius: 20px;
    padding: 1rem 0.25rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    font-family: inherit;
  }
  .num-card:hover { background: #fef5fa; border-color: #c05f8a; transform: translateY(-2px); }
  .num-card:active { transform: scale(0.96); }
  .num-card-char { font-size: 36px; font-weight: 700; color: #c05f8a; margin-bottom: 0.2rem; }
  .num-card-name { font-size: 11px; font-weight: 700; color: #a07060; }

  /* ナビ */
  .nav-bar { position:fixed; bottom:0; left:0; right:0; background:#fff; border-top:1.5px solid #f4d0e4; display:none; justify-content:space-around; padding:8px 0 max(8px,env(safe-area-inset-bottom)); z-index:50; }
  .nav-bar.visible { display:flex; }
  .nav-item { display:flex; flex-direction:column; align-items:center; gap:2px; padding:6px 12px; border-radius:12px; cursor:pointer; border:none; background:none; font-family:inherit; color:#a07060; font-size:11px; }
  .nav-item.active { color:#c05f8a; }
  .nav-item span { font-size:22px; }
  .spacer-nav { height:70px; }
