yellowmug commited on
Commit
db94edb
·
verified ·
1 Parent(s): d3d504c

Upload 4 files

Browse files
Files changed (4) hide show
  1. Dockerfile +1 -1
  2. app.js +392 -0
  3. index.html +263 -17
  4. styles.css +142 -0
Dockerfile CHANGED
@@ -27,7 +27,7 @@ AutoModelForSequenceClassification.from_pretrained(m, revision=r, use_safetensor
27
 
28
  COPY --chown=user server.py coach_agent.py rag.py llm.py \
29
  feedback_db.py healing_knowledge.py memory_db.py ./
30
- COPY --chown=user dist ./dist
31
 
32
  # SQLite 저장 경로. Space 재시작 시 초기화되므로 수집 즉시 집계를 내려받는다.
33
  ENV MINDILY_FEEDBACK_DB=/home/user/app/data/feedback.sqlite3 \
 
27
 
28
  COPY --chown=user server.py coach_agent.py rag.py llm.py \
29
  feedback_db.py healing_knowledge.py memory_db.py ./
30
+ COPY --chown=user index.html app.js styles.css ./dist/
31
 
32
  # SQLite 저장 경로. Space 재시작 시 초기화되므로 수집 즉시 집계를 내려받는다.
33
  ENV MINDILY_FEEDBACK_DB=/home/user/app/data/feedback.sqlite3 \
app.js ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const screens = [...document.querySelectorAll('.screen')];
2
+ const navButtons = [...document.querySelectorAll('.bottom-nav [data-go]')];
3
+ const backButton = document.querySelector('.back-button');
4
+ const miniBrand = document.querySelector('.mini-brand');
5
+ const screenTitle = document.querySelector('.screen-title');
6
+ const titles = { home: '', diary: '감정 일기', analysis: 'AI 감정 분석', coach: '맞춤형 힐링 코치', chat: '마음 친구', records: '나의 마음 기록' };
7
+ let currentScreen = 'home';
8
+ let historyStack = ['home'];
9
+ let selectedTags = [];
10
+ let selectedMood = { name: '걱정되는', color: '#ec846f' };
11
+ let lastAnalysis = null;
12
+ let missionTimer = null;
13
+ let breathTimer = null;
14
+ let memoryToken = null;
15
+ try { memoryToken = localStorage.getItem('mindily-memory-token'); } catch (_) {}
16
+
17
+ const escapeHtml = (value) => String(value).replace(/[&<>'"]/g, (char) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', "'": '&#39;', '"': '&quot;' }[char]));
18
+
19
+ function showScreen(name, push = true) {
20
+ if (!titles.hasOwnProperty(name)) return;
21
+ screens.forEach((screen) => screen.classList.toggle('active', screen.dataset.screen === name));
22
+ navButtons.forEach((button) => button.classList.toggle('active', button.dataset.go === (name === 'analysis' || name === 'chat' ? (name === 'analysis' ? 'diary' : 'coach') : name)));
23
+ currentScreen = name;
24
+ if (push && historyStack.at(-1) !== name) historyStack.push(name);
25
+ const isHome = name === 'home';
26
+ miniBrand.hidden = !isHome;
27
+ screenTitle.hidden = isHome;
28
+ screenTitle.textContent = titles[name];
29
+ backButton.hidden = isHome || ['diary', 'coach', 'records'].includes(name);
30
+ document.querySelector(`[data-screen="${name}"]`).scrollTop = 0;
31
+ }
32
+
33
+ document.addEventListener('click', (event) => {
34
+ const go = event.target.closest('[data-go]');
35
+ if (go) showScreen(go.dataset.go);
36
+ const opener = event.target.closest('[data-open-dialog]');
37
+ if (opener) document.getElementById(opener.dataset.openDialog)?.showModal();
38
+ const closer = event.target.closest('[data-close-dialog]');
39
+ if (closer) document.getElementById(closer.dataset.closeDialog)?.close();
40
+ const toastTarget = event.target.closest('[data-toast]');
41
+ if (toastTarget) toast(toastTarget.dataset.toast);
42
+ if (event.target.closest('[data-start-breath]')) startBreathing();
43
+ });
44
+
45
+ document.getElementById('feedback-form').addEventListener('submit', async (event) => {
46
+ event.preventDefault();
47
+ const satisfaction = document.querySelector('input[name="satisfaction"]:checked')?.value;
48
+ const consent = document.getElementById('feedback-consent').checked;
49
+ if (!satisfaction || !consent) { toast('만족도와 익명 제출 동의를 확인해주세요.'); return; }
50
+ const button = event.currentTarget.querySelector('[type="submit"]');
51
+ if (button.disabled) return;
52
+ button.disabled = true;
53
+ const payload = { card_id: 'session-exit', satisfaction: Number(satisfaction),
54
+ comment: document.getElementById('feedback-comment').value.trim() || null, consent: true };
55
+ try {
56
+ const response = await fetch('/api/feedback', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(payload) });
57
+ if (!response.ok) throw new Error('feedback');
58
+ const result = await response.json();
59
+ if (!result.saved) throw new Error('not saved');
60
+ document.getElementById('feedback-dialog').close();
61
+ document.getElementById('feedback-form').reset();
62
+ toast('만족도를 저장했어요. 고마워요.');
63
+ } catch (error) { toast('저장하지 못했어요. 입력을 보관 중이니 다시 시도해주세요.'); }
64
+ finally { button.disabled = false; }
65
+ });
66
+
67
+ backButton.addEventListener('click', () => {
68
+ historyStack.pop();
69
+ showScreen(historyStack.at(-1) || 'home', false);
70
+ });
71
+
72
+ const now = new Date();
73
+ document.getElementById('today-date').textContent = new Intl.DateTimeFormat('ko-KR', { month: 'long', day: 'numeric', weekday: 'long' }).format(now);
74
+
75
+ const diaryText = document.getElementById('diary-text');
76
+ diaryText.addEventListener('input', () => document.getElementById('char-count').textContent = diaryText.value.length);
77
+
78
+ document.getElementById('emotion-tags').addEventListener('click', (event) => {
79
+ const button = event.target.closest('[data-tag]');
80
+ if (!button) return;
81
+ button.classList.toggle('selected');
82
+ selectedTags = [...document.querySelectorAll('[data-tag].selected')].map((item) => item.dataset.tag);
83
+ });
84
+
85
+ const emotionMeta = {
86
+ 불안: ['😰', '걱정되는'], 슬픔: ['😔', '지친'], 분노: ['😣', '답답한'], 기쁨: ['🙂', '기분 좋은'], 상처: ['🥺', '외로운'], 당황: ['😯', '초조한']
87
+ };
88
+
89
+ async function analyzeDiary(text, stress) {
90
+ const response = await fetch('/api/agent/coach', {
91
+ method: 'POST', headers: {'Content-Type': 'application/json'},
92
+ body: JSON.stringify({text, self_reported_stress: stress, context: 'diary', memory_token: memoryToken}),
93
+ signal: AbortSignal.timeout(60000)
94
+ });
95
+ if (!response.ok) throw new Error('지금은 분석할 수 없어요. 잠시 후 다시 시도해주세요.');
96
+ const data = await response.json();
97
+ const analysis = data.analysis;
98
+ return {id: crypto.randomUUID(), ranked: analysis.labels.map(x => ({name:x.name, score:x.score})),
99
+ model: analysis.model, revision: analysis.revision, chunks: analysis.chunks,
100
+ agentMessage: data.message, recommendation: data.recommendation,
101
+ stress, text, tags: [...selectedTags], date: new Date().toISOString(),
102
+ detailedMood: null, confirmedMood: null};
103
+ }
104
+
105
+ document.getElementById('diary-form').addEventListener('submit', async (event) => {
106
+ event.preventDefault();
107
+ const text = diaryText.value.trim();
108
+ if (!text) return toast('마음을 한 문장으로 들려주세요.');
109
+ const stress = Number(new FormData(event.currentTarget).get('stress'));
110
+ const button = event.currentTarget.querySelector('[type="submit"]');
111
+ if (button.disabled) return;
112
+ button.disabled = true; button.textContent = '마음을 읽고 있어요…';
113
+ try {
114
+ lastAnalysis = await analyzeDiary(text, stress);
115
+ selectedMood = {name:'직접 골라주세요', color:'#b7bfce'};
116
+ document.querySelectorAll('[data-mood]').forEach(x => x.classList.remove('selected'));
117
+ renderAnalysis(); saveEntry(lastAnalysis); showScreen('analysis');
118
+ } catch (error) {
119
+ toast(error.name === 'TimeoutError' ? '분석 시간이 길어졌어요. 글은 그대로 있으니 다시 시도해주세요.' : '분석 서버에 연결하지 못했어요. 글은 그대로 보관 중이에요.');
120
+ } finally { button.disabled = false; button.textContent = 'AI에게 마음 맡기기 ✨'; }
121
+ });
122
+
123
+ function renderAnalysis() {
124
+ const top = lastAnalysis.ranked.slice(0, 3);
125
+ document.getElementById('emotion-result').innerHTML = top.map((item) => `<div class="emotion-pill"><span aria-hidden="true">${emotionMeta[item.name][0]}</span><strong>${item.name}</strong><small>분류 점수 ${item.score.toFixed(3)}</small></div>`).join('');
126
+ const level = lastAnalysis.stress >= 4 ? '높은' : lastAnalysis.stress === 3 ? '조금 높은' : '낮은';
127
+ document.getElementById('analysis-summary').textContent = `직접 기록한 스트레스 ${lastAnalysis.stress}/5`;
128
+ document.getElementById('analysis-meter').style.width = `${lastAnalysis.stress * 20}%`;
129
+ const lead = top[0].name;
130
+ const messages = {
131
+ 불안: '앞으로 일어날 일을 계속 대비하느라 마음이 쉬지 못한 것 같아요. 지금 당장 정답을 찾지 않아도 괜찮아요.',
132
+ 슬픔: '오늘은 에너지가 많이 소모된 날이었나 봐요. 감정을 서둘러 바꾸기보다 잠시 곁에 있어볼게요.',
133
+ 분노: '중요하게 여기는 것이 지켜지지 않아 답답함이 커진 것 같아요. 그 마음에는 이유가 있어요.',
134
+ 기쁨: '마음이 환해지는 순간이 있었군요. 그 장면을 천천히 기억해두어도 좋겠어요.',
135
+ 상처: '관계 속에서 마음이 다친 흔적이 보여요. 그 서운함을 사소하게 여기지 않아도 괜찮아요.',
136
+ 당황: '예상하지 못한 일이 마음의 리듬을 흔든 것 같아요. 천천히 상황을 다시 정리해봐요.'
137
+ };
138
+ document.getElementById('analysis-message').textContent = lastAnalysis.agentMessage || messages[lead];
139
+ updateMoodUI();
140
+ updateRecordUI(lastAnalysis);
141
+ loadHealingRecommendations();
142
+ }
143
+
144
+ async function loadHealingRecommendations() {
145
+ if (!lastAnalysis) return;
146
+ try {
147
+ let data = lastAnalysis.recommendation;
148
+ if (!data) {
149
+ const response = await fetch('/api/healing/recommend', {
150
+ method: 'POST', headers: {'Content-Type': 'application/json'},
151
+ body: JSON.stringify({emotion: lastAnalysis.ranked[0].name, stress: lastAnalysis.stress, minutes: 20,
152
+ allow_location: false, memory_token: memoryToken})
153
+ });
154
+ if (!response.ok) throw new Error('recommendation');
155
+ data = await response.json();
156
+ }
157
+ const list = document.querySelector('.recommend-list');
158
+ list.innerHTML = data.cards.slice(0, 8).map((card, index) => `<article class="card recommendation ${index === 0 ? 'featured' : ''}">
159
+ <div class="rec-icon ${index % 2 ? 'blue' : 'mint'}" aria-hidden="true">${card.kind === '음악' ? '♫' : card.kind === '필사' ? '✎' : card.kind === '꽃·나무' ? '🌿' : card.kind === '취미' ? '✦' : card.kind === '감각활동' ? '◌' : '🌱'}</div>
160
+ <div><span class="soft-chip">${index === 0 ? '1순위 추천' : escapeHtml(card.kind)}</span><h3>${escapeHtml(card.title)}</h3><p>${escapeHtml(card.description)}</p></div>
161
+ ${card.id === 'breathing-1m' ? '<button class="secondary-button" type="button" data-start-breath>1분 시작하기</button>' : ''}
162
+ ${card.source_url?.startsWith('https://') ? `<a class="secondary-button" href="${escapeHtml(card.source_url)}" target="_blank" rel="noopener noreferrer" aria-label="${escapeHtml(card.source_title)} 자료 새 창에서 보기">${escapeHtml(card.source_title)} ↗</a>` : ''}
163
+ </article>`).join('');
164
+ } catch (_) {
165
+ // 기본 정적 추천 카드는 API 오류에도 ��대로 사용할 수 있다.
166
+ }
167
+ }
168
+
169
+ const organizerKey = 'mindily-thoughts';
170
+ const organizerFields = ['event', 'feeling', 'need'];
171
+ function hydrateOrganizer() {
172
+ try {
173
+ const saved = JSON.parse(localStorage.getItem(organizerKey) || 'null');
174
+ if (!saved) return;
175
+ organizerFields.forEach((name) => { document.getElementById(`organize-${name}`).value = saved[name] || ''; });
176
+ document.getElementById('organize-status').textContent = '이 브라우저에 저장된 내용을 다시 볼 수 있어요.';
177
+ } catch (_) {}
178
+ }
179
+
180
+ document.getElementById('organize-form').addEventListener('submit', (event) => {
181
+ event.preventDefault();
182
+ const values = Object.fromEntries(organizerFields.map((name) =>
183
+ [name, document.getElementById(`organize-${name}`).value.trim()]));
184
+ if (!Object.values(values).some(Boolean)) return toast('한 칸 이상 적어주세요.');
185
+ try {
186
+ localStorage.setItem(organizerKey, JSON.stringify({...values, saved_at: new Date().toISOString()}));
187
+ document.getElementById('organize-status').textContent = '이 브라우저에 저장했어요.';
188
+ document.getElementById('organize-dialog').close();
189
+ toast('마음을 정리한 내용을 이 브라우저에 저장했어요.');
190
+ } catch (_) { toast('이 브라우저에 저장할 수 없어요. 저장 설정을 확인해주세요.'); }
191
+ });
192
+
193
+ document.getElementById('delete-organized-thoughts').addEventListener('click', () => {
194
+ if (!window.confirm('이 브라우저에 저장한 감정 정리 내용을 삭제할까요? 복구할 수 없어요.')) return;
195
+ try {
196
+ localStorage.removeItem(organizerKey);
197
+ document.getElementById('organize-form').reset();
198
+ document.getElementById('organize-status').textContent = '저장된 정리 내용이 없어요.';
199
+ toast('정리 내용을 삭제했어요.');
200
+ } catch (_) { toast('정리 내용을 삭제하지 못했어요.'); }
201
+ });
202
+
203
+ document.getElementById('save-memory').addEventListener('click', async () => {
204
+ if (!document.getElementById('memory-consent').checked) return toast('기억 저장 동의를 먼저 확인해주세요.');
205
+ const token = memoryToken || [...crypto.getRandomValues(new Uint8Array(32))].map(x => x.toString(16).padStart(2, '0')).join('');
206
+ const preferred_kind = document.getElementById('preferred-kind').value;
207
+ try {
208
+ const response = await fetch('/api/memory', {method: 'POST', headers: {'Content-Type': 'application/json'},
209
+ body: JSON.stringify({token, preferred_kind, consent: true})});
210
+ if (!response.ok) throw new Error('memory');
211
+ localStorage.setItem('mindily-memory-token', token);
212
+ memoryToken = token;
213
+ document.getElementById('memory-status').textContent = `${preferred_kind} 활동을 기억했어요.`;
214
+ if (lastAnalysis) lastAnalysis.recommendation = null;
215
+ loadHealingRecommendations();
216
+ } catch (_) { toast('선호를 저장하지 못했어요. 다시 시도해주세요.'); }
217
+ });
218
+
219
+ document.getElementById('delete-memory').addEventListener('click', async () => {
220
+ if (!memoryToken) return toast('저장된 선호가 없어요.');
221
+ try {
222
+ const response = await fetch('/api/memory/delete', {method: 'POST', headers: {'Content-Type': 'application/json'},
223
+ body: JSON.stringify({token: memoryToken})});
224
+ if (!response.ok) throw new Error('delete');
225
+ localStorage.removeItem('mindily-memory-token');
226
+ memoryToken = null;
227
+ document.getElementById('memory-consent').checked = false;
228
+ document.getElementById('memory-status').textContent = '저장된 선호를 삭제했어요.';
229
+ if (lastAnalysis) lastAnalysis.recommendation = null;
230
+ loadHealingRecommendations();
231
+ } catch (_) { toast('삭제하지 못했어요. 다시 시도해주세요.'); }
232
+ });
233
+
234
+ if (memoryToken) {
235
+ fetch('/api/memory/read', {method: 'POST', headers: {'Content-Type': 'application/json'},
236
+ body: JSON.stringify({token: memoryToken})})
237
+ .then(response => response.json())
238
+ .then(data => { if (data.preferred_kind) {
239
+ document.getElementById('preferred-kind').value = data.preferred_kind;
240
+ document.getElementById('memory-status').textContent = `${data.preferred_kind} 활동을 기억하고 있어요.`;
241
+ } }).catch(() => {});
242
+ }
243
+
244
+ function saveEntry(entry) {
245
+ try {
246
+ const records = JSON.parse(localStorage.getItem('mindily-records') || '[]');
247
+ const existing = records.findIndex(x => x.id && x.id === entry.id);
248
+ if (existing >= 0) records.splice(existing, 1);
249
+ records.unshift(entry);
250
+ localStorage.setItem('mindily-records', JSON.stringify(records.slice(0, 30)));
251
+ return true;
252
+ } catch (_) { toast('이 브라우저에서는 기록 저장이 안 돼요. 저장 설정을 확인해주세요.'); return false; }
253
+ }
254
+
255
+ function updateRecordUI(entry) {
256
+ const lead = entry.ranked[0].name;
257
+ document.getElementById('record-date').textContent = '오늘';
258
+ document.getElementById('record-emoji').textContent = emotionMeta[lead][0];
259
+ document.getElementById('record-mood').textContent = selectedMood.name;
260
+ document.getElementById('record-stress').textContent = `스트레스 ${entry.stress}/5`;
261
+ document.getElementById('record-copy').textContent = entry.text;
262
+ document.getElementById('latest-mood').textContent = selectedMood.name;
263
+ document.getElementById('home-coach-message').textContent = '기록한 마음을 확인했어요. 어떤 휴식이 필요한지 천천히 골라보세요.';
264
+ const dots = document.querySelector('.stress-dots');
265
+ dots.setAttribute('aria-label', `직접 기록한 스트레스 ${entry.stress}/5`);
266
+ [...dots.children].forEach((dot,i) => dot.classList.toggle('off', i >= entry.stress));
267
+ }
268
+
269
+ function updateMoodUI() {
270
+ document.getElementById('selected-detailed-mood').textContent = selectedMood.name;
271
+ document.getElementById('mood-dot').style.background = selectedMood.color;
272
+ }
273
+
274
+ document.getElementById('mood-meter').addEventListener('click', (event) => {
275
+ const button = event.target.closest('[data-mood]');
276
+ if (!button) return;
277
+ document.querySelectorAll('[data-mood]').forEach((item) => item.classList.remove('selected'));
278
+ button.classList.add('selected');
279
+ selectedMood = { name: button.dataset.mood, color: button.dataset.color };
280
+ });
281
+
282
+ document.getElementById('confirm-mood').addEventListener('click', () => {
283
+ updateMoodUI();
284
+ if (!lastAnalysis || selectedMood.name === '직접 골라주세요') return toast('먼저 마음을 선택해주세요.');
285
+ lastAnalysis.confirmedMood = {...selectedMood};
286
+ lastAnalysis.detailedMood = selectedMood.name;
287
+ if (saveEntry(lastAnalysis)) { updateRecordUI(lastAnalysis); toast(`‘${selectedMood.name}’ 마음으로 기록했어요.`); }
288
+ });
289
+
290
+ const missionButton = document.getElementById('mission-button');
291
+ missionButton.addEventListener('click', () => {
292
+ if (missionTimer) return;
293
+ let value = 0;
294
+ missionButton.textContent = '잠시 창밖을 바라봐요…';
295
+ missionTimer = setInterval(() => {
296
+ value += 10;
297
+ document.getElementById('mission-progress').style.width = `${value}%`;
298
+ if (value >= 100) {
299
+ clearInterval(missionTimer); missionTimer = null;
300
+ missionButton.textContent = '오늘의 미션 완료 ✓';
301
+ missionButton.disabled = true;
302
+ toast('잘했어요. 오늘 당신을 위해 잠시 시간을 내주었네요.');
303
+ document.getElementById('feedback-dialog').showModal();
304
+ }
305
+ }, 450);
306
+ });
307
+
308
+ function startBreathing() {
309
+ const dialog = document.getElementById('breath-dialog');
310
+ dialog.showModal();
311
+ let remaining = 60;
312
+ let phase = true;
313
+ clearInterval(breathTimer);
314
+ breathTimer = setInterval(() => {
315
+ remaining -= 1;
316
+ const label = document.getElementById('breath-label');
317
+ if (remaining % 4 === 0) { phase = !phase; label.textContent = phase ? '들이쉬어요' : '내쉬어요'; }
318
+ document.getElementById('breath-time').textContent = `00:${String(remaining).padStart(2, '0')}`;
319
+ if (remaining <= 0) { clearInterval(breathTimer); label.textContent = '잘했어요'; toast('1분 동안 내 마음 곁에 머물렀어요.'); }
320
+ }, 1000);
321
+ }
322
+ document.querySelector('.close-breath').addEventListener('click', () => { clearInterval(breathTimer); document.getElementById('breath-dialog').close(); });
323
+
324
+ document.getElementById('chat-form').addEventListener('submit', async (event) => {
325
+ event.preventDefault();
326
+ const input = document.getElementById('chat-input');
327
+ const value = input.value.trim();
328
+ if (!value) return;
329
+ const submit = event.currentTarget.querySelector('[type="submit"]');
330
+ if (submit.disabled) return;
331
+ submit.disabled = true;
332
+ const thread = document.getElementById('chat-thread');
333
+ thread.insertAdjacentHTML('beforeend', `<div class="message user"><p>${escapeHtml(value)}</p></div>`);
334
+ input.value = '';
335
+ try {
336
+ const response = await fetch('/api/agent/coach', {method: 'POST', headers: {'Content-Type': 'application/json'},
337
+ body: JSON.stringify({text: value, self_reported_stress: lastAnalysis?.stress || 3,
338
+ context: 'chat', memory_token: memoryToken, known_emotion: lastAnalysis?.ranked?.[0]?.name || null}),
339
+ signal: AbortSignal.timeout(60000)});
340
+ if (!response.ok) throw new Error('coach');
341
+ const result = await response.json();
342
+ const card = result.recommendation?.cards?.[0];
343
+ const source = card?.source_url?.startsWith('https://')
344
+ ? `<p><a href="${escapeHtml(card.source_url)}" target="_blank" rel="noopener noreferrer">${escapeHtml(card.source_title)} 자료 보기 ↗</a></p>` : '';
345
+ thread.insertAdjacentHTML('beforeend', `<div class="message ai"><small>Mindily · 규칙 기반 응답</small><p>${escapeHtml(result.message)}</p>${source}</div>`);
346
+ thread.parentElement.scrollTo({ top: thread.parentElement.scrollHeight, behavior: 'smooth' });
347
+ } catch (_) { thread.insertAdjacentHTML('beforeend', '<div class="message ai"><small>Mindily</small><p>지금은 연결이 어려워요. 잠시 후 다시 이야기해 주세요.</p></div>'); }
348
+ finally { submit.disabled = false; }
349
+ });
350
+
351
+ document.querySelector('.segmented').addEventListener('click', (event) => {
352
+ const button = event.target.closest('[role="tab"]');
353
+ if (!button) return;
354
+ document.querySelectorAll('.segmented [role="tab"]').forEach((item) => item.setAttribute('aria-selected', String(item === button)));
355
+ toast(button.textContent === '월간' ? '월간 보기는 다음 스프린트에서 실제 데이터와 연결돼요.' : '주간 기록을 보고 있어요.');
356
+ });
357
+
358
+ function renderChart() {
359
+ const points = [54, 48, 30, 46, 72, 52, 38];
360
+ const faces = ['😮‍💨','😐','😣','😐','🙂','😐','😔'];
361
+ document.getElementById('emotion-chart').innerHTML = points.map((height, index) => `<div class="chart-point" style="--h:${height}%"><span aria-hidden="true">${faces[index]}</span></div>`).join('');
362
+ }
363
+
364
+ function hydrateLatest() {
365
+ try {
366
+ const entry = JSON.parse(localStorage.getItem('mindily-records') || '[]')[0];
367
+ if (entry) { lastAnalysis = entry; selectedMood = entry.confirmedMood || {name: entry.detailedMood || '직접 골라주세요', color:'#b7bfce'}; updateRecordUI(entry); }
368
+ } catch (_) {}
369
+ }
370
+
371
+ document.getElementById('delete-records').addEventListener('click', () => {
372
+ if (!window.confirm('이 브라우저에 저장된 일기·감정 기록·정리 내용을 모두 삭제할까요? 복구할 수 없어요.')) return;
373
+ try {
374
+ localStorage.removeItem('mindily-records');
375
+ localStorage.removeItem(organizerKey);
376
+ window.location.reload();
377
+ } catch (_) { toast('이 브라우저의 기록을 삭제할 수 없어요. 저장 설정을 확인해주세요.'); }
378
+ });
379
+
380
+ let toastTimeout;
381
+ function toast(message) {
382
+ const element = document.getElementById('toast');
383
+ element.textContent = message;
384
+ element.classList.add('show');
385
+ clearTimeout(toastTimeout);
386
+ toastTimeout = setTimeout(() => element.classList.remove('show'), 2600);
387
+ }
388
+
389
+ renderChart();
390
+ hydrateLatest();
391
+ hydrateOrganizer();
392
+ showScreen('home', false);
index.html CHANGED
@@ -1,19 +1,265 @@
1
  <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
  <!doctype html>
