/* 앱 설치(pwa-install.js): 머리말 '앱 설치' 버튼, 로그인 뒤 안내 카드, 설치 안내 창, 설치 완료 알림. */

/* 머리말: '글자 크기' 다음, '사용법' 앞 */
body.curriculum-app .app-utilities .app-install-btn {
  display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 4px 12px;
  font: inherit; font-size: calc(13px * var(--reading-scale, 1)); font-weight: 800; color: #fff;
  background: #2f8f55; border: 2px solid #3a3f62; border-radius: 15px 225px 15px 255px / 255px 15px 225px 15px; cursor: pointer;
}
body.curriculum-app .app-utilities .app-install-btn:hover { background: #287c4a; box-shadow: 2px 3px 0 #3a3f62; }
body.curriculum-app .app-utilities .app-install-btn:focus-visible { outline: 3px dashed #7d6bc7; outline-offset: 3px; }
body.curriculum-app .app-utilities .app-install-btn.hidden { display: none; }

/* 로그인 뒤 안내 카드 */
body.curriculum-app .install-hint {
  display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; padding: 12px 14px;
  color: #2c3566; background: #fffdf8; border: 2px solid #3a3f62;
  border-radius: 14px 6px 12px 7px / 7px 12px 6px 14px; box-shadow: 3px 4px 0 rgb(44 53 102 / 14%);
}
body.curriculum-app .install-hint.hidden { display: none; }
body.curriculum-app .install-hint-icon {
  flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; color: #fff;
  background: #2f8f55; border: 2px solid #3a3f62; border-radius: 50%;
}
body.curriculum-app .install-hint-text {
  flex: 1 1 auto; min-width: 0; margin: 0; font-size: calc(15px * var(--reading-scale, 1)); font-weight: 700; line-height: 1.5; word-break: keep-all;
}
body.curriculum-app .install-hint-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
body.curriculum-app .install-hint-actions button {
  min-height: 40px; padding: 4px 14px; font: inherit; font-size: calc(14px * var(--reading-scale, 1)); font-weight: 800; cursor: pointer;
  border: 2px solid #3a3f62; border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; white-space: nowrap;
}
body.curriculum-app .install-hint-primary { color: #fff; background: #2f8f55; box-shadow: 2px 3px 0 #3a3f62; }
body.curriculum-app .install-hint-primary:hover { background: #287c4a; }
body.curriculum-app .install-hint-close { color: #3a3f62; background: #fff; }
body.curriculum-app .install-hint-close:hover { background: #fff8e6; }
body.curriculum-app .install-hint-actions button:focus-visible { outline: 3px dashed #7d6bc7; outline-offset: 3px; }

/* 설치 안내 창(iPhone·iPad·Mac Safari·앱 안의 브라우저) */
body.install-open { overflow: hidden; }
body #installModal { z-index: 60; padding: 16px; background: rgb(28 30 52 / 52%); }
body #installModal.hidden { display: none; }
body #installModal .install-panel {
  box-sizing: border-box; width: min(520px, 100%); max-height: calc(100dvh - 32px); padding: 0; overflow: auto;
  color: #2c3566; background: #fffdf8; border: 2px solid #3a3f62; border-radius: 14px 6px 12px 7px / 7px 12px 6px 14px;
  box-shadow: 4px 6px 0 rgb(44 53 102 / 18%);
}
body #installModal .install-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px;
  color: #2c3566; background: #fff7df; border-bottom: 2px dashed #e2d3a6;
  font-size: calc(18px * var(--reading-scale, 1)); line-height: 1.35;
}
body #installModal .install-head strong { min-width: 0; word-break: keep-all; }
body #installModal .install-head .btn {
  flex: 0 0 auto; width: auto; min-height: 36px; padding: 2px 14px; font-size: 14px; font-weight: 800;
  color: #fff !important; background: #e0533d !important; border: 2px solid #3a3f62 !important;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; box-shadow: 2px 3px 0 #3a3f62;
}
body #installModal .install-body { padding: 16px 18px 20px; font-size: calc(16px * var(--reading-scale, 1)); line-height: 1.65; word-break: keep-all; }
body #installModal .install-body p { margin: 0 0 12px; }
body #installModal .install-lead { font-weight: 700; }
body #installModal .install-note { color: #6b6f86; font-size: calc(14px * var(--reading-scale, 1)); }
body #installModal .install-steps { margin: 0 0 14px; padding: 0; list-style: none; counter-reset: install-step; }
body #installModal .install-steps li {
  position: relative; display: flex; align-items: flex-start; gap: 8px; margin: 0 0 10px; padding: 10px 12px 10px 44px;
  background: #fff; border: 2px solid #e2d9c4; border-radius: 10px; counter-increment: install-step;
}
body #installModal .install-steps li::before {
  content: counter(install-step); position: absolute; left: 10px; top: 10px; display: grid; place-items: center; width: 24px; height: 24px;
  font-size: 14px; font-weight: 800; color: #fff; background: #2c3566; border-radius: 50%;
}
body #installModal .install-share-icon { flex: 0 0 auto; margin-top: 3px; color: #1d6fe0; }
body #installModal .install-actions { margin: 4px 0 12px; }
body #installModal .install-open-browser {
  display: inline-flex; align-items: center; min-height: 44px; padding: 6px 18px; font-weight: 800; color: #fff; text-decoration: none;
  background: #2f8f55; border: 2px solid #3a3f62; border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; box-shadow: 2px 3px 0 #3a3f62;
}
body #installModal .install-copy { margin-top: 6px; padding-top: 12px; border-top: 1px dashed #e2d3a6; }
body #installModal .install-copy label { display: block; margin-bottom: 6px; font-size: calc(14px * var(--reading-scale, 1)); font-weight: 700; color: #4b4f6e; }
body #installModal .install-copy-row { display: flex; gap: 8px; }
body #installModal .install-copy-row input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 10px; font: inherit; font-size: 14px; color: #2c3566;
  background: #fff; border: 2px solid #d7cdb5; border-radius: 8px;
}
body #installModal .install-copy-row button {
  flex: 0 0 auto; min-height: 44px; padding: 4px 14px; font: inherit; font-size: 14px; font-weight: 800; color: #3a3f62; cursor: pointer;
  background: #fff; border: 2px solid #3a3f62; border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}
