* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #F7F6F3;
  --card: #FFFFFF;
  --text: #1A1A1A;
  --text2: #888;
  --text3: #BBB;
  --border: #EEEDEA;
  --red: #E84430;
  --yellow: #FFD93D;
  --teal: #4ECDC4;
  --purple: #7C5CFC;
  --orange: #FF8C42;
  --radius: 20px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --yi: #E26B4F;
  --ze: #5B7B95;
}
body {
  font-family: 'Noto Sans SC', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  overflow-x: hidden;
}
.page { display: none; min-height: 100vh; padding-bottom: 90px; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 40px 32px; text-align: center;
}
.login-icon { font-size: 64px; margin-bottom: 20px; }
.login-title { font-size: 28px; font-weight: 900; margin-bottom: 6px; }
.login-sub { font-size: 14px; color: var(--text2); margin-bottom: 40px; }
.login-input {
  width: 100%; max-width: 260px; padding: 14px 20px; border: 2px solid var(--border);
  border-radius: 14px; font-size: 18px; text-align: center; letter-spacing: 8px;
  font-family: inherit; outline: none; background: var(--card); transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--red); }
.login-input.error { border-color: var(--red); animation: shake 0.3s ease; }
.login-btn {
  margin-top: 20px; padding: 14px 48px; background: var(--red); color: white;
  border: none; border-radius: 14px; font-size: 16px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 15px rgba(232,68,48,0.3);
}
.login-btn:active { transform: scale(0.96); }
.login-error { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 20px; }

/* ===== HEADER ===== */
.header { padding: 16px 24px 8px; display: flex; justify-content: space-between; align-items: center; }
.header-left h1 { font-size: 28px; font-weight: 900; letter-spacing: -0.5px; }
.header-left p { font-size: 13px; color: var(--text3); margin-top: 2px; }
.header-avatar {
  width: 46px; height: 46px; border-radius: 15px; background: var(--red);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  box-shadow: 0 4px 15px rgba(232,68,48,0.3);
}

