/* OTHub 실행기능 과제 공통 스타일 — 아이보리·틸·블랙, 터치 타깃 64px 이상 */
:root {
  --ef-bg: #fbf8f1;
  --ef-card: #ffffff;
  --ef-ink: #111814;
  --ef-muted: #4a554f;
  --ef-line: #d9d3c4;
  --ef-teal: #0f5e63;
  --ef-teal-soft: #dcefee;
  --ef-good: #1d6b3f;
  --ef-good-soft: #e3f2ea;
  --ef-warn: #8a4b08;
  --ef-warn-soft: #fbeedd;
  --ef-r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--ef-bg);
  color: var(--ef-ink);
  font: 16px/1.6 "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  word-break: keep-all;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ef-app { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
.ef-screen[hidden] { display: none; }
h1 { margin: 0 0 8px; font-size: 32px; line-height: 1.25; }
h2 { margin: 0 0 8px; font-size: 24px; line-height: 1.3; }
p { margin: 0 0 16px; }
.ef-lead { color: var(--ef-muted); font-size: 20px; }

.ef-card { background: var(--ef-card); border: 1.5px solid var(--ef-line); border-radius: var(--ef-r); padding: 24px; }
.ef-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ef-stack > * + * { margin-top: 16px; }

.ef-btn {
  min-height: 64px; min-width: 64px; padding: 0 24px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--ef-ink); border-radius: var(--ef-r);
  background: var(--ef-card); color: var(--ef-ink);
  font: inherit; font-size: 20px; font-weight: 700; cursor: pointer;
  box-shadow: 0 3px 0 var(--ef-ink);
}
.ef-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ef-ink); }
.ef-btn-primary { background: var(--ef-teal); border-color: var(--ef-teal); color: #fff; box-shadow: 0 3px 0 #083a3d; }
.ef-btn-quiet { font-size: 16px; box-shadow: none; }
.ef-btn:focus-visible, .ef-choice:focus-visible { outline: 3px solid var(--ef-teal); outline-offset: 3px; }

/* 선택지 (모드·시작 레벨) */
.ef-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.ef-choice {
  min-height: 64px; padding: 12px 16px; text-align: left;
  border: 1.5px solid var(--ef-line); border-radius: var(--ef-r); background: var(--ef-card);
  font: inherit; color: inherit; cursor: pointer;
}
.ef-choice strong { display: block; font-size: 20px; }
.ef-choice span { color: var(--ef-muted); font-size: 14px; }
.ef-choice[aria-pressed="true"] { border-color: var(--ef-teal); background: var(--ef-teal-soft); box-shadow: inset 0 0 0 1.5px var(--ef-teal); }

/* 과제 화면: 도구 상세 페이지의 작은 틀(데스크톱 약 610×381) 안에서도 스크롤 없이
   자극과 반응 버튼이 함께 보이도록, 화면(틀) 높이 전체를 채우고 남는 공간에 자극을 맞춘다. */
.ef-full { position: fixed; inset: 0; z-index: 10; background: var(--ef-bg); padding: 8px 12px 10px; display: flex; flex-direction: column; }
.ef-full[hidden] { display: none; }
.ef-task { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.ef-status { flex: none; width: 100%; display: flex; align-items: center; gap: 12px; color: var(--ef-muted); }
.ef-task-title { margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ef-status .ef-dots { flex: 1; justify-content: center; }
.ef-btn-small { min-height: 48px; min-width: 48px; padding: 0 16px; font-size: 16px; box-shadow: none; }
.ef-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.ef-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--ef-line); }
.ef-dots i[data-done="true"] { background: var(--ef-teal); }
/* 자극 영역: 남는 공간 전체. 안의 정사각형은 가로·세로 중 짧은 쪽에 맞춘다 */
.ef-play { flex: 1; min-height: 0; min-width: 0; container-type: size; display: grid; place-items: center; }
.ef-stage {
  width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); display: grid; place-items: center;
  background: var(--ef-card); border: 1.5px solid var(--ef-line); border-radius: 16px; overflow: hidden;
}
.ef-controls { flex: none; display: grid; justify-items: center; align-content: center; gap: 6px; }
.ef-respond { min-height: 72px; width: min(420px, 100%); font-size: 28px; }
.ef-feedback { min-height: 24px; margin: 0; font-size: 18px; line-height: 24px; font-weight: 700; text-align: center; }
.ef-feedback[data-kind="good"] { color: var(--ef-good); }
.ef-feedback[data-kind="retry"] { color: var(--ef-warn); }
/* 가로로 넓고 낮은 틀: 자극은 왼쪽, 반응 버튼은 오른쪽 */
@media (min-aspect-ratio: 5/4) and (max-height: 720px) {
  .ef-task:not(.ef-task-stack) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 40%); grid-template-rows: auto minmax(0, 1fr); }
  .ef-task:not(.ef-task-stack) > .ef-status { grid-column: 1 / -1; }
}

/* 시작 버튼은 설명이 길어도 항상 화면 아래에 보이게 */
.ef-startbar { position: sticky; bottom: 0; z-index: 2; padding: 12px 0; margin-top: 8px; background: linear-gradient(rgba(251,248,241,0), var(--ef-bg) 24%); }
.ef-startbar .ef-btn { width: min(420px, 100%); }

/* 보상 */
.ef-stars { display: flex; gap: 8px; justify-content: center; font-size: 48px; line-height: 1; color: var(--ef-teal); }
.ef-stars span[data-on="false"] { opacity: .2; }

/* 치료사 보기 */
.ef-table-wrap { overflow-x: auto; }
table.ef-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ef-table th, .ef-table td { padding: 8px; border-bottom: 1px solid var(--ef-line); text-align: right; white-space: nowrap; }
.ef-table th:first-child, .ef-table td:first-child { text-align: left; }
.ef-note { color: var(--ef-muted); font-size: 14px; }
.ef-note-box { background: var(--ef-warn-soft); border-radius: 8px; padding: 12px 16px; font-size: 14px; }

@media (max-width: 560px), (max-height: 600px) {
  .ef-app { padding: 12px 12px 0; }
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  .ef-lead { font-size: 16px; }
  .ef-card { padding: 16px; }
  .ef-stack > * + * { margin-top: 12px; }
}

/* 시작 화면 시연: 예시가 하나씩 나타나고 정답이 강조되며 반복된다. 움직임 줄이기 설정이면 멈춘 그림 */
.ef-demo-wrap { display: grid; gap: 8px; }
.ef-demo-label { margin: 0; font-size: 14px; color: var(--ef-muted); }
@media (prefers-reduced-motion: no-preference) {
  .ef-demo > * { animation: ef-demo-step var(--demo-cycle, 6s) ease-in-out infinite both; animation-delay: calc(var(--i, 0) * var(--demo-step, 1.1s)); }
  .ef-demo .ef-demo-hit { animation: ef-demo-hit var(--demo-cycle, 6s) ease-in-out infinite both; animation-delay: calc(var(--i, 0) * var(--demo-step, 1.1s) + .4s); }
}
@keyframes ef-demo-step {
  0% { opacity: 0; transform: translateY(8px) scale(.94); }
  10%, 78% { opacity: 1; transform: none; }
  90%, 100% { opacity: 0; }
}
@keyframes ef-demo-hit {
  0%, 8% { box-shadow: 0 0 0 0 transparent; }
  14%, 34% { box-shadow: 0 0 0 4px var(--ef-teal); }
  44%, 100% { box-shadow: 0 0 0 0 transparent; }
}