body #installModal .install-copy-status { min-height: 1.4em; margin: 6px 0 0; font-size: 14px; color: #2f8f55; font-weight: 700; }
body #installModal :is(a, button, input):focus-visible { outline: 3px dashed #7d6bc7; outline-offset: 2px; }

/* 설치 완료 알림 */
body .install-toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 70; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); padding: 10px 16px; font-size: 15px; font-weight: 700; line-height: 1.5;
  color: #fff; background: #2c3566; border: 2px solid #3a3f62; border-radius: 12px; box-shadow: 3px 4px 0 rgb(44 53 102 / 25%);
}
body .install-toast.hidden { display: none; }

@media (max-width: 640px) {
  body.curriculum-app .app-utilities .app-install-btn { padding: 2px 10px; }
  body.curriculum-app .install-hint { flex-wrap: wrap; gap: 10px; padding: 12px; }
  body.curriculum-app .install-hint-text { flex-basis: calc(100% - 50px); }
  body.curriculum-app .install-hint-actions { width: 100%; justify-content: flex-end; }
  body #installModal { padding: 0; align-items: end; }
  body #installModal .install-panel { width: 100%; max-height: 92dvh; border-width: 2px 0 0; border-radius: 16px 16px 0 0; }
  body #installModal .install-head { padding: 10px 14px; font-size: 17px; }
  body #installModal .install-body { padding: 14px 14px calc(18px + env(safe-area-inset-bottom)); }
}