2
+ <html lang="ko">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
6
+ <meta name="theme-color" content="#f8f5ef">
7
+ <meta name="description" content="감정을 기록하고, 이해하고, 돌보는 AI 감정 일기 데모">
8
+ <title>Mindily — 오늘의 마음</title>
9
+ <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='18' fill='%23e9f3e8'/%3E%3Cpath d='M31 48V26M31 34c-8 0-13-5-13-13 8 0 13 5 13 13Zm1-6c0-8 5-13 13-13 0 8-5 13-13 13Z' fill='none' stroke='%233d745e' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E">
10
+ <link rel="preconnect" href="https://fonts.googleapis.com">
11
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
12
+ <link href="https://fonts.googleapis.com/css2?family=Gowun+Dodum&family=Pretendard:wght@400;500;600;700&display=swap" rel="stylesheet">
13
+ <link rel="stylesheet" href="styles.css">
14
+ </head>
15
+ <body>
16
+ <a class="skip-link" href="#app-main">본문으로 바로가기</a>
17
+ <div class="ambient ambient-a" aria-hidden="true"></div>
18
+ <div class="ambient ambient-b" aria-hidden="true"></div>
19
+
20
+ <div class="app-shell">
21
+ <aside class="desktop-rail" aria-label="Mindily 안내">
22
+ <div class="brand-lockup">
23
+ <span class="brand-mark" aria-hidden="true">♧</span>
24
+ <div><strong>Mindily</strong><small>오늘도, 괜찮아요.</small></div>
25
+ </div>
26
+ <blockquote>“조금 느려도 괜찮아요.<br>당신은 지금도 충분히 잘하고 있어요.”</blockquote>
27
+ <div class="rail-art" aria-hidden="true">
28
+ <span>☁</span><span>❋</span><span>⌁</span>
29
+ </div>
30
+ <p class="privacy-note">분석 시 글이 서버로 전송돼요. 일기 원문과 감정 기록은 이 브라우저에 저장돼요.</p>
31
+ </aside>
32
+
33
+ <main id="app-main" class="phone" aria-live="polite">
34
+ <header class="topbar">
35
+ <button class="icon-button back-button" type="button" aria-label="이전 화면" hidden>‹</button>
36
+ <div class="mini-brand">
37
+ <span class="brand-mark" aria-hidden="true">♧</span>
38
+ <div><strong>Mindily</strong><small>오늘도, 괜찮아요.</small></div>
39
+ </div>
40
+ <h1 class="screen-title" hidden></h1>
41
+ <button class="icon-button" type="button" aria-label="도움말" data-open-dialog="safety-dialog">ⓘ</button>
42
+ </header>
43
+
44
+ <section class="screen active" data-screen="home" aria-labelledby="home-heading">
45
+ <div class="home-sky card hero-card">
46
+ <p class="eyebrow" id="today-date">9월 16일 수요일</p>
47
+ <h2 id="home-heading">안녕하세요,<br>오늘 마음은 어떤가요?</h2>
48
+ <p>크게 설명하지 않아도 괜찮아요. 지금의 마음부터 천천히 살펴봐요.</p>
49
+ <div class="quiet-window" aria-hidden="true"><span>☀</span><i></i><i></i><i></i></div>
50
+ <button class="primary-button" type="button" data-go="diary"><span aria-hidden="true">+</span> 오늘의 일기 쓰기</button>
51
+ </div>
52
+
53
+ <div class="section-heading"><h3>오늘의 상태</h3><button type="button" class="text-button" data-go="records">기록 보기</button></div>
54
+ <div class="card status-card">
55
+ <div class="mood-face" aria-hidden="true">😮‍💨</div>
56
+ <div class="status-copy"><strong id="latest-mood">아직 기록이 없어요</strong><small>내가 선택한 마음을 기록해요.</small></div>
57
+ <div class="stress-dots" aria-label="기록 전 스트레스 미선택"><i class="off"></i><i class="off"></i><i class="off"></i><i class="off"></i><i class="off"></i></div>
58
+ </div>
59
+
60
+ <div class="companion-card card">
61
+ <div class="coach-avatar" aria-hidden="true">☁</div>
62
+ <div><span class="eyebrow">마음을 위한 한마디</span><p id="home-coach-message">오늘의 마음을 기록하면 함께 살펴볼 수 있어요.</p></div>
63
+ </div>
64
+
65
+ <div class="section-heading"><h3>오늘의 작은 미션</h3><span class="soft-chip">시연 · 약 5초</span></div>
66
+ <div class="card mission-card">
67
+ <div class="mission-icon" aria-hidden="true">🌿</div>
68
+ <div><strong>휴대폰을 내려놓고<br>창밖을 바라보기</strong><p>당장 해결하지 않아도 되는 생각은 잠시 내려두어요.</p></div>
69
+ <div class="progress-track" aria-label="미션 진행률"><span id="mission-progress"></span></div>
70
+ <button class="secondary-button" type="button" id="mission-button">미션 시작하기</button>
71
+ </div>
72
+ <button class="text-button session-end-button" type="button" data-open-dialog="feedback-dialog">오늘 사용을 마쳤어요 · 만족도 남기기</button>
73
+ </section>
74
+
75
+ <section class="screen" data-screen="diary" aria-labelledby="diary-heading">
76
+ <div class="screen-intro">
77
+ <span class="eyebrow">오늘의 감정 일기</span>
78
+ <h2 id="diary-heading">오늘 하루는 어땠나요?</h2>
79
+ <p>편하게 이야기해주세요. 판단하지 않을게요.</p>
80
+ </div>
81
+ <form id="diary-form">
82
+ <label class="journal-field">
83
+ <span class="sr-only">오늘의 일기</span>
84
+ <textarea id="diary-text" maxlength="1000" placeholder="오늘 있었던 일이나 지금 느끼는 감정을 자유롭게 적어보세요…" required></textarea>
85
+ <small><span id="char-count">0</span>/1,000</small>
86
+ </label>
87
+
88
+ <fieldset class="form-block">
89
+ <legend>지금 느끼는 감정 <small>복수 선택 가능</small></legend>
90
+ <div class="tag-list" id="emotion-tags">
91
+ <button type="button" data-tag="기쁨">기쁨</button><button type="button" data-tag="피곤함">피곤함</button><button type="button" data-tag="불안">불안</button><button type="button" data-tag="스트레스">스트레스</button><button type="button" data-tag="외로움">외로움</button><button type="button" data-tag="답답함">답답함</button><button type="button" data-tag="설렘">설렘</button><button type="button" data-tag="슬픔">슬픔</button>
92
+ </div>
93
+ </fieldset>
94
+
95
+ <fieldset class="form-block">
96
+ <legend>스트레스는 어느 정도인가요?</legend>
97
+ <div class="stress-scale" role="radiogroup" aria-label="스트레스 정도">
98
+ <label><input type="radio" name="stress" value="1"><span>1</span></label>
99
+ <label><input type="radio" name="stress" value="2"><span>2</span></label>
100
+ <label><input type="radio" name="stress" value="3" checked><span>3</span></label>
101
+ <label><input type="radio" name="stress" value="4"><span>4</span></label>
102
+ <label><input type="radio" name="stress" value="5"><span>5</span></label>
103
+ </div>
104
+ <div class="scale-labels"><span>낮음</span><span>매우 높음</span></div>
105
+ </fieldset>
106
+
107
+ <p class="privacy-inline"><span aria-hidden="true">♡</span> 분석을 누르면 일기가 모델 서버로 전송돼요. 서버는 원문을 저장하지 않으며, 일기 원문과 감정 기록은 이 브라우저에 저장돼요.</p>
108
+ <button class="primary-button submit-button" type="submit">AI에게 마음 맡기기 <span aria-hidden="true">✨</span></button>
109
+ </form>
110
+ </section>
111
+
112
+ <section class="screen" data-screen="analysis" aria-labelledby="analysis-heading">
113
+ <div class="screen-intro centered">
114
+ <span class="sprout-icon" aria-hidden="true">🌱</span>
115
+ <h2 id="analysis-heading">당신의 오늘을<br>조금 들여다봤어요.</h2>
116
+ <p>감정을 확정하지 않고, 글 속 단서를 정리했어요.</p>
117
+ </div>
118
+
119
+ <div class="card analysis-card">
120
+ <div class="card-label">오늘의 주요 감정</div>
121
+ <div class="emotion-result" id="emotion-result"></div>
122
+ <div class="divider"></div>
123
+ <div class="card-label">감정 신호</div>
124
+ <p class="analysis-summary" id="analysis-summary">스트레스가 조금 높은 상태로 보여요.</p>
125
+ <div class="meter"><span id="analysis-meter"></span></div>
126
+ <small class="model-note">실제 KcELECTRA 분류 점수예요. 감정의 비율이나 진단 결과가 아니에요.</small>
127
+ </div>
128
+
129
+ <div class="card coach-note">
130
+ <div class="coach-avatar" aria-hidden="true">☁</div>
131
+ <div><span class="eyebrow">마음을 위한 한마디</span><p id="analysis-message"></p></div>
132
+ </div>
133
+
134
+ <div class="section-heading"><h3>내 마음과 맞나요?</h3><button type="button" class="text-button" data-open-dialog="mood-dialog">무드 미터에서 수정</button></div>
135
+ <button class="mood-confirm card" type="button" data-open-dialog="mood-dialog">
136
+ <span class="mood-dot" id="mood-dot"></span><span><strong id="selected-detailed-mood">걱정되는</strong><small>사용자가 선택하는 세부 감정</small></span><span aria-hidden="true">›</span>
137
+ </button>
138
+ <button class="primary-button" type="button" data-go="coach">휴식 활동 보기</button>
139
+ </section>
140
+
141
+ <section class="screen" data-screen="coach" aria-labelledby="coach-heading">
142
+ <div class="screen-intro">
143
+ <span class="eyebrow">맞춤��� 힐링 코치</span>
144
+ <h2 id="coach-heading">오늘은 이런 휴식이<br>어울릴 것 같아요 🌿</h2>
145
+ <p>지금 바로 할 수 있는 작은 활동부터 골랐어요.</p>
146
+ </div>
147
+ <div class="recommend-list">
148
+ <article class="card recommendation featured">
149
+ <div class="rec-icon mint" aria-hidden="true">🌱</div><div><span class="soft-chip">1순위 추천</span><h3>1분 호흡하기</h3><p>복잡한 생각을 잠시 내려놓고 호흡의 감각에 집중해보세요.</p></div><button class="secondary-button" type="button" data-start-breath>시작하기</button>
150
+ </article>
151
+ <article class="card recommendation">
152
+ <div class="rec-icon blue" aria-hidden="true">♫</div><div><h3>소리로 쉬어가기</h3><p>차분한 자연의 소리를 들으며 머릿속의 속도를 낮춰봐요.</p></div><button class="secondary-button pale-blue" type="button" data-toast="지금은 데모 음원 대신 1분 호흡을 이용해보세요.">들어보기</button>
153
+ </article>
154
+ <article class="card recommendation">
155
+ <div class="rec-icon lilac" aria-hidden="true">☁</div><div><h3>마음 털어놓기</h3><p>조금 더 이야기하고 싶다면, 서두르지 않고 들어드릴게요.</p></div><button class="secondary-button pale-lilac" type="button" data-go="chat">이야기하기</button>
156
+ </article>
157
+ </div>
158
+ <article class="card recommendation organizer-card">
159
+ <div class="rec-icon blue" aria-hidden="true">✎</div>
160
+ <div><span class="soft-chip">스스로 정리하기</span><h3>감정 정리하기</h3><p>있었던 일과 지금 필요한 것을 세 문장으로 적어봐요.</p></div>
161
+ <button class="secondary-button" type="button" data-open-dialog="organize-dialog">시작하기</button>
162
+ </article>
163
+ <div class="card memory-card">
164
+ <h3>다음 휴식에 기억할까요?</h3>
165
+ <p>동의하면 선호하는 활동 종류만 서버에 기억해 추천 순서를 조정해요. 30일이 지나면 기억을 사용하지 않아요. 일기 원문과 위치는 저장하지 않아요.</p>
166
+ <label for="preferred-kind">선호 활동</label>
167
+ <select id="preferred-kind"><option value="호흡">호흡</option><option value="감각활동">감각 활동</option><option value="걷기">걷기</option></select>
168
+ <label class="privacy-inline"><input type="checkbox" id="memory-consent"> 익명 선호 활동 기억에 동의합니다.</label>
169
+ <button class="secondary-button" type="button" id="save-memory">선호 저장</button>
170
+ <button class="text-button" type="button" id="delete-memory">저장된 선호 삭제</button>
171
+ <p id="memory-status" role="status">저장된 선호가 없어요.</p>
172
+ </div>
173
+ <button class="text-button session-end-button" type="button" data-open-dialog="feedback-dialog">오늘 사용을 마쳤어요 · 만족도 남기기</button>
174
+ <p class="gentle-note">지금은 충분히 쉬어도 괜찮아요.<br>작은 휴식이 내일의 여유가 되어줄 거예요. ♡</p>
175
+ </section>
176
+
177
+ <section class="screen" data-screen="chat" aria-labelledby="chat-heading">
178
+ <div class="chat-heading"><div class="coach-avatar" aria-hidden="true">☁</div><div><h2 id="chat-heading">마음 친구</h2><span><i></i> 감정 분석 + 규칙 기반 응답</span></div></div>
179
+ <div class="chat-thread" id="chat-thread">
180
+ <div class="message ai"><small>Mindily</small><p>오늘 여러 가지 일이 겹쳐 마음의 여유가 줄어든 것 같아요. 가장 마음에 걸리는 일이 있었나요?</p></div>
181
+ <div class="message user"><p>오늘 발표를 망친 것 같아서 계속 생각나.</p></div>
182
+ <div class="message ai"><small>Mindily</small><p>그 장면이 계속 떠오르면 마음이 무거울 수 있겠어요. 지금은 그때 가장 아쉬웠던 한 가지만 이야기해도 괜찮아요.</p></div>
183
+ </div>
184
+ <form class="chat-composer" id="chat-form"><label><span class="sr-only">마음 친구에게 보내기</span><input id="chat-input" placeholder="지금 마음을 이야기해보세요…" autocomplete="off"></label><button type="submit" aria-label="보내기">↑</button></form>
185
+ <p class="chat-disclaimer">위기 상황에는 지역 응급기관이나 전문 상담기관에 연락해주세요.</p>
186
+ </section>
187
+
188
+ <section class="screen" data-screen="records" aria-labelledby="records-heading">
189
+ <div class="screen-intro"><span class="eyebrow">나의 마음 기록</span><h2 id="records-heading">감정은 매일 달라도 괜찮아요.</h2><p>평가보다 흐름을 발견하는 데 집중해요.</p></div>
190
+ <div class="segmented" role="tablist" aria-label="기록 기간"><button role="tab" aria-selected="true">주간</button><button role="tab" aria-selected="false">월간</button></div>
191
+ <div class="card chart-card">
192
+ <div class="section-heading"><h3>감정 흐름 예시</h3><span class="soft-chip">샘플 데이터</span></div>
193
+ <div class="emotion-chart" id="emotion-chart" aria-label="감정 흐름 예시 그래프"></div>
194
+ <div class="chart-axis"><span>월</span><span>화</span><span>수</span><span>목</span><span>금</span><span>토</span><span>일</span></div>
195
+ </div>
196
+ <div class="card pattern-card"><div class="pattern-icon" aria-hidden="true">◷</div><div><span class="eyebrow">패턴 안내 예시</span><p>실제 기록 기반 패턴 분석은 다음 단계에서 연결합니다. 위 그래프는 화면 구성 예시예요.</p></div></div>
197
+ <div class="card recent-entry"><div class="section-heading"><h3>최근 기록</h3><span id="record-date">오늘</span></div><div class="entry-title"><span id="record-emoji">😮‍💨</span><strong id="record-mood">걱정되는</strong><span class="soft-chip" id="record-stress">스트레스 3/5</span></div><p id="record-copy">오늘의 마음을 기록하면 여기에 일기와 AI가 정리한 감정이 남아요.</p></div>
198
+ <button class="text-button" type="button" id="delete-records">이 브라우저의 모든 일기 기록 삭제</button>
199
+ </section>
200
+
201
+ <nav class="bottom-nav" aria-label="주요 메뉴">
202
+ <button type="button" class="active" data-go="home"><span aria-hidden="true">⌂</span><small>홈</small></button>
203
+ <button type="button" data-go="diary"><span aria-hidden="true">▣</span><small>감정 일기</small></button>
204
+ <button type="button" data-go="coach"><span aria-hidden="true">♧</span><small>AI 코치</small></button>
205
+ <button type="button" data-go="records"><span aria-hidden="true">⌁</span><small>마음 기록</small></button>
206
+ </nav>
207
+ </main>
208
+ </div>
209
+
210
+ <dialog id="mood-dialog" class="sheet-dialog">
211
+ <form method="dialog" class="sheet-content">
212
+ <div class="sheet-handle" aria-hidden="true"></div>
213
+ <div class="section-heading"><div><span class="eyebrow">무드 미터</span><h2>지금 마음과 가까운 단어는?</h2></div><button class="icon-button" value="cancel" aria-label="닫기">×</button></div>
214
+ <p>에너지와 편안함의 위치를 참고하되, 가장 맞는 감정은 직접 고르세요.</p>
215
+ <div class="mood-meter" id="mood-meter">
216
+ <button type="button" data-mood="초조한" data-color="#f47d61">초조한</button><button type="button" data-mood="답답한" data-color="#f6a06f">답답한</button><button type="button" data-mood="설레는" data-color="#f5c84d">설레는</button><button type="button" data-mood="활기찬" data-color="#e8b643">활기찬</button>
217
+ <button type="button" data-mood="불안한" data-color="#d65e58">불안한</button><button type="button" data-mood="걱정되는" data-color="#ec846f" class="selected">걱정되는</button><button type="button" data-mood="기분 좋은" data-color="#f0d25d">기분 좋은</button><button type="button" data-mood="집중되는" data-color="#d8c44c">집중되는</button>
218
+ <button type="button" data-mood="지친" data-color="#739bdc">지친</button><button type="button" data-mood="외로운" data-color="#536dc5">외로운</button><button type="button" data-mood="편안한" data-color="#78b975">편안한</button><button type="button" data-mood="안정된" data-color="#58a967">안정된</button>
219
+ <button type="button" data-mood="우울한" data-color="#5251a5">우울한</button><button type="button" data-mood="무기력한" data-color="#4e77c6">무기력한</button><button type="button" data-mood="고요한" data-color="#4f9c63">고요한</button><button type="button" data-mood="포근한" data-color="#32854c">포근한</button>
220
+ </div>
221
+ <div class="meter-label energy">에너지 높음 ↑</div><div class="meter-label pleasant">편안함 높음 →</div>
222
+ <button class="primary-button" value="confirm" id="confirm-mood">이 감정으로 기록하기</button>
223
+ </form>
224
+ </dialog>
225
+
226
+ <dialog id="breath-dialog" class="breath-dialog">
227
+ <div class="breath-content"><button class="icon-button close-breath" type="button" aria-label="호흡 닫기">×</button><span class="eyebrow">1분 호흡</span><div class="breath-orb"><span id="breath-label">들이쉬어요</span></div><p>어깨의 힘을 풀고, 천천히 숨의 움직임을 느껴보세요.</p><strong id="breath-time">01:00</strong></div>
228
+ </dialog>
229
+
230
+ <dialog id="organize-dialog" class="sheet-dialog">
231
+ <form class="sheet-content" id="organize-form">
232
+ <div class="sheet-handle" aria-hidden="true"></div>
233
+ <div class="section-heading"><div><span class="eyebrow">감정 정리하기</span><h2>지금 마음을 천천히 정리해요.</h2></div><button class="icon-button" type="button" data-close-dialog="organize-dialog" aria-label="닫기">×</button></div>
234
+ <p>정리한 내용은 이 브라우저에만 저장됩니다. 분석 서버로 보내지 않아요.</p>
235
+ <label class="journal-field"><span>무슨 일이 있었나요?</span><textarea id="organize-event" maxlength="500" placeholder="기억나는 장면 한 가지만 적어도 좋아요."></textarea></label>
236
+ <label class="journal-field"><span>어떤 마음이 들었나요?</span><textarea id="organize-feeling" maxlength="500" placeholder="정확한 단어를 몰라도 괜찮아요."></textarea></label>
237
+ <label class="journal-field"><span>지금 무엇이 필요할까요?</span><textarea id="organize-need" maxlength="500" placeholder="쉼, 도움, 시간처럼 작은 것부터요."></textarea></label>
238
+ <p id="organize-status" role="status">저장된 정리 내용이 없어요.</p>
239
+ <button class="primary-button" type="submit">이 브라우저에 저장하기</button>
240
+ <button class="text-button" type="button" id="delete-organized-thoughts">정리 내용 삭제</button>
241
+ </form>
242
+ </dialog>
243
+
244
+ <dialog id="safety-dialog" class="info-dialog">
245
+ <form method="dialog"><button class="icon-button" value="cancel" aria-label="닫기">×</button><span class="eyebrow">안전한 사용 안내</span><h2>Mindily는 마음을 정리하는 도구예요.</h2><p>감정 분석은 의료적 진단이 아니며, 중요한 판단을 대신하지 않아요. 스스로 또는 타인을 해칠 위험이 있거나 즉각적인 도움이 필요하면 지역 응급기관과 전문 상담기관에 연락해주세요.</p><button class="secondary-button" value="ok">확인했어요</button></form>
246
+ </dialog>
247
+
248
+ <dialog id="feedback-dialog" class="sheet-dialog">
249
+ <form method="dialog" class="sheet-content" id="feedback-form">
250
+ <div class="sheet-handle" aria-hidden="true"></div>
251
+ <div class="section-heading"><div><span class="eyebrow">사용 후 한마디</span><h2>오늘 Mindily는 어땠나요?</h2></div><button class="icon-button" type="button" data-close-dialog="feedback-dialog" aria-label="닫기">×</button></div>
252
+ <p>서버에는 일기 원문을 보내지 않아요. 만족도와 선택한 의견은 익명으로 저장하며, 민감한 내용은 의견란에 적지 말아주세요.</p>
253
+ <fieldset class="form-block"><legend>사용 경험은 어땠나요?</legend><div class="stress-scale feedback-scale" role="radiogroup" aria-label="만족도">
254
+ <label><input type="radio" name="satisfaction" value="1" required><span>1</span></label><label><input type="radio" name="satisfaction" value="2"><span>2</span></label><label><input type="radio" name="satisfaction" value="3"><span>3</span></label><label><input type="radio" name="satisfaction" value="4"><span>4</span></label><label><input type="radio" name="satisfaction" value="5"><span>5</span></label>
255
+ </div></fieldset>
256
+ <label class="journal-field"><span>한마디 (선택)</span><textarea id="feedback-comment" maxlength="300" placeholder="가장 도움이 된 점이나 불편했던 점을 적어주세요."></textarea></label>
257
+ <label class="privacy-inline"><input type="checkbox" id="feedback-consent"> 익명 만족도 조사에 동의하고 제출합니다.</label>
258
+ <button class="primary-button" value="confirm" type="submit">만족도 제출하기</button>
259
+ </form>
260
+ </dialog>
261
+
262
+ <div class="toast" role="status" aria-live="polite" id="toast"></div>
263
+ <script src="app.js?v=organizer-20260919"></script>
264
+ </body>
265
  </html>
