:root {
  --bg: #fdf6ec;
  --ink: #3b2f2f;
  --muted: #8a7a72;
  --accent: #ff6b8b;
  --card: #ffffff;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[hidden] { display: none !important; }

/* ---------- 잠금 화면 ---------- */
.gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
}
.gate-hint { color: var(--muted); margin: 0; }
.mystery {
  width: min(70vw, 280px);
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  animation: bob 2.4s ease-in-out infinite;
  transition: transform .2s;
}
.mystery:hover { transform: scale(1.05); }
.mystery img, .mystery svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  display: block;
}
.mystery img + .fallback { display: none; }
@keyframes bob { 50% { translate: 0 -10px; } }

/* ---------- 비밀번호 창 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(40, 25, 25, .45);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 10;
}
.modal-card {
  position: relative;
  background: var(--card);
  border-radius: 18px;
  padding: 28px 24px 22px;
  width: min(100%, 340px);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.modal-card h2 { font-size: 1.15rem; margin: 0 0 16px; }
.modal-card input {
  width: 100%;
  font-size: 1.6rem;
  letter-spacing: .4em;
  text-align: center;
  padding: 10px;
  border: 2px solid #eadfd8;
  border-radius: 12px;
  outline: none;
  font-family: inherit;
}
.modal-card input:focus { border-color: var(--accent); }
.close {
  position: absolute; top: 8px; right: 12px;
  border: 0; background: none; font-size: 1.6rem;
  color: var(--muted); cursor: pointer;
}
.pw-msg { min-height: 1.4em; margin: 10px 0; color: #e03131; font-size: .95rem; }
.shake { animation: shake .35s; }
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.btn {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .6; cursor: default; }

/* ---------- 롤링페이퍼 ---------- */
.paper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 16px 64px;
  animation: fadein .6s ease;
}
@keyframes fadein { from { opacity: 0; translate: 0 12px; } }

.note-form {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  max-width: 520px;
  margin: 0 auto 36px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
}
.note-form input, .note-form textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 12px;
  border: 1.5px solid #eadfd8;
  border-radius: 10px;
  resize: vertical;
  outline: none;
}
.note-form input:focus, .note-form textarea:focus { border-color: var(--accent); }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.colors { display: flex; gap: 8px; }
.colors input { position: absolute; opacity: 0; pointer-events: none; }
.colors span {
  display: block; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.08); cursor: pointer;
}
.colors input:checked + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.store-note { margin: 0; font-size: .8rem; color: var(--muted); }

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px;
}
.note {
  padding: 16px 16px 12px;
  min-height: 130px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  font-size: 1rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-wrap: anywhere;
}
.note .text { flex: 1; white-space: pre-wrap; }
.note .foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; font-size: .88rem; color: #5c4b45;
}
.note .edited { color: var(--muted); font-size: .78rem; }
.icon-btn {
  border: 0; background: rgba(255,255,255,.6); color: #5c4b45;
  font-family: inherit; font-size: .82rem;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.icon-btn:hover { background: #fff; }
.note.editing { box-shadow: 0 0 0 3px var(--accent), 0 4px 12px rgba(0,0,0,.08); }
.note textarea, .note input {
  font-family: inherit; font-size: 1rem; line-height: 1.6;
  width: 100%; border: 1.5px solid rgba(0,0,0,.12); border-radius: 8px;
  background: rgba(255,255,255,.7); padding: 8px; outline: none; resize: vertical;
}
.note textarea { flex: 1; min-height: 90px; }
.note input { margin-top: 8px; font-size: .9rem; }
.note .edit-row { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }
.note .btn { padding: 6px 14px; font-size: .88rem; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); }