/* ===== WELCOME CARD ===== */
.welcome {
  margin: 14px 24px; padding: 18px 22px; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.welcome-bg { position: absolute; top: -15px; right: -5px; font-size: 70px; opacity: 0.07; transform: rotate(15deg); }
.welcome p { font-size: 15px; color: #555; line-height: 1.6; }
.welcome span { color: var(--red); font-weight: 800; }
.welcome .sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ===== ROOM GRID ===== */
.section-title { padding: 20px 24px 12px; display: flex; justify-content: space-between; align-items: center; }
.section-title h2 { font-size: 20px; font-weight: 800; }
.section-title span { font-size: 13px; color: var(--text3); }
.room-grid { padding: 0 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.room-card {
  border-radius: 22px; padding: 22px 18px; cursor: pointer; position: relative;
  overflow: hidden; min-height: 155px; display: flex; flex-direction: column;
  justify-content: space-between; transition: transform 0.2s cubic-bezier(.25,.46,.45,.94);
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}
.room-card:active { transform: scale(0.96); }
.room-card .icon-wrap {
  width: 46px; height: 46px; border-radius: 14px; background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.room-card h3 { font-size: 17px; font-weight: 800; margin-top: 16px; }
.room-card .room-sub { font-size: 12px; opacity: 0.7; margin-top: 4px; }
.room-card .room-count { font-size: 11px; opacity: 0.5; margin-top: 10px; font-weight: 600; }
.room-card .deco1 {
  position: absolute; top: -20px; right: -20px; width: 80px; height: 80px;
  border-radius: 50%; background: rgba(255,255,255,0.12);
}
.room-card .deco2 {
  position: absolute; bottom: -15px; right: 30px; width: 50px; height: 50px;
  border-radius: 50%; background: rgba(255,255,255,0.08);
}

/* ===== ACTIVITY ===== */
.activity { margin: 24px 24px 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.activity-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid #F0EFEC; }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.activity-text { flex: 1; font-size: 13px; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-time { font-size: 11px; color: var(--text3); flex-shrink: 0; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px;
  background: rgba(247,246,243,0.92); backdrop-filter: blur(20px); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 12px 0 28px; z-index: 100;
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; font-size: 12px; color: var(--text3); font-weight: 500; }
.nav-item.active { color: var(--red); font-weight: 700; }

/* ===== MEMORY PAGE ===== */
.page-header {
  padding: 16px 24px; display: flex; align-items: center; gap: 14px;
}
.back-btn { font-size: 24px; cursor: pointer; padding: 4px; color: var(--text); }
.page-header h1 { font-size: 22px; font-weight: 800; }
.tabs {
  display: flex; gap: 8px; padding: 0 24px; margin-bottom: 16px;
}
.tab {
  padding: 8px 20px; border-radius: 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: 2px solid var(--border); background: var(--card); color: var(--text2);
  transition: all 0.2s;
}
.tab.active { background: var(--red); color: white; border-color: var(--red); }
.search-bar {
  margin: 0 24px 16px; display: flex; gap: 8px;
}
.search-bar input {
  flex: 1; padding: 12px 16px; border: 2px solid var(--border); border-radius: 14px;
  font-size: 14px; font-family: inherit; outline: none; background: var(--card);
}
.search-bar input:focus { border-color: var(--red); }
.memory-list { padding: 0 24px; }
.memory-card {
  background: var(--card); border-radius: 16px; padding: 16px 18px; margin-bottom: 10px;
  box-shadow: var(--shadow); position: relative;
}
.memory-card .layer-badge {
  display: inline-block; padding: 2px 10px; border-radius: 8px; font-size: 11px;
  font-weight: 700; margin-bottom: 8px;
}
.memory-card .layer-badge.core { background: #FFEAEA; color: var(--red); }
.memory-card .layer-badge.short { background: #FFF8E0; color: #B8860B; }
.memory-card .memory-text { font-size: 14px; line-height: 1.6; color: #333; }
.memory-card .memory-time { font-size: 11px; color: var(--text3); margin-top: 8px; }
.memory-card .memory-actions { display: flex; gap: 12px; margin-top: 10px; }
.memory-card .memory-actions button {
  padding: 6px 14px; border-radius: 10px; font-size: 12px; font-weight: 600;
  border: none; cursor: pointer; font-family: inherit;
}
.btn-edit { background: #F0F0F0; color: #555; }
.btn-delete { background: #FFEAEA; color: var(--red); }
.btn-save { background: var(--red); color: white; }
.btn-cancel { background: #F0F0F0; color: #555; }
.memory-card textarea {
  width: 100%; padding: 10px; border: 2px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; resize: vertical; min-height: 60px; outline: none;
}
.memory-card textarea:focus { border-color: var(--red); }
.memory-card select {
  padding: 6px 12px; border: 2px solid var(--border); border-radius: 10px;
  font-size: 13px; font-family: inherit; outline: none; margin-top: 8px;
}

/* FAB */
.fab {
  position: fixed; bottom: 100px; right: calc(50% - 195px);
  width: 52px; height: 52px; border-radius: 16px; background: var(--red);
  color: white; font-size: 28px; border: none; cursor: pointer;
  box-shadow: 0 4px 20px rgba(232,68,48,0.4); display: flex; align-items: center;
  justify-content: center; z-index: 50; transition: transform 0.15s;
}
.fab:active { transform: scale(0.92); }

/* Add form */
.add-form {
  margin: 0 24px 16px; background: var(--card); border-radius: 16px; padding: 18px;
  box-shadow: var(--shadow); display: none;
}
.add-form.visible { display: block; }
.add-form textarea {
  width: 100%; padding: 12px; border: 2px solid var(--border); border-radius: 12px;
  font-size: 14px; font-family: inherit; resize: vertical; min-height: 80px; outline: none;
}
.add-form textarea:focus { border-color: var(--red); }
.add-form .form-row { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.add-form select {
  padding: 8px 14px; border: 2px solid var(--border); border-radius: 10px;
  font-size: 13px; font-family: inherit; outline: none; flex: 1;
}
.add-form .form-row button {
  padding: 10px 24px; background: var(--red); color: white; border: none;
  border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
}

/* Empty state */
.empty { text-align: center; padding: 40px 24px; color: var(--text3); font-size: 14px; }

/* ===== DIARY PAGE ===== */
.diary-list { padding: 0 24px; }
.diary-card {
  background: #FFFBEA; border-radius: 16px; padding: 18px 20px;
  margin-bottom: 12px; cursor: pointer; position: relative;
  border-left: 4px solid var(--yellow);
  box-shadow: 0 2px 10px rgba(255,217,61,0.18);
  transition: transform 0.15s;
}
.diary-card:active { transform: scale(0.98); }
.diary-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.diary-title { font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.4; }
.diary-date { font-size: 11px; color: var(--text3); flex-shrink: 0; padding-top: 2px; }
.diary-summary { font-size: 13px; color: #666; margin-top: 8px; line-height: 1.5; }
.diary-content {
  display: none; margin-top: 14px; padding-top: 14px;
  border-top: 1px solid #F0E27A; font-size: 14px; line-height: 1.8;
  color: #444; white-space: pre-wrap; word-break: break-word;
}
.diary-card.expanded .diary-content { display: block; }
.diary-expand-hint { font-size: 11px; color: var(--text3); margin-top: 10px; text-align: right; }

/* ===== COUNTER ===== */
.counter-card {
  margin: 14px 24px; padding: 20px 24px; border-radius: var(--radius);
  background: var(--card); text-align: center; box-shadow: var(--shadow);
}
.counter-pre { font-size: 14px; color: #333; font-weight: 400; }
.counter-num-row { font-size: 30px; font-weight: 800; color: #333; margin-top: 6px; }
.counter-sub { font-size: 12px; color: #999; margin-top: 8px; }

/* ===== OVERVIEW ===== */
.overview { margin: 14px 24px 4px; }
.stat-row { display: flex; gap: 10px; }
.stat-mini { flex: 1; border-radius: 16px; padding: 14px 8px; text-align: center; }
.stat-mini .stat-num { font-size: 24px; font-weight: 900; }
.stat-mini .stat-name { font-size: 11px; margin-top: 3px; font-weight: 600; opacity: 0.75; }
.recall-card {
  background: var(--card); border-radius: var(--radius); padding: 16px 18px;
  margin-top: 10px; box-shadow: var(--shadow);
}
.recall-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.recall-title { font-size: 14px; font-weight: 700; color: var(--text); }
.recall-dice { font-size: 20px; cursor: pointer; user-select: none; transition: transform 0.25s; display: inline-block; }
.recall-dice:active { transform: rotate(180deg) scale(0.85); }
.recall-item { display: flex; gap: 10px; align-items: flex-start; }
.recall-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.recall-content {
  font-size: 13px; color: #333; line-height: 1.65;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.recall-author { font-size: 12px; color: var(--text3); margin-top: 4px; }
.recall-link { font-size: 12px; color: var(--red); font-weight: 700; margin-top: 6px; cursor: pointer; }
.recall-empty { font-size: 13px; color: var(--text3); padding: 4px 0; }

/* ===== BOARD PAGE ===== */
.board-list { padding: 0 20px; }
.note-card {
  border-radius: 16px; padding: 14px 16px; margin-bottom: 14px;
  position: relative; box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.note-del {
  position: absolute; top: 8px; right: 10px; font-size: 15px;
  color: rgba(0,0,0,0.25); cursor: pointer; padding: 2px 4px; line-height: 1;
}
.note-del:active { color: rgba(0,0,0,0.6); }
.note-text { font-size: 14px; line-height: 1.65; color: #333; padding-right: 18px; word-break: break-word; }
.note-footer {
  display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px;
}
.note-author { font-size: 11px; color: rgba(0,0,0,0.4); font-weight: 700; flex-shrink: 0; }
.note-meta { display: flex; align-items: center; gap: 10px; }
.note-reply-btn { font-size: 11px; color: rgba(0,0,0,0.35); cursor: pointer; }
.note-time { font-size: 11px; color: rgba(0,0,0,0.3); }
.note-replies { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(0,0,0,0.07); }
.reply-card {
  border-radius: 12px; padding: 10px 12px; margin-top: 8px;
  border-left: 3px solid rgba(0,0,0,0.1); margin-left: 8px; position: relative;
}
.reply-text { font-size: 13px; line-height: 1.6; color: #444; word-break: break-word; }
.reply-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.reply-info { font-size: 11px; color: rgba(0,0,0,0.35); }
.reply-del { font-size: 11px; color: rgba(0,0,0,0.25); cursor: pointer; padding: 2px 4px; }
.board-fab {
  position: fixed; bottom: 100px; right: calc(50% - 195px);
  width: 52px; height: 52px; border-radius: 16px; background: var(--teal);
  color: white; font-size: 22px; border: none; cursor: pointer;
  box-shadow: 0 4px 20px rgba(78,205,196,0.4); display: flex; align-items: center;
  justify-content: center; z-index: 50; transition: transform 0.15s;
}
.board-fab:active { transform: scale(0.92); }
.board-modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: none; align-items: flex-end; justify-content: center;
  z-index: 200; backdrop-filter: blur(4px);
}
.board-modal-bg.visible { display: flex; }
.board-modal {
  background: var(--card); border-radius: 24px 24px 0 0;
  padding: 24px 24px 44px; width: 100%; max-width: 430px;
  animation: slideUp 0.25s cubic-bezier(.25,.46,.45,.94);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.board-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.board-modal-title { font-size: 16px; font-weight: 800; }
.board-modal-close { font-size: 24px; cursor: pointer; color: var(--text3); line-height: 1; }
.board-modal textarea {
  width: 100%; padding: 12px 14px; border: 2px solid var(--border);
  border-radius: 14px; font-size: 14px; font-family: inherit;
  resize: none; height: 100px; outline: none; display: block;
}
.board-modal textarea:focus { border-color: var(--teal); }
.board-modal-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.board-char-count { font-size: 12px; color: var(--text3); }
.board-char-count.warn { color: var(--red); }
.board-submit {
  padding: 10px 28px; background: var(--teal); color: white;
  border: none; border-radius: 12px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: opacity 0.15s;
}
.board-submit:disabled { opacity: 0.45; cursor: not-allowed; }

/* ===== BEDROOM PAGE (dark theme — scoped to #page-bedroom) ===== */
#page-bedroom {
  background: #1a1a2e; min-height: 100vh; padding-bottom: 90px;
}
#page-bedroom .page-header {
  padding: 16px 24px; display: flex; align-items: center; gap: 14px;
}
#page-bedroom .page-header .back-btn { color: #aaa; }
#page-bedroom .page-header h1 { font-size: 22px; font-weight: 800; color: #e0e0e0; }
.bedroom-lock-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; backdrop-filter: blur(6px); padding: 32px;
}
.bedroom-lock-card {
  background: #16213e; border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius); padding: 36px 28px; width: 100%; max-width: 300px;
  text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.bedroom-lock-icon { font-size: 40px; margin-bottom: 14px; }
.bedroom-lock-title { font-size: 16px; font-weight: 700; color: #e0e0e0; margin-bottom: 4px; }
.bedroom-lock-sub { font-size: 12px; color: #666; margin-bottom: 24px; }
.bedroom-lock-input {
  width: 100%; padding: 12px 16px; background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1); border-radius: 12px;
  font-size: 20px; text-align: center; letter-spacing: 8px; color: #e0e0e0;
  font-family: inherit; outline: none; transition: border-color 0.2s;
}
.bedroom-lock-input:focus { border-color: var(--purple); }
.bedroom-lock-input.error { border-color: #e84430; animation: shake 0.3s ease; }
.bedroom-lock-btn {
  margin-top: 16px; width: 100%; padding: 13px; background: var(--purple);
  color: white; border: none; border-radius: 12px; font-size: 15px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: opacity 0.15s;
}
.bedroom-lock-btn:active { opacity: 0.8; }
.bedroom-lock-error { font-size: 12px; color: #e84430; margin-top: 10px; min-height: 18px; }
.bedroom-list { padding: 0 24px; }
.bedroom-card {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
  transition: border-color 0.2s;
}
.bedroom-card:hover { border-color: rgba(255,255,255,0.2); }
.bedroom-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; cursor: pointer; gap: 12px;
}
.bedroom-card-title { font-size: 15px; font-weight: 700; color: #e0e0e0; flex: 1; line-height: 1.4; }
.bedroom-card-del {
  font-size: 16px; color: rgba(255,255,255,0.2); cursor: pointer;
  padding: 4px 6px; flex-shrink: 0; line-height: 1; transition: color 0.15s;
}
.bedroom-card-del:hover { color: rgba(255,255,255,0.6); }
.bedroom-card-date { font-size: 11px; color: #555; padding: 0 18px 12px; }
.bedroom-card-content {
  display: none; padding: 14px 18px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 14px; line-height: 1.8; color: #bbb;
  white-space: pre-wrap; word-break: break-word;
}
.bedroom-card.expanded .bedroom-card-content { display: block; }
#page-bedroom .empty { color: #444; }

/* ===== COMING SOON ===== */
.coming-soon {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; text-align: center;
}
.coming-soon .icon { font-size: 64px; margin-bottom: 16px; }
.coming-soon h2 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.coming-soon p { font-size: 14px; color: var(--text2); }

/* ===== FITNESS PAGE ===== */
.fit-field-label { font-size: 12px; font-weight: 600; color: #5A5650; margin-bottom: 6px; }
.fit-input {
  width: 100%; padding: 11px 14px; border: 1px solid #EAE7E0; border-radius: 12px;
  background: #fff; font-size: 14px; color: #1A1815; font-family: inherit;
  outline: none; box-sizing: border-box;
}
.fit-textarea {
  width: 100%; padding: 11px 14px; border: 1px solid #EAE7E0; border-radius: 12px;
  background: #fff; font-size: 14px; color: #1A1815; font-family: inherit;
  outline: none; resize: vertical; box-sizing: border-box; line-height: 1.5;
}
.fit-fab {
  position: fixed; right: calc(50% - 197px); bottom: 100px;
  width: 56px; height: 56px; border-radius: 999px; background: var(--yi);
  border: none; box-shadow: 0 6px 20px rgba(226,107,79,0.35), 0 2px 4px rgba(0,0,0,0.06);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 50;
}
.fit-modal-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(20,18,15,0.35);
  display: none; align-items: flex-end; justify-content: center;
}
.fit-modal-overlay.open { display: flex; animation: fadeIn 180ms ease-out; }
.fit-modal-sheet {
  background: #F7F6F3; width: 100%; max-width: 430px; max-height: 92vh;
  border-radius: 24px 24px 0 0; overflow: hidden;
  display: flex; flex-direction: column;
  animation: slideUp 240ms cubic-bezier(0.32,0.72,0,1);
}
.fit-modal-body { flex: 1; overflow-y: auto; padding: 16px 20px 20px; }
.fit-modal-footer {
  padding: 12px 20px 24px; background: #F7F6F3;
  border-top: 1px solid #EAE7E0; display: flex; gap: 10px; flex-shrink: 0;
}