styles.css ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --ink: #172655;
3
+ --muted: #6c7897;
4
+ --paper: #fbfaf7;
5
+ --ivory: #f7f2e9;
6
+ --line: rgba(66, 78, 113, .12);
7
+ --blue: #748eef;
8
+ --blue-deep: #526fcf;
9
+ --sky: #dceaff;
10
+ --mint: #dcefdc;
11
+ --sage: #83bda0;
12
+ --peach: #f8d9ca;
13
+ --lilac: #e9e5fb;
14
+ --shadow: 0 18px 45px rgba(73, 72, 93, .10), 0 3px 12px rgba(55, 68, 112, .06);
15
+ --radius: 24px;
16
+ --safe-bottom: env(safe-area-inset-bottom, 0px);
17
+ }
18
+
19
+ * { box-sizing: border-box; }
20
+ button { min-height: 44px; }
21
+ textarea, input { font-size: 16px; }
22
+ [hidden] { display: none !important; }
23
+ html { background: #ece8e0; scroll-behavior: smooth; }
24
+ body { margin: 0; color: var(--ink); background: radial-gradient(circle at 15% 15%, #fff9ee 0 16%, transparent 42%), radial-gradient(circle at 85% 90%, #e2efe9 0 14%, transparent 38%), #eeeae4; font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif; min-height: 100vh; }
25
+ button, textarea, input { font: inherit; }
26
+ button { color: inherit; }
27
+ button:focus-visible, textarea:focus-visible, input:focus-visible { outline: 3px solid rgba(82, 111, 207, .35); outline-offset: 3px; }
28
+ .skip-link { position: fixed; top: -100px; left: 16px; background: #fff; padding: 12px 16px; z-index: 100; }
29
+ .skip-link:focus { top: 16px; }
30
+ .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
31
+ .ambient { position: fixed; border-radius: 50%; filter: blur(3px); pointer-events: none; }
32
+ .ambient-a { width: 280px; height: 280px; background: rgba(255, 226, 186, .38); top: -90px; right: -70px; }
33
+ .ambient-b { width: 320px; height: 320px; background: rgba(191, 220, 204, .3); bottom: -110px; left: -80px; }
34
+
35
+ .app-shell { width: min(1100px, 100%); min-height: 100vh; margin: 0 auto; display: grid; grid-template-columns: 320px minmax(0, 430px); align-items: center; justify-content: center; gap: 84px; padding: 32px; position: relative; }
36
+ .desktop-rail { align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: 40px 10px; }
37
+ .brand-lockup, .mini-brand { display: flex; align-items: center; gap: 12px; }
38
+ .brand-mark { color: #438976; font-size: 32px; line-height: 1; transform: rotate(-10deg); }
39
+ .brand-lockup strong, .mini-brand strong { display: block; font-family: "Gowun Dodum", sans-serif; font-size: 26px; letter-spacing: .02em; }
40
+ .brand-lockup small, .mini-brand small { display: block; color: var(--muted); margin-top: 1px; font-size: 12px; }
41
+ .desktop-rail blockquote { margin: 88px 0 24px; font-family: "Gowun Dodum", sans-serif; color: #675b57; font-size: 24px; line-height: 1.9; }
42
+ .rail-art { height: 170px; position: relative; color: #7da887; font-size: 50px; border-bottom: 1px solid rgba(79, 116, 84, .18); }
43
+ .rail-art span { position: absolute; }
44
+ .rail-art span:nth-child(1) { left: 0; top: 42px; color: #c6d8ee; }
45
+ .rail-art span:nth-child(2) { left: 115px; top: 20px; }
46
+ .rail-art span:nth-child(3) { right: 20px; bottom: 18px; color: #d6a766; }
47
+ .privacy-note { color: var(--muted); font-size: 13px; }
48
+
49
+ .phone { width: 100%; height: min(880px, calc(100vh - 32px)); min-height: 700px; background: rgba(251, 250, 247, .96); border: 1px solid rgba(255,255,255,.85); border-radius: 42px; box-shadow: 0 34px 90px rgba(74, 66, 67, .22); overflow: hidden; position: relative; display: flex; flex-direction: column; backdrop-filter: blur(14px); }
50
+ .topbar { height: 74px; flex: 0 0 74px; display: flex; align-items: center; padding: 14px 20px 8px; gap: 12px; position: relative; z-index: 5; background: linear-gradient(to bottom, rgba(251,250,247,.96), rgba(251,250,247,.82)); }
51
+ .mini-brand { flex: 1; }
52
+ .mini-brand .brand-mark { font-size: 25px; }
53
+ .mini-brand strong { font-size: 20px; }
54
+ .screen-title { flex: 1; font-size: 17px; text-align: center; margin: 0; }
55
+ .icon-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255,255,255,.65); display: grid; place-items: center; font-size: 20px; cursor: pointer; }
56
+ .back-button { font-size: 32px; justify-self: start; }
57
+ .screen { display: none; flex: 1; overflow-y: auto; padding: 8px 18px calc(102px + var(--safe-bottom)); scrollbar-width: none; animation: appear .32s ease; }
58
+ .screen::-webkit-scrollbar { display: none; }
59
+ .screen.active { display: block; }
60
+ @keyframes appear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
61
+
62
+ h2, h3, p { margin-top: 0; }
63
+ h2 { font-family: "Gowun Dodum", sans-serif; font-size: 28px; line-height: 1.32; letter-spacing: -.02em; margin-bottom: 10px; }
64
+ h3 { font-size: 16px; margin-bottom: 0; }
65
+ p { color: var(--muted); line-height: 1.62; font-size: 15px; }
66
+ .eyebrow { color: #57719f; font-size: 13px; font-weight: 700; letter-spacing: .02em; }
67
+ .card { border: 1px solid rgba(72, 82, 112, .08); border-radius: var(--radius); background: rgba(255,255,255,.78); box-shadow: var(--shadow); }
68
+ .hero-card { overflow: hidden; position: relative; min-height: 322px; padding: 26px 22px 22px; background: linear-gradient(145deg, #fffdf8 0 54%, #e9f3ec 100%); }
69
+ .hero-card h2 { font-size: 29px; max-width: 300px; margin: 12px 0 8px; }
70
+ .hero-card > p:not(.eyebrow) { max-width: 290px; }
71
+ .quiet-window { height: 78px; width: 120px; position: absolute; right: 0; top: 26px; border-radius: 20px 0 0 20px; background: linear-gradient(160deg, #d9eaff, #fff2d9); overflow: hidden; opacity: .75; }
72
+ .quiet-window span { position: absolute; right: 14px; top: 8px; color: #eab94b; }
73
+ .quiet-window i { position: absolute; display: block; width: 42px; height: 48px; border-radius: 100% 0 100% 0; background: #7daa7f; bottom: -24px; transform-origin: bottom center; }
74
+ .quiet-window i:nth-of-type(1) { left: 12px; transform: rotate(-24deg); }.quiet-window i:nth-of-type(2) { left: 50px; transform: rotate(15deg); background: #9abc84; }.quiet-window i:nth-of-type(3) { left: 78px; transform: rotate(42deg); background: #638f69; }
75
+ .primary-button, .secondary-button { width: 100%; border: 0; cursor: pointer; border-radius: 999px; font-weight: 700; min-height: 52px; transition: transform .18s ease, box-shadow .18s ease; }
76
+ .primary-button { color: white; background: linear-gradient(135deg, #829cf4, #6c80e7); box-shadow: 0 12px 24px rgba(100, 123, 217, .24); }
77
+ .primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
78
+ .hero-card .primary-button { position: absolute; left: 22px; bottom: 22px; width: calc(100% - 44px); }
79
+ .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 4px 10px; }
80
+ .text-button { border: 0; background: transparent; color: #5c73b8; font-size: 13px; cursor: pointer; padding: 4px; }
81
+ .status-card { display: flex; align-items: center; gap: 14px; padding: 17px; }
82
+ .mood-face { width: 52px; height: 52px; border-radius: 18px; background: #fff1c9; display: grid; place-items: center; font-size: 26px; }
83
+ .status-copy { flex: 1; }.status-copy strong { display: block; font-size: 16px; margin-bottom: 4px; }.status-copy small { color: var(--muted); font-size: 11px; line-height: 1.3; display: block; }
84
+ .stress-dots { display: flex; gap: 5px; }.stress-dots i { width: 9px; height: 9px; border-radius: 50%; background: #f7957e; }.stress-dots .off { background: #e5e4e8; }
85
+ .companion-card, .pattern-card { margin-top: 12px; padding: 17px; display: flex; gap: 13px; background: linear-gradient(135deg, #f3f7ff, #f5f1ff); }
86
+ .companion-card p, .pattern-card p { margin: 4px 0 0; font-size: 13px; }
87
+ .coach-avatar { width: 45px; height: 45px; flex: 0 0 45px; border-radius: 50%; background: radial-gradient(circle at 50% 65%, white 0 28%, transparent 29%), linear-gradient(160deg, #d9eaff, #ece8ff); display: grid; place-items: center; color: #748ec3; }
88
+ .soft-chip { background: #f1f3fb; color: #64739b; padding: 5px 10px; border-radius: 999px; font-size: 11px; white-space: nowrap; }
89
+ .mission-card { padding: 18px; display: grid; grid-template-columns: 56px 1fr; column-gap: 14px; }
90
+ .mission-icon { width: 56px; height: 56px; background: var(--mint); border-radius: 18px; display: grid; place-items: center; font-size: 27px; }
91
+ .mission-card strong { font-size: 17px; line-height: 1.45; }.mission-card p { font-size: 13px; margin: 7px 0 14px; }
92
+ .progress-track { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: #ececf2; overflow: hidden; margin: 5px 0 14px; }.progress-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #85c0a7, #6fab92); border-radius: inherit; transition: width .7s ease; }
93
+ .secondary-button { background: #cfe7d5; color: #2f6c56; box-shadow: none; }.mission-card .secondary-button { grid-column: 1/-1; }
94
+ .recommendation a.secondary-button { display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px 14px; min-height: 44px; text-decoration: none; }
95
+ .memory-card { margin-top: 14px; padding: 18px; display: grid; gap: 10px; }
96
+ .memory-card h3, .memory-card p { margin: 0; }
97
+ .memory-card select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; background: white; color: var(--ink); font: inherit; }
98
+ .memory-card .text-button { justify-self: center; min-height: 44px; }
99
+
100
+ .screen-intro { padding: 12px 8px 8px; }.screen-intro .eyebrow { display: block; margin-bottom: 8px; }.screen-intro p { margin-bottom: 12px; }
101
+ .screen-intro.centered { text-align: center; padding-top: 22px; }.sprout-icon { font-size: 34px; display: block; margin-bottom: 10px; }
102
+ .journal-field { display: block; position: relative; }
103
+ .journal-field textarea { width: 100%; height: 190px; resize: none; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.85); padding: 19px; color: var(--ink); line-height: 1.7; box-shadow: inset 0 2px 10px rgba(80,70,60,.025); }
104
+ .journal-field textarea::placeholder { color: #a2abc1; }.journal-field small { position: absolute; right: 16px; bottom: 13px; color: #9da5b8; font-size: 11px; }
105
+ .form-block { border: 0; padding: 0; margin: 24px 2px 0; }.form-block legend { font-weight: 700; font-size: 15px; margin-bottom: 12px; }.form-block legend small { font-weight: 400; color: var(--muted); margin-left: 5px; }
106
+ .tag-list { display: flex; flex-wrap: wrap; gap: 8px; }.tag-list button { border: 1px solid transparent; background: #f3f2f5; color: #69728b; padding: 9px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; }.tag-list button:nth-child(3n+1) { background: #fff1de; }.tag-list button:nth-child(3n+2) { background: #eaf0ff; }.tag-list button:nth-child(3n) { background: #f9e5e5; }.tag-list button.selected { border-color: #718aea; color: #3856b0; box-shadow: 0 0 0 2px rgba(113,138,234,.08); }
107
+ .stress-scale { display: flex; justify-content: space-between; gap: 9px; }.stress-scale label { flex: 1; }.stress-scale input { position: absolute; opacity: 0; pointer-events: none; }.stress-scale span { aspect-ratio: 1; border-radius: 50%; background: #f3f2f2; display: grid; place-items: center; border: 1px solid transparent; cursor: pointer; }.stress-scale input:checked + span { background: #fff1e5; border-color: #edb58f; color: #a15b30; box-shadow: 0 5px 14px rgba(198,128,83,.12); }.scale-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 7px; }
108
+ .privacy-inline { font-size: 12px; text-align: center; margin: 24px 0 10px; }.submit-button { margin-bottom: 8px; }
109
+
110
+ .analysis-card { padding: 20px; }.card-label { font-weight: 700; font-size: 13px; margin-bottom: 12px; }.emotion-result { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }.emotion-pill { text-align: center; border-radius: 18px; background: #f8f7f4; padding: 12px 5px; }.emotion-pill span { display: block; font-size: 25px; margin-bottom: 4px; }.emotion-pill strong { display: block; font-size: 13px; }.emotion-pill small { color: var(--muted); font-size: 11px; }.divider { height: 1px; background: var(--line); margin: 18px 0; }.analysis-summary { color: var(--ink); font-weight: 600; margin-bottom: 8px; }.meter { height: 9px; background: #eeeaf0; border-radius: 999px; overflow: hidden; }.meter span { display: block; height: 100%; width: 60%; border-radius: inherit; background: linear-gradient(90deg, #ff9178, #ffc2a1); transition: width .7s ease; }.model-note { color: var(--muted); display: block; margin-top: 9px; font-size: 10px; }
111
+ .coach-note { padding: 17px; display: flex; gap: 13px; margin-top: 12px; background: linear-gradient(135deg, #eef5ff, #f3efff); }.coach-note p { margin: 5px 0 0; font-size: 13px; }
112
+ .mood-confirm { width: 100%; padding: 14px; display: grid; grid-template-columns: 42px 1fr auto; gap: 11px; align-items: center; text-align: left; color: inherit; cursor: pointer; }.mood-dot { width: 42px; height: 42px; border-radius: 50%; background: #ec846f; }.mood-confirm strong, .mood-confirm small { display: block; }.mood-confirm small { color: var(--muted); margin-top: 3px; }.mood-confirm + .primary-button { margin-top: 16px; }
113
+
114
+ .recommend-list { display: grid; gap: 12px; }.recommendation { padding: 17px; display: grid; grid-template-columns: 56px 1fr; gap: 13px; }.recommendation.featured { background: linear-gradient(135deg, #fbfefa, #edf7ef); border-color: rgba(100,158,118,.18); }.rec-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 25px; }.rec-icon.mint { background: var(--mint); }.rec-icon.blue { background: var(--sky); }.rec-icon.lilac { background: var(--lilac); }.recommendation h3 { margin: 5px 0 5px; }.recommendation p { font-size: 13px; margin-bottom: 12px; }.recommendation .secondary-button { grid-column: 2; min-height: 42px; }.pale-blue { background: #d8e9ff; color: #42679e; }.pale-lilac { background: #e9e3f9; color: #67548f; }.gentle-note { margin: 20px 0 0; background: linear-gradient(135deg, #fff2e9, #fbf1ea); padding: 18px; border-radius: 22px; text-align: center; color: #8b6f66; }
115
+
116
+ .chat-heading { display: flex; align-items: center; gap: 12px; padding: 8px 4px 16px; border-bottom: 1px solid var(--line); }.chat-heading h2 { font-family: inherit; font-size: 18px; margin: 0; }.chat-heading span { color: var(--muted); font-size: 11px; }.chat-heading i { display: inline-block; width: 7px; height: 7px; background: #77b88d; border-radius: 50%; margin-right: 4px; }
117
+ .chat-thread { padding: 20px 2px 180px; display: flex; flex-direction: column; gap: 13px; }.message { max-width: 83%; padding: 13px 15px; border-radius: 20px; }.message p { margin: 0; font-size: 14px; color: inherit; }.message small { color: #6179a7; display: block; margin-bottom: 5px; }.message.ai { align-self: flex-start; background: linear-gradient(135deg, #edf4ff, #f1edfb); border-bottom-left-radius: 7px; }.message.user { align-self: flex-end; background: #dfe9f8; color: #263b61; border-bottom-right-radius: 7px; }.chat-composer { position: absolute; z-index: 7; bottom: calc(76px + var(--safe-bottom)); left: 16px; right: 16px; display: grid; grid-template-columns: 1fr 46px; gap: 9px; padding: 9px; background: rgba(255,255,255,.92); border-radius: 24px; border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(56,70,103,.16); backdrop-filter: blur(10px); }.chat-composer input { width: 100%; border: 0; background: transparent; height: 46px; padding: 0 10px; color: var(--ink); }.chat-composer input:focus { outline: 0; }.chat-composer button { border: 0; border-radius: 50%; background: var(--blue); color: white; font-size: 20px; cursor: pointer; }.chat-disclaimer { position: absolute; z-index: 6; bottom: calc(63px + var(--safe-bottom)); left: 25px; right: 25px; font-size: 9px; text-align: center; margin: 0; transform: translateY(58px); }
118
+
119
+ .segmented { background: #f0f1f6; padding: 4px; border-radius: 15px; display: grid; grid-template-columns: 1fr 1fr; margin: 4px 5px 16px; }.segmented button { border: 0; min-height: 36px; border-radius: 12px; color: var(--muted); background: transparent; cursor: pointer; }.segmented button[aria-selected="true"] { background: white; color: #5069b6; box-shadow: 0 4px 10px rgba(72,82,112,.08); font-weight: 700; }
120
+ .chart-card { padding: 17px; }.chart-card .section-heading { margin: 0 0 16px; }.emotion-chart { height: 170px; display: flex; align-items: flex-end; justify-content: space-around; gap: 7px; background: repeating-linear-gradient(to top, transparent 0 41px, rgba(80,92,119,.07) 42px); border-bottom: 1px solid var(--line); padding: 0 7px; }.chart-point { flex: 1; height: var(--h); max-width: 32px; min-height: 28px; border-radius: 18px 18px 6px 6px; background: linear-gradient(to top, #c8d8fc, #8aa7ee); position: relative; transition: height .6s ease; }.chart-point span { position: absolute; top: -28px; left: 50%; transform: translateX(-50%); font-size: 18px; }.chart-axis { display: flex; justify-content: space-around; padding: 8px 7px 0; color: var(--muted); font-size: 11px; }.pattern-card { background: linear-gradient(135deg, #f3f5ff, #faf3ff); }.pattern-icon { width: 42px; height: 42px; border-radius: 50%; background: #e4e8ff; display: grid; place-items: center; color: #5b6fc4; flex: 0 0 42px; }.recent-entry { margin-top: 12px; padding: 17px; }.recent-entry .section-heading { margin: 0 0 12px; }.entry-title { display: flex; align-items: center; gap: 9px; }.entry-title > span:first-child { font-size: 25px; }.entry-title .soft-chip { margin-left: auto; }.recent-entry p { margin: 12px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
121
+
122
+ .bottom-nav { position: absolute; z-index: 8; bottom: 0; left: 0; right: 0; height: calc(76px + var(--safe-bottom)); padding: 10px 18px var(--safe-bottom); display: grid; grid-template-columns: repeat(4,1fr); background: rgba(255,255,255,.93); border-top: 1px solid var(--line); backdrop-filter: blur(15px); }.bottom-nav button { border: 0; background: transparent; color: #7b8293; display: grid; place-items: center; align-content: center; gap: 4px; border-radius: 14px; cursor: pointer; }.bottom-nav button span { font-size: 21px; }.bottom-nav button small { font-size: 10px; }.bottom-nav button.active { color: #5f7de2; }.bottom-nav button.active span { background: #e8edff; min-width: 38px; border-radius: 13px; }
123
+
124
+ dialog { border: 0; padding: 0; color: var(--ink); }.sheet-dialog { width: min(430px, 100%); max-height: 88vh; margin: auto auto 0; border-radius: 30px 30px 0 0; background: var(--paper); }.sheet-dialog::backdrop, .breath-dialog::backdrop, .info-dialog::backdrop { background: rgba(23,31,53,.42); backdrop-filter: blur(4px); }.sheet-content { padding: 12px 18px 26px; max-height: 88vh; overflow-y: auto; }.sheet-handle { width: 42px; height: 4px; border-radius: 9px; background: #dad8de; margin: 0 auto 16px; }.sheet-content .section-heading { margin: 0; align-items: flex-start; }.sheet-content h2 { font-size: 22px; margin-top: 5px; }.sheet-content > p { font-size: 13px; }.mood-meter { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; padding: 5px; background: #fff; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line); }.mood-meter button { border: 2px solid transparent; color: #1e3154; min-height: 54px; border-radius: 12px; font-size: 11px; font-weight: 600; cursor: pointer; }.mood-meter button:nth-child(-n+4) { background: #ffd8ae; }.mood-meter button:nth-child(n+5):nth-child(-n+8) { background: #f5c7a8; }.mood-meter button:nth-child(n+9):nth-child(-n+12) { background: #cce4d2; }.mood-meter button:nth-child(n+13) { background: #c7d7ee; }.mood-meter button.selected { border-color: #223766; box-shadow: 0 0 0 2px white inset; transform: scale(.96); }.meter-label { font-size: 10px; color: var(--muted); }.meter-label.energy { margin: 7px 0 0 4px; }.meter-label.pleasant { text-align: right; margin: -13px 4px 14px 0; }.sheet-content .primary-button { margin-top: 4px; }
125
+ .breath-dialog, .info-dialog { width: min(390px, calc(100% - 32px)); border-radius: 30px; background: #f9faf6; box-shadow: var(--shadow); }.breath-content { min-height: 520px; padding: 25px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; background: radial-gradient(circle at 50% 45%, #eff8ef, #f8f4ec 62%); }.close-breath { position: absolute; top: 17px; right: 17px; }.breath-orb { width: 210px; height: 210px; border-radius: 50%; background: radial-gradient(circle, #fff 0 22%, #dceee0 23% 56%, rgba(208,230,218,.25) 57%); display: grid; place-items: center; margin: 30px 0; color: #477763; animation: breathe 8s ease-in-out infinite; }.breath-orb span { font-family: "Gowun Dodum", sans-serif; font-size: 19px; }.breath-content p { max-width: 270px; }.breath-content > strong { font-size: 27px; font-variant-numeric: tabular-nums; }.breath-orb.exhale { animation-direction: reverse; }
126
+ @keyframes breathe { 0%,100% { transform: scale(.82); box-shadow: 0 0 0 0 rgba(130,183,151,.16); } 50% { transform: scale(1); box-shadow: 0 0 0 32px rgba(130,183,151,0); } }
127
+ .info-dialog form { padding: 25px; position: relative; }.info-dialog .icon-button { position: absolute; top: 15px; right: 15px; }.info-dialog h2 { font-size: 23px; margin-top: 9px; }.info-dialog .secondary-button { margin-top: 8px; }
128
+ .toast { position: fixed; z-index: 100; left: 50%; bottom: 30px; transform: translate(-50%, 30px); background: #243052; color: white; padding: 12px 18px; border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none; transition: .25s ease; box-shadow: var(--shadow); }.toast.show { opacity: 1; transform: translate(-50%, 0); }
129
+
130
+ @media (max-width: 760px) {
131
+ body { background: var(--paper); }
132
+ .ambient, .desktop-rail { display: none; }
133
+ .app-shell { display: block; min-height: 100vh; padding: 0; }
134
+ .phone { height: 100dvh; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
135
+ .topbar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); height: calc(68px + env(safe-area-inset-top, 0px)); flex-basis: calc(68px + env(safe-area-inset-top, 0px)); }
136
+ .sheet-dialog { width: 100%; }
137
+ }
138
+
139
+ @media (prefers-reduced-motion: reduce) {
140
+ *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
141
+ }
142
+